From: Matthias Geiger Date: Wed, 10 Jun 2026 19:31:57 +0000 (+0200) Subject: Import solvespace_3.2+dfsg.orig.tar.xz X-Git-Tag: archive/raspbian/3.2+dfsg-5+rpi1^2^2^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0a573b7b21c4f395af838edc37f327efac9d61a1;p=solvespace.git Import solvespace_3.2+dfsg.orig.tar.xz [dgit import orig solvespace_3.2+dfsg.orig.tar.xz] --- 0a573b7b21c4f395af838edc37f327efac9d61a1 diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..5cb786f --- /dev/null +++ b/.clang-format @@ -0,0 +1,41 @@ +--- +# Things explicitly enumerated in CONTRIBUTING.md +IndentWidth: 4 +UseTab: Never +SpaceBeforeParens: Never +BreakBeforeBraces: Attach +ColumnLimit: 100 +# Docs say 100, but some places look more like 80. +#ColumnLimit: 80 + +# Based on minimizing diff when applying clang-format +AccessModifierOffset: -4 +AlignConsecutiveAssignments: true +AlignEscapedNewlines: DontAlign +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: true +AllowShortLoopsOnASingleLine: false +AlwaysBreakTemplateDeclarations: Yes # MultiLine +BreakConstructorInitializers: BeforeColon +DerivePointerAlignment: true +FixNamespaceComments: true +IndentPPDirectives: AfterHash +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: Inner +SpaceAfterTemplateKeyword: false + +# No way to remove all space around operators as seen in much of the code I looked at. +#SpaceBeforeAssignmentOperators: false + +# Only seen some of the time (mostly just variables, not functions) +# but clang-format only has a true/false +#AlignConsecutiveDeclarations: true + + +# Would be nice to turn on eventually, maybe? +SortIncludes: false +SortUsingDeclarations: false + +# Hard to tell what the desired config here was. +# AllowShortFunctionsOnASingleLine: Inline +AllowShortFunctionsOnASingleLine: None diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1f15ca3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +* text=auto +*.cpp text +*.h text +*.txt text +*.gz binary +*.ico binary +*.jpg binary +*.lib binary +*.png binary +*.slvs binary diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..640e5b5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,17 @@ +### System information + +- **SolveSpace version:** +- **Operating system:** + +### Expected behavior + + + +### Actual behavior + + + +### Additional information + + diff --git a/.github/scripts/build-macos.sh b/.github/scripts/build-macos.sh new file mode 100755 index 0000000..7111afd --- /dev/null +++ b/.github/scripts/build-macos.sh @@ -0,0 +1,51 @@ +#!/bin/sh -xe + +ENABLE_SANITIZERS="OFF" +if [ "$1" = "release" ]; then + BUILD_TYPE="RelWithDebInfo" + ENABLE_LTO="ON" +else + BUILD_TYPE="Debug" + ENABLE_LTO="OFF" +fi + +# this is an option for our Github CI only, since it doesn't have a macos arm64 image yet +CMAKE_GENERATOR="Unix Makefiles" +CMAKE_PREFIX_PATH="" +if [ "$2" = "arm64" ]; then + OSX_ARCHITECTURE="arm64" + CMAKE_PREFIX_PATH=$(find /tmp/libomp-arm64/libomp -depth 1) + mkdir build-arm64 || true + cd build-arm64 +elif [ "$2" = "x86_64" ]; then + OSX_ARCHITECTURE="x86_64" + CMAKE_PREFIX_PATH=$(find /tmp/libomp-x86_64/libomp -depth 1) + mkdir build || true + cd build +else + mkdir build || true + cd build +fi + +if [ "$3" = "xcode" ]; then + CMAKE_GENERATOR="Xcode" +fi + +cmake \ + -G "${CMAKE_GENERATOR}" \ + -D CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \ + -D CMAKE_OSX_ARCHITECTURES="${OSX_ARCHITECTURE}" \ + -D CMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -D ENABLE_OPENMP="ON" \ + -D ENABLE_SANITIZERS="${ENABLE_SANITIZERS}" \ + -D ENABLE_LTO="${ENABLE_LTO}" \ + .. + +if [ "$3" = "xcode" ]; then + open solvespace.xcodeproj +else + cmake --build . --config "${BUILD_TYPE}" -j$(sysctl -n hw.logicalcpu) + if [ $(uname -m) = "$2" ]; then + make -j$(sysctl -n hw.logicalcpu) test_solvespace + fi +fi diff --git a/.github/scripts/build-snap.sh b/.github/scripts/build-snap.sh new file mode 100755 index 0000000..665e561 --- /dev/null +++ b/.github/scripts/build-snap.sh @@ -0,0 +1,3 @@ +#!/bin/sh -xe + +./pkg/snap/build.sh --use-lxd diff --git a/.github/scripts/build-ubuntu.sh b/.github/scripts/build-ubuntu.sh new file mode 100755 index 0000000..4c8f4ea --- /dev/null +++ b/.github/scripts/build-ubuntu.sh @@ -0,0 +1,11 @@ +#!/bin/sh -xe + +mkdir build +cd build +cmake \ + -DCMAKE_BUILD_TYPE="Debug" \ + -DENABLE_OPENMP="ON" \ + -DENABLE_SANITIZERS="ON" \ + .. +make -j$(nproc) VERBOSE=1 +make test_solvespace diff --git a/.github/scripts/build-wasmlib.sh b/.github/scripts/build-wasmlib.sh new file mode 100755 index 0000000..842d1d1 --- /dev/null +++ b/.github/scripts/build-wasmlib.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +cd .. +git clone https://github.com/emscripten-core/emsdk.git --depth 1 +cd emsdk +./emsdk install latest +./emsdk activate latest +cd ../solvespace +source ../emsdk/emsdk_env.sh +mkdir -p build-wasmlib +cd build-wasmlib +emcmake cmake .. \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DENABLE_GUI="OFF" \ + -DENABLE_CLI="OFF" \ + -DENABLE_TESTS="OFF" \ + -DENABLE_COVERAGE="OFF" \ + -DENABLE_OPENMP="OFF" \ + -DFORCE_VENDORED_Eigen3="ON" \ + -DENABLE_LTO="ON" +cmake --build . -j$(nproc) --target slvs-wasm diff --git a/.github/scripts/build-web.sh b/.github/scripts/build-web.sh new file mode 100755 index 0000000..6e61338 --- /dev/null +++ b/.github/scripts/build-web.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +if [ "$1" = "release" ]; then + BUILD_TYPE="Release" + ENABLE_LTO="ON" +else + BUILD_TYPE="Debug" + ENABLE_LTO="OFF" +fi + +cd .. +git clone https://github.com/emscripten-core/emsdk.git --depth 1 +cd emsdk +./emsdk install latest +./emsdk activate latest +cd ../solvespace +source ../emsdk/emsdk_env.sh +mkdir build +cd build +emcmake cmake .. \ + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -DENABLE_CLI="OFF" \ + -DENABLE_TESTS="OFF" \ + -DENABLE_COVERAGE="OFF" \ + -DENABLE_OPENMP="OFF" \ + -DENABLE_LTO="ON" +cmake --build . --config "${BUILD_TYPE}" -j$(nproc) --target solvespace diff --git a/.github/scripts/build-windows.sh b/.github/scripts/build-windows.sh new file mode 100755 index 0000000..603ada3 --- /dev/null +++ b/.github/scripts/build-windows.sh @@ -0,0 +1,55 @@ +#!/bin/sh -xe + +mkdir build +cd build + +if [ "$1" = "release" ]; then + if [ "$2" = "openmp" ]; then + ENABLE_OPENMP="ON" + else + ENABLE_OPENMP="OFF" + fi + + if [ "$3" = "x64" ]; then + PLATFORM="$3" + else + PLATFORM="Win32" + fi + + BUILD_TYPE=RelWithDebInfo + cmake \ + -G "Visual Studio 17 2022" \ + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -DENABLE_OPENMP="${ENABLE_OPENMP}" \ + -DENABLE_LTO=ON \ + -DCMAKE_GENERATOR_PLATFORM="${PLATFORM}" \ + .. +else + BUILD_TYPE=Debug + cmake \ + -G "Visual Studio 17 2022" \ + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -DENABLE_OPENMP="ON" \ + -DENABLE_SANITIZERS="ON" \ + -DCMAKE_GENERATOR_PLATFORM="Win32" \ + .. +fi + +cmake --build . --config "${BUILD_TYPE}" -- -maxcpucount + +# Run the tests in the proper environment (required for having the ASan libraries available) +cmake --build . --config "${BUILD_TYPE}" -t test_solvespace -- -maxcpucount + +if [ "$3" = "x64" ]; then + if [ "$2" != "openmp" ]; then + mv bin/$BUILD_TYPE/solvespace.exe bin/$BUILD_TYPE/solvespace_single_core_x64.exe + else + mv bin/$BUILD_TYPE/solvespace.exe bin/$BUILD_TYPE/solvespace_x64.exe + fi +else + if [ "$2" != "openmp" ]; then + mv bin/$BUILD_TYPE/solvespace.exe bin/$BUILD_TYPE/solvespace_single_core_x86.exe + else + mv bin/$BUILD_TYPE/solvespace.exe bin/$BUILD_TYPE/solvespace_x86.exe + fi +fi diff --git a/.github/scripts/install-macos.sh b/.github/scripts/install-macos.sh new file mode 100755 index 0000000..9388cd1 --- /dev/null +++ b/.github/scripts/install-macos.sh @@ -0,0 +1,22 @@ +#!/bin/sh -xe +set -o pipefail + +if [ "$1" = "ci" ]; then + brew_cache=$(brew --cache) + brew fetch --bottle-tag=arm64_tahoe libomp >/dev/null + brew fetch --bottle-tag=sonoma libomp >/dev/null + armloc=$(find "$brew_cache"/downloads -maxdepth 1 -name "*--libomp--*arm64_tahoe.bottle.tar.gz" -print | tail -n1) + x64loc=$(find "$brew_cache"/downloads -maxdepth 1 -name "*--libomp--*sonoma.bottle.tar.gz" -print | tail -n1) + [ -n "$armloc" ] || { echo "Failed to locate arm64 libomp bottle in cache" >&2; exit 1; } + [ -n "$x64loc" ] || { echo "Failed to locate x86_64 libomp bottle in cache" >&2; exit 1; } + cp "$armloc" /tmp/libomp-arm64.tar.gz + mkdir /tmp/libomp-arm64 || true + tar -xzvf /tmp/libomp-arm64.tar.gz -C /tmp/libomp-arm64 + cp "$x64loc" /tmp/libomp-x86_64.tar.gz + mkdir /tmp/libomp-x86_64 || true + tar -xzvf /tmp/libomp-x86_64.tar.gz -C /tmp/libomp-x86_64 +else + brew install libomp +fi + +git submodule update --init extlib/cairo extlib/freetype extlib/libdxfrw extlib/libpng extlib/mimalloc extlib/pixman extlib/zlib extlib/eigen diff --git a/.github/scripts/install-snap.sh b/.github/scripts/install-snap.sh new file mode 100755 index 0000000..e10a91d --- /dev/null +++ b/.github/scripts/install-snap.sh @@ -0,0 +1,6 @@ +#!/bin/sh -xe + +sudo /snap/bin/lxd waitready +sudo /snap/bin/lxd init --auto +sudo chgrp travis /var/snap/lxd/common/lxd/unix.socket +mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache" diff --git a/.github/scripts/install-ubuntu.sh b/.github/scripts/install-ubuntu.sh new file mode 100755 index 0000000..6033f73 --- /dev/null +++ b/.github/scripts/install-ubuntu.sh @@ -0,0 +1,10 @@ +#!/bin/sh -xe + +sudo apt-get update -qq + +sudo apt-get install -q -y \ + zlib1g-dev libpng-dev libcairo2-dev libfreetype6-dev libjson-c-dev \ + libfontconfig1-dev libgtkmm-3.0-dev libpangomm-1.4-dev libgl-dev \ + libgl-dev libglu-dev libspnav-dev + +git submodule update --init extlib/libdxfrw extlib/mimalloc extlib/eigen diff --git a/.github/scripts/install-web.sh b/.github/scripts/install-web.sh new file mode 100755 index 0000000..738d67d --- /dev/null +++ b/.github/scripts/install-web.sh @@ -0,0 +1,3 @@ +#!/bin/sh -xe + +git submodule update --init diff --git a/.github/scripts/install-windows.sh b/.github/scripts/install-windows.sh new file mode 100755 index 0000000..738d67d --- /dev/null +++ b/.github/scripts/install-windows.sh @@ -0,0 +1,3 @@ +#!/bin/sh -xe + +git submodule update --init diff --git a/.github/scripts/sign-macos.sh b/.github/scripts/sign-macos.sh new file mode 100755 index 0000000..63f5734 --- /dev/null +++ b/.github/scripts/sign-macos.sh @@ -0,0 +1,86 @@ +#!/bin/bash -xe + +lipo \ + -create \ + build/bin/SolveSpace.app/Contents/Resources/libomp.dylib \ + build-arm64/bin/SolveSpace.app/Contents/Resources/libomp.dylib \ + -output \ + build/bin/SolveSpace.app/Contents/Resources/libomp.dylib + +lipo \ + -create \ + build/bin/SolveSpace.app/Contents/MacOS/SolveSpace \ + build-arm64/bin/SolveSpace.app/Contents/MacOS/SolveSpace \ + -output \ + build/bin/SolveSpace.app/Contents/MacOS/SolveSpace + +lipo \ + -create \ + build/bin/SolveSpace.app/Contents/MacOS/solvespace-cli \ + build-arm64/bin/SolveSpace.app/Contents/MacOS/solvespace-cli \ + -output \ + build/bin/SolveSpace.app/Contents/MacOS/solvespace-cli + +cd build + +openmp="bin/SolveSpace.app/Contents/Resources/libomp.dylib" +app="bin/SolveSpace.app" +dmg="bin/SolveSpace.dmg" +bundle_id="com.solvespace.solvespace" + +if [ "$CI" = "true" ]; then + # get the signing certificate (this is the Developer ID:Application: Your Name, exported to a p12 file, then converted to base64, e.g.: cat ~/Desktop/certificate.p12 | base64 | pbcopy) + echo $MACOS_CERTIFICATE_P12 | base64 --decode > certificate.p12 + + # create a keychain + security create-keychain -p secret build.keychain + security default-keychain -s build.keychain + security unlock-keychain -p secret build.keychain + + # import the key + security import certificate.p12 -k build.keychain -P "${MACOS_CERTIFICATE_PASSWORD}" -T /usr/bin/codesign + + security set-key-partition-list -S apple-tool:,apple: -s -k secret build.keychain + + # check if all is good + security find-identity -v +fi + +# sign openmp +codesign -s "${MACOS_DEVELOPER_ID}" --timestamp --options runtime -f --deep "${openmp}" + +# sign the .app +codesign -s "${MACOS_DEVELOPER_ID}" --timestamp --options runtime -f --deep "${app}" + +# create the .dmg from the signed .app +hdiutil create -srcfolder "${app}" "${dmg}" + +# sign the .dmg +codesign -s "${MACOS_DEVELOPER_ID}" --timestamp --options runtime -f --deep "${dmg}" + +if ! command -v xcrun >/dev/null || ! xcrun --find notarytool >/dev/null; then + echo "Notarytool is not present in the system. Notarization has failed." + exit 1 +fi + +# Submit the package for notarization +notarization_output=$( + xcrun notarytool submit "${dmg}" \ + --apple-id "hello@koenschmeets.nl" \ + --password "${MACOS_APPSTORE_APP_PASSWORD}" \ + --team-id "8X77K9NDG3" \ + --wait 2>&1) + +if [ $? -eq 0 ]; then + # Extract the operation ID from the output + operation_id=$(echo "$notarization_output" | awk '/RequestUUID/ {print $NF}') + echo "Notarization submitted. Operation ID: $operation_id" + exit 0 + else + echo "Notarization failed. Error: $notarization_output" + exit 1 + fi +fi + +# staple +xcrun stapler staple "${dmg}" diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..dd1ae04 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,225 @@ +name: CD + +on: + push: + branches: + - master + release: + types: + - created + +jobs: + cancel_previous_runs: + runs-on: ubuntu-latest + name: Cancel Previous Runs + permissions: + actions: write + steps: + - uses: styfle/cancel-workflow-action@0.13.1 + with: + access_token: ${{ github.token }} + + test_ubuntu: + needs: [cancel_previous_runs] + runs-on: ubuntu-latest + name: Test Ubuntu + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-ubuntu.sh + - name: Build & Test + run: .github/scripts/build-ubuntu.sh + + test_windows: + needs: [cancel_previous_runs] + runs-on: windows-2022 + name: Test Windows + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-windows.sh + shell: bash + - name: Build & Test + run: .github/scripts/build-windows.sh + shell: bash + + test_macos: + needs: [cancel_previous_runs] + runs-on: macos-latest + name: Test macOS + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-macos.sh ci + - name: Build & Test + run: .github/scripts/build-macos.sh debug arm64 && .github/scripts/build-macos.sh debug x86_64 + + build_release_windows_x86: + needs: [test_ubuntu, test_windows, test_macos] + name: Build Release Windows x86 + runs-on: windows-2022 + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-windows.sh + shell: bash + - name: Build & Test + run: .github/scripts/build-windows.sh release + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: windows_single_core_x86 + path: build/bin/RelWithDebInfo/solvespace_single_core_x86.exe + + build_release_windows_openmp_x86: + needs: [test_ubuntu, test_windows, test_macos] + name: Build Release Windows (OpenMP) x86 + runs-on: windows-2022 + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-windows.sh + shell: bash + - name: Build & Test + run: .github/scripts/build-windows.sh release openmp + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: windows_x86 + path: build/bin/RelWithDebInfo/solvespace_x86.exe + + build_release_windows_x64: + needs: [test_ubuntu, test_windows, test_macos] + name: Build Release Windows x64 + runs-on: windows-2022 + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-windows.sh + shell: bash + - name: Build & Test + run: .github/scripts/build-windows.sh release not_openmp x64 + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: windows_single_core_x64 + path: build/bin/RelWithDebInfo/solvespace_single_core_x64.exe + + build_release_windows_openmp_x64: + needs: [test_ubuntu, test_windows, test_macos] + name: Build Release Windows (OpenMP) x64 + runs-on: windows-2022 + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-windows.sh + shell: bash + - name: Build & Test + run: .github/scripts/build-windows.sh release openmp x64 + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: windows_x64 + path: build/bin/RelWithDebInfo/solvespace_x64.exe + + build_release_macos: + needs: [test_ubuntu, test_windows, test_macos] + name: Build Release macOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-macos.sh ci + - name: Build & Test + run: .github/scripts/build-macos.sh release arm64 && .github/scripts/build-macos.sh release x86_64 + - name: Sign Build + run: .github/scripts/sign-macos.sh + env: + MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} + MACOS_CERTIFICATE_P12: ${{ secrets.MACOS_CERTIFICATE_P12 }} + MACOS_APPSTORE_APP_PASSWORD: ${{ secrets.MACOS_APPSTORE_APP_PASSWORD }} + MACOS_APPSTORE_USERNAME: ${{ secrets.MACOS_APPSTORE_USERNAME }} + MACOS_DEVELOPER_ID: ${{ secrets.MACOS_DEVELOPER_ID }} + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: macos + path: build/bin/SolveSpace.dmg + + build_release_web: + needs: [test_ubuntu, test_windows, test_macos] + name: Build Release Web + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-web.sh + - name: Build & Pack + run: | + .github/scripts/build-web.sh release + cd build/bin + rm *.a || true + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: solvespace_web + path: build/bin/ + + # deploy_snap_amd64: + # needs: [test_ubuntu, test_windows, test_macos] + # name: Deploy AMD64 Snap + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v6 + # - name: Fetch Tags + # run: git fetch --force --tags + # - name: Set Up Source + # run: rsync --filter=":- .gitignore" -r ./ pkg/snap/solvespace-snap-src + # - name: Build Snap + # uses: snapcore/action-build@v1 + # id: build + # with: + # path: pkg/snap + # - name: Upload & Release to Edge + # if: github.event_name == 'push' + # uses: snapcore/action-publish@v1 + # env: + # SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPSTORE_LOGIN }} + # with: + # snap: ${{ steps.build.outputs.snap }} + # release: edge + # - name: Upload & Release to Beta + Edge + # if: github.event_name == 'release' + # uses: snapcore/action-publish@v1 + # with: + # store_login: ${{ secrets.SNAPSTORE_LOGIN }} + # snap: ${{ steps.build.outputs.snap }} + # release: edge,beta + + upload_release_assets: + name: Upload Release Assets + needs: + - build_release_windows_x86 + - build_release_windows_openmp_x86 + - build_release_windows_x64 + - build_release_windows_openmp_x64 + - build_release_macos + if: "!cancelled() && github.event_name == 'release'" + runs-on: ubuntu-latest + steps: + - name: Download All Workflow Artifacts + uses: actions/download-artifact@v4 + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + files: | + windows_single_core_x86/solvespace_single_core_x86.exe + windows_x86/solvespace_x86.exe + windows_single_core_x64/solvespace_single_core_x64.exe + windows_x64/solvespace_x64.exe + macos/SolveSpace.dmg \ No newline at end of file diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..5e69eec --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,181 @@ +name: Python + +on: + push: + branches: [ master ] + tags: [ v* ] + workflow_dispatch: + +jobs: + python-sdist: + name: python sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - run: git submodule update --init extlib/mimalloc extlib/eigen + - uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Pack + shell: bash + run: | + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + version="${GITHUB_REF##*/}" + else + mkdir empty-build + cd empty-build + cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF + source version.env + cd .. + version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}" + fi + sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak + python -m pip install -U setuptools build + python -m build --sdist + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: sdist + path: dist/*.tar.gz + python-wheel: + name: ${{ matrix.os_short }} python ${{ matrix.architecture }} cp${{ matrix.python_version }} + runs-on: ${{ matrix.os }} + timeout-minutes: 240 + strategy: + fail-fast: false + matrix: + os_arch: [ + "windows-ia32", + "windows-x64", + # "windows-arm64", + "macos-x86_64", + "macos-arm64", + "linux-x86_64", + "linux-aarch64", + ] + python_version: [ + "37", + "38", + "39", + "310", + "311", + "312", + "313", + "314", + "315", + ] + exclude: + - os_arch: "macos-arm64" + python_version: "37" + include: + - os_arch: "windows-ia32" + os: "windows-2022" + os_short: "windows" + architecture: "ia32" + cibuildwheel_architecture: "x86" + cmake_generator_platform: "Win32" + - os_arch: "windows-x64" + os: "windows-2022" + os_short: "windows" + architecture: "x64" + cibuildwheel_architecture: "AMD64" + cmake_generator_platform: "x64" + # - os_arch: "windows-arm64" + # os: "windows-2022" + # os_short: "windows" + # architecture: "arm64" + # cibuildwheel_architecture: "ARM64" + # cmake_generator_platform: "ARM64" + - os_arch: "macos-x86_64" + os: "macos-latest" + os_short: "macos" + cibuildwheel_architecture: "x86_64" + architecture: "x86_64" + - os_arch: "macos-arm64" + os: "macos-latest" + os_short: "macos" + cibuildwheel_architecture: "arm64" + architecture: "arm64" + - os_arch: linux-x86_64 + os: "ubuntu-22.04" + os_short: "linux" + cibuildwheel_architecture: "x86_64" + architecture: "x86_64" + - os_arch: linux-aarch64 + os: "ubuntu-22.04" + os_short: "linux" + cibuildwheel_architecture: "aarch64" + architecture: "aarch64" + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - run: git submodule update --init extlib/mimalloc extlib/eigen + - name: Set version + shell: bash + run: | + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + version="${GITHUB_REF##*/}" + else + mkdir empty-build + cd empty-build + cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF + source version.env + cd .. + version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}" + fi + sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + if: matrix.architecture == 'aarch64' + with: + platforms: arm64 + - name: Build wheels + uses: pypa/cibuildwheel@v2.22.0 + env: + CIBW_BUILD: "cp${{ matrix.python_version }}-*" + CIBW_PLATFORM: "${{ matrix.os_short }}" + CIBW_BUILD_VERBOSITY: "1" + CIBW_ARCHS: "${{ matrix.cibuildwheel_architecture }}" + CIBW_ENVIRONMENT_WINDOWS: > + CMAKE_GENERATOR="Visual Studio 17 2022" + CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}" + CIBW_ENVIRONMENT_PASS_WINDOWS: "CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM" + CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.12 + - uses: actions/upload-artifact@v6 + with: + name: wheel-cp${{ matrix.python_version }}-${{ matrix.os_short }}-${{ matrix.architecture }} + path: | + ./wheelhouse/*.whl + publish-pypi: + name: publish to PyPi + needs: [ + python-sdist, + python-wheel, + ] + runs-on: ubuntu-22.04 + steps: + - uses: actions/download-artifact@v4 + with: + path: prebuilds + - name: prepare + shell: bash + run: | + mkdir dist + ls prebuilds + mv prebuilds/*/* dist + ls dist + - name: Publish wheels to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + attestations: false + verbose: true + - name: Publish wheels to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + attestations: false + verbose: true diff --git a/.github/workflows/source-tarball.yml b/.github/workflows/source-tarball.yml new file mode 100644 index 0000000..1367c37 --- /dev/null +++ b/.github/workflows/source-tarball.yml @@ -0,0 +1,56 @@ +name: Source Tarball + +on: + release: + types: + - created + +jobs: + create_tarball: + name: Create & Upload Tarball + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + submodules: true + fetch-depth: 0 + - name: Pack Tarball + id: pack_tarball + run: | + version="${GITHUB_REF#refs/tags/v}" + dir_name="solvespace-${version}" + archive_name="${dir_name}.tar.xz" + archive_path="${HOME}/${archive_name}" + commit_sha="$GITHUB_SHA" + + sed -e 's/^\(include(GetGitCommitHash)\)/#\1/' \ + -e 's/^# \(set(GIT_COMMIT_HASH\).*/\1 '"$commit_sha"')/' \ + -i CMakeLists.txt + + echo "::set-output name=archive_name::${archive_name}" + echo "::set-output name=archive_path::${archive_path}" + + cd .. + tar \ + --exclude-vcs \ + --transform "s:^solvespace:${dir_name}:" \ + -cvaf \ + ${archive_path} \ + solvespace + - name: Get Release Upload URL + id: get_upload_url + env: + event: ${{ toJson(github.event) }} + run: | + upload_url=$(echo "$event" | jq -r ".release.upload_url") + echo "::set-output name=upload_url::$upload_url" + echo "Upload URL: $upload_url" + - name: Upload Tarball + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_upload_url.outputs.upload_url }} + asset_path: ${{ steps.pack_tarball.outputs.archive_path }} + asset_name: ${{ steps.pack_tarball.outputs.archive_name }} + asset_content_type: binary/octet-stream diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d700e8c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: Test + +on: + pull_request: + branches: + - master + push: + branches-ignore: + - master + tags-ignore: + - v* + +jobs: + test_ubuntu: + runs-on: ubuntu-latest + name: Test Ubuntu + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-ubuntu.sh + - name: Build & Test + run: .github/scripts/build-ubuntu.sh + + test_windows: + runs-on: windows-2022 + name: Test Windows + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-windows.sh + shell: bash + - name: Build & Test + run: .github/scripts/build-windows.sh + shell: bash + + test_macos: + runs-on: macos-latest + name: Test macOS + steps: + - uses: actions/checkout@v6 + - name: Install Dependencies + run: .github/scripts/install-macos.sh ci + - name: Build & Test + run: .github/scripts/build-macos.sh debug arm64 && .github/scripts/build-macos.sh debug x86_64 + + test_flatpak: + name: Test Flatpak x86_64 + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:freedesktop-21.08 + options: --privileged + steps: + - uses: actions/checkout@v6 + with: + submodules: true + fetch-depth: 0 + - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: "solvespace.flatpak" + manifest-path: "pkg/flatpak/com.solvespace.SolveSpace.json" + cache-key: flatpak-builder-${{ github.sha }} diff --git a/.github/workflows/wasmlib.yml b/.github/workflows/wasmlib.yml new file mode 100644 index 0000000..afc9666 --- /dev/null +++ b/.github/workflows/wasmlib.yml @@ -0,0 +1,79 @@ +name: WASM Library + +on: + push: + branches: [ master ] + tags: [ v* ] + workflow_dispatch: + +# https://docs.npmjs.com/trusted-publishers +permissions: + id-token: write + contents: read + +jobs: + build-wasmlib: + name: WASM library + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - run: git submodule update --init extlib/mimalloc extlib/eigen + - name: Pack + shell: bash + run: | + .github/scripts/build-wasmlib.sh + cd build-wasmlib/bin + rm libmimalloc.a || true + zip -r slvs-wasmlib.zip . + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: slvs-wasmlib + path: build-wasmlib/bin/slvs-wasmlib.zip + publish-wasmlib: + name: publish WASM library + needs: [ + build-wasmlib, + ] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v6 + - run: git submodule update --init extlib/mimalloc extlib/eigen + - uses: actions/download-artifact@v4 + with: + path: artifacts + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: '24.x' + registry-url: https://registry.npmjs.org/ + - name: prepare + shell: bash + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + git fetch --unshallow --tags + + ls artifacts + unzip artifacts/slvs-wasmlib/slvs-wasmlib.zip -d js + ls js + + mkdir empty-build + cd empty-build + cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF + source version.env + cd .. + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" + else + version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-dev.${GITHUB_RUN_NUMBER}" + is_dev="1" + fi + jq --arg version "${version}" '.version = $version' package.json > package.json.tmp + mv package.json.tmp js/package.json + cd js + if [ "${is_dev}" == "1" ]; then + npm publish --access public --tag dev + else + npm publish --access public --tag stable + fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bf6e0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +/CMakeCache.txt +/build*/ +/test/**/*.diff.* +/test/**/*.curr.* +*.trace +/debian/tmp/ +/debian/*.log +/debian/*.substvars +/debian/*.debhelper +/debian/files +/debian/solvespace/ +/debian/libslvs1/ +/debian/libslvs1-dev/ +/obj-*/ +/*.slvs +.vscode/ +.cache/ + +# Visual Studio +out/ +.vs/ +CMakeSettings.json +__pycache__/ +solvespace.egg-info/ +dist/ +.DS_Store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..84b25a8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,28 @@ +[submodule "extlib/zlib"] + path = extlib/zlib + url = https://github.com/madler/zlib + ignore = dirty +[submodule "extlib/libpng"] + path = extlib/libpng + url = https://github.com/glennrp/libpng +[submodule "extlib/freetype"] + path = extlib/freetype + url = https://github.com/freetype/freetype.git +[submodule "extlib/libdxfrw"] + path = extlib/libdxfrw + url = https://github.com/solvespace/libdxfrw.git +[submodule "extlib/pixman"] + path = extlib/pixman + url = https://github.com/solvespace/pixman +[submodule "extlib/cairo"] + path = extlib/cairo + url = https://github.com/solvespace/cairo +[submodule "extlib/angle"] + path = extlib/angle + url = https://github.com/solvespace/angle +[submodule "extlib/mimalloc"] + path = extlib/mimalloc + url = https://github.com/microsoft/mimalloc +[submodule "extlib/eigen"] + path = extlib/eigen + url = https://gitlab.com/libeigen/eigen.git diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..2264671 --- /dev/null +++ b/.mailmap @@ -0,0 +1,25 @@ +Bauke Conijn +Bauke Conijn + +EvilSpirit + +Isaac Garzón +Isaac Garzón +Isaac Garzón +Isaac Garzón + +luz paz + +Maximilian Federle +Maximilian Federle + +Not4Sure + +Paul Kahler <14852918+phkahler@users.noreply.github.com> + +Rylie Pavlik +Rylie Pavlik +Rylie Pavlik +Rylie Pavlik +Rylie Pavlik +Rylie Pavlik diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d9d9a0f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,434 @@ +Changelog +========= + +3.2 +--- + +Geometric Modelling Kernel (NURBS) + +* Improve the difference boolean operations. +* Extrude groups have a checkbox to allow skewing - 3 DoF for the extrude direction. + +Constraints (new and improved): + +* Add Parallel and Perpendicular constraints for 2 faces. +* The equal angle constraint is moved to the `N` shortcut and menu item to allow equal length (`Q`) to be applied to three or four lines. +* Allow tangent on arcs/lines/splines without coincident endpoints. + +Allow these constraints to be applied to more entities at once: + +* More than two line Segments - equal length. +* More than two Arcs and/or circles - equal diameter/radius. +* Any number of Lines - horizontal or vertical. +* More than two points - horizontal or vertical. +* Point on face can be applied to a point and 1-3 faces at once. +* More than two points coincident. + +Sketching + +* `Image` sketch elements are not copied in 3d groups (extrude, lathe, revolve, helix) by default. `Toggle Construction` for an image to get the old behavior. +* New option to use radius instead of diameter for circle and arc dimensions. +* Dimensions on arcs default to radius instead of diameter. Uncheck `use radius` in the Property Browser to get diameters. +* `Text in True Type Font` elements now support basic kerning. Enable it with `apply kerning` in the Property Browser. + +Translations (now in 10 languages!) + +* Added Czech cs_CZ. +* Added Japanese ja_JP. +* Update translation for French fr_FR, Russian ru_RU, Chinese zh_CN and Ukrainian uk_UA. + +Other User interface changes: + +* `CTRL+Tab` hides/shows the toolbar. +* Marquee selection of line segments is now precise. +* Speed up the animation when moving the view, for example when pressing `F2` or `F3`. +* The animation speed when changing the 3D view is configurable. +* Pressing ESC while drawing a sketch entity now deletes the entity rather than completing it. +* `CTRL+Shift+S` shortcut for "Save As..." +* New option "use camera mouse navigation" for camera (instead of the default model) rotation navigation. +* Sketches can be displayed with only dimensions visible (the button controlling visibility of constraints in the Property Browser has a new state). +* More entity types described in the text screens. +* A new option to `display the full path in the title bar`; or not. +* Handle smooth scrolling (mouse wheel zoom) on GTK/Linux. +* The embedded vector font (used for the UI and labels): + * now has many new and improved Chinese characters + * includes the Greek alphabet + * improved "є" + * added superscript 5 "⁵" + * fixed crash when typing "£" +* Add an 'only unconstrained' option on the Property Browser home screen that shows only unconstrained groups. +* Some faces can be gragged. Linked objects can be moved by gragging their faces. + +Solver + +* Merged Python bindings for the geometric constraint solver to master. + +Other + +* STEP files now export as solid model(s). +* Merged a QT front end as an option for Linux builds. +* Merged and improved the experimental Web version (Emscripten port). +* Better Flatpack support. +* Several bug fixes and usability improvements. +* Allow 32 bit SolveSpace to access up to 4GB of RAM to allow working on larger projects. + +Bug fixes: + +* `Paste Transformed` on elements that contain a point-line distance does not flip any more. +* Fix saving assemblies when opened with a relative path on the command line. +* Windows: The Property Browser remains visible when going full screen (CTRL-F11). +* Fix crash when linking .STL and .EMN files with extensions in capital letters. +* Mac: Don't crash on file ops without changing dir. +* Fix incorrect arc handling when linking IDF files. +* Windows: avoid (sometimes) showing multiple messages when deleting an entity causes other entities to be removed. +* "Split Curves at Intersection" fixes: + * Does not create a zero length edge when splitting lines intersecting in a T shape + * Does not create an invisible zero length edge and jump the intersection point to (0, 0, 0) when splitting lines with coincident end points. +* Fix IDF import with THOU units. +* macOS: Fix some points not draggable on macOS 26 (Tahoe). +* Windows 10/11: Fix the button click area in the property browser shifting because the contents were rendered stretched or compressed. + +3.1 +--- + +Constraints: + +* Arcs length ratio and difference. +* Arc & Line length ratio and difference. +* Allow comments to be associated with point entities. + +Sketching: + +* Support for pan, zoom and rotate trackpad gestures on macOS +* Add "exploded view" to sketches via "\\" key. Shows sketch elements separated + by a configurable distance perpendicular to the sketch plane. +* Added Feet-Inches as a unit of measure. Inputs are still in inches. + But the display shows feet, inches, and fraction of an inch. +* Added an optional "pitch" parameter to helix extrusions (in the text window) +* Allow use of Point & Normal to define "sketch-in-new-workplane". +* Update "Property Browser" live while dragging the sketch. + +MISC: + +* Add a link to the GitHub commit from which SolveSpace was built in the Help + menu. +* Make all points, vectors and normals shown in the Property Browser into + active links. This makes them explorable and selectable. +* Load 16bit PNG images correctly by re-scaling to 8bit. +* Fixed hang when trying to display characters missing from the embedded font. +* The main window vertical size can be as small as the toolbar. +* Configurable "SafeHeight" parameter instead of the fixed 5mm for G-code export. +* Add Spanish / Argentina translation. +* Move "perspective factor", "lighting direction" and "explode distance" from + the "configuration" screen to the "view" screen. +* Add a "∆" suffix to groups which have "force to triangle mesh" ticked +* Gray the group name in the text window for groups with suppressed solid model. +* Added the ability to Link STL files. +* When linking circuit boards (IDF .emn files) show keepout regions as construction entities. + +Performance: + +* Speed up sketches with many constraints by roughly 8x by using the Eigen + library in the solver. The maximum unknowns increased from 1024 to 2048. +* Add a "suppress dof calculation" setting to groups - increases performance for + complex sketches. +* More changes to the ID list implementation. + +3.0 +--- + +New sketch features: + +* New intersection boolean operation for solid models. +* New groups, revolution and helical extrusion. +* Extrude, lathe, translate and rotate groups can use the "assembly" + boolean operation, to increase performance. +* The solid model of extrude and lathe groups can be suppressed, + for splitting a single model in multiple parts to export, + or if only the generated entities are desired, without the mesh. +* Translate and rotate groups can create n-dimensional arrays using + the "difference" and "assembly" boolean operations. +* A new sketch in workplane group can be created based on existing workplane. +* TTF text request has two additional points on the right side, which allow + constraining the width of text. +* Image requests can now be created, similar to TTF text requests. + This replaces the "style → background image" feature. +* Irrelevant points (e.g. arc center point) are not counted when estimating + the bounding box used to compute chord tolerance. +* When adding a constraint which has a label and is redundant with another + constraint, the constraint is added as a reference, avoiding an error. +* Datum points can be copied and pasted. +* "Split Curves at Intersection" can now split curves at point lying on curve, + not just at intersection of two curves. +* Property browser now shows amount of degrees of freedom in group list. + It also shows a yellow "err" if the sketch has problems (e.g. self + intersecting) that would propagate in subsequent groups. +* It is now possible to press "g" to toggle construction on new objects while + they are still being drawn. +* Allow right click to end sketching of all entities. + +New constraint features: + +* When dragging an arc or rectangle point, it will be automatically + constrained to other points with a click. +* When selecting a constraint, the requests it constraints can be selected + in the text window. +* When selecting an entity, the constraints applied to it can be selected + in the text window. +* Distance constraint labels can now be formatted to use SI prefixes. + Values are edited in the configured unit regardless of label format. +* When creating a constraint, if an exactly identical constraint already + exists, it is now selected instead of adding a redundant constraint. +* It is now possible to turn off automatic creation of horizontal/vertical + constraints on line segments. +* Automatic creation of constraints no longer happens if the constraint + would have been redundant with other ones. +* New option to open the constraint editor for newly created constraints + with a value. +* New "redundant constraint timeout (in ms)" option to prevent UI freeze + when looking for redundant constraints. +* Swap vertical and horizontal constraints when pasting rotated by 90/270 + degrees. + +New export/import features: + +* Link IDF circuit boards in an assembly (.emn files) +* Three.js: allow configuring projection for exported model, and initially + use the current viewport projection. +* Wavefront OBJ: a material file is exported alongside the model, containing + mesh color information. +* DXF/DWG: 3D DXF files are imported as construction entities, in 3d. +* VRML (WRL) triangle meshes can now be exported, useful for e.g. [KiCAD](http://kicad.org). +* Export 2d section: custom styled entities that lie in the same + plane as the exported section are included. +* Added ExportBackgroundColor in configuration for EPS, PDF, and SVG files. +* STEP export includes object colors and transparency. +* Default "line styles" have a new "export these objects" option. + +New rendering features: + +* The "Show/hide hidden lines" button is now a tri-state button that allows + showing all lines (on top of shaded mesh), stippling occluded lines + or not drawing them at all. +* The "Show/hide outlines" button is now independent from "Show/hide edges". +* "View | Darken Inactive Solids" added. When turned off and a "sketch in plane" + group is active solids form previous groups will not be "darkened" (have the + s000d-#def-dim-solid style applied to them). + +New measurement/analysis features: + +* New choice for base unit, meters. +* New command for measuring total length of selected entities, + "Analyze → Measure Perimeter". +* New command for measuring center of mass, with live updates as the sketch + changes, "Analyze → Center of Mass". +* New option for displaying areas of closed contours. +* When calculating volume of the mesh, volume of the solid from the current + group is now shown alongside total volume of all solids. +* When calculating area, and faces are selected, calculate area of those faces + instead of the closed contour in the sketch. +* When selecting a point and a line, projected distance to current + workplane is displayed. + +Other new features: + +* Improvements to the text window for selected entities and constraints. +* Ambient light source added in text window to allow flat shaded renderings. +* New command-line interface, for batch exporting and more. +* The graphical interface now supports HiDPI screens on every OS. +* New option to lock Z axis to be always vertical when rotating the view, + a.k.a. "turntable navigation". +* New button to hide all construction entities. +* New link to match the on-screen size of the sketch with its actual size, + "view → set to full scale". +* When zooming to fit, constraints are also considered. +* Ctrl-clicking entities now deselects them, as the inverse of clicking. +* When clicking on an entity that shares a place with other entities, + the entity from the current group is selected. +* When dragging an entity that shares a place with other entities, + the entity from a request is selected. For example, dragging a point on + a face of an extrusion coincident with the source sketch plane will + drag the point from the source sketch. +* The default font for TTF text is now Bitstream Vera Sans, which is + included in the resources such that it is available on any OS. +* In expressions, numbers can contain the digit group separator, "_". +* The "=" key is bound to "Zoom In", like "+" key. +* The numpad decimal separator key is bound to "." regardless of locale. +* On Windows, full-screen mode is implemented. +* On Linux, native file chooser dialog can be used. +* New edit menu items "Line Styles", "View Projection" and "Configuration" + that are shortcuts to the respective configuration screens. +* New cmake build options using -DENABLE_OPENMP=yes and -DENABLE_LTO=yes + to enable support for multi-threading and link-time optimization. +* "Shift+Scroll" for ten times finer zoom. +* Translations: Chinese, French, German, Russian, Turkish, Ukrainian. + +Bugs fixed: + +* Fixed broken --view options for command line thumbnail image creation. +* Some errors in Triangulation of surfaces. +* Some NURNS boolean operations that failed particularly on surfaces + created with Lathe, Revolve, or Helix. +* Segfault in Remove Spline Point context menu. +* A point in 3d constrained to any line whose length is free no longer + causes the line length to collapse. +* Curve-line constraints (in 3d), parallel constraints (in 3d), and + same orientation constraints are more robust. +* Adding some constraints (vertical, midpoint, etc) twice errors out + immediately, instead of later and in a confusing way. +* Constraining a newly placed point to a hovered entity does not cause + spurious changes in the sketch. +* Points highlighted with "Analyze → Show Degrees of Freedom" are drawn + on top of all other geometry. +* A step rotate/translate group using a group forced to triangle mesh + as a source group also gets forced to triangle mesh. +* Paste Transformed with a negative scale does not invert arcs. +* The tangent arc now modifies the original entities instead of deleting + them, such that their constraints are retained. +* When linking a sketch file, missing custom styles are now imported from + the linked file. +* 3Dconnexion SpaceMouse should now work (on Windows and macOS X). +* Improved NURBS boolean operations on curved surfaces in some cases. +* Show only usable fonts in the font selector. + +2.x +--- + +Bug fixes: + +* Do not crash when changing an unconstrained lathe group between + union and difference modes. + +2.3 +--- + +Bug fixes: + +* Do not crash when applying a symmetry constraint to two points. +* Fix TTF font metrics again (properly this time). +* Fix the "draw back faces in red" option. +* Fix export of wireframe as 3D DXF. +* Various minor crashes. + +2.2 +--- + +Other new features: + +* OS X: support 3Dconnexion devices (SpaceMouse, SpaceNavigator, etc). +* GTK: files with uppercase extensions can be opened. + +Bug fixes: + +* Do not remove autosaves after successfully opening a file, preventing + data loss in case of two abnormal terminations in a row. +* Do not crash when changing autosave interval. +* Unbreak the "Show degrees of freedom" command. +* Three.js: correctly respond to controls when browser zoom is used. +* OS X: do not completely hide main window when defocused. +* GTK: unbreak 3Dconnexion support. +* When pasting transformed entities, multiply constraint values by scale. +* Fix TTF font metrics (restore the behavior from version 2.0). +* Forcibly show the current group once we start a drawing operation. +* DXF export: always declare layers before using them. +* Do not truncate operations on selections to first 32 selected entities. +* Translate and rotate groups inherit the "suppress solid model" setting. +* DXF: files with paths containing non-ASCII or spaces can be exported + or imported. +* Significantly improved performance when dragging an entity. +* Various crashes and minor glitches. + +2.1 +--- + +New sketch features: + +* Lathe groups create circle and face entities. +* New toolbar button for creating lathe groups. +* Chord tolerance is separated into two: display chord tolerance (specified + in percents, relative to model bounding box), and export chord tolerance + (specified in millimeters as absolute value). +* Bezier spline points can be added and removed after the spline is created. +* When an unconstrained extrusion is switched between "union" and + "difference", its normal is flipped. +* Groups can be added in the middle of the stack. Note that this results + in files incompatible with version 2.0. +* Active group can be removed. +* Removing an imported group does not cause all subsequent groups to also + be removed. +* When a new group with a solid is created, the color is taken from + a previous group with a solid, if any. +* Entities in a newly active group do not become visible. +* When entities are selected, "Zoom to fit" zooms to fit only these + entities and not the entire sketch. +* Zero-length edges are reported with a "zero-length error", not + "points not all coplanar". + +New constraint features: + +* Height of the font used for drawing constraint labels can be changed. +* New constraint, length difference, placed with J. + (Patch by Peter Ruevski) +* Horizontal/vertical constraints are automatically added if a line segment + is close enough to being horizontal/vertical. This can be disabled by + holding Ctrl. +* Reference dimensions and angles can be placed with Shift+D and Shift+N. +* Copying and pasting entities duplicates any constraints that only involve + entities in the clipboard, as well as selected comments. +* Diameter constraints can be shown as radius. +* The "pi" identifier can be used in expressions. +* Constraint labels can be snapped to grid. +* Integer angles are displayed without trailing zeroes. +* Angle constraints have proper reference lines and arrowheads. +* Extension lines are drawn for point-line distance constraints. + +New solver features: + +* Sketches with redundant and unsolvable constraints are distinguished. +* New group setting, "allow redundant constraints". Note that it makes + the solver less stable. + +New rendering and styling features: + +* New line style parameter: stippling, based on ISO 128. +* Outlines of solids can be drawn in a particular style (by default, thick + lines) controlled by the "Show outline of solid model" button. +* Occluded edges can be drawn in a particular style (by default, stippled + with short dashes) controlled by the "Show hidden lines" button. +* Solids can be made transparent. + +New export/import features: + +* The old "import" command (for .slvs files) is renamed to "link". +* If a linked .slvs file is not found, first the relative path recorded + in the .slvs file is checked and then the absolute path; this is + an inversion of the previously used order. If it is still not found, + a dialog appears offering to locate it. +* DXF and DWG files can be imported, with point-coincident, horizontal and + vertical constraints automatically inferred from geometry, and distance + and angle constraints created when a dimension placed against geometry + exists. +* Triangle mesh can be exported for viewing in the browser through WebGL. +* Export dialogs remember the last file format used, and preselect it. +* Exported DXF files have exact circles, arcs and splines instead of + a piecewise linear approximation (unless hidden line removal was needed). +* Exported DXF files preserve color and line thickness. +* In exported DXF files, constraints are represented as DXF dimensions, + instead of piecewise linear geometry. +* When exporting 2d views, overlapping lines are removed. + +Other new features: + +* Native Linux (GTK 2 and GTK 3) and Mac OS X ports. +* Automatically save and then restore sketches if SolveSpace crashes. + (Patch by Marc Britten) +* Unicode is supported everywhere (filenames, group names, TTF text, + comments), although RTL scripts and scripts making heavy use of ligatures + are not rendered correctly. +* The vector font is grid-fitted when rendered on screen to make it easier + to read regardless of its size. + +2.0 +--- + +Initial public release. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..11adeb5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,514 @@ +# cmake configuration +cmake_minimum_required(VERSION 3.18...3.25) + +cmake_policy(SET CMP0094 NEW) # for Python*_FIND_STRATEGY=LOCATION + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + message(FATAL_ERROR + "In-tree builds are not supported; please perform an out-of-tree build:\n" + " rm -rf CMakeCache.txt CMakeFiles/\n" + " mkdir build && cd build && cmake ..") +endif() + +list(APPEND CMAKE_MODULE_PATH + "${CMAKE_SOURCE_DIR}/cmake/") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED YES) + +# for /MT on MSVC +set(CMAKE_USER_MAKE_RULES_OVERRIDE + "${CMAKE_SOURCE_DIR}/cmake/c_flag_overrides.cmake") +set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX + "${CMAKE_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake") + +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +endif() + +if (APPLE) + # Docs say this must be set before the first project() call + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "macOS minimum supported version") +endif() + +# project + +# NOTE TO PACKAGERS: The embedded git commit hash is critical for rapid bug triage when the builds +# can come from a variety of sources. If you are mirroring the sources or otherwise build when +# the .git directory is not present, please comment the following line: +include(GetGitCommitHash) +# and instead uncomment the following, adding the complete git hash of the checkout you are using: +# set(GIT_COMMIT_HASH 0000000000000000000000000000000000000000) + +string(SUBSTRING "${GIT_COMMIT_HASH}" 0 8 solvespace_GIT_HASH) +project(solvespace + VERSION 3.2 + LANGUAGES C CXX ASM) + +if(EMSCRIPTEN) + # Enable optimization. Workaround for "too many locals" error when runs in the browser. + if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Debug") + add_compile_options(-O1) + endif() + + set(INCLUDE_NATIVE_COMPONENTS OFF) +else() + set(INCLUDE_NATIVE_COMPONENTS ON) +endif() + +set(ENABLE_GUI ON CACHE BOOL + "Whether the graphical interface is enabled") +set(USE_QT_GUI OFF CACHE BOOL + "Whether the Qt library used to build graphical interface") +set(ENABLE_CLI ${INCLUDE_NATIVE_COMPONENTS} CACHE BOOL + "Whether the command line interface is enabled") +set(ENABLE_TESTS ${INCLUDE_NATIVE_COMPONENTS} CACHE BOOL + "Whether the test suite will be built and run") +set(ENABLE_COVERAGE OFF CACHE BOOL + "Whether code coverage information will be collected") +set(ENABLE_SANITIZERS OFF CACHE BOOL + "Whether to enable Clang's AddressSanitizer and UndefinedBehaviorSanitizer") +set(ENABLE_OPENMP OFF CACHE BOOL + "Whether geometric operations will be parallelized using OpenMP") +set(ENABLE_LTO OFF CACHE BOOL + "Whether interprocedural (global) optimizations are enabled") +option(FORCE_VENDORED_Eigen3 + "Whether we should use our bundled Eigen even in the presence of a system copy" + OFF) + +set(OPENGL 3 CACHE STRING "OpenGL version to use (one of: 1 3)") + +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) +if("${CMAKE_GENERATOR}" STREQUAL "Xcode") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}/bin>) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + # GCC 4.8/4.9 ship with broken but present . meh. + message(FATAL_ERROR "GCC 5.0+ is required") + endif() +endif() + +# common compiler flags +include(CheckCXXCompilerFlag) + +if (NOT APPLE) + set(FILE_PREFIX_MAP "-ffile-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.") + check_cxx_compiler_flag("${FILE_PREFIX_MAP}" HAS_FILE_PREFIX_MAP) + if(HAS_FILE_PREFIX_MAP) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FILE_PREFIX_MAP}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FILE_PREFIX_MAP}") + endif() +endif() + +if(MINGW) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + # Link 32 bit SolveSpace with --large-address-aware which allows it to access + # up to 3GB on a properly configured 32 bit Windows and up to 4GB on 64 bit. + # See https://msdn.microsoft.com/en-us/library/aa366778 + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware") + endif() +endif() + +# Ensure that all platforms use 64-bit IEEE floating point operations for consistency; +# this is most important for the testsuite, which compares savefiles directly +# and depends on consistent rounding of intermediate results. +if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86") + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(FLOAT_FLAGS "-mfpmath=sse -msse2") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(FLOAT_FLAGS "-msse2") + endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLOAT_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLOAT_FLAGS}") +endif() + +if(ENABLE_LTO) + include(CheckIPOSupported) + check_ipo_supported() + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +endif() + +if(ENABLE_OPENMP) + find_package( OpenMP REQUIRED ) + if(OPENMP_FOUND) + add_library(slvs_openmp INTERFACE) + target_compile_options(slvs_openmp INTERFACE "SHELL:${OpenMP_CXX_FLAGS}") + target_link_libraries(slvs_openmp INTERFACE + ${OpenMP_CXX_LIBRARIES}) + target_include_directories(slvs_openmp SYSTEM INTERFACE + ${OpenMP_CXX_INCLUDE_DIRS}) + message(STATUS "found OpenMP, compiling with flags: " ${OpenMP_CXX_FLAGS} ) + endif() +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_EXE_LINKER_FLAGS}") +endif() + +if(ENABLE_SANITIZERS) + if(NOT SANITIZERS) + if(MSVC) + if(MSVC_VERSION LESS 1928) + # Technically 1928 is also used for VS 16.8, but CMake doesn't have a way + # to distinguish patch versions of MSVC, so this is good enough + message(FATAL_ERROR "Using sanitizers with MSVC requires Visual Studio 16.9 or newer") + endif() + set(SANITIZERS "address") + else() + set(SANITIZERS "address;undefined") + endif() + endif() + + foreach(option ${SANITIZERS}) + if(option STREQUAL "thread" AND NOT MSVC) + list(APPEND SANITIZE_OPTIONS thread) + elseif(option STREQUAL "address") + list(APPEND SANITIZE_OPTIONS address) + elseif(option STREQUAL "undefined" AND NOT MSVC) + list(APPEND SANITIZE_OPTIONS alignment bounds) + list(APPEND SANITIZE_OPTIONS shift signed-integer-overflow integer-divide-by-zero) + list(APPEND SANITIZE_OPTIONS null bool enum) + list(APPEND SANITIZE_OPTIONS return) + else() + message(FATAL_ERROR "Unknown sanitizer ${option}") + endif() + endforeach() + + message(STATUS "Using sanitizer options ${SANITIZE_OPTIONS}") + + if(MSVC) + string(REPLACE ";" " /fsanitize=" SANITIZE_OPTIONS "${SANITIZE_OPTIONS}") + set(SANITIZE_FLAGS "/Zi /fsanitize=${SANITIZE_OPTIONS}") + else() + string(REPLACE ";" "," SANITIZE_OPTIONS "${SANITIZE_OPTIONS}") + set(SANITIZE_FLAGS "-O1 -fsanitize=${SANITIZE_OPTIONS}") + if (NOT APPLE) + set(SANITIZE_FLAGS "${SANITIZE_FLAGS} -fno-sanitize-recover=address,undefined") + endif() + endif() + + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(SANITIZE_FLAGS "${SANITIZE_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(SANITIZE_FLAGS "${SANITIZE_FLAGS} -fuse-ld=gold") + elseif(NOT MSVC) + message(FATAL_ERROR "Sanitizers are only available when using MSVC, GCC, or Clang") + endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZE_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZE_FLAGS}") +endif() + +# common dependencies + +if(APPLE) + set(CMAKE_FIND_FRAMEWORK FIRST) +endif() + +if(ENABLE_GUI OR ENABLE_CLI) + message(STATUS "Using in-tree libdxfrw") + add_subdirectory(extlib/libdxfrw) +endif() + +message(STATUS "Using in-tree mimalloc") +set(MI_OVERRIDE OFF CACHE BOOL "") +set(MI_BUILD_SHARED OFF CACHE BOOL "") +set(MI_BUILD_OBJECT OFF CACHE BOOL "") +set(MI_BUILD_TESTS OFF CACHE BOOL "") +if(EMSCRIPTEN) + # HACK: We only use mimalloc for the temporary heap, not as a general purpose + # allocator. However, the Emscripten port of mimalloc assumes that it is used + # as the system allocator, and depends on the slow emmalloc allocator. + # We do not want to enable emmalloc, as that would slow down allocations all + # over the place, so we must either use mimalloc as the system allocator as + # well, or override its definitions to just use the existing system allocator. + # The latter option is the least intrusive change from a stability standpoint, + # so for now that's what we do here. We can try to convert to mimalloc wholsale + # and remove this hack if we find the need to do so in the future. + set(MI_EXTRA_CPPDEFS "emmalloc_free=free;emmalloc_memalign=memalign" CACHE INTERNAL "") +endif() +add_subdirectory(extlib/mimalloc EXCLUDE_FROM_ALL) +set(MIMALLOC_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/mimalloc/include) + +if(NOT FORCE_VENDORED_Eigen3) + find_package(Eigen3 CONFIG) +endif() +if(FORCE_VENDORED_Eigen3 OR NOT EIGEN3_INCLUDE_DIRS) + message(STATUS "Using in-tree Eigen") + set(EIGEN3_FOUND YES) + set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/eigen) +else() + message(STATUS "Using system Eigen: ${EIGEN3_INCLUDE_DIRS}") +endif() +if(NOT EXISTS "${EIGEN3_INCLUDE_DIRS}") + message(FATAL_ERROR "Eigen 3 not found on system or in-tree") +endif() + + +if(ENABLE_GUI OR ENABLE_CLI) + if(WIN32 OR APPLE OR EMSCRIPTEN) + # On Win32 and macOS we use vendored packages, since there is little to no benefit + # to trying to find system versions. In particular, trying to link to libraries from + # Homebrew or macOS system libraries into the .app file is highly likely to result + # in incompatibilities after upgrades. + + include(FindVendoredPackage) + include(AddVendoredSubdirectory) + + set(FORCE_VENDORED_ZLIB ON) + set(FORCE_VENDORED_PNG ON) + set(FORCE_VENDORED_Freetype ON) + + # HACK: This is essentially what `find_vendored_package()` does, except we also + # define the ZLIB::ZLIB target to be an alias for zlibstatic before calling + # `find_package()` in order to avoid having it defined as an imported target + # by the built-in FindZLIB.cmake module, which breaks libpng's png_static + # target that relies on ZLIB::ZLIB instead of on zlibstatic. + # Once zlib releases its develop branch post 1.3.1, the built-in module will not + # generate an imported target since we'll have proper targets, but libpng would + # still need to be updated to use ZLIB::ZLIBSTATIC instead of ZLIB::ZLIB, so this + # ugly hack will have to stay until both libraries release fixed versions. + add_vendored_subdirectory(extlib/zlib) + set(ZLIB_LIBRARY zlibstatic CACHE INTERNAL "") + set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/zlib CACHE INTERNAL "") + add_library(ZLIB::ZLIB ALIAS ${ZLIB_LIBRARY}) + find_package(ZLIB REQUIRED) + set(ZLIB_FOUND ${ZLIB_FOUND} CACHE INTERNAL "") + + list(APPEND ZLIB_INCLUDE_DIR ${CMAKE_BINARY_DIR}/extlib/zlib) + + # There's an issue with the zlib configuration, which doesn't provide a way to + # disable the shared or static library builds, and on UNIX sets the base name of + # the output for both the static and shared targets to `libz`. As Emscripten doesn't + # support shared libraries, CMake converts the shared library target to a static + # library and both targets end up with the name `libz.a`, causing Ninja to complain + # about different rules generating the same target. As a workaround, force the output + # name of the static library target to be different on Emscripten. + # NOTE: The unreleased develop branch of zlib after version 1.3.1 allows disabling + # the shared library build, which is the proper fix for this issue, so when the + # next version of zlib is released and updated as a dependency, `ZLIB_BUILD_SHARED` + # should be set to `OFF` instead of this hack. + if(EMSCRIPTEN AND UNIX) + set_target_properties(${ZLIB_LIBRARY} PROPERTIES OUTPUT_NAME zlibstatic) + endif() + + find_vendored_package(PNG libpng + SKIP_INSTALL_ALL ON + PNG_LIBRARY png_static + PNG_SHARED OFF + PNG_STATIC ON + PNG_TOOLS OFF + PNG_TESTS OFF + PNG_FRAMEWORK OFF + PNG_PNG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/libpng) + list(APPEND PNG_PNG_INCLUDE_DIR ${CMAKE_BINARY_DIR}/extlib/libpng) + + find_vendored_package(Freetype freetype + FT_DISABLE_BZIP2 ON + FT_DISABLE_HARFBUZZ ON + FT_DISABLE_BROTLI ON + FT_DISABLE_PNG ON + FREETYPE_LIBRARY freetype + FREETYPE_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/freetype/include) + + message(STATUS "Using in-tree pixman") + set(PIXMAN_FOUND YES) + set(PIXMAN_LIBRARY pixman) + set(PIXMAN_BUILD_TESTS OFF CACHE BOOL "") + set(PIXMAN_BUILD_DEMOS OFF CACHE BOOL "") + + set(PIXMAN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/pixman/pixman) + list(APPEND PIXMAN_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/extlib/pixman/pixman) + add_vendored_subdirectory(extlib/pixman) + + message(STATUS "Using in-tree cairo") + add_vendored_subdirectory(extlib/cairo) + set(CAIRO_FOUND YES) + set(CAIRO_LIBRARIES cairo) + set(CAIRO_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/cairo/src) + list(APPEND CAIRO_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/extlib/cairo/src) + else() + # On Linux and BSDs we're a good citizen and link to system libraries. + find_package(Backtrace) + find_package(PkgConfig REQUIRED) + find_package(ZLIB REQUIRED) + find_package(PNG REQUIRED) + find_package(Freetype REQUIRED) + if (NOT USE_QT_GUI OR ENABLE_CLI OR ENABLE_TESTS) + find_package(Cairo REQUIRED) + endif() + endif() +endif() + +# GUI dependencies + +if(ENABLE_GUI) + if(WIN32) + if(OPENGL STREQUAL "3") + message(STATUS "Using in-tree ANGLE") + set(ANGLE_STATIC ON CACHE INTERNAL "") + set(ANGLE_ENABLE_D3D9 ON CACHE INTERNAL "") + set(ANGLE_ENABLE_D3D11 ON CACHE INTERNAL "") + set(ANGLE_ENABLE_OPENGL ON CACHE INTERNAL "") + set(ANGLE_ENABLE_ESSL ON CACHE INTERNAL "") + set(ANGLE_ENABLE_GLSL ON CACHE INTERNAL "") + set(ANGLE_ENABLE_HLSL ON CACHE INTERNAL "") + add_vendored_subdirectory(extlib/angle) + set(OPENGL_LIBRARIES EGL GLESv2) + set(OPENGL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/angle/include) + else() + find_package(OpenGL REQUIRED) + endif() + + if(MSVC AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) + message(STATUS "Using prebuilt SpaceWare") + set(SPACEWARE_FOUND TRUE) + set(SPACEWARE_INCLUDE_DIR + "${CMAKE_SOURCE_DIR}/extlib/si") + set(SPACEWARE_LIBRARIES + "${CMAKE_SOURCE_DIR}/extlib/si/siapp.lib") + endif() + elseif(APPLE) + find_package(OpenGL REQUIRED) + find_library(APPKIT_LIBRARY AppKit REQUIRED) + elseif(EMSCRIPTEN) + # Everything is built in + else() + find_package(OpenGL REQUIRED) + find_package(SpaceWare) + pkg_check_modules(FONTCONFIG REQUIRED fontconfig) + if (NOT USE_QT_GUI) + pkg_check_modules(JSONC REQUIRED json-c) + pkg_check_modules(GTKMM REQUIRED gtkmm-3.0>=3.18 pangomm-1.4 x11) + endif() + endif() +endif() + +# code coverage + +if(ENABLE_COVERAGE) + if(CMAKE_CXX_COMPILER_ID STREQUAL GNU) + find_program(GCOV gcov) + elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang) + find_program(LLVM_COV llvm-cov) + + if(LLVM_COV) + set(GCOV ${CMAKE_CURRENT_BINARY_DIR}/llvm-gcov.sh) + file(WRITE ${GCOV} "#!/bin/sh -e\n${LLVM_COV} gcov $*") + execute_process(COMMAND chmod +x ${GCOV}) + endif() + endif() + + find_program(LCOV lcov) + find_program(GENHTML genhtml) + if(NOT GCOV OR NOT LCOV OR NOT GENHTML) + message(FATAL_ERROR "gcov/llvm-cov and lcov are required for producing coverage reports") + endif() +endif() + +# translations + +find_program(XGETTEXT xgettext) +find_program(MSGINIT msginit) +find_program(MSGMERGE msgmerge) +if(XGETTEXT AND MSGINIT AND MSGMERGE) + set(HAVE_GETTEXT TRUE) +else() + message(WARNING "Gettext not found, translations will not be updated") + set(HAVE_GETTEXT FALSE) +endif() + +# solvespace-only compiler flags + +if(WIN32) + add_definitions( + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_SCL_SECURE_NO_WARNINGS + -DWINVER=0x0501 + -D_WIN32_WINNT=0x0501 + -D_WIN32_IE=_WIN32_WINNT + -DISOLATION_AWARE_ENABLED + -DWIN32 + -DWIN32_LEAN_AND_MEAN + -DUNICODE + -D_UNICODE + -DNOMINMAX + -D_USE_MATH_DEFINES) +endif() + +if(MSVC) + # Many versions of MSVC do not have the (C99) inline keyword, instead + # they have their own __inline; this breaks `static inline` functions. + # We do not want to care and so we fix this with a definition. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline") + # Same for the (C99) __func__ special variable; we use it only in C++ code. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__func__=__FUNCTION__") + + # Multi-processor Compilation + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + + # We rely on these /we flags. They correspond to the GNU-style flags below as + # follows: /w4062=-Wswitch + set(WARNING_FLAGS "${WARNING_FLAGS} /we4062") + + # Link 32 bit SolveSpace with /LARGEADDRESSAWARE which allows it to access + # up to 3GB on a properly configured 32 bit Windows and up to 4GB on 64 bit. + # See https://msdn.microsoft.com/en-us/library/aa366778 + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(WARNING_FLAGS "${WARNING_FLAGS} -Wfloat-conversion") + endif() + # We rely on these -Werror flags. + set(WARNING_FLAGS "${WARNING_FLAGS} -Werror=switch") +endif() + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}") + +if(WIN32) + set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -l0") +endif() + +if(ENABLE_COVERAGE) + if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR + CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + message(FATAL_ERROR "Code coverage is only available on GCC and Clang") + endif() + + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + message(FATAL_ERROR "Code coverage produces reliable results only on Debug builds") + endif() + + # With -fexceptions, every call becomes a branch. While technically accurate, + # this is not useful for us. + set(COVERAGE_FLAGS -fno-exceptions --coverage) + set(COVERAGE_LIBRARY --coverage) +endif() + +# application components +if(ENABLE_GUI OR ENABLE_CLI) + add_subdirectory(res) + add_subdirectory(exposed) +endif() +add_subdirectory(src) +if(ENABLE_TESTS) + add_subdirectory(test) +endif() +if((ENABLE_CLI OR ENABLE_GUI) AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) + add_subdirectory(bench) +else() + message(STATUS "Benchmarking disabled in debug and library builds.") +endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..27f90fd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,291 @@ +Contributing to SolveSpace +========================== + +Contributing bug reports +------------------------ + +Bug reports are always welcome! When reporting a bug, please include the following: + + * The version of SolveSpace (use Help → About...); + * The operating system; + * The save file that reproduces the incorrect behavior, or, if trivial or impossible, + instructions for reproducing it. + +GitHub does not allow attaching `*.slvs` files, but it does allow attaching `*.zip` files, +so any savefiles should first be archived. + +Licensing +--------------- + +SolveSpace is licensed under the GPLv3 or later and any contributions +must be made available under the terms of that license. + +Contributing translations +------------------------- + +To contribute a translation, not a lot is necessary—at a minimum, you need to be able +to edit .po files with a tool such as [poedit](https://poedit.net/). Once you have +such a tool installed, take `res/messages.pot` and start translating! + +However, if you want to see your translation in action, a little more work is necessary. +First, you need to be able to build SolveSpace; see [README](README.md). After that: + + * Copy `res/messages.pot` to `res/locales/xx_YY.po`, where `xx` is an ISO 639-1 + country code, and `YY` is an ISO 3166-1 language code. + * Add a line `xx-YY,LCID,Name` to `res/locales.txt`, where `xx-YY` have the same + meaning as above, `LCID` is a Windows Language Code Identifier ([MS-LCID][] + has a complete list), and `Name` is the full name of your locale in your language. + * Add `locales/xx_YY.po` in `res/CMakeLists.txt`—search for `locales/en_US.po` + to see where it should be added. + +You're done! Recompile SolveSpace and you should be able to select your translation +via Help → Language. + +[MS-LCID]: https://msdn.microsoft.com/en-us/library/cc233965.aspx + +Contributing code +----------------- + +SolveSpace is written in C++, and currently targets all compilers compliant with C++11. +This includes GCC 5 and later, Clang 3.3 and later, and Visual Studio 12 (2013) and later. + +### High-level conventions + +#### Portability + +SolveSpace aims to consist of two general parts: a fully portable core, and platform-specific +UI and support code. Anything outside of `src/platform/` should only use standard C++11, +and rely on `src/platform/platform.h` to interact with the OS where this cannot be done +through the C++11 standard library. + +#### Libraries + +SolveSpace primarily relies on the C++11 STL. STL has well-known drawbacks, but is also +widely supported, used, and understood. SolveSpace also includes a fair amount of use of +bespoke containers List and IdList; these provide STL iterators, and can be used when +convenient, such as when reusing other code. + +One notable departure here is the STL I/O streams. SolveSpace does not use STL I/O streams +for two reasons: (i) the interface is borderline unusable, and (ii) on Windows it is not +possible to open files with Unicode paths through STL. + +When using external libraries (other than to access platform features), the libraries +should satisfy the following conditions: + + * Portable, and preferably not interacting with the platform at all; + * Can be included as a CMake subproject, to facilitate Windows, Android, etc. builds; + * Use a license less restrictive than GPL (BSD/MIT, Apache2, MPL, etc.) + +#### String encoding + +Internally, SolveSpace exclusively stores and uses UTF-8 for all purposes; any `std::string` +may be assumed to be encoded in UTF-8. On Windows, UTF-8 strings are converted to and from +wide strings at the boundary; see [UTF-8 Everywhere][utf8] for details. + +[utf8]: http://utf8everywhere.org/ + +#### String formatting + +For string formatting, a wrapper around `sprintf`, `ssprintf`, is used. A notable +pitfall when using it is trying to pass an `std::string` argument without first converting +it to a C string with `.c_str()`. + +#### Filesystem access + +For filesystem access, the C standard library is used. The `ssfopen` and `ssremove` +wrappers are provided that accept UTF-8 encoded paths. + +#### Assertions + +To ensure that internal invariants hold, the `ssassert` function is used, e.g. +`ssassert(!isFoo, "Unexpected foo condition");`. Unlike the standard `assert` function, +the `ssassert` function is always enabled, even in release builds. It is more valuable +to discover a bug through a crash than to silently generate incorrect results, and crashes +do not result in losing more than a few minutes of work thanks to the autosave feature. + +### Use of C++ features + +The conventions described in this section should be used for all new code, but there is a lot +of existing code in SolveSpace that does not use them. This is fine; don't touch it if it works, +but if you need to modify it anyway, might as well modernize it. + +#### Exceptions + +Exceptions are not used primarily because SolveSpace's testsuite uses measurement +of branch coverage, important for the critical parts such as the geometric kernel. +Every function call with exceptions enabled introduces a branch, making branch coverage +measurement useless. + +#### Operator overloading + +Operator overloading is not used primarily for historical reasons. Instead, method such +as `Plus` are used. + +#### Member visibility + +Member visibility is not used for implementation hiding. Every member field and function +is `public`. + +#### Constructors + +Constructors are not used for initialization, chiefly because indicating an error +in a constructor would require throwing an exception, nor does it use constructors for +blanket zero-initialization because of the performance impact of doing this for common +POD classes like `Vector`. + +Instances can be zero-initialized using the aggregate-initialization syntax, e.g. `Foo foo = {};`. +This zero-initializes the POD members and default-initializes the non-POD members, generally +being an equivalent of `memset(&foo, 0, sizeof(foo));` but compatible with STL containers. + +#### Input- and output-arguments + +Functions accepting an input argument take it either by-value (`Vector v`) or +by-const-reference (`const Vector &v`). Generally, passing by-value is safer as the value +cannot be aliased by something else, but passing by-const-reference is faster, as a copy is +eliminated. Small values should always be passed by-value, and otherwise functions that do not +capture pointers into their arguments should take them by-const-reference. Use your judgement. + +Functions accepting an output argument always take it by-pointer (`Vector *v`). This makes +it immediately visible at the call site as it is seen that the address is taken. Arguments +are never passed by-reference, except when needed for interoperability with STL, etc. + +#### Iteration + +`foreach`-style iteration is preferred for both STL and `List`/`IdList` containers as it indicates +intent clearly, as opposed to `for`-style. + +#### Const correctness + +Functions that do not mutate `this` should be marked as `const`; when iterating a collection +without mutating any of its elements, `for(const Foo &elem : collection)` is preferred to indicate +the intent. + +### Coding style + +Code is formatted by the following rules: + + * Code is indented using 4 spaces, with no trailing spaces, and lines are wrapped + at 100 columns; + * Braces are placed at the end of the line with the declaration or control flow statement; + * Braces are used with every control flow statement, even if there is only one statement + in the body; + * There is no space after control flow keywords (`if`, `while`, etc.); + * Identifiers are formatted in camel case; variables start with a lowercase letter + (`exampleVariable`) and functions start with an uppercase letter (`ExampleFunction`). + +For example: + +```c++ +std::string SolveSpace::Dirname(std::string filename) { + int slash = filename.rfind(PATH_SEP); + if(slash >= 0) { + return filename.substr(0, slash); + } + + return ""; +} +``` + +If you install [clang-format][], this style can be automatically applied by staging your changes +with `git add -u`, running `git clang-format`, and staging any changes it made again. + +[clang-format]: https://clang.llvm.org/docs/ClangFormat.html + +Debugging code +-------------- + +SolveSpace releases are thoroughly tested but sometimes they contain crash +bugs anyway. The reason for such crashes can be determined only if the executable +was built with debug information. + +### Debugging a released version + +The Linux distributions usually include separate debug information packages. +On a Debian derivative (e.g. Ubuntu), these can be installed with: + + apt-get install solvespace-dbg + +The macOS releases include the debug information, and no further action +is needed. + +The Windows releases include the debug information on the GitHub +[release downloads page](https://github.com/solvespace/solvespace/releases). + +### Debugging a custom build + +If you are building SolveSpace yourself on macOS, use the XCode +CMake generator, then open the project in XCode as usual, select +the Debug build scheme, and build the project: + + cd build + cmake .. -G Xcode [other cmake args...] + +If you are building SolveSpace yourself on any Unix-like platform, +configure or re-configure SolveSpace to produce a debug build, and +then build it: + + cd build + cmake .. -DCMAKE_BUILD_TYPE=Debug [other cmake args...] + make + +If you are building SolveSpace yourself using the Visual Studio IDE, +select Debug from the Solution Configurations list box on the toolbar, +and build the solution. + +### Debugging with gdb + +gdb is a debugger that is mostly used on Linux. First, run SolveSpace +under debugging: + + gdb [path to solvespace executable] + (gdb) run + +Then, reproduce the crash. After the crash, attach the output in +the console, as well as output of the following gdb commands to +a bug report: + + (gdb) backtrace + (gdb) info locals + +If the crash is not easy to reproduce, please generate a core file, +which you can use to resume the debugging session later, and provide +any other information that is requested: + + (gdb) generate-core-file + +This will generate a large file called like `core.1234` in the current +directory; it can be later re-loaded using `gdb --core core.1234`. + +### Debugging with lldb + +lldb is a debugger that is mostly used on macOS. First, run SolveSpace +under debugging: + + lldb [path to solvespace executable] + (lldb) run + +Then, reproduce the crash. After the crash, attach the output in +the console, as well as output of the following gdb commands to +a bug report: + + (lldb) backtrace all + (lldb) frame variable + +If the crash is not easy to reproduce, please generate a core file, +which you can use to resume the debugging session later, and provide +any other information that is requested: + + (lldb) process save-core "core" + +This will generate a large file called `core` in the current +directory; it can be later re-loaded using `lldb -c core`. + +### Debugging GUI-related bugs on Linux + +There are several environment variables available that make crashes +earlier and errors more informative. Before running SolveSpace, run +the following commands in your shell: + + export G_DEBUG=fatal_warnings + export LIBGL_DEBUG=1 + export MESA_DEBUG=1 diff --git a/COPYING.txt b/COPYING.txt new file mode 100644 index 0000000..a737dcf --- /dev/null +++ b/COPYING.txt @@ -0,0 +1,675 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a4513b9 --- /dev/null +++ b/README.md @@ -0,0 +1,356 @@ +# SolveSpace + +SolveSpace Logo + +[![Build Status](https://github.com/solvespace/solvespace/workflows/CD/badge.svg)](https://github.com/solvespace/solvespace/actions) +[![solvespace](https://snapcraft.io/solvespace/badge.svg)](https://snapcraft.io/solvespace) +[![solvespace](https://snapcraft.io/solvespace/trending.svg?name=0)](https://snapcraft.io/solvespace) + +This repository contains the source code of [SolveSpace][], a parametric +2d/3d CAD tool. + +[solvespace]: https://solvespace.com + +## Community + +The official SolveSpace [website][sswebsite] has [tutorials][sstutorial], +[reference manual][ssref] and a [forum][ssforum]; there is also an official +IRC channel [#solvespace at web.libera.chat][ssirc]. + +[sswebsite]: http://solvespace.com/ +[ssref]: http://solvespace.com/ref.pl +[sstutorial]: http://solvespace.com/tutorial.pl +[ssforum]: http://solvespace.com/forum.pl +[ssirc]: https://web.libera.chat/#solvespace + +# Installation + +### Via Official Packages + +_Official_ release packages for macOS (>=10.6 64-bit) and Windows +(>=Vista 32-bit) are available via [GitHub releases][rel]. These packages are +automatically built by the SolveSpace maintainers for each stable release. + +[rel]: https://github.com/solvespace/solvespace/releases + +### Via Flathub + +Official releases can be installed as a Flatpak from Flathub. + +[Get SolveSpace from Flathub](https://flathub.org/apps/details/com.solvespace.SolveSpace) + +These should work on any Linux distribution that supports Flatpak. + +### Via Snap Store + +Official releases can be installed from the `stable` channel. + +Builds from master are automatically released to the `edge` channel in the Snap +Store. Those packages contain the latest improvements, but receive less testing +than release builds. + +[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/solvespace) + +Or install from a terminal: + +```sh +# for the latest stable release: +snap install solvespace + +# for the bleeding edge builds from master: +snap install solvespace --edge +``` + +### Via automated edge builds + +> :warning: **Edge builds might be unstable or contain severe bugs!** +> They are intended for experienced users to test new features or verify bugfixes. + +Cutting edge builds from the latest master commit are available as zip archives +from the following links: + +- [macOS](https://nightly.link/solvespace/solvespace/workflows/cd/master/macos.zip) +- [Windows with OpenMP enabled 32bit](https://nightly.link/solvespace/solvespace/workflows/cd/master/windows_x86.zip) +- [Windows 32bit](https://nightly.link/solvespace/solvespace/workflows/cd/master/windows_single_core_x86.zip) +- [Windows with OpenMP enabled 64bit](https://nightly.link/solvespace/solvespace/workflows/cd/master/windows_x64.zip) +- [Windows 64bit](https://nightly.link/solvespace/solvespace/workflows/cd/master/windows_single_core_x64.zip) + +**Please note that the 64bit Windows versions do *not* support 6DOF (SpeceMouse, SpaceNavigator) controllers.** + +Extract the downloaded archive and install or execute the contained file as is +appropriate for your platform. + +### Via source code + +Irrespective of the OS used, before building, check out the project and the +necessary submodules: + +```sh +git clone https://github.com/solvespace/solvespace +cd solvespace +git submodule update --init +``` + +You will need `git`. See the platform specific instructions below to install it. + +## Building on Linux + +### Building for Linux + +You will need the usual build tools, CMake, zlib, libpng, cairo, freetype. To +build the GUI, you will need fontconfig, gtkmm 3.0 (version 3.16 or later) for +GTK, or QT6 for the newer QT interface, pangomm 1.4, OpenGL and OpenGL GLU, +and optionally, the Space Navigator client library. + +On a Debian derivative (e.g. Ubuntu) these can be installed with: + +```sh +sudo apt install git build-essential cmake zlib1g-dev libpng-dev \ + libcairo2-dev libfreetype6-dev libjson-c-dev \ + libfontconfig1-dev libpangomm-1.4-dev libgl-dev \ + libglu-dev libspnav-dev libgtkmm-3.0-dev qt6-base-dev +``` + +On a RedHat derivative (e.g. Fedora) the dependencies can be installed with: + +```sh +sudo dnf install git gcc-c++ cmake zlib-devel libpng-devel \ + cairo-devel freetype-devel json-c-devel \ + fontconfig-devel pangomm-devel mesa-libGL-devel \ + mesa-libGLU-devel libspnav-devel gtkmm30-devel \ + qt6-qtbase-devel +``` +`gtkmm30-devel` is required to build the GTK version and `qt6-qtbase-devel` is required to build the QT version. One or +the other may be omitted if both versions are not needed. Likewise with `libgtkmm-3.0-dev` and `qt6-base-dev` for Debuntu +respectively. + +Before building, [check out the project and the necessary submodules](#via-source-code). + +After that, build SolveSpace as following: + +```sh +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENMP=ON [-DENABLE_LTO=ON] [-DUSE_QT_GUI=ON] [-DENABLE_GUI=OFF] +make + +# Optionally +sudo make install +``` +Optional: + - -DENABLE_LTO=ON: Enable Link Time Optimization at the expense of longer build time. + - -DUSE_QT_GUI=ON: Build the newer QT GUI interface. + - -DENABLE_GUI=OFF: Build only the command-line interface + +The GTK graphical interface is built as `build/bin/solvespace`, and the command-line +interface is built as `build/bin/solvespace-cli`. The QT graphical interface is built +as `build/bin/solvespace-qt`. + +### Building for Windows + +Ubuntu will require 20.04 or above. Cross-compiling with WSL is also confirmed +to work. + +You will need the usual build tools, CMake, and a Windows cross-compiler. On a +Debian derivative (e.g. Ubuntu) these can be installed with: + +```sh +apt-get install git build-essential cmake mingw-w64 +``` + +Before building, [check out the project and the necessary submodules](#via-source-code). + +Build 64-bit SolveSpace with the following: + +```sh +mkdir build +cd build +cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake \ + -DCMAKE_BUILD_TYPE=Release +make +``` + +The graphical interface is built as `build/bin/solvespace.exe`, and the +command-line interface is built as `build/bin/solvespace-cli.exe`. + +Space Navigator support will not be available. + +### Building for web (very experimental) + +**Please note that this port contains many critical bugs and unimplemented core functions.** + +You will need the usual build tools, cmake and [Emscripten][]. On a Debian derivative (e.g. Ubuntu) dependencies other than Emscripten can be installed with: + +```sh +apt-get install git build-essential cmake +``` + +First, install and prepare `emsdk`: + +```sh +git clone https://github.com/emscripten-core/emsdk +cd emsdk +./emsdk install latest +./emsdk activate latest +source ./emsdk_env.sh +cd .. +``` + +Before building, [check out the project and the necessary submodules](#via-source-code). + +After that, build SolveSpace as following: + +```sh +mkdir build +cd build +emcmake cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO="ON" -DENABLE_TESTS="OFF" -DENABLE_CLI="OFF" -DENABLE_COVERAGE="OFF" +make +``` + +The graphical interface is built as multiple files in the `build/bin` directory with names +starting with `solvespace`. It can be run locally with `emrun build/bin/solvespace.html`. + +The command-line interface is not available. + +[emscripten]: https://emscripten.org/ + +## Building on macOS + +You will need git, XCode tools, CMake and libomp. Git, CMake and libomp can be installed +via [Homebrew][]: + +```sh +brew install git cmake libomp +``` + +XCode has to be installed via AppStore or [the Apple website][appledeveloper]; +it requires a free Apple ID. + +Before building, [check out the project and the necessary submodules](#via-source-code). + +After that, build SolveSpace as following: + +```sh +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENMP=ON +make +``` + +Link Time Optimization is supported by adding `-DENABLE_LTO=ON` to cmake at the +expense of longer build time. + +Alternatively, generate an XCode project, open it, and build the "Release" scheme: + +```sh +mkdir build +cd build +cmake .. -G Xcode +``` + +The application is built in `build/bin/SolveSpace.app`, the graphical interface executable +is `build/bin/SolveSpace.app/Contents/MacOS/SolveSpace`, and the command-line interface executable +is `build/bin/SolveSpace.app/Contents/MacOS/solvespace-cli`. + +[homebrew]: https://brew.sh/ +[appledeveloper]: https://developer.apple.com/download/ + +## Building on OpenBSD + +You will need git, cmake, libexecinfo, libpng, gtk3mm and pangomm. +These can be installed from the ports tree: + +```sh +pkg_add -U git cmake libexecinfo png json-c gtk3mm pangomm +``` + +Before building, [check out the project and the necessary submodules](#via-source-code). + +After that, build SolveSpace as following: + +```sh +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release +make +sudo make install +``` + +Unfortunately, on OpenBSD, the produced executables are not filesystem location independent +and must be installed before use. By default, the graphical interface is installed to +`/usr/local/bin/solvespace`, and the command-line interface is built as +`/usr/local/bin/solvespace-cli`. It is possible to build only the command-line interface +by passing the `-DENABLE_GUI=OFF` flag to the cmake invocation. + +## Building on Windows + +You will need [git][gitwin], [cmake][cmakewin] and a C++ compiler +(either Visual C++ or MinGW). If using Visual C++, Visual Studio 2015 +or later is required. +If gawk is in your path be sure it is a proper Windows port that can handle CL LF line endings. +If not CMake may fail in libpng due to some awk scripts - issue #1228. + +Before building, [check out the project and the necessary submodules](#via-source-code). + +### Building with Visual Studio IDE + +Create a directory `build` in +the source tree and point cmake-gui to the source tree and that directory. +Press "Configure" and "Generate", then open `build\solvespace.sln` with +Visual C++ and build it. + +### Building with Visual Studio in a command prompt + +First, ensure that `git` and `cl` (the Visual C++ compiler driver) are in your +`%PATH%`; the latter is usually done by invoking `vcvarsall.bat` from your +Visual Studio install. Then, run the following in cmd or PowerShell: + +```bat +mkdir build +cd build +cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release +nmake +``` + +### Building with MinGW + +It is also possible to build SolveSpace using [MinGW][mingw], though +Space Navigator support will be disabled. + +The easiest way to build using MinGW is with [MSYS2][msys2]. If you're not using MSYS2, skip +the installation instructions and ensure that git, cmake, ninja, and gcc are in your `$PATH`. + +With MSYS2, you can build either a 32-bit binary or a 64-bit one, depending on the compiler +used. The following instructions assume you're running the commands inside an `MSYS2 MINGW64` +terminal window and building a 64-bit version. If you want to build a 32-bit version, you'll +need to run the commands in an `MSYS2 MINGW32` terminal window and replace `x86_64` +with `i686` in the installation commands. + +First, install Git, GCC, CMake, and Ninja: + +```sh +pacman -Sy mingw-w64-x86_64-git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja +``` + +Then, run the following in bash: + +```sh +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -GNinja +ninja +``` + +[gitwin]: https://git-scm.com/download/win +[cmakewin]: https://www.cmake.org/download/#latest +[mingw]: http://www.mingw.org/ +[msys2]: https://www.msys2.org/ + +## Contributing + +See the [guide for contributors](CONTRIBUTING.md) for the best way to file issues, contribute code, +and debug SolveSpace. + +## License + +SolveSpace is distributed under the terms of the [GPL v3](COPYING.txt) or later. diff --git a/THIRD_PARTIES.txt b/THIRD_PARTIES.txt new file mode 100644 index 0000000..ad04bf6 --- /dev/null +++ b/THIRD_PARTIES.txt @@ -0,0 +1,50 @@ +This file outlines third party licenses that apply to the files and resources +listed with them. All file paths are relative to the SolveSpace project root. + +When redistributing SolveSpace, make sure to also reproduce this file such that +the paths indicating the scope of each license remain intact. +================================================================================ + + Bitstream Vera, ./res/fonts/BitstreamVeraSans-Roman-builtin.ttf + ~ +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a +trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +the fonts accompanying this license (“Fonts”) and associated documentation files +(the “Font Software”), to reproduce and distribute the Font Software, including +without limitation the rights to use, copy, merge, publish, distribute, and/or +sell copies of the Font Software, and to permit persons to whom the Font +Software is furnished to do so, subject to the following conditions: + +The above copyright and trademark notices and this permission notice shall be +included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular the +designs of glyphs or characters in the Fonts may be modified and additional +glyphs or characters may be added to the Fonts, only if the fonts are renamed to +names not containing either the words “Bitstream” or the word “Vera”. + +This License becomes null and void to the extent applicable to Fonts or Font +Software that has been modified and is distributed under the “Bitstream Vera” +names. + +The Font Software may be sold as part of a larger software package but no copy +of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR +OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR +FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the names of GNOME, the GNOME Foundation, +and Bitstream Inc., shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Font Software without prior written +authorization from the GNOME Foundation or Bitstream Inc., respectively. For +further information, contact: fonts at gnome dot org. + + ----------- diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt new file mode 100644 index 0000000..26172f1 --- /dev/null +++ b/bench/CMakeLists.txt @@ -0,0 +1,17 @@ +# benchmark runner + +foreach(pkg_config_lib CAIRO) + include_directories(${${pkg_config_lib}_INCLUDE_DIRS}) + link_directories(${${pkg_config_lib}_LIBRARY_DIRS}) +endforeach() + +add_executable(solvespace-benchmark + harness.cpp + $) + +target_link_libraries(solvespace-benchmark + solvespace-core + solvespace-headless) + +add_dependencies(solvespace-benchmark + resources) diff --git a/bench/harness.cpp b/bench/harness.cpp new file mode 100644 index 0000000..66d5308 --- /dev/null +++ b/bench/harness.cpp @@ -0,0 +1,85 @@ +//----------------------------------------------------------------------------- +// Our harness for running benchmarks. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include +#include +#include +#include + +#include "solvespace.h" + +using namespace SolveSpace; + +static bool RunBenchmark(std::function setupFn, + std::function benchFn, + std::function teardownFn, + size_t minIter = 5, double minTime = 5.0) { + // Warmup + setupFn(); + if(!benchFn()) { + fprintf(stderr, "Benchmark failed\n"); + return false; + } + teardownFn(); + + // Benchmark + size_t iter = 0; + double time = 0.0; + while(iter < minIter || time < minTime) { + setupFn(); + auto testStartTime = std::chrono::steady_clock::now(); + benchFn(); + auto testEndTime = std::chrono::steady_clock::now(); + teardownFn(); + + std::chrono::duration testTime = testEndTime - testStartTime; + time += testTime.count(); + iter += 1; + } + + // Report + fprintf(stdout, "Iterations: %zd\n", iter); + fprintf(stdout, "Time: %.3f s\n", time); + fprintf(stdout, "Per iter.: %.3f s\n", time / (double)iter); + + return true; +} + +int main(int argc, char **argv) { + std::vector args = Platform::InitCli(argc, argv); + + std::string mode; + Platform::Path filename; + if(args.size() == 3) { + mode = args[1]; + filename = Platform::Path::From(args[2]); + } else { + fprintf(stderr, "Usage: %s [mode] [filename]\n", args[0].c_str()); + fprintf(stderr, "Mode can be one of: load.\n"); + return 1; + } + + bool result = false; + if(mode == "load") { + result = RunBenchmark( + [] { + SS.Init(); + }, + [&] { + if(!SS.LoadFromFile(filename)) + return false; + SS.AfterNewFile(); + return true; + }, + [] { + SK.Clear(); + SS.Clear(); + }); + } else { + fprintf(stderr, "Unknown mode \"%s\"\n", mode.c_str()); + } + + return (result == true ? 0 : 1); +} diff --git a/cmake/AddVendoredSubdirectory.cmake b/cmake/AddVendoredSubdirectory.cmake new file mode 100644 index 0000000..9d2edf6 --- /dev/null +++ b/cmake/AddVendoredSubdirectory.cmake @@ -0,0 +1,10 @@ +# Equivalent to add_subdirectory(... EXCLUDE_FROM_ALL), but also disables +# all warnings. + +include(DisableWarnings) + +function(add_vendored_subdirectory PATH) + disable_warnings() + + add_subdirectory(${PATH} EXCLUDE_FROM_ALL) +endfunction() diff --git a/cmake/DisableWarnings.cmake b/cmake/DisableWarnings.cmake new file mode 100644 index 0000000..34925c8 --- /dev/null +++ b/cmake/DisableWarnings.cmake @@ -0,0 +1,15 @@ +# Disables all warnings on MSVC and GNU-compatible compilers. + +function(disable_warnings) + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w" PARENT_SCOPE) + elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0 /MP" PARENT_SCOPE) + endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w" PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0 /MP" PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake new file mode 100644 index 0000000..d0130ad --- /dev/null +++ b/cmake/FindCairo.cmake @@ -0,0 +1,75 @@ +# - Try to find Cairo +# Once done, this will define +# +# CAIRO_FOUND - system has Cairo +# CAIRO_INCLUDE_DIRS - the Cairo include directories +# CAIRO_LIBRARIES - link these to use Cairo +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +find_package(PkgConfig) +pkg_check_modules(PC_CAIRO QUIET cairo) + +find_path(CAIRO_INCLUDE_DIRS + NAMES cairo.h + HINTS ${PC_CAIRO_INCLUDEDIR} + ${PC_CAIRO_INCLUDE_DIRS} + PATH_SUFFIXES cairo +) + +find_library(CAIRO_LIBRARIES + NAMES cairo + HINTS ${PC_CAIRO_LIBDIR} + ${PC_CAIRO_LIBRARY_DIRS} +) + +if (CAIRO_INCLUDE_DIRS) + if (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h") + file(READ "${CAIRO_INCLUDE_DIRS}/cairo-version.h" CAIRO_VERSION_CONTENT) + + string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + set(CAIRO_VERSION_MICRO "${CMAKE_MATCH_1}") + + set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}") + endif () +endif () + +if ("${Cairo_FIND_VERSION}" VERSION_GREATER "${CAIRO_VERSION}") + message(FATAL_ERROR "Required version (" ${Cairo_FIND_VERSION} ") is higher than found version (" ${CAIRO_VERSION} ")") +endif () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cairo REQUIRED_VARS CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES + VERSION_VAR CAIRO_VERSION) + +mark_as_advanced( + CAIRO_INCLUDE_DIRS + CAIRO_LIBRARIES +) diff --git a/cmake/FindSpaceWare.cmake b/cmake/FindSpaceWare.cmake new file mode 100644 index 0000000..451063c --- /dev/null +++ b/cmake/FindSpaceWare.cmake @@ -0,0 +1,28 @@ +# Find the libspnav library and header. +# +# Sets the usual variables expected for find_package scripts: +# +# SPACEWARE_INCLUDE_DIR - header location +# SPACEWARE_LIBRARIES - library to link against +# SPACEWARE_FOUND - true if libspnav was found. + +if(UNIX) + + find_path(SPACEWARE_INCLUDE_DIR + spnav.h) + + find_library(SPACEWARE_LIBRARY + NAMES spnav libspnav) + + # Support the REQUIRED and QUIET arguments, and set SPACEWARE_FOUND if found. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(SpaceWare DEFAULT_MSG + SPACEWARE_LIBRARY SPACEWARE_INCLUDE_DIR) + + if(SPACEWARE_FOUND) + set(SPACEWARE_LIBRARIES ${SPACEWARE_LIBRARY}) + endif() + + mark_as_advanced(SPACEWARE_LIBRARY SPACEWARE_INCLUDE_DIR) + +endif() diff --git a/cmake/FindVendoredPackage.cmake b/cmake/FindVendoredPackage.cmake new file mode 100644 index 0000000..6227f6c --- /dev/null +++ b/cmake/FindVendoredPackage.cmake @@ -0,0 +1,56 @@ +# Find the given library in the system locations, or build in-tree if not found. +# +# Arguments: +# PKG_NAME - name of the package as passed to find_package +# PKG_PATH - name of the source tree relative to extlib/ +# +# The rest of the arguments are VARIABLE VALUE pairs. If the library is not found, +# every VARIABLE will be set to VALUE and find_package will be rerun with the REQUIRED flag. +# Regardless of where the library was found, only the specified VARIABLEs that start with +# ${PKG_NAME} will be set in the parent scope. +# +# All warnings in the in-tree package are disabled. + +include(DisableWarnings) + +function(find_vendored_package PKG_NAME PKG_PATH) + if(NOT FORCE_VENDORED_${PKG_NAME}) + find_package(${PKG_NAME}) + endif() + + set(cfg_name) + foreach(item ${ARGN}) + if(NOT cfg_name) + set(cfg_name ${item}) + else() + set(${cfg_name} ${item} CACHE INTERNAL "") + set(cfg_name) + endif() + endforeach() + + disable_warnings() + + string(TOUPPER ${PKG_NAME} VAR_NAME) + if(NOT ${VAR_NAME}_FOUND) + message(STATUS "Using in-tree ${PKG_PATH}") + set(${VAR_NAME}_IN_TREE YES CACHE INTERNAL "") + + add_subdirectory(extlib/${PKG_PATH} EXCLUDE_FROM_ALL) + find_package(${PKG_NAME} REQUIRED) + elseif(${VAR_NAME}_IN_TREE) + add_subdirectory(extlib/${PKG_PATH} EXCLUDE_FROM_ALL) + endif() + + # Now put everything we just discovered into the cache. + set(cfg_name) + foreach(item ${ARGN} ${VAR_NAME}_FOUND) + if(NOT cfg_name) + set(cfg_name ${item}) + else() + if(cfg_name MATCHES "^${VAR_NAME}") + set(${cfg_name} "${${cfg_name}}" CACHE INTERNAL "") + endif() + set(cfg_name) + endif() + endforeach() +endfunction() diff --git a/cmake/GetGitCommitHash.cmake b/cmake/GetGitCommitHash.cmake new file mode 100644 index 0000000..c3d2267 --- /dev/null +++ b/cmake/GetGitCommitHash.cmake @@ -0,0 +1,43 @@ +function(get_git_commit_hash) + get_filename_component(GIT_DESCRIBE_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + get_filename_component(GIT_ROOT ${GIT_DESCRIBE_CMAKE_DIR} PATH) + set(GIT_DIR "${GIT_ROOT}/.git") + + if(EXISTS ${GIT_DIR} AND NOT IS_DIRECTORY ${GIT_DIR}) + # In case we are included as a git submodule. + file(READ ${GIT_DIR} GIT_SUB_DIR) + string(REPLACE "gitdir: " "" GIT_SUB_DIR ${GIT_SUB_DIR}) + string(STRIP ${GIT_SUB_DIR} GIT_SUB_DIR) + set(GIT_DIR "${GIT_ROOT}/${GIT_SUB_DIR}") + endif() + + # Add a CMake configure dependency to the currently checked out revision. + set(GIT_DEPENDS ${GIT_DIR}/HEAD) + file(READ ${GIT_DIR}/HEAD HEAD_REF) + if(HEAD_REF MATCHES "ref: (.+)\n") + set(HEAD_REF ${CMAKE_MATCH_1}) + if(EXISTS "${GIT_DIR}/${HEAD_REF}") + list(APPEND GIT_DEPENDS ${GIT_DIR}/${HEAD_REF}) + file(READ ${GIT_DIR}/${HEAD_REF} HEAD_REF) + elseif(EXISTS "${GIT_DIR}/packed-refs") + list(APPEND GIT_DEPENDS ${GIT_DIR}/packed-refs) + file(READ "${GIT_DIR}/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_REF ${CMAKE_MATCH_1}) + else() + set(HEAD_REF "") + endif() + else() + set(HEAD_REF "") + endif() + endif() + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${GIT_DEPENDS}) + + string(STRIP ${HEAD_REF} HEAD_REF) + if(HEAD_REF STREQUAL "") + message(WARNING "Cannot determine git HEAD") + else() + set(GIT_COMMIT_HASH ${HEAD_REF} PARENT_SCOPE) + endif() +endfunction() +get_git_commit_hash() diff --git a/cmake/MacOSXBundleInfo.plist.in b/cmake/MacOSXBundleInfo.plist.in new file mode 100644 index 0000000..dddb46f --- /dev/null +++ b/cmake/MacOSXBundleInfo.plist.in @@ -0,0 +1,49 @@ + + + + + CFBundleIdentifier + com.solvespace + CFBundleDevelopmentRegion + English + CFBundleExecutable + SolveSpace + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + SolveSpace + CFBundlePackageType + APPL + CFBundleVersion + ${PROJECT_VERSION}~${solvespace_GIT_HASH} + CFBundleShortVersionString + ${PROJECT_VERSION} + NSHumanReadableCopyright + © 2008-2026 Jonathan Westhues and other authors + NSPrincipalClass + NSApplication + NSMainNibFile + MainMenu + CFBundleIconFile + AppIcon + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + slvs + + CFBundleTypeIconFile + AppIcon.icns + CFBundleTypeName + SolveSpace sketch + CFBundleTypeOSTypes + + slvs + + CFBundleTypeRole + Editor + + + + diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake new file mode 100644 index 0000000..9ad0a77 --- /dev/null +++ b/cmake/Platform/Emscripten.cmake @@ -0,0 +1,364 @@ +# This file is a 'toolchain description file' for CMake. +# It teaches CMake about the Emscripten compiler, so that CMake can generate +# makefiles from CMakeLists.txt that invoke emcc. + +# The following variable describes the target OS we are building to. +set(CMAKE_SYSTEM_NAME Emscripten) +set(CMAKE_SYSTEM_VERSION 1) + +set(CMAKE_CROSSCOMPILING TRUE) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +# Advertise Emscripten as a 32-bit platform (as opposed to +# CMAKE_SYSTEM_PROCESSOR=x86_64 for 64-bit platform), since some projects (e.g. +# OpenCV) use this to detect bitness. +# Allow users to ovewrite this on the command line with -DEMSCRIPTEN_SYSTEM_PROCESSOR=arm. +if (NOT DEFINED EMSCRIPTEN_SYSTEM_PROCESSOR) + set(EMSCRIPTEN_SYSTEM_PROCESSOR x86) +endif() +set(CMAKE_SYSTEM_PROCESSOR ${EMSCRIPTEN_SYSTEM_PROCESSOR}) + +# Tell CMake how it should instruct the compiler to generate multiple versions +# of an outputted .so library: e.g. "libfoo.so, libfoo.so.1, libfoo.so.1.4" etc. +# This feature is activated if a shared library project has the property +# SOVERSION defined. +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + +# In CMake, CMAKE_HOST_WIN32 is set when we are cross-compiling from Win32 to +# Emscripten: +# http://www.cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_HOST_WIN32 +# The variable WIN32 is set only when the target arch that will run the code +# will be WIN32, so unset WIN32 when cross-compiling. +set(WIN32) + +# The same logic as above applies for APPLE and CMAKE_HOST_APPLE, so unset +# APPLE. +set(APPLE) + +# And for UNIX and CMAKE_HOST_UNIX. However, Emscripten is often able to mimic +# being a Linux/Unix system, in which case a lot of existing CMakeLists.txt +# files can be configured for Emscripten while assuming UNIX build, so this is +# left enabled. +set(UNIX 1) + +# Do a no-op access on the CMAKE_TOOLCHAIN_FILE variable so that CMake will not +# issue a warning on it being unused. +if (CMAKE_TOOLCHAIN_FILE) +endif() + +if (CMAKE_HOST_WIN32) + set(EMCC_SUFFIX ".bat") +else() + set(EMCC_SUFFIX "") +endif() + +# Locate where the Emscripten compiler resides in +if (NOT DEFINED EMSCRIPTEN_ROOT_PATH) + # Check relative to this toolchain file + get_filename_component(GUESS_EMSCRIPTEN_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + # If not found by above search, locate using the EMSCRIPTEN environment variable + find_program(EMSCRIPTEN_EMRANLIB_PATH emranlib${EMCC_SUFFIX} HINTS "${GUESS_EMSCRIPTEN_ROOT_PATH}" ENV "EMSCRIPTEN") + if(NOT EMSCRIPTEN_EMRANLIB_PATH) + # Abort if not found + message(FATAL_ERROR "Could not locate the Emscripten compiler toolchain directory! Either set the EMSCRIPTEN environment variable, or pass -DEMSCRIPTEN_ROOT_PATH=xxx to CMake to explicitly specify the location of the compiler!") + endif() + get_filename_component(EMSCRIPTEN_ROOT_PATH "${EMSCRIPTEN_EMRANLIB_PATH}" DIRECTORY) +endif() + +# Normalize, convert Windows backslashes to forward slashes or CMake will crash. +get_filename_component(EMSCRIPTEN_ROOT_PATH "${EMSCRIPTEN_ROOT_PATH}" ABSOLUTE) + +list(APPEND CMAKE_MODULE_PATH "${EMSCRIPTEN_ROOT_PATH}/cmake/Modules") + +# Specify the compilers to use for C and C++ +set(CMAKE_C_COMPILER "${EMSCRIPTEN_ROOT_PATH}/emcc${EMCC_SUFFIX}") +set(CMAKE_CXX_COMPILER "${EMSCRIPTEN_ROOT_PATH}/em++${EMCC_SUFFIX}") +set(CMAKE_NM "${EMSCRIPTEN_ROOT_PATH}/emnm${EMCC_SUFFIX}") +set(CMAKE_AR "${EMSCRIPTEN_ROOT_PATH}/emar${EMCC_SUFFIX}") +set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}") +set(CMAKE_C_COMPILER_AR "${CMAKE_AR}") +set(CMAKE_CXX_COMPILER_AR "${CMAKE_AR}") +set(CMAKE_C_COMPILER_RANLIB "${CMAKE_RANLIB}") +set(CMAKE_CXX_COMPILER_RANLIB "${CMAKE_RANLIB}") +set(CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS "${EMSCRIPTEN_ROOT_PATH}/emscan-deps") + +# Capture the Emscripten version to EMSCRIPTEN_VERSION variable. +if (NOT EMSCRIPTEN_VERSION) + execute_process(COMMAND "${CMAKE_C_COMPILER}" "-v" RESULT_VARIABLE _cmake_compiler_result ERROR_VARIABLE _cmake_compiler_output OUTPUT_QUIET) + if (NOT _cmake_compiler_result EQUAL 0) + message(FATAL_ERROR "Failed to fetch Emscripten version information with command \"'${CMAKE_C_COMPILER}' -v\"!\n" + "Process returned with error code ${_cmake_compiler_result}.\n" + "Output:\n${_cmake_compiler_output}") + endif() + string(REGEX MATCH "emcc \\(.*\\) ([0-9\\.]+)" _dummy_unused "${_cmake_compiler_output}") + if (NOT CMAKE_MATCH_1) + message(FATAL_ERROR "Failed to regex parse Emscripten compiler version from version string: ${_cmake_compiler_output}") + endif() + + set(EMSCRIPTEN_VERSION "${CMAKE_MATCH_1}") +endif() + +execute_process(COMMAND "${EMSCRIPTEN_ROOT_PATH}/em-config${EMCC_SUFFIX}" "CACHE" + RESULT_VARIABLE _emcache_result + OUTPUT_VARIABLE _emcache_output + OUTPUT_STRIP_TRAILING_WHITESPACE) +if (NOT _emcache_result EQUAL 0) + message(FATAL_ERROR "Failed to find emscripten cache directory with command \"'${EMSCRIPTEN_ROOT_PATH}/em-config${EMCC_SUFFIX}' CACHE\"! Process returned with error code ${_emcache_result}.") +endif() +file(TO_CMAKE_PATH "${_emcache_output}" _emcache_output) +set(EMSCRIPTEN_SYSROOT "${_emcache_output}/sysroot") + +# Allow skipping of CMake compiler autodetection, since this is quite slow with +# Emscripten. Pass -DEMSCRIPTEN_FORCE_COMPILERS=ON to enable +option(EMSCRIPTEN_FORCE_COMPILERS "Force C/C++ compiler" OFF) +if (EMSCRIPTEN_FORCE_COMPILERS) + # Detect version of the 'emcc' executable. Note that for CMake, we tell it the + # version of the Clang compiler and not the version of Emscripten, because + # CMake understands Clang better. + # Toolchain script is interpreted multiple times, so don't rerun the check if + # already done before. + if (NOT CMAKE_C_COMPILER_VERSION) + execute_process(COMMAND "${CMAKE_C_COMPILER}" "-v" RESULT_VARIABLE _cmake_compiler_result ERROR_VARIABLE _cmake_compiler_output OUTPUT_QUIET) + if (NOT _cmake_compiler_result EQUAL 0) + message(FATAL_ERROR "Failed to fetch compiler version information with command \"'${CMAKE_C_COMPILER}' -v\"! Process returned with error code ${_cmake_compiler_result}.") + endif() + if (NOT "${_cmake_compiler_output}" MATCHES "[Ee]mscripten") + message(FATAL_ERROR "System LLVM compiler cannot be used to build with Emscripten! Check Emscripten's LLVM toolchain location in .emscripten configuration file, and make sure to point CMAKE_C_COMPILER to where emcc is located. (was pointing to \"${CMAKE_C_COMPILER}\")") + endif() + string(REGEX MATCH "clang version ([0-9\\.]+)" _dummy_unused "${_cmake_compiler_output}") + if (NOT CMAKE_MATCH_1) + message(FATAL_ERROR "Failed to regex parse Clang compiler version from version string: ${_cmake_compiler_output}") + endif() + + set(CMAKE_C_COMPILER_VERSION "${CMAKE_MATCH_1}") + set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_MATCH_1}") + if (${CMAKE_C_COMPILER_VERSION} VERSION_LESS 3.9.0) + message(WARNING "CMAKE_C_COMPILER version looks too old. Was ${CMAKE_C_COMPILER_VERSION}, should be at least 3.9.0.") + endif() + endif() + + set(CMAKE_C_COMPILER_ID_RUN TRUE) + set(CMAKE_C_COMPILER_FORCED TRUE) + set(CMAKE_C_COMPILER_WORKS TRUE) + set(CMAKE_C_COMPILER_ID Clang) + set(CMAKE_C_COMPILER_FRONTEND_VARIANT GNU) + set(CMAKE_C_STANDARD_COMPUTED_DEFAULT 11) + + set(CMAKE_CXX_COMPILER_ID_RUN TRUE) + set(CMAKE_CXX_COMPILER_FORCED TRUE) + set(CMAKE_CXX_COMPILER_WORKS TRUE) + set(CMAKE_CXX_COMPILER_ID Clang) + set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT GNU) + set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT 98) + + set(CMAKE_C_PLATFORM_ID "emscripten") + set(CMAKE_CXX_PLATFORM_ID "emscripten") + + if (NOT DEFINED CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES) + set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "${EMSCRIPTEN_SYSROOT}/include") + endif() + if (NOT DEFINED CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) + set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "${EMSCRIPTEN_SYSROOT}/include;${EMSCRIPTEN_SYSROOT}/include/c++/v1") + endif() + + if ("${CMAKE_VERSION}" VERSION_LESS "3.8") + set(CMAKE_C_COMPILE_FEATURES "c_function_prototypes;c_restrict;c_variadic_macros;c_static_assert") + set(CMAKE_C90_COMPILE_FEATURES "c_function_prototypes") + set(CMAKE_C99_COMPILE_FEATURES "c_restrict;c_variadic_macros") + set(CMAKE_C11_COMPILE_FEATURES "c_static_assert") + + set(CMAKE_CXX_COMPILE_FEATURES "cxx_template_template_parameters;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") + set(CMAKE_CXX98_COMPILE_FEATURES "cxx_template_template_parameters") + set(CMAKE_CXX11_COMPILE_FEATURES "cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") + set(CMAKE_CXX14_COMPILE_FEATURES "cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") + else() # 3.8+ + set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") + set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") + set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") + + set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") + set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") + set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") + set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") + if ("${CMAKE_VERSION}" VERSION_LESS "3.12") # [3.8, 3.12) + set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") + set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17") + else() # 3.12+ + set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") + if ("${CMAKE_VERSION}" VERSION_LESS "3.20") # [3.12, 3.20) + set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") + set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") + else() # 3.20+ + set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + if ("${CMAKE_VERSION}" VERSION_LESS "3.25") + set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") + else() # 3.25+ + set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23;cxx_std_26") + endif() + if ("${CMAKE_VERSION}" VERSION_LESS "3.21") # 3.20 + set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") + else() # 3.21+ + set(CMAKE_C17_COMPILE_FEATURES "c_std_17") + set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") + endif() + endif() + endif() + endif() +endif() + +list(APPEND CMAKE_FIND_ROOT_PATH "${EMSCRIPTEN_SYSROOT}") +list(APPEND CMAKE_SYSTEM_PREFIX_PATH /) + +if (${CMAKE_C_FLAGS} MATCHES "MEMORY64") + set(CMAKE_LIBRARY_ARCHITECTURE "wasm64-emscripten") + set(CMAKE_SIZEOF_VOID_P 8) + set(CMAKE_C_SIZEOF_DATA_PTR 8) + set(CMAKE_CXX_SIZEOF_DATA_PTR 8) +else() + set(CMAKE_LIBRARY_ARCHITECTURE "wasm32-emscripten") + set(CMAKE_SIZEOF_VOID_P 4) + set(CMAKE_C_SIZEOF_DATA_PTR 4) + set(CMAKE_CXX_SIZEOF_DATA_PTR 4) +endif() + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${EMSCRIPTEN_SYSROOT}" CACHE PATH + "Install path prefix, prepended onto install directories." FORCE) +endif() + +# To find programs to execute during CMake run time with find_program(), e.g. +# 'git' or so, we allow looking into system paths. +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + +# Since Emscripten is a cross-compiler, we should never look at the +# system-provided directories like /usr/include and so on. Therefore only +# CMAKE_FIND_ROOT_PATH should be used as a find directory. See +# http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_FIND_ROOT_PATH_MODE_INCLUDE.html +if (NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +endif() +if (NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() +if (NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +endif() + +set(_em_pkgconfig_libdir "${EMSCRIPTEN_SYSROOT}/local/lib/pkgconfig" "${EMSCRIPTEN_SYSROOT}/lib/pkgconfig") +if("${CMAKE_VERSION}" VERSION_LESS "3.20") + file(TO_NATIVE_PATH "${_em_pkgconfig_libdir}" _em_pkgconfig_libdir) + if(CMAKE_HOST_UNIX) + string(REPLACE ";" ":" _em_pkgconfig_libdir "${_em_pkgconfig_libdir}") + string(REPLACE "\\ " " " _em_pkgconfig_libdir "${_em_pkgconfig_libdir}") + endif() +else() + cmake_path(CONVERT "${_em_pkgconfig_libdir}" TO_NATIVE_PATH_LIST _em_pkgconfig_libdir) +endif() +set(ENV{PKG_CONFIG_LIBDIR} "${_em_pkgconfig_libdir}") +unset(_em_pkgconfig_libdir) + +option(EMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES "If set, static library targets generate LLVM bitcode files (.bc). If disabled (default), UNIX ar archives (.a) are generated." OFF) +if (EMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES) + message(FATAL_ERROR "EMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES is not compatible with the llvm backend") +endif() + +set(CMAKE_EXECUTABLE_SUFFIX ".js") + +set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1) +set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1) +set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) +set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) +set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1) +set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1) + +set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@") +set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@") + +# Enable $ for CMake 3.24+ +set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "-Wl,--whole-archive" "" "-Wl,--no-whole-archive") +set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED True) + +# Set a global EMSCRIPTEN variable that can be used in client CMakeLists.txt to +# detect when building using Emscripten. +set(EMSCRIPTEN 1 CACHE INTERNAL "If true, we are targeting Emscripten output.") + +# Hardwire support for cmake-2.8/Modules/CMakeBackwardsCompatibilityC.cmake +# without having CMake to try complex things to autodetect these: +set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) +set(CMAKE_SIZEOF_CHAR 1) +set(CMAKE_SIZEOF_UNSIGNED_SHORT 2) +set(CMAKE_SIZEOF_SHORT 2) +set(CMAKE_SIZEOF_INT 4) +set(CMAKE_SIZEOF_UNSIGNED_LONG 4) +set(CMAKE_SIZEOF_UNSIGNED_INT 4) +set(CMAKE_SIZEOF_LONG 4) +set(CMAKE_SIZEOF_FLOAT 4) +set(CMAKE_SIZEOF_DOUBLE 8) +set(CMAKE_HAVE_LIMITS_H 1) +set(CMAKE_HAVE_UNISTD_H 1) +set(CMAKE_HAVE_PTHREAD_H 1) +set(CMAKE_HAVE_SYS_PRCTL_H 1) +set(CMAKE_WORDS_BIGENDIAN 0) +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_DL_LIBS) + +function(em_validate_asmjs_after_build target) + message(WARNING "em_validate_asmjs_after_build no longer exists") +endfunction() + +# Internal function: Do not call from user CMakeLists.txt files. Use one of +# em_link_js_library()/em_link_pre_js()/em_link_post_js() instead. +function(em_add_link_deps target flagname) + # User can input list of JS files either as a single list, or as variable + # arguments to this function, so iterate over varargs, and treat each item in + # varargs as a list itself, to support both syntax forms. + foreach(jsFileList ${ARGN}) + foreach(jsfile ${jsFileList}) + get_target_property(linkdeps ${target} LINK_DEPENDS) + if(linkdeps STREQUAL "linkdeps-NOTFOUND") + set(linkdeps "") + endif() + get_filename_component(jsfile_abs "${jsfile}" ABSOLUTE ) + set_target_properties(${target} PROPERTIES LINK_DEPENDS "${linkdeps};${jsfile_abs}") + target_link_libraries(${target} "${flagname} \"${jsfile_abs}\"") + endforeach() + endforeach() +endfunction() + +# This function links a (list of ) .js library file(s) to the given CMake project. +# Example: em_link_js_library(my_executable "lib1.js" "lib2.js") +# will result in emcc passing --js-library lib1.js --js-library lib2.js to +# the emscripten linker, as well as tracking the modification timestamp +# between the linked .js files and the main project, so that editing the .js +# file will cause the target project to be relinked. +function(em_link_js_library target) + em_add_link_deps(${target} "--js-library" ${ARGN}) +endfunction() + +# This function is identical to em_link_js_library(), except the .js files will +# be added with '--pre-js file.js' command line flag, which is generally used to +# add some preamble .js code to a generated output file. +function(em_link_pre_js target) + em_add_link_deps(${target} "--pre-js" ${ARGN}) +endfunction() + +# This function is identical to em_link_js_library(), except the .js files will +# be added with '--post-js file.js' command line flag, which is generally used +# to add some postamble .js code to a generated output file. +function(em_link_post_js target) + em_add_link_deps(${target} "--post-js" ${ARGN}) +endfunction() + +if (NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR) + find_program(NODE_JS_EXECUTABLE NAMES nodejs node) + if(NODE_JS_EXECUTABLE) + set(CMAKE_CROSSCOMPILING_EMULATOR "${NODE_JS_EXECUTABLE}" CACHE FILEPATH "Path to the emulator for the target system.") + endif() +endif() + +# No-op on CMAKE_CROSSCOMPILING_EMULATOR so older versions of cmake do not +# complain about unused CMake variable. +if (CMAKE_CROSSCOMPILING_EMULATOR) +endif() diff --git a/cmake/Toolchain-mingw32.cmake b/cmake/Toolchain-mingw32.cmake new file mode 100644 index 0000000..a8767fd --- /dev/null +++ b/cmake/Toolchain-mingw32.cmake @@ -0,0 +1,15 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(TRIPLE i686-w64-mingw32) + +set(CMAKE_C_COMPILER ${TRIPLE}-gcc) +set(CMAKE_CXX_COMPILER ${TRIPLE}-g++) +set(CMAKE_RC_COMPILER ${TRIPLE}-windres) + +set(CMAKE_FIND_ROOT_PATH /usr/${TRIPLE}) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(ENV{PKG_CONFIG_LIBDIR} /usr/${TRIPLE}/lib/pkgconfig) diff --git a/cmake/Toolchain-mingw64.cmake b/cmake/Toolchain-mingw64.cmake new file mode 100644 index 0000000..7f85f35 --- /dev/null +++ b/cmake/Toolchain-mingw64.cmake @@ -0,0 +1,15 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(TRIPLE x86_64-w64-mingw32) + +set(CMAKE_C_COMPILER ${TRIPLE}-gcc) +set(CMAKE_CXX_COMPILER ${TRIPLE}-g++) +set(CMAKE_RC_COMPILER ${TRIPLE}-windres) + +set(CMAKE_FIND_ROOT_PATH /usr/${TRIPLE}) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(ENV{PKG_CONFIG_LIBDIR} /usr/${TRIPLE}/lib/pkgconfig) diff --git a/cmake/c_flag_overrides.cmake b/cmake/c_flag_overrides.cmake new file mode 100644 index 0000000..7d33e9b --- /dev/null +++ b/cmake/c_flag_overrides.cmake @@ -0,0 +1,11 @@ +if(MSVC) + set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") + set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif() + +if(EMSCRIPTEN) + set(CMAKE_C_FLAGS_DEBUG_INIT "-g4") +endif() diff --git a/cmake/cxx_flag_overrides.cmake b/cmake/cxx_flag_overrides.cmake new file mode 100644 index 0000000..9c8d15f --- /dev/null +++ b/cmake/cxx_flag_overrides.cmake @@ -0,0 +1,10 @@ +if(MSVC) + set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") + set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") +endif() + +if(EMSCRIPTEN) + set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g4") +endif() diff --git a/developer_docs/IdLists_Entities_and_Remap.txt b/developer_docs/IdLists_Entities_and_Remap.txt new file mode 100644 index 0000000..5fe1791 --- /dev/null +++ b/developer_docs/IdLists_Entities_and_Remap.txt @@ -0,0 +1,49 @@ +Some notes about Entities, Entity IDs and the IdList structure +============================================================== +Sketch entities in SolveSpace are all of the same type without use of language +support for polymorphism. The entity class is defined in sketch.h. That class +contains an enum for each entity to define its type (line, arc, etc...) and some +other members that can be used to store different things depending on the entity +type. This means all entities are the same size, so some data may be reference +by pointers from the entity (font, extra points, etc...) + +Entities in a sketch are kept in a global array (IdList) referenced by a unique +Id (handle) and can be looked up by Id in log(n) time via binary search. In +order to use binary search the array must be kept in order sorted by Id. One +problem is that insertion takes O(n) time because half the list (on average) +must be shifted to make room for a new item. + +The IdList class is a template and is used for more than entities. + +EntityMap: +========== +Another important structure is the EntityMap and EntityKey defined in sketch.h +This is what allows SovleSpace to update groups when earlier groups in the +sketch are changed. If a rectangle is extruded to a box and items are +constrained to entities on that box, the user can go back to the sketch and +modify it. Entities can be added, modified an even deleted. So long as the +entities that are later used to build upon are kept the later extrude group will +pick up the changes from the 2D sketch and anything build on it will remain. + +The way this works is that each group has a member called remap, which is one of +these maps. This is where my understanding is fuzzy. At the end of Group.cpp is +a function called Group::CopyEntity() which is used to make new sketch entities +when a group is created. These are generally copies of entities in the previous +group, but there are exceptions. A point will be used to generate a line when +extruding a 2D sketch. A point will also be "copied" to a circle for a Lathe +group. For this reason, the entity key is derived by combining its previous key +with something often called the CopyNumber or just remap (unfortunate). + +When a group is regenerated (the first time, or after a previous one is +modified) entities are copied from the old group to the new one. For Step +Translating and Rotating there may be many copies, and the copy number is +literally N for the Nth copy except for the last one which gets an enum - it is +common to constrain the last item, so it gets a large unique number so that +constraints still refer to it if the number of copies changes. When an entity is +copied like this a new handle is created unless there is already an entity in +Remap that was created the same way. This is how constructions are preserved +across underlying changes. + +There are some hard limits used in the hash table for the remap mechanism which +limit the number of entities in a group (but not the global sketch). + diff --git a/developer_docs/Solver_Transforms.txt b/developer_docs/Solver_Transforms.txt new file mode 100644 index 0000000..98300f8 --- /dev/null +++ b/developer_docs/Solver_Transforms.txt @@ -0,0 +1,154 @@ + +CREATING NEW GROUPS in 3D +================================= + +New Transformed Entity Types: +----------------------------- +New construction tools may require new transformations of entities - Points, +Normals, and Faces. A number of "Types" exist to transform an entity to a new +location. The term "Type" refers to the type of transformation an entity was +created from, and should not be confused with the 3 kinds of Entity (there are +other entities but they rely on others of the 3 base types for position and +orientation information, so they don't directly transform). A list of +Types is at the top of the EntityBase class definition: + + enum class Type : uint32_t { + POINT_IN_3D = 2000, + POINT_IN_2D = 2001, + POINT_N_TRANS = 2010, + POINT_N_ROT_TRANS = 2011, + POINT_N_COPY = 2012, + POINT_N_ROT_AA = 2013, + POINT_N_ROT_AXIS_TRANS = 2014, + + NORMAL_IN_3D = 3000, + NORMAL_IN_2D = 3001, + NORMAL_N_COPY = 3010, + NORMAL_N_ROT = 3011, + NORMAL_N_ROT_AA = 3012, + + FACE_NORMAL_PT = 5000, + FACE_XPROD = 5001, + FACE_N_ROT_TRANS = 5002, + FACE_N_TRANS = 5003, + FACE_N_ROT_AA = 5004, + +Some of the point definitions with _N_ in the name are points defined by +N application of a transformation. The number of times a particular entity +is transformed is given in the member variable "timesApplied". The following +is a dectription of the various transformation Types. + +POINT_N_TRANS: Translates a point by a vector defined by param[0],param[1],param[2] + the vector is multiplied by timesApplied. + +POINT_N_ROT_TRANS: Rotates a point via quaternion param[3],param[4],param[5],param[6] + and then translates it by vector param[0],param[1],param[2] + +POINT_N_COPY: A non-transformed copy of a point - numeric copy? + +POINT_N_ROT_AA: A point rotated around point param[0],param[1],param[2] Where the + angle is given by param[3]*timesApplied (times 2?) and the axis + of rotation defined by param[4],param[5],param[6] + +POINT_N_ROT_AXIS_TRANS: Same as POINT_N_ROT_AA but after rotation, the point is + translated along the rotation axis by distance param[7]. + +NORMAL_N_COPY A non-transformed copy of a normal - numeric copy? + +NORMAL_N_ROT: A normal rotated by a quaternion defeined by param[0],param[1],param[2],param[3] + +NORMAL_N_ROT_AA A normal rotated by timesApplied*param[0] around the axis + specified by param[1],param[2],parma[3] + +FACE_N_ROT_TRANS A face rotated then translated. Rotation is defined by + quaternion param[3],param[4],param[5],param[6]. The translation + is defined by param[0],param[1],param[2]. + +FACE_N_TRANS: Translates a face by a vector defined by param[0],param[1],param[2] + faces are defined by a point and a normal, so this just moves the point. + +FACE_N_ROT_AA Face rotated about point param[0],param[1],param[2]. The axis + is param[4],param[5],param[6]. Angle is timesApplied*param[3]. + + +All entities are copied by the function Group::CopyEntity() which has a CopyAs +parameter to indicate which kind of copy is to be made. The mapping from CopyAs to +Entity Types can be found in that function. Most point types get copied the same +way depending on CopyAs. Several of the normals get copied to the same new +entity Type because they are unaffected by translation - you don't care if CopyAs +specified a translation with rotation or just a rotation, a normal is affected the +same in either case. The mapping from entity type to new entity type has to be +decoded from the cases and if-else logic in that function. + +It is important that a transformation be properly applied to all three of the +fundamental entities - points, normals, and surfaces. + +FUNCTIONS THAT MAY NEED TO BE EXTENDED when new entity types are defined: + +These functions have default cases, so they only need to be extended to return True: +EntityBase::IsPoint() +EntityBase::IsNormal() +EntityBAse::IsFace() + +For new normal transforms the following should be filled in: +Quaternion EntityBase::NormalGetNum() +void EntityBase::NormalForceTo(Quaternion q) +ExprQuaternion EntityBase::NormalGetExprs() + +For points: +Vector EntityBase::PointGetNum() +void EntityBase::PointForceTo(Vector p) +ExprVector EntityBase::PointGetExprs() + +For Faces: +ExprVector EntityBase::FaceGetNormalExprs() +Vector EntityBase::FaceGetNormalNum() +ExprVector EntityBase::FaceGetPointExprs() +Vector EntityBase::FaceGetPointNum() + +The basic model for these transformed entities is that the group containing them +will have parameters that define the transformed entity in terms of the one it +was copied from. For example, in PointGetNum() under the case POINT_N_TRANS we see: + + Vector trans = Vector::From(param[0], param[1], param[2]); + p = numPoint.Plus(trans.ScaledBy(timesApplied)); + break; + +This take the original "numPoint" and adds a vector created from 3 parameters and +multiplied by "timesApplied". This is used in the step-translating groups. It's also +used in extrude groups where there are constraints on the 3 parameters to keep the +vector perpendicular to the sketch it was extruded from. This function returns a +numerical version of the copied point, hence "GetNum" in the name. + +Another function PointGetExprs() returns the same coordinates of the point but +returns an expression vector. When the user applies a constraint to a point, this +function is called to get algebraic expressions for the point that are suitable for +use in the solver. Most points will not be constrained directly, so expressions +are not needed for them. It is also notable that the expressions are not part of +the entity itself. + +The ForceTo() functions are shortcuts for using the solver. They are passed the +desired location of a point (or orientation of a normal...) and have the opportunity +to back-calculate what the group parameters should be to place it there. This is +used for mouse dragging of copied entities. It is notable that the constraints will +still be applied afterward, but this is a good shortcut. + +When creating a new entity transformation, the first thing to do is define the +numerical copy (xxxGetNum). That should allow display. Dragging will not work +until ForceTo is implemented, and user constraints will not work until GetExprs() +is completed. Most of these functions have an assert that will fire if the required +new case is missing. This is may not be a complete list of everything you need to +make new entity transformations. + +One thing of note, parameters in both entities and groups are stored by their handle. +An entity can have up to 8 parameters to define how it is transformed from another +entity. By convention this array of parameter handles matches that of the group but +this is probably not strictly necessary. + +ADDING GROUP CONSTRAINTS: +The example above where a point is copied via POINT_N_TRANS for both EXTRUDE and +STEP TRANSLATING groups is a good example here. For the EXTRUDE case, two constraint +equations are added to keep the offset vector perpendicular to the sketch. These +equations are created in Group::GenerateEquations() and are nothing more than an +expression which is implicitly set equal to zero in the solver. + diff --git a/exposed/CDemo.c b/exposed/CDemo.c new file mode 100644 index 0000000..a5564b3 --- /dev/null +++ b/exposed/CDemo.c @@ -0,0 +1,302 @@ +/*----------------------------------------------------------------------------- + * Some sample code for slvs.dll. We draw some geometric entities, provide + * initial guesses for their positions, and then constrain them. The solver + * calculates their new positions, in order to satisfy the constraints. + * + * Copyright 2008-2013 Jonathan Westhues. + *---------------------------------------------------------------------------*/ +#ifdef WIN32 +# include +#endif +#include +#include +#include +#include + +#include + +static Slvs_System sys; + +static void *CheckMalloc(size_t n) +{ + void *r = malloc(n); + if(!r) { + printf("out of memory!\n"); + exit(-1); + } + return r; +} + +void ExampleStateful() +{ + Slvs_hGroup g = 1; + Slvs_Entity wp = Slvs_AddBase2D(g); + Slvs_Entity p1 = Slvs_AddPoint2D(g, 0.0, 10.0, wp); + Slvs_Entity p2 = Slvs_AddPoint2D(g, 5.0, 20.0, wp); + Slvs_AddLine2D(g, p1, p2, wp); + + // double w, vx, vy, vz; + // Slvs_MakeQuaternion(1, 0, 0, 0, 1, 0, &w, &vx, &vy, &vz); + // Slvs_Entity n = Slvs_AddNormal3D(g, w, vx, vy, vz); + // Slvs_Entity center = Slvs_AddPoint2D(g, 5.0, 5.0, wp); + // Slvs_Entity radius = Slvs_AddDistance(g, 50.0, wp); + // Slvs_Entity c1 = Slvs_AddCircle(g, n, center, radius, wp); + + Slvs_Vertical(g, p1, wp, p2); + Slvs_SolveResult res = Slvs_SolveSketch(g, NULL); + printf("res: %i\n", res.result); + printf("dof: %i\n", res.dof); + double p1x = Slvs_GetParamValue(p1.param[0]); + double p1y = Slvs_GetParamValue(p1.param[1]); + double p2x = Slvs_GetParamValue(p2.param[0]); + double p2y = Slvs_GetParamValue(p2.param[1]); + printf("p1x:%.3f\n", p1x); + printf("p1y:%.3f\n", p1y); + printf("p2x:%.3f\n", p2x); + printf("p2y:%.3f\n", p2y); +} + +/*----------------------------------------------------------------------------- + * An example of a constraint in 3d. We create a single group, with some + * entities and constraints. + *---------------------------------------------------------------------------*/ +void Example3d() +{ + /* This will contain a single group, which will arbitrarily number 1. */ + Slvs_hGroup g = 1; + + /* A point, initially at (x y z) = (10 10 10) */ + sys.param[sys.params++] = Slvs_MakeParam(1, g, 10.0); + sys.param[sys.params++] = Slvs_MakeParam(2, g, 10.0); + sys.param[sys.params++] = Slvs_MakeParam(3, g, 10.0); + sys.entity[sys.entities++] = Slvs_MakePoint3d(101, g, 1, 2, 3); + /* and a second point at (20 20 20) */ + sys.param[sys.params++] = Slvs_MakeParam(4, g, 20.0); + sys.param[sys.params++] = Slvs_MakeParam(5, g, 20.0); + sys.param[sys.params++] = Slvs_MakeParam(6, g, 20.0); + sys.entity[sys.entities++] = Slvs_MakePoint3d(102, g, 4, 5, 6); + /* and a line segment connecting them. */ + sys.entity[sys.entities++] = Slvs_MakeLineSegment(200, g, + SLVS_FREE_IN_3D, 101, 102); + + /* The distance between the points should be 30.0 units. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 1, g, + SLVS_C_PT_PT_DISTANCE, + SLVS_FREE_IN_3D, + 30.0, + 101, 102, 0, 0); + + /* Let's tell the solver to keep the second point as close to constant + * as possible, instead moving the first point. */ + sys.dragged[sys.ndragged++] = 4; + sys.dragged[sys.ndragged++] = 5; + sys.dragged[sys.ndragged++] = 6; + + /* Now that we have written our system, we solve. */ + Slvs_Solve(&sys, g); + + if(sys.result == SLVS_RESULT_OKAY) { + printf("okay; now at (%.3f %.3f %.3f)\n" + " (%.3f %.3f %.3f)\n", + sys.param[0].val, sys.param[1].val, sys.param[2].val, + sys.param[3].val, sys.param[4].val, sys.param[5].val); + printf("%d DOF\n", sys.dof); + } else { + printf("solve failed"); + } +} + +/*----------------------------------------------------------------------------- + * An example of a constraint in 2d. In our first group, we create a workplane + * along the reference frame's xy plane. In a second group, we create some + * entities in that group and dimension them. + *---------------------------------------------------------------------------*/ +void Example2d() +{ + Slvs_hGroup g; + double qw, qx, qy, qz; + + g = 1; + /* First, we create our workplane. Its origin corresponds to the origin + * of our base frame (x y z) = (0 0 0) */ + sys.param[sys.params++] = Slvs_MakeParam(1, g, 0.0); + sys.param[sys.params++] = Slvs_MakeParam(2, g, 0.0); + sys.param[sys.params++] = Slvs_MakeParam(3, g, 0.0); + sys.entity[sys.entities++] = Slvs_MakePoint3d(101, g, 1, 2, 3); + /* and it is parallel to the xy plane, so it has basis vectors (1 0 0) + * and (0 1 0). */ + Slvs_MakeQuaternion(1, 0, 0, + 0, 1, 0, &qw, &qx, &qy, &qz); + sys.param[sys.params++] = Slvs_MakeParam(4, g, qw); + sys.param[sys.params++] = Slvs_MakeParam(5, g, qx); + sys.param[sys.params++] = Slvs_MakeParam(6, g, qy); + sys.param[sys.params++] = Slvs_MakeParam(7, g, qz); + sys.entity[sys.entities++] = Slvs_MakeNormal3d(102, g, 4, 5, 6, 7); + + sys.entity[sys.entities++] = Slvs_MakeWorkplane(200, g, 101, 102); + + /* Now create a second group. We'll solve group 2, while leaving group 1 + * constant; so the workplane that we've created will be locked down, + * and the solver can't move it. */ + g = 2; + /* These points are represented by their coordinates (u v) within the + * workplane, so they need only two parameters each. */ + sys.param[sys.params++] = Slvs_MakeParam(11, g, 10.0); + sys.param[sys.params++] = Slvs_MakeParam(12, g, 20.0); + sys.entity[sys.entities++] = Slvs_MakePoint2d(301, g, 200, 11, 12); + + sys.param[sys.params++] = Slvs_MakeParam(13, g, 20.0); + sys.param[sys.params++] = Slvs_MakeParam(14, g, 10.0); + sys.entity[sys.entities++] = Slvs_MakePoint2d(302, g, 200, 13, 14); + + /* And we create a line segment with those endpoints. */ + sys.entity[sys.entities++] = Slvs_MakeLineSegment(400, g, + 200, 301, 302); + + /* Now three more points. */ + sys.param[sys.params++] = Slvs_MakeParam(15, g, 100.0); + sys.param[sys.params++] = Slvs_MakeParam(16, g, 120.0); + sys.entity[sys.entities++] = Slvs_MakePoint2d(303, g, 200, 15, 16); + + sys.param[sys.params++] = Slvs_MakeParam(17, g, 120.0); + sys.param[sys.params++] = Slvs_MakeParam(18, g, 110.0); + sys.entity[sys.entities++] = Slvs_MakePoint2d(304, g, 200, 17, 18); + + sys.param[sys.params++] = Slvs_MakeParam(19, g, 115.0); + sys.param[sys.params++] = Slvs_MakeParam(20, g, 115.0); + sys.entity[sys.entities++] = Slvs_MakePoint2d(305, g, 200, 19, 20); + + /* And arc, centered at point 303, starting at point 304, ending at + * point 305. */ + sys.entity[sys.entities++] = Slvs_MakeArcOfCircle(401, g, 200, 102, + 303, 304, 305); + + /* Now one more point, and a distance */ + sys.param[sys.params++] = Slvs_MakeParam(21, g, 200.0); + sys.param[sys.params++] = Slvs_MakeParam(22, g, 200.0); + sys.entity[sys.entities++] = Slvs_MakePoint2d(306, g, 200, 21, 22); + + sys.param[sys.params++] = Slvs_MakeParam(23, g, 30.0); + sys.entity[sys.entities++] = Slvs_MakeDistance(307, g, 200, 23); + + /* And a complete circle, centered at point 306 with radius equal to + * distance 307. The normal is 102, the same as our workplane. */ + sys.entity[sys.entities++] = Slvs_MakeCircle(402, g, 200, + 306, 102, 307); + + + /* The length of our line segment is 30.0 units. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 1, g, + SLVS_C_PT_PT_DISTANCE, + 200, + 30.0, + 301, 302, 0, 0); + + /* And the distance from our line segment to the origin is 10.0 units. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 2, g, + SLVS_C_PT_LINE_DISTANCE, + 200, + 10.0, + 101, 0, 400, 0); + /* And the line segment is vertical. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 3, g, + SLVS_C_VERTICAL, + 200, + 0.0, + 0, 0, 400, 0); + /* And the distance from one endpoint to the origin is 15.0 units. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 4, g, + SLVS_C_PT_PT_DISTANCE, + 200, + 15.0, + 301, 101, 0, 0); +#if 0 + /* And same for the other endpoint; so if you add this constraint then + * the sketch is overconstrained and will signal an error. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 5, g, + SLVS_C_PT_PT_DISTANCE, + 200, + 18.0, + 302, 101, 0, 0); +#endif /* 0 */ + + /* The arc and the circle have equal radius. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 6, g, + SLVS_C_EQUAL_RADIUS, + 200, + 0.0, + 0, 0, 401, 402); + /* The arc has radius 17.0 units. */ + sys.constraint[sys.constraints++] = Slvs_MakeConstraint( + 7, g, + SLVS_C_DIAMETER, + 200, + 17.0*2, + 0, 0, 401, 0); + + /* If the solver fails, then ask it to report which constraints caused + * the problem. */ + sys.calculateFaileds = 1; + + /* And solve. */ + Slvs_Solve(&sys, g); + + if(sys.result == SLVS_RESULT_OKAY) { + printf("solved okay\n"); + printf("line from (%.3f %.3f) to (%.3f %.3f)\n", + sys.param[7].val, sys.param[8].val, + sys.param[9].val, sys.param[10].val); + + printf("arc center (%.3f %.3f) start (%.3f %.3f) finish (%.3f %.3f)\n", + sys.param[11].val, sys.param[12].val, + sys.param[13].val, sys.param[14].val, + sys.param[15].val, sys.param[16].val); + + printf("circle center (%.3f %.3f) radius %.3f\n", + sys.param[17].val, sys.param[18].val, + sys.param[19].val); + printf("%d DOF\n", sys.dof); + } else { + int i; + printf("solve failed: problematic constraints are:"); + for(i = 0; i < sys.faileds; i++) { + printf(" %d", sys.failed[i]); + } + printf("\n"); + if(sys.result == SLVS_RESULT_INCONSISTENT) { + printf("system inconsistent\n"); + } else { + printf("system nonconvergent\n"); + } + } +} + +int main() +{ + ExampleStateful(); + + sys.param = CheckMalloc(50*sizeof(sys.param[0])); + sys.entity = CheckMalloc(50*sizeof(sys.entity[0])); + sys.constraint = CheckMalloc(50*sizeof(sys.constraint[0])); + sys.dragged = CheckMalloc(50*sizeof(sys.dragged[0])); + + sys.failed = CheckMalloc(50*sizeof(sys.failed[0])); + sys.faileds = 50; + + Example3d(); + sys.params = sys.constraints = sys.entities = sys.ndragged = 0; + for(;;) { + Example2d(); + sys.params = sys.constraints = sys.entities = sys.ndragged = 0; + break; + } + return 0; +} + diff --git a/exposed/CMakeLists.txt b/exposed/CMakeLists.txt new file mode 100644 index 0000000..f0bce91 --- /dev/null +++ b/exposed/CMakeLists.txt @@ -0,0 +1,12 @@ +add_executable(CDemo + CDemo.c) + +target_link_libraries(CDemo PRIVATE + slvs) + +if(EMSCRIPTEN) + target_link_options(CDemo PRIVATE + "SHELL:-s TOTAL_MEMORY=134217728") + set_target_properties(CDemo PROPERTIES + SUFFIX ".html") +endif() diff --git a/exposed/DOC.txt b/exposed/DOC.txt new file mode 100644 index 0000000..f64f3ac --- /dev/null +++ b/exposed/DOC.txt @@ -0,0 +1,467 @@ + +INTRODUCTION +============ + +A sketch in SolveSpace consists of three basic elements: parameters, +entities, and constraints. + +A parameter (Slvs_Param) is a single real number, represented internally +by a double-precision floating point variable. The parameters are unknown +variables that the solver modifies in order to satisfy the constraints. + +An entity (Slvs_Entity) is a geometric thing, like a point or a line +segment or a circle. Entities are defined in terms of parameters, +and in terms of other entities. For example, a point in three-space +is represented by three parameters, corresponding to its x, y, and z +coordinates in our base coordinate frame. A line segment is represented +by two point entities, corresponding to its endpoints. + +A constraint (Slvs_Constraint) is a geometric property of an entity, +or a relationship among multiple entities. For example, a point-point +distance constraint will set the distance between two point entities. + +Parameters, entities, and constraints are typically referenced by their +handles (Slvs_hParam, Slvs_hEntity, Slvs_hConstraint). These handles are +32-bit integer values starting from 1. The zero handle is reserved. Each +object has a unique handle within its type (but it's acceptable, for +example to have a constraint with an Slvs_hConstraint of 7, and also to +have an entity with an Slvs_hEntity of 7). The use of handles instead +of pointers helps to avoid memory corruption. + +Entities and constraints are assigned into groups. A group is a set of +entities and constraints that is solved simultaneously. In a parametric +CAD system, a single group would typically correspond to a single sketch. +Constraints within a group may refer to entities outside that group, +but only the entities within that group will be modified by the solver. + +Consider point A in group 1, and point B in group 2. We have a constraint +in group 2 that makes the points coincident. When we solve group 2, the +solver is allowed to move point B to place it on top of point A. It is +not allowed to move point A to put it on top of point B, because point +A is outside the group being solved. + +This corresponds to the typical structure of a parametric CAD system. In a +later sketch, we may constrain our entities against existing geometry from +earlier sketches. The constraints will move the entities in our current +sketch, but will not change the geometry from the earlier sketches. + +To use the solver, we first define a set of parameters, entities, and +constraints. We provide an initial guess for each parameter; this is +necessary to achieve convergence, and also determines which solution +gets chosen when (finitely many) multiple solutions exist. Typically, +these initial guesses are provided by the initial configuration in which +the user drew the entities before constraining them. + +We then run the solver for a given group. The entities within that group +are modified in an attempt to satisfy the constraints. + +After running the solver, there are three possible outcomes: + + * All constraints were satisfied to within our numerical + tolerance (i.e., success). The result is equal to SLVS_RESULT_OKAY, + and the parameters in param[] have been updated. + + * The solver can prove that two constraints are inconsistent (for + example, if a line with nonzero length is constrained both + horizontal and vertical). In that case, a list of inconsistent + constraints is generated in failed[]. + + * The solver cannot prove that two constraints are inconsistent, but + it cannot find a solution. In that case, the list of unsatisfied + constraints is generated in failed[]. + + +TYPES OF ENTITIES +================= + +SLVS_E_POINT_IN_3D + + A point in 3d. Defined by three parameters: + + param[0] the point's x coordinate + param[1] y + param[1] z + + +SLVS_E_POINT_IN_2D + + A point within a workplane. Defined by the workplane + + wrkpl + + and by two parameters + + param[0] the point's u coordinate + param[1] v + + within the coordinate system of the workplane. For example, if the + workplane is the zx plane, then u = z and v = x. If the workplane is + parallel to the zx plane, but translated so that the workplane's + origin is (3, 4, 5), then u = z - 5 and v = x - 3. + + +SLVS_E_NORMAL_IN_3D + + A normal. In SolveSpace, "normals" represent a 3x3 rotation matrix + from our base coordinate system to a new frame. Defined by the + unit quaternion + + param[0] w + param[1] x + param[2] y + param[3] z + + where the quaternion is given by w + x*i + y*j + z*k. + + It is useful to think of this quaternion as representing a plane + through the origin. This plane has three associated vectors: basis + vectors U, V that lie within the plane, and normal N that is + perpendicular to it. This means that + + [ U V N ]' + + defines a 3x3 rotation matrix. So U, V, and N all have unit length, + and are orthogonal so that + + U cross V = N + V cross N = U + N cross U = V + + Convenience functions (Slvs_Quaternion*) are provided to convert + between this representation as vectors U, V, N and the unit + quaternion. + + A unit quaternion has only 3 degrees of freedom, but is specified in + terms of 4 parameters. An extra constraint is therefore generated + implicitly, that + + w^2 + x^2 + y^2 + z^2 = 1 + + +SLVS_E_NORMAL_IN_2D + + A normal within a workplane. This is identical to the workplane's + normal, so it is simply defined by + + wrkpl + + This entity type is used, for example, to define a circle that lies + within a workplane. The circle's normal is the same as the workplane's + normal, so we can use an SLVS_E_NORMAL_IN_2D to copy the workplane's + normal. + + +SLVS_E_DISTANCE + + A distance. This entity is used to define the radius of a circle, by + a single parameter + + param[0] r + + +SLVS_E_WORKPLANE + + An oriented plane, somewhere in 3d. This entity therefore has 6 + degrees of freedom: three translational, and three rotational. It is + specified in terms of its origin + + point[0] origin + + and a normal + + normal + + The normal describes three vectors U, V, N, as discussed in the + documentation for SLVS_E_NORMAL_IN_3D. The plane is therefore given + by the equation + + p = origin + s*U + t*V + + for any scalar s and t. + + +SLVS_E_LINE_SEGMENT + + A line segment between two endpoints + + point[0] + point[1] + + +SLVS_E_CUBIC + + A nonrational cubic Bezier segment + + point[0] starting point P0 + point[1] control point P1 + point[2] control point P2 + point[3] ending point P3 + + The curve then has equation + + p(t) = P0*(1 - t)^3 + 3*P1*(1 - t)^2*t + 3*P2*(1 - t)*t^2 + P3*t^3 + + as t goes from 0 to 1. + + +SLVS_E_CIRCLE + + A complete circle. The circle lies within a plane with normal + + normal + + The circle is centered at + + point[0] + + The circle's radius is + + distance + + +SLVS_E_ARC_OF_CIRCLE + + An arc of a circle. An arc must always lie within a workplane; it + cannot be free in 3d. So it is specified with a workplane + + wrkpl + + It is then defined by three points + + point[0] center of the circle + point[1] beginning of the arc + point[2] end of the arc + + and its normal + + normal identical to the normal of the workplane + + The arc runs counter-clockwise from its beginning to its end (with + the workplane's normal pointing towards the viewer). If the beginning + and end of the arc are coincident, then the arc is considered to + represent a full circle. + + This representation has an extra degree of freedom. An extra + constraint is therefore generated implicitly, so that + + distance(center, beginning) = distance(center, end) + + +TYPES OF CONSTRAINTS +==================== + +Many constraints can apply either in 3d, or in a workplane. This is +determined by the wrkpl member of the constraint. If that member is set +to SLVS_FREE_IN_3D, then the constraint applies in 3d. If that member +is set equal to a workplane, the constraint applies projected into that +workplane. (For example, a constraint on the distance between two points +actually applies to the projected distance). + +Constraints that may be used in 3d or projected into a workplane are +marked with a single star (*). Constraints that must always be used with +a workplane are marked with a double star (**). Constraints that ignore +the wrkpl member are marked with no star. + +SLVS_C_PT_PT_DISTANCE* + + The distance between points ptA and ptB is equal to valA. This is an + unsigned distance, so valA must always be positive. + +SLVS_C_PROJ_PT_DISTANCE + + The distance between points ptA and ptB, as projected along the line + or normal entityA, is equal to valA. This is a signed distance. + +SLVS_C_POINTS_COINCIDENT* + + Points ptA and ptB are coincident (i.e., exactly on top of each + other). + +SLVS_C_PT_PLANE_DISTANCE + + The distance from point ptA to workplane entityA is equal to + valA. This is a signed distance; positive versus negative valA + correspond to a point that is above vs. below the plane. + +SLVS_C_PT_LINE_DISTANCE* + + The distance from point ptA to line segment entityA is equal to valA. + + If the constraint is projected, then valA is a signed distance; + positive versus negative valA correspond to a point that is above + vs. below the line. + + If the constraint applies in 3d, then valA must always be positive. + +SLVS_C_PT_IN_PLANE + + The point ptA lies in plane entityA. + +SLVS_C_PT_ON_LINE* + + The point ptA lies on the line entityA. + + Note that this constraint removes one degree of freedom when projected + in to the plane, but two degrees of freedom in 3d. + +SLVS_C_EQUAL_LENGTH_LINES* + + The lines entityA and entityB have equal length. + +SLVS_C_LENGTH_RATIO* + + The length of line entityA divided by the length of line entityB is + equal to valA. + +SLVS_C_LENGTH_DIFFERENCE* + + The lengths of line entityA and line entityB differ by valA. + +SLVS_C_EQ_LEN_PT_LINE_D* + + The length of the line entityA is equal to the distance from point + ptA to line entityB. + +SLVS_C_EQ_PT_LN_DISTANCES* + + The distance from the line entityA to the point ptA is equal to the + distance from the line entityB to the point ptB. + +SLVS_C_EQUAL_ANGLE* + + The angle between lines entityA and entityB is equal to the angle + between lines entityC and entityD. + + If other is true, then the angles are supplementary (i.e., theta1 = + 180 - theta2) instead of equal. + +SLVS_C_EQUAL_LINE_ARC_LEN* + + The length of the line entityA is equal to the length of the circular + arc entityB. + +SLVS_C_SYMMETRIC* + + The points ptA and ptB are symmetric about the plane entityA. This + means that they are on opposite sides of the plane and at equal + distances from the plane, and that the line connecting ptA and ptB + is normal to the plane. + +SLVS_C_SYMMETRIC_HORIZ +SLVS_C_SYMMETRIC_VERT** + + The points ptA and ptB are symmetric about the horizontal or vertical + axis of the specified workplane. + +SLVS_C_SYMMETRIC_LINE** + + The points ptA and ptB are symmetric about the line entityA. + +SLVS_C_AT_MIDPOINT* + + The point ptA lies at the midpoint of the line entityA. + +SLVS_C_HORIZONTAL +SLVS_C_VERTICAL** + + The line connecting points ptA and ptB is horizontal or vertical. Or, + the line segment entityA is horizontal or vertical. If points are + specified then the line segment should be left zero, and if a line + is specified then the points should be left zero. + +SLVS_C_DIAMETER + + The diameter of circle or arc entityA is equal to valA. + +SLVS_C_PT_ON_CIRCLE + + The point ptA lies on the right cylinder obtained by extruding circle + or arc entityA normal to its plane. + +SLVS_C_SAME_ORIENTATION + + The normals entityA and entityB describe identical rotations. This + constraint therefore restricts three degrees of freedom. + +SLVS_C_ANGLE* + + The angle between lines entityA and entityB is equal to valA, where + valA is specified in degrees. This constraint equation is written + in the form + + (A dot B)/(|A||B|) = cos(valA) + + where A and B are vectors in the directions of lines A and B. This + equation does not specify the angle unambiguously; for example, + note that valA = +/- 90 degrees will produce the same equation. + + If other is true, then the constraint is instead that + + (A dot B)/(|A||B|) = -cos(valA) + +SLVS_C_PERPENDICULAR* + + Identical to SLVS_C_ANGLE with valA = 90 degrees. + +SLVS_C_PARALLEL* + + Lines entityA and entityB are parallel. + + Note that this constraint removes one degree of freedom when projected + in to the plane, but two degrees of freedom in 3d. + +SLVS_C_ARC_LINE_TANGENT** + + The arc entityA is tangent to the line entityB. If other is false, + then the arc is tangent at its beginning (point[1]). If other is true, + then the arc is tangent at its end (point[2]). + +SLVS_C_CUBIC_LINE_TANGENT* + + The cubic entityA is tangent to the line entityB. The variable + other indicates: + + if false: the cubic is tangent at its beginning + if true: the cubic is tangent at its end + + The beginning of the cubic is point[0], and the end is point[3]. + +SLVS_C_CURVE_CURVE_TANGENT** + + The two entities entityA and entityB are tangent. These entities can + each be either an arc or a cubic, in any combination. The flags + other and other2 indicate which endpoint of the curve is tangent, + for entityA and entityB respectively: + + if false: the entity is tangent at its beginning + if true: the entity is tangent at its end + + For cubics, point[0] is the beginning, and point[3] is the end. For + arcs, point[1] is the beginning, and point[2] is the end. + +SLVS_C_EQUAL_RADIUS + + The circles or arcs entityA and entityB have equal radius. + +SLVS_C_WHERE_DRAGGED* + + The point ptA is locked at its initial numerical guess, and cannot + be moved. This constrains two degrees of freedom in a workplane, + and three in free space. It's therefore possible for this constraint + to overconstrain the sketch, for example if it's applied to a point + with one remaining degree of freedom. + + +USING THE SOLVER +================ + +The solver is provided as a DLL, and will be usable with most +Windows-based development tools. Examples are provided: + + in C/C++ - CDemo.c + + in VB.NET - VbDemo.vb + + +Copyright 2009-2013 Jonathan Westhues. + diff --git a/exposed/VbDemo.vb b/exposed/VbDemo.vb new file mode 100644 index 0000000..708de93 --- /dev/null +++ b/exposed/VbDemo.vb @@ -0,0 +1,1257 @@ +'----------------------------------------------------------------------------- +' Some sample code for slvs.dll. We draw some geometric entities, provide +' initial guesses for their positions, and then constrain them. The solver +' calculates their new positions, in order to satisfy the constraints. +' +' The library is distributed as a DLL, but the functions are designed to +' be usable from .net languages through a P/Invoke. This file contains an +' example of that process, and a wrapper class around those P/Invoke'd +' functions that you may wish to use a starting point in your own +' application. +' +' Copyright 2008-2013 Jonathan Westhues. +'----------------------------------------------------------------------------- + +Imports System.Runtime.InteropServices + +Module VbDemo + + ' Call our example functions, which set up some kind of sketch, solve + ' it, and then print the result. + Sub Main() + Console.WriteLine("EXAMPLE IN 3d (by objects):") + Example3dWithObjects() + Console.WriteLine("") + + Console.WriteLine("EXAMPLE IN 2d (by objects):") + Example2dWithObjects() + Console.WriteLine("") + + Console.WriteLine("EXAMPLE IN 3d (by handles):") + Example3dWithHandles() + Console.WriteLine("") + + Console.WriteLine("EXAMPLE IN 2d (by handles):") + Example2dWithHandles() + Console.WriteLine("") + End Sub + + + ''''''''''''''''''''''''''''''' + ' This is the simplest way to use the library. A set of wrapper + ' classes allow us to represent entities (e.g., lines and points) + ' as .net objects. So we create an Slvs object, which will contain + ' the entire sketch, with all the entities and constraints. + ' + ' We then create entity objects (for example, points and lines) + ' associated with that sketch, indicating the initial positions of + ' those entities and any hierarchical relationships among them (e.g., + ' defining a line entity in terms of endpoint entities). We also add + ' constraints associated with those entities. + ' + ' Finally, we solve, and print the new positions of the entities. If the + ' solution succeeded, then the entities will satisfy the constraints. If + ' not, then the solver will suggest problematic constraints that, if + ' removed, would render the sketch solvable. + + Sub Example3dWithObjects() + Dim g As UInteger + Dim slv As New Slvs + + ' This will contain a single group, which will arbitrarily number 1. + g = 1 + + Dim p1, p2 As Slvs.Point3d + ' A point, initially at (x y z) = (10 10 10) + p1 = slv.NewPoint3d(g, 10.0, 10.0, 10.0) + ' and a second point at (20 20 20) + p2 = slv.NewPoint3d(g, 20.0, 20.0, 20.0) + + Dim ln As Slvs.LineSegment + ' and a line segment connecting them. + ln = slv.NewLineSegment(g, slv.FreeIn3d(), p1, p2) + + ' The distance between the points should be 30.0 units. + slv.AddConstraint(1, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + slv.FreeIn3d(), 30.0, p1, p2, Nothing, Nothing) + + ' Let's tell the solver to keep the second point as close to constant + ' as possible, instead moving the first point. + slv.Solve(g, p2, True) + + If (slv.GetResult() = Slvs.SLVS_RESULT_OKAY) Then + ' We call the GetX(), GetY(), and GetZ() functions to see + ' where the solver moved our points to. + Console.WriteLine(String.Format( _ + "okay; now at ({0:F3}, {1:F3}, {2:F3})", _ + p1.GetX(), p1.GetY(), p1.GetZ())) + Console.WriteLine(String.Format( _ + " ({0:F3}, {1:F3}, {2:F3})", _ + p2.GetX(), p2.GetY(), p2.GetZ())) + Console.WriteLine(slv.GetDof().ToString() + " DOF") + Else + Console.WriteLine("solve failed") + End If + End Sub + + Sub Example2dWithObjects() + Dim g As UInteger + Dim slv As New Slvs + + g = 1 + + ' First, we create our workplane. Its origin corresponds to the origin + ' of our base frame (x y z) = (0 0 0) + Dim origin As Slvs.Point3d + origin = slv.NewPoint3d(g, 0.0, 0.0, 0.0) + ' and it is parallel to the xy plane, so it has basis vectors (1 0 0) + ' and (0 1 0). + Dim normal As Slvs.Normal3d + normal = slv.NewNormal3d(g, 1.0, 0.0, 0.0, _ + 0.0, 1.0, 0.0) + + Dim wrkpl As Slvs.Workplane + wrkpl = slv.NewWorkplane(g, origin, normal) + + ' Now create a second group. We'll solve group 2, while leaving group 1 + ' constant; so the workplane that we've created will be locked down, + ' and the solver can't move it. + g = 2 + ' These points are represented by their coordinates (u v) within the + ' workplane, so they need only two parameters each. + Dim pl1, pl2 As Slvs.Point2d + pl1 = slv.NewPoint2d(g, wrkpl, 10.0, 20.0) + pl2 = slv.NewPoint2d(g, wrkpl, 20.0, 10.0) + + ' And we create a line segment with those endpoints. + Dim ln As Slvs.LineSegment + ln = slv.NewLineSegment(g, wrkpl, pl1, pl2) + + ' Now three more points. + Dim pc, ps, pf As Slvs.Point2d + pc = slv.NewPoint2d(g, wrkpl, 100.0, 120.0) + ps = slv.NewPoint2d(g, wrkpl, 120.0, 110.0) + pf = slv.NewPoint2d(g, wrkpl, 115.0, 115.0) + + ' And arc, centered at point pc, starting at point ps, ending at + ' point pf. + Dim arc As Slvs.ArcOfCircle + arc = slv.NewArcOfCircle(g, wrkpl, normal, pc, ps, pf) + + ' Now one more point, and a distance + Dim pcc As Slvs.Point2d + pcc = slv.NewPoint2d(g, wrkpl, 200.0, 200.0) + Dim r As Slvs.Distance + r = slv.NewDistance(g, wrkpl, 30.0) + + ' And a complete circle, centered at point pcc with radius equal to + ' distance r. The normal is the same as for our workplane. + Dim circle As Slvs.Circle + circle = slv.NewCircle(g, wrkpl, pcc, normal, r) + + ' The length of our line segment is 30.0 units. + slv.AddConstraint(1, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + wrkpl, 30.0, pl1, pl2, Nothing, Nothing) + + ' And the distance from our line segment to the origin is 10.0 units. + slv.AddConstraint(2, g, Slvs.SLVS_C_PT_LINE_DISTANCE, _ + wrkpl, 10.0, origin, Nothing, ln, Nothing) + + ' And the line segment is vertical. + slv.AddConstraint(3, g, Slvs.SLVS_C_VERTICAL, _ + wrkpl, 0.0, Nothing, Nothing, ln, Nothing) + + ' And the distance from one endpoint to the origin is 15.0 units. + slv.AddConstraint(4, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + wrkpl, 15.0, pl1, origin, Nothing, Nothing) + + ' And same for the other endpoint; so if you add this constraint then + ' the sketch is overconstrained and will signal an error. + 'slv.AddConstraint(5, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + ' wrkpl, 18.0, pl2, origin, Nothing, Nothing) + + ' The arc and the circle have equal radius. + slv.AddConstraint(6, g, Slvs.SLVS_C_EQUAL_RADIUS, _ + wrkpl, 0.0, Nothing, Nothing, arc, circle) + + ' The arc has radius 17.0 units. + slv.AddConstraint(7, g, Slvs.SLVS_C_DIAMETER, _ + wrkpl, 2 * 17.0, Nothing, Nothing, arc, Nothing) + + ' If the solver fails, then ask it to report which constraints caused + ' the problem. + slv.Solve(g, True) + + If (slv.GetResult() = Slvs.SLVS_RESULT_OKAY) Then + Console.WriteLine("solved okay") + ' We call the GetU(), GetV(), and GetDistance() functions to + ' see where the solver moved our points and distances to. + Console.WriteLine(String.Format( _ + "line from ({0:F3} {1:F3}) to ({2:F3} {3:F3})", _ + pl1.GetU(), pl1.GetV(), _ + pl2.GetU(), pl2.GetV())) + Console.WriteLine(String.Format( _ + "arc center ({0:F3} {1:F3}) start ({2:F3} {3:F3}) " + _ + "finish ({4:F3} {5:F3})", _ + pc.GetU(), pc.GetV(), _ + ps.GetU(), ps.GetV(), _ + pf.GetU(), pf.GetV())) + Console.WriteLine(String.Format( _ + "circle center ({0:F3} {1:F3}) radius {2:F3}", _ + pcc.GetU(), pcc.GetV(), _ + r.GetDistance())) + + Console.WriteLine(slv.GetDof().ToString() + " DOF") + Else + Console.Write("solve failed; problematic constraints are:") + Dim t As UInteger + For Each t In slv.GetFaileds() + Console.Write(" " + t.ToString()) + Next + Console.WriteLine("") + If (slv.GetResult() = Slvs.SLVS_RESULT_INCONSISTENT) Then + Console.WriteLine("system inconsistent") + Else + Console.WriteLine("system nonconvergent") + End If + End If + + End Sub + + + ''''''''''''''''''''''''''''''' + ' This is a lower-level way to use the library. Internally, the library + ' represents parameters, entities, and constraints by integer handles. + ' Here, those handles are assigned manually, and not by the wrapper + ' classes. + + Sub Example3dWithHandles() + Dim g As UInteger + Dim slv As New Slvs + + ' This will contain a single group, which will arbitrarily number 1. + g = 1 + + ' A point, initially at (x y z) = (10 10 10) + slv.AddParam(1, g, 10.0) + slv.AddParam(2, g, 10.0) + slv.AddParam(3, g, 10.0) + slv.AddPoint3d(101, g, 1, 2, 3) + + ' and a second point at (20 20 20) + slv.AddParam(4, g, 20.0) + slv.AddParam(5, g, 20.0) + slv.AddParam(6, g, 20.0) + slv.AddPoint3d(102, g, 4, 5, 6) + + ' and a line segment connecting them. + slv.AddLineSegment(200, g, Slvs.SLVS_FREE_IN_3D, 101, 102) + + ' The distance between the points should be 30.0 units. + slv.AddConstraint(1, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + Slvs.SLVS_FREE_IN_3D, 30.0, 101, 102, 0, 0) + + ' Let's tell the solver to keep the second point as close to constant + ' as possible, instead moving the first point. That's parameters + ' 4, 5, and 6. + slv.Solve(g, 4, 5, 6, 0, True) + + If (slv.GetResult() = Slvs.SLVS_RESULT_OKAY) Then + ' Note that we are referring to the parameters by their handles, + ' and not by their index in the list. This is a difference from + ' the C example. + Console.WriteLine(String.Format( _ + "okay; now at ({0:F3}, {1:F3}, {2:F3})", _ + slv.GetParamByHandle(1), slv.GetParamByHandle(2), _ + slv.GetParamByHandle(3))) + Console.WriteLine(String.Format( _ + " ({0:F3}, {1:F3}, {2:F3})", _ + slv.GetParamByHandle(4), slv.GetParamByHandle(5), _ + slv.GetParamByHandle(6))) + Console.WriteLine(slv.GetDof().ToString() + " DOF") + Else + Console.WriteLine("solve failed") + End If + End Sub + + + Sub Example2dWithHandles() + Dim g As UInteger + Dim qw, qx, qy, qz As Double + + Dim slv As New Slvs + + g = 1 + + ' First, we create our workplane. Its origin corresponds to the origin + ' of our base frame (x y z) = (0 0 0) + slv.AddParam(1, g, 0.0) + slv.AddParam(2, g, 0.0) + slv.AddParam(3, g, 0.0) + slv.AddPoint3d(101, g, 1, 2, 3) + ' and it is parallel to the xy plane, so it has basis vectors (1 0 0) + ' and (0 1 0). + slv.MakeQuaternion(1, 0, 0, _ + 0, 1, 0, qw, qx, qy, qz) + slv.AddParam(4, g, qw) + slv.AddParam(5, g, qx) + slv.AddParam(6, g, qy) + slv.AddParam(7, g, qz) + slv.AddNormal3d(102, g, 4, 5, 6, 7) + + slv.AddWorkplane(200, g, 101, 102) + + ' Now create a second group. We'll solve group 2, while leaving group 1 + ' constant; so the workplane that we've created will be locked down, + ' and the solver can't move it. + g = 2 + ' These points are represented by their coordinates (u v) within the + ' workplane, so they need only two parameters each. + slv.AddParam(11, g, 10.0) + slv.AddParam(12, g, 20.0) + slv.AddPoint2d(301, g, 200, 11, 12) + + slv.AddParam(13, g, 20.0) + slv.AddParam(14, g, 10.0) + slv.AddPoint2d(302, g, 200, 13, 14) + + ' And we create a line segment with those endpoints. + slv.AddLineSegment(400, g, 200, 301, 302) + + ' Now three more points. + slv.AddParam(15, g, 100.0) + slv.AddParam(16, g, 120.0) + slv.AddPoint2d(303, g, 200, 15, 16) + + slv.AddParam(17, g, 120.0) + slv.AddParam(18, g, 110.0) + slv.AddPoint2d(304, g, 200, 17, 18) + + slv.AddParam(19, g, 115.0) + slv.AddParam(20, g, 115.0) + slv.AddPoint2d(305, g, 200, 19, 20) + + ' And arc, centered at point 303, starting at point 304, ending at + ' point 305. + slv.AddArcOfCircle(401, g, 200, 102, 303, 304, 305) + + ' Now one more point, and a distance + slv.AddParam(21, g, 200.0) + slv.AddParam(22, g, 200.0) + slv.AddPoint2d(306, g, 200, 21, 22) + + slv.AddParam(23, g, 30.0) + slv.AddDistance(307, g, 200, 23) + + ' And a complete circle, centered at point 306 with radius equal to + ' distance 307. The normal is 102, the same as our workplane. + slv.AddCircle(402, g, 200, 306, 102, 307) + + ' The length of our line segment is 30.0 units. + slv.AddConstraint(1, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + 200, 30.0, 301, 302, 0, 0) + + ' And the distance from our line segment to the origin is 10.0 units. + slv.AddConstraint(2, g, Slvs.SLVS_C_PT_LINE_DISTANCE, _ + 200, 10.0, 101, 0, 400, 0) + + ' And the line segment is vertical. + slv.AddConstraint(3, g, Slvs.SLVS_C_VERTICAL, _ + 200, 0.0, 0, 0, 400, 0) + + ' And the distance from one endpoint to the origin is 15.0 units. + slv.AddConstraint(4, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + 200, 15.0, 301, 101, 0, 0) + + ' And same for the other endpoint; so if you add this constraint then + ' the sketch is overconstrained and will signal an error. + 'slv.AddConstraint(5, g, Slvs.SLVS_C_PT_PT_DISTANCE, _ + ' 200, 18.0, 302, 101, 0, 0) + + ' The arc and the circle have equal radius. + slv.AddConstraint(6, g, Slvs.SLVS_C_EQUAL_RADIUS, _ + 200, 0.0, 0, 0, 401, 402) + + ' The arc has radius 17.0 units. + slv.AddConstraint(7, g, Slvs.SLVS_C_DIAMETER, _ + 200, 2 * 17.0, 0, 0, 401, 0) + + ' If the solver fails, then ask it to report which constraints caused + ' the problem. + slv.Solve(g, 0, 0, 0, 0, True) + + If (slv.GetResult() = Slvs.SLVS_RESULT_OKAY) Then + Console.WriteLine("solved okay") + ' Note that we are referring to the parameters by their handles, + ' and not by their index in the list. This is a difference from + ' the C example. + Console.WriteLine(String.Format( _ + "line from ({0:F3} {1:F3}) to ({2:F3} {3:F3})", _ + slv.GetParamByHandle(11), slv.GetParamByHandle(12), _ + slv.GetParamByHandle(13), slv.GetParamByHandle(14))) + Console.WriteLine(String.Format( _ + "arc center ({0:F3} {1:F3}) start ({2:F3} {3:F3}) " + _ + "finish ({4:F3} {5:F3})", _ + slv.GetParamByHandle(15), slv.GetParamByHandle(16), _ + slv.GetParamByHandle(17), slv.GetParamByHandle(18), _ + slv.GetParamByHandle(19), slv.GetParamByHandle(20))) + Console.WriteLine(String.Format( _ + "circle center ({0:F3} {1:F3}) radius {2:F3}", _ + slv.GetParamByHandle(21), slv.GetParamByHandle(22), _ + slv.GetParamByHandle(23))) + + Console.WriteLine(slv.GetDof().ToString() + " DOF") + Else + Console.Write("solve failed; problematic constraints are:") + Dim t As UInteger + For Each t In slv.GetFaileds() + Console.Write(" " + t.ToString()) + Next + Console.WriteLine("") + If (slv.GetResult() = Slvs.SLVS_RESULT_INCONSISTENT) Then + Console.WriteLine("system inconsistent") + Else + Console.WriteLine("system nonconvergent") + End If + End If + + End Sub + + + ''''''''''''''''''''''''''''''' + ' The interface to the library, and the wrapper functions around + ' that interface, follow. + + ' These are the core functions imported from the DLL + _ + Public Sub Slvs_Solve(ByVal sys As IntPtr, ByVal hg As UInteger) + End Sub + + _ + Public Sub Slvs_MakeQuaternion( + ByVal ux As Double, ByVal uy As Double, ByVal uz As Double, + ByVal vx As Double, ByVal vy As Double, ByVal vz As Double, + ByRef qw As Double, ByRef qx As Double, ByRef qy As Double, + ByRef qz As Double) + End Sub + + ' And this is a thin wrapper around those functions, which provides + ' convenience functions similar to those provided in slvs.h for the C API. + Public Class Slvs + + Public Structure Slvs_Param + Public h As UInteger + Public group As UInteger + Public val As Double + End Structure + + Public Const SLVS_FREE_IN_3D As Integer = 0 + + Public Const SLVS_E_POINT_IN_3D As Integer = 50000 + Public Const SLVS_E_POINT_IN_2D As Integer = 50001 + Public Const SLVS_E_NORMAL_IN_3D As Integer = 60000 + Public Const SLVS_E_NORMAL_IN_2D As Integer = 60001 + Public Const SLVS_E_DISTANCE As Integer = 70000 + Public Const SLVS_E_WORKPLANE As Integer = 80000 + Public Const SLVS_E_LINE_SEGMENT As Integer = 80001 + Public Const SLVS_E_CUBIC As Integer = 80002 + Public Const SLVS_E_CIRCLE As Integer = 80003 + Public Const SLVS_E_ARC_OF_CIRCLE As Integer = 80004 + + Public Structure Slvs_Entity + Public h As UInteger + Public group As UInteger + + Public type As Integer + + Public wrkpl As UInteger + Public point0 As UInteger + Public point1 As UInteger + Public point2 As UInteger + Public point3 As UInteger + Public normal As UInteger + Public distance As UInteger + + Public param0 As UInteger + Public param1 As UInteger + Public param2 As UInteger + Public param3 As UInteger + End Structure + + Public Const SLVS_C_POINTS_COINCIDENT As Integer = 100000 + Public Const SLVS_C_PT_PT_DISTANCE As Integer = 100001 + Public Const SLVS_C_PT_PLANE_DISTANCE As Integer = 100002 + Public Const SLVS_C_PT_LINE_DISTANCE As Integer = 100003 + Public Const SLVS_C_PT_FACE_DISTANCE As Integer = 100004 + Public Const SLVS_C_PT_IN_PLANE As Integer = 100005 + Public Const SLVS_C_PT_ON_LINE As Integer = 100006 + Public Const SLVS_C_PT_ON_FACE As Integer = 100007 + Public Const SLVS_C_EQUAL_LENGTH_LINES As Integer = 100008 + Public Const SLVS_C_LENGTH_RATIO As Integer = 100009 + Public Const SLVS_C_EQ_LEN_PT_LINE_D As Integer = 100010 + Public Const SLVS_C_EQ_PT_LN_DISTANCES As Integer = 100011 + Public Const SLVS_C_EQUAL_ANGLE As Integer = 100012 + Public Const SLVS_C_EQUAL_LINE_ARC_LEN As Integer = 100013 + Public Const SLVS_C_SYMMETRIC As Integer = 100014 + Public Const SLVS_C_SYMMETRIC_HORIZ As Integer = 100015 + Public Const SLVS_C_SYMMETRIC_VERT As Integer = 100016 + Public Const SLVS_C_SYMMETRIC_LINE As Integer = 100017 + Public Const SLVS_C_AT_MIDPOINT As Integer = 100018 + Public Const SLVS_C_HORIZONTAL As Integer = 100019 + Public Const SLVS_C_VERTICAL As Integer = 100020 + Public Const SLVS_C_DIAMETER As Integer = 100021 + Public Const SLVS_C_PT_ON_CIRCLE As Integer = 100022 + Public Const SLVS_C_SAME_ORIENTATION As Integer = 100023 + Public Const SLVS_C_ANGLE As Integer = 100024 + Public Const SLVS_C_PARALLEL As Integer = 100025 + Public Const SLVS_C_PERPENDICULAR As Integer = 100026 + Public Const SLVS_C_ARC_LINE_TANGENT As Integer = 100027 + Public Const SLVS_C_CUBIC_LINE_TANGENT As Integer = 100028 + Public Const SLVS_C_EQUAL_RADIUS As Integer = 100029 + Public Const SLVS_C_PROJ_PT_DISTANCE As Integer = 100030 + Public Const SLVS_C_WHERE_DRAGGED As Integer = 100031 + Public Const SLVS_C_CURVE_CURVE_TANGENT As Integer = 100032 + Public Const SLVS_C_LENGTH_DIFFERENCE As Integer = 100033 + + Public Structure Slvs_Constraint + Public h As UInteger + Public group As UInteger + + Public type As Integer + + Public wrkpl As UInteger + + Public valA As Double + Public ptA As UInteger + Public ptB As UInteger + Public entityA As UInteger + Public entityB As UInteger + Public entityC As UInteger + Public entityD As UInteger + + Public other As Integer + Public other2 As Integer + End Structure + + Public Const SLVS_RESULT_OKAY As Integer = 0 + Public Const SLVS_RESULT_INCONSISTENT As Integer = 1 + Public Const SLVS_RESULT_DIDNT_CONVERGE As Integer = 2 + Public Const SLVS_RESULT_TOO_MANY_UNKNOWNS As Integer = 3 + + Public Structure Slvs_System + Public param As IntPtr + Public params As Integer + Public entity As IntPtr + Public entities As Integer + Public constraint As IntPtr + Public constraints As Integer + + Public dragged As IntPtr + Public ndragged As Integer + + Public calculatedFaileds As Integer + + Public failed As IntPtr + Public faileds As Integer + + Public dof As Integer + + Public result As Integer + End Structure + + Dim Params As New List(Of Slvs_Param) + Dim Entities As New List(Of Slvs_Entity) + Dim Constraints As New List(Of Slvs_Constraint) + + Dim Faileds As New List(Of UInteger) + + Dim Result As Integer + Dim Dof As Integer + + ' Return the value of a parameter, by its handle. This function + ' may be used, for example, to obtain the new values of the + ' parameters after a call to Solve(). + Public Function GetParamByHandle(ByVal h As UInteger) As Double + Dim t As Slvs_Param + For Each t In Params + If (t.h = h) Then + Return t.val + End If + Next + Throw New Exception("Invalid parameter handle.") + End Function + + ' Return the value of a parameter, by its index in the list (where + ' that index is determined by the order in which the parameters + ' were inserted with AddParam(), not by its handle). + Public Function GetParamByIndex(ByVal i As Integer) As Double + Return Params(i).val + End Function + + ' Get the result after a call to Solve(). This may be + ' SLVS_RESULT_OKAY - it worked + ' SLVS_RESULT_INCONSISTENT - failed, inconsistent + ' SLVS_RESULT_DIDNT_CONVERGE - consistent, but still failed + ' SLVS_RESULT_TOO_MANY_UNKNOWNS - too many parameters in one group + Public Function GetResult() As Integer + Return Result + End Function + + ' After a call to Solve(), this returns the number of unconstrained + ' degrees of freedom for the sketch. + Public Function GetDof() As Integer + Return Dof + End Function + + ' After a failing call to Solve(), this returns the list of + ' constraints, identified by their handle, that would fix the + ' system if they were deleted. This list will be populated only + ' if calculateFaileds is True in the Solve() call. + Public Function GetFaileds() As List(Of UInteger) + Return Faileds + End Function + + ' Clear our lists of entities, constraints, and parameters. + Public Sub ResetAll() + Params.Clear() + Entities.Clear() + Constraints.Clear() + End Sub + + + ''''''''''''''''''''''''''''''' + ' These functions are broadly similar to the Slvs_Make... + ' functions in slvs.h. See the file DOC.txt accompanying the + ' library for details. + + Public Sub AddParam(ByVal h As UInteger, ByVal group As UInteger, + ByVal val As Double) + Dim p As Slvs_Param + p.h = h + p.group = group + p.val = val + Params.Add(p) + End Sub + + Public Sub AddPoint2d(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger, + ByVal u As UInteger, ByVal v As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_POINT_IN_2D + e.wrkpl = wrkpl + e.param0 = u + e.param1 = v + Entities.Add(e) + End Sub + + Public Sub AddPoint3d(ByVal h As UInteger, ByVal group As UInteger, + ByVal x As UInteger, ByVal y As UInteger, ByVal z As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_POINT_IN_3D + e.wrkpl = SLVS_FREE_IN_3D + e.param0 = x + e.param1 = y + e.param2 = z + Entities.Add(e) + End Sub + + Public Sub AddNormal3d(ByVal h As UInteger, ByVal group As UInteger, + ByVal qw As UInteger, ByVal qx As UInteger, + ByVal qy As UInteger, ByVal qz As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_NORMAL_IN_3D + e.wrkpl = SLVS_FREE_IN_3D + e.param0 = qw + e.param1 = qx + e.param2 = qy + e.param3 = qz + Entities.Add(e) + End Sub + + Public Sub AddNormal2d(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_NORMAL_IN_2D + e.wrkpl = wrkpl + Entities.Add(e) + End Sub + + Public Sub AddDistance(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger, ByVal d As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_DISTANCE + e.wrkpl = wrkpl + e.param0 = d + Entities.Add(e) + End Sub + + Public Sub AddLineSegment(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger, + ByVal ptA As UInteger, ByVal ptB As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_LINE_SEGMENT + e.wrkpl = wrkpl + e.point0 = ptA + e.point1 = ptB + Entities.Add(e) + End Sub + + Public Sub AddCubic(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger, + ByVal pt0 As UInteger, ByVal pt1 As UInteger, + ByVal pt2 As UInteger, ByVal pt3 As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_CUBIC + e.wrkpl = wrkpl + e.point0 = pt0 + e.point1 = pt1 + e.point2 = pt2 + e.point3 = pt3 + Entities.Add(e) + End Sub + + Public Sub AddArcOfCircle(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger, + ByVal normal As UInteger, + ByVal center As UInteger, + ByVal pstart As UInteger, + ByVal pend As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_ARC_OF_CIRCLE + e.wrkpl = wrkpl + e.normal = normal + e.point0 = center + e.point1 = pstart + e.point2 = pend + Entities.Add(e) + End Sub + + Public Sub AddCircle(ByVal h As UInteger, ByVal group As UInteger, + ByVal wrkpl As UInteger, + ByVal center As UInteger, ByVal normal As UInteger, + ByVal radius As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_CIRCLE + e.wrkpl = wrkpl + e.point0 = center + e.normal = normal + e.distance = radius + Entities.Add(e) + End Sub + + Public Sub AddWorkplane(ByVal h As UInteger, ByVal group As UInteger, + ByVal origin As UInteger, + ByVal normal As UInteger) + Dim e As Slvs_Entity + e.h = h + e.group = group + e.type = SLVS_E_WORKPLANE + e.wrkpl = SLVS_FREE_IN_3D + e.point0 = origin + e.normal = normal + Entities.Add(e) + End Sub + + Public Sub AddConstraint(ByVal h As UInteger, + ByVal group As UInteger, + ByVal type As Integer, + ByVal wrkpl As UInteger, + ByVal valA As Double, + ByVal ptA As UInteger, + ByVal ptB As UInteger, + ByVal entityA As UInteger, + ByVal entityB As UInteger) + Dim c As Slvs_Constraint + c.h = h + c.group = group + c.type = type + c.wrkpl = wrkpl + c.valA = valA + c.ptA = ptA + c.ptB = ptB + c.entityA = entityA + c.entityB = entityB + Constraints.Add(c) + End Sub + + ' Solve the system. The geometry of the system must already have + ' been specified through the Add...() calls. The result of the + ' solution process may be obtained by calling GetResult(), + ' GetFaileds(), GetDof(), and GetParamByXXX(). + ' + ' The parameters dragged (indicated by their handles) will be held + ' as close as possible to their original positions, even if this + ' results in large moves for other parameters. This feature may be + ' useful if, for example, the user is dragging the point whose + ' location is defined by those parameters. + Public Sub Solve(ByVal group As UInteger, + ByVal dragged As List(Of UInteger), + ByVal calculateFaileds As Boolean) + Dim i As Integer + + Dim pp, p(Params.Count()) As Slvs_Param + i = 0 + For Each pp In Params + p(i) = pp + i += 1 + Next + + Dim ee, e(Entities.Count()) As Slvs_Entity + i = 0 + For Each ee In Entities + e(i) = ee + i += 1 + Next + + Dim cc, c(Constraints.Count()) As Slvs_Constraint + i = 0 + For Each cc In Constraints + c(i) = cc + i += 1 + Next + Dim f(Constraints.Count()) As UInteger + + Dim dd, d(dragged.Count()) As UInteger + i = 0 + For Each cc In dragged + d(i) = dd + i += 1 + Next + + Dim sys As Slvs_System + + Dim pgc, egc, cgc, dgc As GCHandle + pgc = GCHandle.Alloc(p, GCHandleType.Pinned) + sys.param = pgc.AddrOfPinnedObject() + sys.params = Params.Count() + egc = GCHandle.Alloc(e, GCHandleType.Pinned) + sys.entity = egc.AddrOfPinnedObject() + sys.entities = Entities.Count() + cgc = GCHandle.Alloc(c, GCHandleType.Pinned) + sys.constraint = cgc.AddrOfPinnedObject() + sys.constraints = Constraints.Count() + dgc = GCHandle.Alloc(d, GCHandleType.Pinned) + sys.dragged = dgc.AddrOfPinnedObject() + sys.ndragged = dragged.Count() + + Dim fgc As GCHandle + fgc = GCHandle.Alloc(f, GCHandleType.Pinned) + If calculateFaileds Then + sys.calculatedFaileds = 1 + Else + sys.calculatedFaileds = 0 + End If + sys.faileds = Constraints.Count() + sys.failed = fgc.AddrOfPinnedObject() + + Dim sysgc As GCHandle + sysgc = GCHandle.Alloc(sys, GCHandleType.Pinned) + + Slvs_Solve(sysgc.AddrOfPinnedObject(), group) + + sys = sysgc.Target + + For i = 0 To Params.Count() - 1 + Params(i) = p(i) + Next + + Faileds.Clear() + For i = 0 To sys.faileds - 1 + Faileds.Add(f(i)) + Next + + sysgc.Free() + fgc.Free() + pgc.Free() + egc.Free() + cgc.Free() + dgc.Free() + + Result = sys.result + Dof = sys.dof + End Sub + ' A simpler version of the function, if the parameters being dragged + ' correspond to a single point. + Public Sub Solve(ByVal group As UInteger, ByVal dragged As Point, + ByVal calculatedFaileds As Boolean) + If TypeOf dragged Is Point2d Then + Dim p As Point2d + p = dragged + Dim d As New List(Of UInteger)({ p.up.H, p.vp.H }) + Solve(group, d, calculatedFaileds) + ElseIf TypeOf dragged Is Point3d Then + Dim p As Point3d + p = dragged + Dim d As New List(Of UInteger)({ p.xp.H, p.yp.H, p.zp.H }) + Solve(group, d, calculatedFaileds) + Else + Throw New Exception("Can't get dragged params for point.") + End If + End Sub + ' or if it's a single distance (e.g., the radius of a circle) + Public Sub Solve(ByVal group As UInteger, ByVal dragged As Distance, + ByVal calculatedFaileds As Boolean) + Dim d As New List(Of UInteger)({ dragged.dp.H }) + Solve(group, d, calculatedFaileds) + End Sub + ' or if it's nothing. + Public Sub Solve(ByVal group As UInteger, + ByVal calculateFaileds As Boolean) + Solve(group, 0, 0, 0, 0, calculateFaileds) + End Sub + + ' Return the quaternion in (qw, qx, qy, qz) that represents a + ' rotation from the base frame to a coordinate system with the + ' specified basis vectors u and v. For example, u = (0, 1, 0) + ' and v = (0, 0, 1) specifies the yz plane, such that a point with + ' (u, v) = (7, 12) has (x, y, z) = (0, 7, 12). + Public Sub MakeQuaternion( + ByVal ux As Double, ByVal uy As Double, ByVal uz As Double, + ByVal vx As Double, ByVal vy As Double, ByVal vz As Double, + ByRef qw As Double, ByRef qx As Double, ByRef qy As Double, + ByRef qz As Double) + Slvs_MakeQuaternion(ux, uy, uz, _ + vx, vy, vz, _ + qw, qx, qy, qz) + End Sub + + Public Function FreeIn3d() + Return New Workplane(Me) + End Function + + + ''''''''''''''''''''''''''''''' + ' Functions to create the object-oriented wrappers defined below. + + Public Function NewParam(ByVal group As UInteger, ByVal val As Double) + Return New Param(Me, group, val) + End Function + Public Function NewPoint2d(ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal u As Double, ByVal v As Double) + Return New Point2d(Me, group, wrkpl, u, v) + End Function + Public Function NewPoint2d(ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal u As Param, ByVal v As Param) + Return New Point2d(Me, group, wrkpl, u, v) + End Function + Public Function NewPoint3d(ByVal group As UInteger, + ByVal x As Double, + ByVal y As Double, + ByVal z As Double) + Return New Point3d(Me, group, x, y, z) + End Function + Public Function NewPoint3d(ByVal group As UInteger, + ByVal x As Param, + ByVal y As Param, + ByVal z As Param) + Return New Point3d(Me, group, x, y, z) + End Function + Public Function NewNormal3d(ByVal group As UInteger, + ByVal ux As Double, ByVal uy As Double, ByVal uz As Double, + ByVal vx As Double, ByVal vy As Double, ByVal vz As Double) + Return New Normal3d(Me, group, ux, uy, uz, vx, vy, vz) + End Function + Public Function NewNormal3d(ByVal group As UInteger, + ByVal qw As Param, ByVal qx As Param, + ByVal qy As Param, ByVal qz As Param) + Return New Normal3d(Me, group, qw, qx, qy, qz) + End Function + Public Function NewNormal2d(ByVal group As UInteger, + ByVal wrkpl As Workplane) + Return New Normal2d(Me, group, wrkpl) + End Function + Public Function NewDistance(ByVal group As UInteger, + ByVal wrkpl As Workplane, ByVal d As Double) + Return New Distance(Me, group, wrkpl, d) + End Function + Public Function NewDistance(ByVal group As UInteger, + ByVal wrkpl As Workplane, ByVal d As Param) + Return New Distance(Me, group, wrkpl, d) + End Function + Public Function NewLineSegment(ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal ptA As Point, ByVal ptB As Point) + Return New LineSegment(Me, group, wrkpl, ptA, ptB) + End Function + Public Function NewArcOfCircle(ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal normal As Normal, + ByVal center As Point, + ByVal pstart As Point, + ByVal pend As Point) + Return New ArcOfCircle(Me, group, wrkpl, normal, _ + center, pstart, pend) + End Function + Public Function NewCircle(ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal center As Point, + ByVal normal As Normal, + ByVal radius As Distance) + Return New Circle(Me, group, wrkpl, center, normal, radius) + End Function + Public Function NewWorkplane(ByVal group As UInteger, + ByVal origin As Point, + ByVal normal As Normal) + Return New Workplane(Me, group, origin, normal) + End Function + + Public Sub AddConstraint(ByVal H As UInteger, ByVal group As UInteger, + ByVal type As Integer, + ByVal wrkpl As Workplane, + ByVal valA As Double, + ByVal ptA As Point, ByVal ptB As Point, + ByVal entityA As Entity, + ByVal entityB As Entity) + AddConstraint(H, group, type, _ + If(IsNothing(wrkpl), 0, wrkpl.H), _ + valA, _ + If(IsNothing(ptA), 0, ptA.H), _ + If(IsNothing(ptB), 0, ptB.H), _ + If(IsNothing(entityA), 0, entityA.H), _ + If(IsNothing(entityB), 0, entityB.H)) + End Sub + + + ''''''''''''''''''''''''''''''' + ' The object-oriented wrapper classes themselves, to allow the + ' representation of entities and constraints as .net objects, not + ' integer handles. These don't do any work themselves, beyond + ' allocating and storing a unique integer handle. + ' + ' These functions will assign parameters and entities with + ' consecutive handles starting from 1. If they are intermixed + ' with parameters and entities with user-specified handles, then + ' those handles must be chosen not to conflict, e.g. starting + ' from 100 000 or another large number. + + Public Class Param + Public Slv As Slvs + Public H As UInteger + + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal val As Double) + Slv = s + H = Slv.Params.Count() + 1 + Slv.AddParam(H, group, val) + End Sub + End Class + + Public MustInherit Class Entity + Public Slv As Slvs + Public H As UInteger + + Public Sub New(ByVal s As Slvs) + Slv = s + H = Slv.Entities.Count() + 1 + End Sub + End Class + + Public MustInherit Class Point + Inherits Entity + Public Sub New(ByVal s As Slvs) + MyBase.New(s) + End Sub + End Class + + Public MustInherit Class Normal + Inherits Entity + Public Sub New(ByVal s As Slvs) + MyBase.New(s) + End Sub + End Class + + Public Class Point2d + Inherits Point + Public up, vp As Param + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal u As Double, ByVal v As Double) + MyBase.New(s) + up = New Param(Slv, group, u) + vp = New Param(Slv, group, v) + Slv.AddPoint2d(H, group, wrkpl.H, up.H, vp.H) + End Sub + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal u As Param, ByVal v As Param) + MyBase.New(s) + Slv.AddPoint2d(H, group, wrkpl.H, u.H, v.H) + up = u + vp = v + End Sub + Function GetU() + Return Slv.GetParamByHandle(up.H) + End Function + Function GetV() + Return Slv.GetParamByHandle(vp.H) + End Function + End Class + + Public Class Point3d + Inherits Point + Public xp, yp, zp As Param + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal x As Double, ByVal y As Double, + ByVal z As Double) + MyBase.New(s) + xp = New Param(Slv, group, x) + yp = New Param(Slv, group, y) + zp = New Param(Slv, group, z) + Slv.AddPoint3d(H, group, xp.H, yp.H, zp.H) + End Sub + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal x As Param, ByVal y As Param, ByVal z As Param) + MyBase.New(s) + Slv.AddPoint3d(H, group, x.H, y.H, z.H) + xp = x + yp = y + zp = z + End Sub + Function GetX() + Return Slv.GetParamByHandle(xp.H) + End Function + Function GetY() + Return Slv.GetParamByHandle(yp.H) + End Function + Function GetZ() + Return Slv.GetParamByHandle(zp.H) + End Function + End Class + + Public Class Normal3d + Inherits Normal + Dim qwp, qxp, qyp, qzp As Param + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal ux As Double, ByVal uy As Double, ByVal uz As Double, + ByVal vx As Double, ByVal vy As Double, ByVal vz As Double) + MyBase.New(s) + Dim qw, qx, qy, qz As Double + Slv.MakeQuaternion(ux, uy, uz, vx, vy, vz, qw, qx, qy, qz) + qwp = New Param(Slv, group, qw) + qxp = New Param(Slv, group, qx) + qyp = New Param(Slv, group, qy) + qzp = New Param(Slv, group, qz) + Slv.AddNormal3d(H, group, qwp.H, qxp.H, qyp.H, qzp.H) + End Sub + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal qw As Param, ByVal qx As Param, + ByVal qy As Param, ByVal qz As Param) + MyBase.New(s) + Slv.AddNormal3d(H, group, qw.H, qx.H, qy.H, qz.H) + qwp = qw + qxp = qx + qyp = qy + qzp = qz + End Sub + End Class + + Public Class Normal2d + Inherits Normal + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane) + MyBase.New(s) + Slv.AddNormal2d(H, group, wrkpl.H) + End Sub + End Class + + Public Class Distance + Inherits Entity + Public dp As Param + + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, ByVal d As Double) + MyBase.New(s) + dp = New Param(Slv, group, d) + Slv.AddDistance(H, group, wrkpl.H, dp.H) + End Sub + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, ByVal d As Param) + MyBase.New(s) + Slv.AddDistance(H, group, wrkpl.H, d.H) + dp = d + End Sub + Function GetDistance() As Double + Return Slv.GetParamByHandle(dp.H) + End Function + End Class + + Public Class LineSegment + Inherits Entity + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal ptA As Point, ByVal ptB As Point) + MyBase.New(s) + Slv.AddLineSegment(H, group, wrkpl.H, ptA.H, ptB.H) + End Sub + End Class + + Public Class Cubic + Inherits Entity + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, + ByVal pt0 As Point, ByVal pt1 As Point, + ByVal pt2 As Point, ByVal pt3 As Point) + MyBase.New(s) + Slv.AddCubic(H, group, wrkpl.H, pt0.H, pt1.H, pt2.H, pt3.H) + End Sub + End Class + + Public Class ArcOfCircle + Inherits Entity + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, ByVal normal As Normal, + ByVal center As Point, ByVal pstart As Point, + ByVal pend As Point) + MyBase.New(s) + Slv.AddArcOfCircle(H, group, wrkpl.H, normal.H, _ + center.H, pstart.H, pend.H) + End Sub + End Class + + Public Class Circle + Inherits Entity + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal wrkpl As Workplane, ByVal center As Point, + ByVal normal As Normal, ByVal radius As Distance) + MyBase.New(s) + Slv.AddCircle(H, group, wrkpl.H, center.H, normal.H, radius.H) + End Sub + End Class + + Public Class Workplane + Inherits Entity + Public Sub New(ByVal s As Slvs) + MyBase.New(s) + H = SLVS_FREE_IN_3D + End Sub + Public Sub New(ByVal s As Slvs, ByVal group As UInteger, + ByVal origin As Point, ByVal normal As Normal) + MyBase.New(s) + Slv.AddWorkplane(H, group, origin.H, normal.H) + End Sub + End Class + + End Class + +End Module + diff --git a/include/slvs.h b/include/slvs.h new file mode 100644 index 0000000..0e58d46 --- /dev/null +++ b/include/slvs.h @@ -0,0 +1,516 @@ +/*----------------------------------------------------------------------------- + * Data structures and prototypes for slvs.lib, a geometric constraint solver. + * + * See the comments in this file, the accompanying sample code that uses + * this library, and the accompanying documentation (DOC.txt). + * + * Copyright 2009-2013 Jonathan Westhues. + *---------------------------------------------------------------------------*/ + +#ifndef __SLVS_H +#define __SLVS_H + +#if defined(WIN32) && !defined(STATIC_LIB) +# ifdef EXPORT_DLL +# define DLL __declspec( dllexport ) +# else +# define DLL __declspec( dllimport ) +# endif +#else +# define DLL +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +typedef unsigned __int32 uint32_t; +#else +#include +#endif +#include +#include + +typedef uint32_t Slvs_hParam; +typedef uint32_t Slvs_hEntity; +typedef uint32_t Slvs_hConstraint; +typedef uint32_t Slvs_hGroup; + +/* To obtain the 3d (not projected into a workplane) of a constraint or + * an entity, specify this instead of the workplane. */ +#define SLVS_FREE_IN_3D 0 + +typedef struct { + Slvs_hParam h; + Slvs_hGroup group; + double val; +} Slvs_Param; + + +#define SLVS_E_POINT_IN_3D 50000 +#define SLVS_E_POINT_IN_2D 50001 + +#define SLVS_E_NORMAL_IN_3D 60000 +#define SLVS_E_NORMAL_IN_2D 60001 + +#define SLVS_E_DISTANCE 70000 + +/* The special point, normal, and distance types used for parametric step + * and repeat, extrude, and assembly are currently not exposed. Please + * contact us if you are interested in using these. */ + +#define SLVS_E_WORKPLANE 80000 +#define SLVS_E_LINE_SEGMENT 80001 +#define SLVS_E_CUBIC 80002 +#define SLVS_E_CIRCLE 80003 +#define SLVS_E_ARC_OF_CIRCLE 80004 + +typedef struct { + Slvs_hEntity h; + Slvs_hGroup group; + + int type; + + Slvs_hEntity wrkpl; + Slvs_hEntity point[4]; + Slvs_hEntity normal; + Slvs_hEntity distance; + + Slvs_hParam param[4]; +} Slvs_Entity; + +#define SLVS_C_POINTS_COINCIDENT 100000 +#define SLVS_C_PT_PT_DISTANCE 100001 +#define SLVS_C_PT_PLANE_DISTANCE 100002 +#define SLVS_C_PT_LINE_DISTANCE 100003 +#define SLVS_C_PT_FACE_DISTANCE 100004 +#define SLVS_C_PT_IN_PLANE 100005 +#define SLVS_C_PT_ON_LINE 100006 +#define SLVS_C_PT_ON_FACE 100007 +#define SLVS_C_EQUAL_LENGTH_LINES 100008 +#define SLVS_C_LENGTH_RATIO 100009 +#define SLVS_C_EQ_LEN_PT_LINE_D 100010 +#define SLVS_C_EQ_PT_LN_DISTANCES 100011 +#define SLVS_C_EQUAL_ANGLE 100012 +#define SLVS_C_EQUAL_LINE_ARC_LEN 100013 +#define SLVS_C_SYMMETRIC 100014 +#define SLVS_C_SYMMETRIC_HORIZ 100015 +#define SLVS_C_SYMMETRIC_VERT 100016 +#define SLVS_C_SYMMETRIC_LINE 100017 +#define SLVS_C_AT_MIDPOINT 100018 +#define SLVS_C_HORIZONTAL 100019 +#define SLVS_C_VERTICAL 100020 +#define SLVS_C_DIAMETER 100021 +#define SLVS_C_PT_ON_CIRCLE 100022 +#define SLVS_C_SAME_ORIENTATION 100023 +#define SLVS_C_ANGLE 100024 +#define SLVS_C_PARALLEL 100025 +#define SLVS_C_PERPENDICULAR 100026 +#define SLVS_C_ARC_LINE_TANGENT 100027 +#define SLVS_C_CUBIC_LINE_TANGENT 100028 +#define SLVS_C_EQUAL_RADIUS 100029 +#define SLVS_C_PROJ_PT_DISTANCE 100030 +#define SLVS_C_WHERE_DRAGGED 100031 +#define SLVS_C_CURVE_CURVE_TANGENT 100032 +#define SLVS_C_LENGTH_DIFFERENCE 100033 +#define SLVS_C_ARC_ARC_LEN_RATIO 100034 +#define SLVS_C_ARC_LINE_LEN_RATIO 100035 +#define SLVS_C_ARC_ARC_DIFFERENCE 100036 +#define SLVS_C_ARC_LINE_DIFFERENCE 100037 + +typedef struct { + Slvs_hConstraint h; + Slvs_hGroup group; + + int type; + + Slvs_hEntity wrkpl; + + double valA; + Slvs_hEntity ptA; + Slvs_hEntity ptB; + Slvs_hEntity entityA; + Slvs_hEntity entityB; + Slvs_hEntity entityC; + Slvs_hEntity entityD; + + int other; + int other2; +} Slvs_Constraint; + + +typedef struct { + /*** INPUT VARIABLES + * + * Here, we specify the parameters and their initial values, the entities, + * and the constraints. For example, param[] points to the array of + * parameters, which has length params, so that the last valid element + * is param[params-1]. + * + * param[] is actually an in/out variable; if the solver is successful, + * then the new values (that satisfy the constraints) are written to it. */ + Slvs_Param *param; + int params; + Slvs_Entity *entity; + int entities; + Slvs_Constraint *constraint; + int constraints; + + /* If a parameter corresponds to a point (distance, normal, etc.) being + * dragged, then specify it here. This will cause the solver to favor + * that parameter, and attempt to change it as little as possible even + * if that requires it to change other parameters more. + * + * Note that the solver is still allowed to change the values of parameters + * specified this way. If you want to lock a dragged entity in place, use + * a SLVS_C_WHERE_DRAGGED constraint (though note that it can overconstrain + * e.g in case the dragged entity has less than two degrees of freedom in + * a workplane or less than 3 degrees of freedom in free space). */ + Slvs_hParam *dragged; + int ndragged; + + + /* If the solver fails, then it can determine which constraints are + * causing the problem. But this is a relatively slow process (for + * a system with n constraints, about n times as long as just solving). + * If calculateFaileds is true, then the solver will do so, otherwise + * not. */ + int calculateFaileds; + + /*** OUTPUT VARIABLES + * + * If the solver fails, then it can report which constraints are causing + * the problem. The caller should allocate the array failed[], and pass + * its size in faileds. + * + * The solver will set faileds equal to the number of problematic + * constraints, and write their Slvs_hConstraints into failed[]. To + * ensure that there is sufficient space for any possible set of + * failing constraints, faileds should be greater than or equal to + * constraints. */ + Slvs_hConstraint *failed; + int faileds; + + /* The solver indicates the number of unconstrained degrees of freedom. */ + int dof; + + /* The solver indicates whether the solution succeeded. */ +#define SLVS_RESULT_OKAY 0 +#define SLVS_RESULT_INCONSISTENT 1 +#define SLVS_RESULT_DIDNT_CONVERGE 2 +#define SLVS_RESULT_TOO_MANY_UNKNOWNS 3 +#define SLVS_RESULT_REDUNDANT_OKAY 4 + int result; +} Slvs_System; + +typedef struct { + int result; + int dof; + int nbad; +} Slvs_SolveResult; + +/* Our base coordinate system has basis vectors + * (1, 0, 0) (0, 1, 0) (0, 0, 1) + * A unit quaternion defines a rotation to a new coordinate system with + * basis vectors + * U V N + * which these functions compute from the quaternion. */ +DLL void Slvs_QuaternionU(double qw, double qx, double qy, double qz, + double *x, double *y, double *z); +DLL void Slvs_QuaternionV(double qw, double qx, double qy, double qz, + double *x, double *y, double *z); +DLL void Slvs_QuaternionN(double qw, double qx, double qy, double qz, + double *x, double *y, double *z); + +/* Similarly, compute a unit quaternion in terms of two basis vectors. */ +DLL void Slvs_MakeQuaternion(double ux, double uy, double uz, + double vx, double vy, double vz, + double *qw, double *qx, double *qy, double *qz); + + +/*------------------------------------- + * These are just convenience functions, to save you the trouble of filling + * out the structures by hand. The code is included in the header file to + * let the compiler inline them if possible. */ + +static inline Slvs_Param Slvs_MakeParam(Slvs_hParam h, Slvs_hGroup group, double val) +{ + Slvs_Param r; + r.h = h; + r.group = group; + r.val = val; + return r; +} +static inline Slvs_Entity Slvs_MakePoint2d(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl, + Slvs_hParam u, Slvs_hParam v) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_POINT_IN_2D; + r.wrkpl = wrkpl; + r.param[0] = u; + r.param[1] = v; + return r; +} +static inline Slvs_Entity Slvs_MakePoint3d(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hParam x, Slvs_hParam y, Slvs_hParam z) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_POINT_IN_3D; + r.wrkpl = SLVS_FREE_IN_3D; + r.param[0] = x; + r.param[1] = y; + r.param[2] = z; + return r; +} +static inline Slvs_Entity Slvs_MakeNormal3d(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hParam qw, Slvs_hParam qx, + Slvs_hParam qy, Slvs_hParam qz) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_NORMAL_IN_3D; + r.wrkpl = SLVS_FREE_IN_3D; + r.param[0] = qw; + r.param[1] = qx; + r.param[2] = qy; + r.param[3] = qz; + return r; +} +static inline Slvs_Entity Slvs_MakeNormal2d(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_NORMAL_IN_2D; + r.wrkpl = wrkpl; + return r; +} +static inline Slvs_Entity Slvs_MakeDistance(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl, Slvs_hParam d) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_DISTANCE; + r.wrkpl = wrkpl; + r.param[0] = d; + return r; +} +static inline Slvs_Entity Slvs_MakeLineSegment(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl, + Slvs_hEntity ptA, Slvs_hEntity ptB) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_LINE_SEGMENT; + r.wrkpl = wrkpl; + r.point[0] = ptA; + r.point[1] = ptB; + return r; +} +static inline Slvs_Entity Slvs_MakeCubic(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl, + Slvs_hEntity pt0, Slvs_hEntity pt1, + Slvs_hEntity pt2, Slvs_hEntity pt3) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_CUBIC; + r.wrkpl = wrkpl; + r.point[0] = pt0; + r.point[1] = pt1; + r.point[2] = pt2; + r.point[3] = pt3; + return r; +} +static inline Slvs_Entity Slvs_MakeArcOfCircle(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl, + Slvs_hEntity normal, + Slvs_hEntity center, + Slvs_hEntity start, Slvs_hEntity end) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_ARC_OF_CIRCLE; + r.wrkpl = wrkpl; + r.normal = normal; + r.point[0] = center; + r.point[1] = start; + r.point[2] = end; + return r; +} +static inline Slvs_Entity Slvs_MakeCircle(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity wrkpl, + Slvs_hEntity center, + Slvs_hEntity normal, Slvs_hEntity radius) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_CIRCLE; + r.wrkpl = wrkpl; + r.point[0] = center; + r.normal = normal; + r.distance = radius; + return r; +} +static inline Slvs_Entity Slvs_MakeWorkplane(Slvs_hEntity h, Slvs_hGroup group, + Slvs_hEntity origin, Slvs_hEntity normal) +{ + Slvs_Entity r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = SLVS_E_WORKPLANE; + r.wrkpl = SLVS_FREE_IN_3D; + r.point[0] = origin; + r.normal = normal; + return r; +} + +static inline Slvs_Constraint Slvs_MakeConstraint(Slvs_hConstraint h, + Slvs_hGroup group, + int type, + Slvs_hEntity wrkpl, + double valA, + Slvs_hEntity ptA, + Slvs_hEntity ptB, + Slvs_hEntity entityA, + Slvs_hEntity entityB) +{ + Slvs_Constraint r; + memset(&r, 0, sizeof(r)); + r.h = h; + r.group = group; + r.type = type; + r.wrkpl = wrkpl; + r.valA = valA; + r.ptA = ptA; + r.ptB = ptB; + r.entityA = entityA; + r.entityB = entityB; + return r; +} + +DLL bool Slvs_IsFreeIn3D(Slvs_Entity e); +DLL bool Slvs_Is3D(Slvs_Entity e); +DLL bool Slvs_IsNone(Slvs_Entity e); +DLL bool Slvs_IsPoint2D(Slvs_Entity e); +DLL bool Slvs_IsPoint3D(Slvs_Entity e); +DLL bool Slvs_IsNormal2D(Slvs_Entity e); +DLL bool Slvs_IsNormal3D(Slvs_Entity e); +DLL bool Slvs_IsLine(Slvs_Entity e); +DLL bool Slvs_IsLine2D(Slvs_Entity e); +DLL bool Slvs_IsLine3D(Slvs_Entity e); +DLL bool Slvs_IsCubic(Slvs_Entity e); +DLL bool Slvs_IsArc(Slvs_Entity e); +DLL bool Slvs_IsWorkplane(Slvs_Entity e); +DLL bool Slvs_IsDistance(Slvs_Entity e); +DLL bool Slvs_IsPoint(Slvs_Entity e); +DLL bool Slvs_IsCircle(Slvs_Entity e); + +static const Slvs_Entity SLVS_E_NONE = { 0 }; +static const Slvs_Entity SLVS_E_FREE_IN_3D = { 0 }; + +DLL Slvs_Entity Slvs_AddPoint2D(uint32_t grouph, double u, double v, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddPoint3D(uint32_t grouph, double x, double y, double z); +DLL Slvs_Entity Slvs_AddNormal2D(uint32_t grouph, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddNormal3D(uint32_t grouph, double qw, double qx, double qy, double qz); +DLL Slvs_Entity Slvs_AddDistance(uint32_t grouph, double value, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddLine2D(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddLine3D(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB); +DLL Slvs_Entity Slvs_AddCubic(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity ptC, Slvs_Entity ptD, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddArc(uint32_t grouph, Slvs_Entity normal, Slvs_Entity center, Slvs_Entity start, Slvs_Entity end, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddCircle(uint32_t grouph, Slvs_Entity normal, Slvs_Entity center, Slvs_Entity radius, Slvs_Entity workplane); +DLL Slvs_Entity Slvs_AddWorkplane(uint32_t grouph, Slvs_Entity origin, Slvs_Entity nm); +DLL Slvs_Entity Slvs_AddBase2D(uint32_t grouph); + + +DLL Slvs_Constraint Slvs_AddConstraint(uint32_t grouph, int type, Slvs_Entity workplane, double val, Slvs_Entity ptA, + Slvs_Entity ptB, Slvs_Entity entityA, + Slvs_Entity entityB, Slvs_Entity entityC, + Slvs_Entity entityD, int other, int other2); +DLL Slvs_Constraint Slvs_Coincident(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Distance(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Equal(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_EqualAngle(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, + Slvs_Entity entityD, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_EqualPointToLine(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity entityC, Slvs_Entity entityD, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Ratio(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Symmetric(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity entityC , + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_SymmetricH(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_SymmetricV(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Midpoint(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Horizontal(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity workplane, + Slvs_Entity entityB); +DLL Slvs_Constraint Slvs_Vertical(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity workplane, + Slvs_Entity entityB); +DLL Slvs_Constraint Slvs_Diameter(uint32_t grouph, Slvs_Entity entityA, double value); +DLL Slvs_Constraint Slvs_SameOrientation(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB); +DLL Slvs_Constraint Slvs_Angle(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, + Slvs_Entity workplane, + int inverse); +DLL Slvs_Constraint Slvs_Perpendicular(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity workplane, + int inverse); +DLL Slvs_Constraint Slvs_Parallel(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Tangent(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_DistanceProj(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, double value); +DLL Slvs_Constraint Slvs_LengthDiff(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, + Slvs_Entity workplane); +DLL Slvs_Constraint Slvs_Dragged(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity workplane); + +DLL double Slvs_GetParamValue(uint32_t ph); +DLL void Slvs_SetParamValue(uint32_t ph, double value); + +DLL void Slvs_Solve(Slvs_System *sys, uint32_t hg); +DLL void Slvs_MarkDragged(Slvs_Entity ptA); +/** + * Setting `bad` to a non NULL pointer enables finding of bad constraints. + * If such constraints are found, `bad` is set to a heap allocated array containing + * the handles of those constraints, while the `nbad` member of the returned + * `Slvs_SolveResult` struct is set to the number of the bad constraints. + * NOTE: the user is responsible for freeing the heap allocated memory using `free()`. + */ +DLL Slvs_SolveResult Slvs_SolveSketch(uint32_t hg, Slvs_hConstraint **bad); +DLL void Slvs_ClearSketch(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/js/README.md b/js/README.md new file mode 100644 index 0000000..e1e900c --- /dev/null +++ b/js/README.md @@ -0,0 +1,84 @@ +# slvs + +SolveSpace's geometric constraint solver for the browser and node.js + +## example + +```html + + +``` \ No newline at end of file diff --git a/js/slvs.d.ts b/js/slvs.d.ts new file mode 100644 index 0000000..6c10376 --- /dev/null +++ b/js/slvs.d.ts @@ -0,0 +1,194 @@ +export interface Entity { + h: number; + group: number; + type: number; + wrkpl: number; + normal: number; + distance: number; + param: [number, number, number, number]; +} + +export interface Constraint { + h: number; + group: number; + type: number; + wrkpl: Entity; + valA: number; + ptA: Entity; + ptB: Entity; + entityA: Entity; + entityB: Entity; + entityC: Entity; + entityD: Entity; + other: boolean; + other2: boolean; +} + +export interface SolveResult { + result: number; + dof: number; + nbad: number; + bad: Uint32Array; +} + +export interface Vector { + x: number + y: number + z: number +} + +export interface Quaternion { + w: number + vx: number + vy: number + vz: number + plus(b: Quaternion): Quaternion; + minus(b: Quaternion): Quaternion; + scaledBy(s: number): Quaternion; + magnitude(): number; + withMagnitude(s: number): Quaternion; + rotationU(): Vector; + rotationV(): Vector; + rotationN(): Vector; + rotate(p: Vector): Vector; + toThe(p: number): Quaternion; + inverse(): Quaternion; + times(b: Quaternion): Quaternion; + mirror(): Quaternion; +} + +export interface QuaternionConstructor { + new(): Quaternion; + prototype: Quaternion; + from(w: number, vx: number, vy: number, vz: number): Quaternion; +} + +export interface SlvsModule { + C_POINTS_COINCIDENT: 100000; + C_PT_PT_DISTANCE: 100001; + C_PT_PLANE_DISTANCE: 100002; + C_PT_LINE_DISTANCE: 100003; + C_PT_FACE_DISTANCE: 100004; + C_PT_IN_PLANE: 100005; + C_PT_ON_LINE: 100006; + C_PT_ON_FACE: 100007; + C_EQUAL_LENGTH_LINES: 100008; + C_LENGTH_RATIO: 100009; + C_EQ_LEN_PT_LINE_D: 100010; + C_EQ_PT_LN_DISTANCES: 100011; + C_EQUAL_ANGLE: 100012; + C_EQUAL_LINE_ARC_LEN: 100013; + C_SYMMETRIC: 100014; + C_SYMMETRIC_HORIZ: 100015; + C_SYMMETRIC_VERT: 100016; + C_SYMMETRIC_LINE: 100017; + C_AT_MIDPOINT: 100018; + C_HORIZONTAL: 100019; + C_VERTICAL: 100020; + C_DIAMETER: 100021; + C_PT_ON_CIRCLE: 100022; + C_SAME_ORIENTATION: 100023; + C_ANGLE: 100024; + C_PARALLEL: 100025; + C_PERPENDICULAR: 100026; + C_ARC_LINE_TANGENT: 100027; + C_CUBIC_LINE_TANGENT: 100028; + C_EQUAL_RADIUS: 100029; + C_PROJ_PT_DISTANCE: 100030; + C_WHERE_DRAGGED: 100031; + C_CURVE_CURVE_TANGENT: 100032; + C_LENGTH_DIFFERENCE: 100033; + C_ARC_ARC_LEN_RATIO: 100034; + C_ARC_LINE_LEN_RATIO: 100035; + C_ARC_ARC_DIFFERENCE: 100036; + C_ARC_LINE_DIFFERENCE: 100037; + + E_POINT_IN_3D: 50000; + E_POINT_IN_2D: 50001; + E_NORMAL_IN_3D: 60000; + E_NORMAL_IN_2D: 60001; + E_DISTANCE: 70000; + E_WORKPLANE: 80000; + E_LINE_SEGMENT: 80001; + E_CUBIC: 80002; + E_CIRCLE: 80003; + E_ARC_OF_CIRCLE: 80004; + + E_NONE: Entity; + E_FREE_IN_3D: Entity; + + isFreeIn3D(entity: Entity): boolean; + is3D(entity: Entity): boolean; + isNone(entity: Entity): boolean; + isPoint2D(entity: Entity): boolean; + isPoint3D(entity: Entity): boolean; + isNormal2D(entity: Entity): boolean; + isNormal3D(entity: Entity): boolean; + isLine(entity: Entity): boolean; + isLine2D(entity: Entity): boolean; + isLine3D(entity: Entity): boolean; + isCubic(entity: Entity): boolean; + isArc(entity: Entity): boolean; + isWorkplane(entity: Entity): boolean; + isDistance(entity: Entity): boolean; + isPoint(entity: Entity): boolean; + + addPoint2D(grouph: number, u: number, v: number, workplane: Entity): Entity; + addPoint3D(grouph: number, x: number, y: number, z: number): Entity; + addNormal2D(grouph: number, workplane: Entity): Entity; + addNormal3D(grouph: number, qw: number, qx: number, qy: number, qz: number): Entity; + addDistance(grouph: number, value: number, workplane: Entity): Entity; + addLine2D(grouph: number, ptA: Entity, ptB: Entity, workplane: Entity): Entity; + addLine3D(grouph: number, ptA: Entity, ptB: Entity): Entity; + addCubic(grouph: number, ptA: Entity, ptB: Entity, ptC: Entity, ptD: Entity, workplane: Entity): Entity; + addArc(grouph: number, normal: Entity, center: Entity, start: Entity, end: Entity, workplane: Entity): Entity; + addCircle(grouph: number, normal: Entity, center: Entity, radius: Entity, workplane: Entity): Entity; + addWorkplane(grouph: number, origin: Entity, nm: Entity): Entity; + addBase2D(grouph: number): Entity; + + addConstraint( + grouph: number, + type: number, + workplane: Entity, + val: number, + ptA: Entity, + ptB: Entity, + entityA: Entity, + entityB: Entity, + entityC: Entity, + entityD: Entity, + other: boolean, + other2: boolean, + ): Constraint; + + coincident(grouph: number, entityA: Entity, entityB: Entity, workplane: Entity): Constraint; + distance(grouph: number, entityA: Entity, entityB: Entity, value: number, workplane: Entity): Constraint; + equal(grouph: number, entityA: Entity, entityB: Entity, workplane: Entity): Constraint; + equalAngle(grouph: number, entityA: Entity, entityB: Entity, entityC: Entity, entityD: Entity, workplane: Entity): Constraint; + equalPointToLine(grouph: number, entityA: Entity, entityB: Entity, entityC: Entity, entityD: Entity, workplane: Entity): Constraint; + ratio(grouph: number, entityA: Entity, entityB: Entity, value: number, workplane: Entity): Constraint; + symmetric(grouph: number, entityA: Entity, entityB: Entity, entityC: Entity): Constraint; + symmetricH(grouph: number, ptA: Entity, ptB: Entity, workplane: Entity): Constraint; + symmetricV(grouph: number, ptA: Entity, ptB: Entity, workplane: Entity): Constraint; + midpoint(grouph: number, ptA: Entity, ptB: Entity, workplane: Entity): Constraint; + horizontal(grouph: number, entityA: Entity, workplane: Entity, entityB: Entity): Constraint; + vertical(grouph: number, entityA: Entity, workplane: Entity, entityB: Entity): Constraint; + diameter(grouph: number, entityA: Entity, value: number): Constraint; + sameOrientation(grouph: number, entityA: Entity, entityB: Entity): Constraint; + angle(grouph: number, entityA: Entity, entityB: Entity, value: number, workplane: Entity, inverse: boolean): Constraint; + perpendicular(grouph: number, entityA: Entity, entityB: Entity, workplane: Entity, inverse: boolean): Constraint; + parallel(grouph: number, entityA: Entity, entityB: Entity, workplane: Entity): Constraint; + tangent(grouph: number, entityA: Entity, entityB: Entity, workplane: Entity): Constraint; + distanceProj(grouph: number, ptA: Entity, ptB: Entity, value: number): Constraint; + lengthDiff(grouph: number, entityA: Entity, entityB: Entity, value: number, workplane: Entity): Constraint; + dragged(grouph: number, ptA: Entity, workplane: Entity): Constraint; + + getParamValue(ph: number): number; + setParamValue(ph: number, value: number): number; + solveSketch(hgroup: number, calculateFaileds: boolean): SolveResult; + clearSketch(): void; +} + +declare function ModuleLoader(): Promise; + +export default ModuleLoader; diff --git a/package.json b/package.json new file mode 100644 index 0000000..c9188b7 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "slvs", + "version": "0.0.0", + "description": "\"SolveSpace", + "main": "slvs.js", + "types": "slvs.d.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/solvespace/solvespace.git" + }, + "keywords": [], + "author": "", + "license": "GNU GPL V3", + "bugs": { + "url": "https://github.com/solvespace/solvespace/issues" + }, + "homepage": "http://solvespace.com" +} diff --git a/pkg/flatpak/.gitignore b/pkg/flatpak/.gitignore new file mode 100644 index 0000000..ca1b1d7 --- /dev/null +++ b/pkg/flatpak/.gitignore @@ -0,0 +1,4 @@ +/.flatpak-builder +/build-dir +/repo +*.flatpak diff --git a/pkg/flatpak/build.sh b/pkg/flatpak/build.sh new file mode 100755 index 0000000..a65961f --- /dev/null +++ b/pkg/flatpak/build.sh @@ -0,0 +1,4 @@ +#!/bin/sh -ex +cd $(dirname $0) +flatpak-builder "$@" --force-clean --repo repo build-dir com.solvespace.SolveSpace.json +flatpak build-bundle repo solvespace.flatpak com.solvespace.SolveSpace diff --git a/pkg/flatpak/com.solvespace.SolveSpace.json b/pkg/flatpak/com.solvespace.SolveSpace.json new file mode 100644 index 0000000..005a8bc --- /dev/null +++ b/pkg/flatpak/com.solvespace.SolveSpace.json @@ -0,0 +1,267 @@ +{ + "$schema": "https://raw.githubusercontent.com/TingPing/flatpak-manifest-schema/master/flatpak-manifest.schema", + "app-id": "com.solvespace.SolveSpace", + "runtime": "org.freedesktop.Platform", + "runtime-version": "25.08", + "sdk": "org.freedesktop.Sdk", + "finish-args": [ + "--device=dri", + "--share=ipc", + "--socket=fallback-x11", + "--socket=wayland" + ], + "cleanup": [ + "/include", + "/lib/cmake", + "/lib/pkgconfig", + "/share/aclocal", + "/share/pkgconfig", + "*.la" + ], + "command": "solvespace", + "modules": [ + { + "name": "mm-common", + "buildsystem": "meson", + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/mm-common/1.0/mm-common-1.0.7.tar.xz", + "sha256": "494abfce781418259b1e9d8888c73af4de4b6f3be36cc75d9baa8baa0f2a7a39", + "x-checker-data": { + "type": "gnome", + "name": "mm-common", + "stable-only": true + } + } + ], + "cleanup": [ + "/bin", + "/share/doc", + "/share/man", + "/share/mm-common" + ] + }, + { + "name": "sigc++", + "buildsystem": "meson", + "config-opts": [ + "--buildtype=release", + "-Dbuild-examples=false" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/libsigc++/2.10/libsigc++-2.10.8.tar.xz", + "sha256": "235a40bec7346c7b82b6a8caae0456353dc06e71f14bc414bcc858af1838719a", + "x-checker-data": { + "type": "gnome", + "name": "libsigc++", + "stable-only": true, + "versions": { + "<": "3.0.0" + } + } + } + ], + "cleanup": [ + "/lib/sigc++-*" + ] + }, + { + "name": "glibmm", + "buildsystem": "meson", + "config-opts": [ + "--buildtype=release", + "-Dbuild-examples=false" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/glibmm/2.66/glibmm-2.66.8.tar.xz", + "sha256": "64f11d3b95a24e2a8d4166ecff518730f79ecc27222ef41faf7c7e0340fc9329", + "x-checker-data": { + "type": "gnome", + "name": "glibmm", + "stable-only": true, + "versions": { + "<": "2.68.0" + } + } + } + ], + "cleanup": [ + "/lib/giomm-*", + "/lib/glibmm-*", + "/lib/libglibmm_generate_extra_defs-*.so*" + ] + }, + { + "name": "cairomm", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/cairomm/1.12/cairomm-1.12.0.tar.xz", + "sha256": "a54ada8394a86182525c0762e6f50db6b9212a2109280d13ec6a0b29bfd1afe6", + "x-checker-data": { + "type": "gnome", + "name": "cairomm", + "stable-only": true, + "versions": { + "<": "1.16.0" + } + } + } + ], + "cleanup": [ + "/lib/cairomm-*" + ] + }, + { + "name": "pangomm", + "buildsystem": "meson", + "config-opts": [ + "--buildtype=release" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/pangomm/2.46/pangomm-2.46.4.tar.xz", + "sha256": "b92016661526424de4b9377f1512f59781f41fb16c9c0267d6133ba1cd68db22", + "x-checker-data": { + "type": "gnome", + "name": "pangomm", + "stable-only": true, + "versions": { + "<": "2.48.0" + } + } + } + ], + "cleanup": [ + "/lib/pangomm-*" + ] + }, + { + "name": "atkmm", + "buildsystem": "meson", + "config-opts": [ + "--buildtype=release" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/atkmm/2.28/atkmm-2.28.4.tar.xz", + "sha256": "0a142a8128f83c001efb8014ee463e9a766054ef84686af953135e04d28fdab3", + "x-checker-data": { + "type": "gnome", + "name": "atkmm", + "stable-only": true, + "versions": { + "<": "2.30.0" + } + } + } + ], + "cleanup": [ + "/lib/atkmm-*" + ] + }, + { + "name": "gtkmm", + "buildsystem": "meson", + "config-opts": [ + "--buildtype=release", + "-Dbuild-demos=false", + "-Dbuild-tests=false" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/gtkmm/3.24/gtkmm-3.24.10.tar.xz", + "sha256": "7ab7e2266808716e26c39924ace1fb46da86c17ef39d989624c42314b32b5a76", + "x-checker-data": { + "type": "gnome", + "name": "gtkmm", + "stable-only": true, + "versions": { + "<": "4.0.0" + } + } + } + ], + "cleanup": [ + "/lib/gdkmm-*", + "/lib/gtkmm-*" + ] + }, + { + "name": "eigen", + "buildsystem": "cmake-ninja", + "builddir": true, + "sources": [ + { + "type": "archive", + "url": "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz", + "sha256": "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72", + "x-checker-data": { + "type": "html", + "url": "https://eigen.tuxfamily.org/index.php?title=Main_Page", + "version-pattern": "latest stable release is Eigen ([\\d\\.-]+[\\d])", + "stable-only": true, + "url-template": "https://gitlab.com/libeigen/eigen/-/archive/$version/eigen-$version.tar.gz" + } + } + ], + "cleanup": [ + "*" + ] + }, + { + "name": "libjson-c", + "buildsystem": "cmake-ninja", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DBUILD_STATIC_LIBS=OFF", + "-DENABLE_THREADING=ON", + "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" + ], + "sources": [ + { + "type": "archive", + "url": "https://s3.amazonaws.com/json-c_releases/releases/json-c-0.18.tar.gz", + "sha256": "876ab046479166b869afc6896d288183bbc0e5843f141200c677b3e8dfb11724", + "x-checker-data": { + "type": "anitya", + "project-id": 1477, + "stable-only": true, + "url-template": "https://s3.amazonaws.com/json-c_releases/releases/json-c-$version.tar.gz" + } + } + ] + }, + { + "name": "solvespace", + "buildsystem": "cmake-ninja", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=RelWithDebInfo", + "-DFLATPAK=ON", + "-DENABLE_TESTS=OFF" + ], + "sources": [ + { + "type": "dir", + "path": "../.." + } + ], + "cleanup": [ + "/lib/libslvs*.so*" + ] + } + ] +} diff --git a/pkg/snap/.gitignore b/pkg/snap/.gitignore new file mode 100644 index 0000000..9f938db --- /dev/null +++ b/pkg/snap/.gitignore @@ -0,0 +1,3 @@ +*.snap +solvespace-snap-src +squashfs-root diff --git a/pkg/snap/build.sh b/pkg/snap/build.sh new file mode 100755 index 0000000..abd7a86 --- /dev/null +++ b/pkg/snap/build.sh @@ -0,0 +1,12 @@ +#!/bin/sh -xe + +dir="$(dirname "$(readlink -f "$0")")" +solvespace_snap_src="$dir/solvespace-snap-src" +trap "rm -rf $solvespace_snap_src" EXIT + +cd "$dir" + +git_root="$(git rev-parse --show-toplevel)" +rsync --filter=":- .gitignore" -r "$git_root"/ "$solvespace_snap_src" + +snapcraft "$@" diff --git a/pkg/snap/snap/snapcraft.yaml b/pkg/snap/snap/snapcraft.yaml new file mode 100644 index 0000000..7d3cf77 --- /dev/null +++ b/pkg/snap/snap/snapcraft.yaml @@ -0,0 +1,87 @@ +name: solvespace +base: core22 +summary: Parametric 2d/3d CAD +adopt-info: solvespace +description: | + SOLVESPACE is a free (GPLv3) parametric 3d CAD tool. + Applications include + * modeling 3d parts — draw with extrudes, revolves, and Boolean (union / difference) operations + * modeling 2d parts — draw the part as a single section, and export DXF, PDF, SVG; use 3d assembly to verify fit + * 3d-printed parts — export the STL or other triangle mesh expected by most 3d printers + * preparing CAM data — export 2d vector art for a waterjet machine or laser cutter; or generate STEP or STL, for import into third-party CAM software for machining + * mechanism design — use the constraint solver to simulate planar or spatial linkages, with pin, ball, or slide joints + * plane and solid geometry — replace hand-solved trigonometry and spreadsheets with a live dimensioned drawing + +confinement: strict +license: GPL-3.0 +compression: lzo +grade: stable + +layout: + /usr/share/solvespace: + symlink: $SNAP/usr/share/solvespace + +apps: + solvespace: + command: usr/bin/solvespace + desktop: solvespace.desktop + extensions: [gnome] + plugs: [opengl, unity7, home, removable-media, gsettings, network] + environment: + GTK_USE_PORTAL: "0" + cli: + command: usr/bin/solvespace-cli + extensions: [gnome] + plugs: [home, removable-media, network] + +parts: + solvespace: + plugin: cmake + source: ./solvespace-snap-src + source-type: local + override-pull: | + craftctl default + git submodule update --init extlib/libdxfrw extlib/mimalloc extlib/eigen + override-build: | + craftctl default + project_version=$(grep CMAKE_PROJECT_VERSION:STATIC CMakeCache.txt | cut -d "=" -f2) + cd $CRAFT_PART_SRC + version="$project_version~$(git rev-parse --short=8 HEAD)" + craftctl set version="$version" + cmake-parameters: + - -DCMAKE_INSTALL_PREFIX=/usr + - -DCMAKE_BUILD_TYPE=Release + - -DENABLE_TESTS=OFF + - -DSNAP=ON + - -DENABLE_OPENMP=ON + - -DENABLE_LTO=ON + build-packages: + - zlib1g-dev + - libpng-dev + - libcairo2-dev + - libfreetype6-dev + - libjson-c-dev + - libgl-dev + - libsigc++-2.0-dev + - libspnav-dev + - git + - g++ + - libc6-dev + stage-packages: + - libspnav0 + - libsigc++-2.0-0v5 + + cleanup: + after: [solvespace] + plugin: nil + build-snaps: [gnome-42-2204] + override-prime: | + set -eux + for snap in "gnome-42-2204"; do # List all content-snaps you're using here + cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" "$CRAFT_PRIME/usr/{}" \; + done + for cruft in bug lintian man; do + rm -rf $CRAFT_PRIME/usr/share/$cruft + done + find $CRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete + find $CRAFT_PRIME/usr/share -type d -empty -delete diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cc18b09 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +[build-system] +requires = ["scikit-build-core", "Cython", "cmake==3.31.6", "ninja"] +build-backend = "scikit_build_core.build" + +[project] +name = "slvs" +version = "0.0.0" +description="SolveSpace solver wrapped with Cython" +readme = "README.md" +authors = [ + { name = "Koen Schmeets", email = "koen@schmeets.de" }, +] +requires-python = ">=3.7" +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", +] + +[tool.scikit-build] +wheel.expand-macos-universal-tags = true +cmake.verbose = true +cmake.build-type = "RelWithDebInfo" +build.targets = ["slvs-py"] +install.components = ["python"] +sdist.include = [ + ".git/HEAD", + ".git/refs" +] +wheel.packages = ["python/slvs"] + +[tool.scikit-build.cmake.define] +ENABLE_GUI = "OFF" +ENABLE_CLI = "OFF" +ENABLE_TESTS = "OFF" +ENABLE_COVERAGE = "OFF" +ENABLE_OPENMP = "OFF" +FORCE_VENDORED_Eigen3 = "ON" +ENABLE_LTO = "ON" +ENABLE_PYTHON_LIB = "ON" + +[tool.cibuildwheel] +build-verbosity = 1 \ No newline at end of file diff --git a/python/slvs/__init__.py b/python/slvs/__init__.py new file mode 100644 index 0000000..9595104 --- /dev/null +++ b/python/slvs/__init__.py @@ -0,0 +1,99 @@ +from .solvespace import ( + add_base_2d, + add_arc, + add_circle, + add_constraint, + add_cubic, + add_distance, + add_line_2d, + add_line_3d, + add_normal_2d, + add_normal_3d, + add_point_2d, + add_point_3d, + add_workplane, + angle, + clear_sketch, + coincident, + diameter, + distance, + distance_proj, + dragged, + equal, + equal_angle, + equal_point_to_line, + get_param_value, + set_param_value, + horizontal, + length_diff, + make_quaternion, + midpoint, + parallel, + perpendicular, + quaternion_n, + quaternion_u, + quaternion_v, + ratio, + same_orientation, + solve_sketch, + symmetric, + symmetric_h, + symmetric_v, + tangent, + vertical, + ResultFlag, + ConstraintType, + E_NONE, + E_FREE_IN_3D +) + +__all__ = [ + "add_base_2d", + "add_arc", + "add_circle", + "add_constraint", + "add_cubic", + "add_distance", + "add_line_2d", + "add_line_3d", + "add_normal_2d", + "add_normal_3d", + "add_point_2d", + "add_point_3d", + "add_workplane", + "angle", + "clear_sketch", + "coincident", + "diameter", + "distance", + "distance_proj", + "dragged", + "equal", + "equal_angle", + "equal_point_to_line", + "get_param_value", + "set_param_value", + "horizontal", + "length_diff", + "make_quaternion", + "midpoint", + "parallel", + "perpendicular", + "quaternion_n", + "quaternion_u", + "quaternion_v", + "ratio", + "same_orientation", + "solve_sketch", + "symmetric", + "symmetric_h", + "symmetric_v", + "tangent", + "vertical", + "ResultFlag", + "ConstraintType", + "E_NONE", + "E_FREE_IN_3D", +] + +__test__ = {} diff --git a/python/slvs/solvespace.pyi b/python/slvs/solvespace.pyi new file mode 100644 index 0000000..54497fc --- /dev/null +++ b/python/slvs/solvespace.pyi @@ -0,0 +1,280 @@ +# -*- coding: utf-8 -*- + +from typing import Tuple, TypedDict +from enum import IntEnum, auto + +class ConstraintType(IntEnum): + """Symbol of the constraint types.""" + POINTS_COINCIDENT = 100000 + PT_PT_DISTANCE = 100001 + PT_PLANE_DISTANCE = 100002 + PT_LINE_DISTANCE = 100003 + PT_FACE_DISTANCE = 100004 + PT_IN_PLANE = 100005 + PT_ON_LINE = 100006 + PT_ON_FACE = 100007 + EQUAL_LENGTH_LINES = 100008 + LENGTH_RATIO = 100009 + EQ_LEN_PT_LINE_D = 100010 + EQ_PT_LN_DISTANCES = 100011 + EQUAL_ANGLE = 100012 + EQUAL_LINE_ARC_LEN = 100013 + SYMMETRIC = 100014 + SYMMETRIC_HORIZ = 100015 + SYMMETRIC_VERT = 100016 + SYMMETRIC_LINE = 100017 + AT_MIDPOINT = 100018 + HORIZONTAL = 100019 + VERTICAL = 100020 + DIAMETER = 100021 + PT_ON_CIRCLE = 100022 + SAME_ORIENTATION = 100023 + ANGLE = 100024 + PARALLEL = 100025 + PERPENDICULAR = 100026 + ARC_LINE_TANGENT = 100027 + CUBIC_LINE_TANGENT = 100028 + EQUAL_RADIUS = 100029 + PROJ_PT_DISTANCE = 100030 + WHERE_DRAGGED = 100031 + CURVE_CURVE_TANGENT = 100032 + LENGTH_DIFFERENCE = 100033 + ARC_ARC_LEN_RATIO = 100034 + ARC_LINE_LEN_RATIO = 100035 + ARC_ARC_DIFFERENCE = 100036 + ARC_LINE_DIFFERENCE = 100037 + +class EntityType(IntEnum): + POINT_IN_3D = 50000 + POINT_IN_2D = 50001 + NORMAL_IN_3D = 60000 + NORMAL_IN_2D = 60001 + DISTANCE = 70000 + WORKPLANE = 80000 + LINE_SEGMENT = 80001 + CUBIC = 80002 + CIRCLE = 80003 + ARC_OF_CIRCLE = 80004 + +class ResultFlag(IntEnum): + """Symbol of the result flags.""" + OKAY = 0 + INCONSISTENT = auto() + DIDNT_CONVERGE = auto() + TOO_MANY_UNKNOWNS = auto() + REDUNDANT_OKAY = auto() + +class Slvs_Entity(TypedDict): + h: int + group: int + type: int + wrkpl: int + point: list[int] + normal: int + distance: int + param: list[int] + +class Slvs_Constraint(TypedDict): + h: int + group: int + type: int + wrkpl: int + valA: float + ptA: int + ptB: int + entityA: int + entityB: int + entityC: int + entityD: int + other: int + other2: int + +class Slvs_SolveResult(TypedDict): + result: int + dof: int + rank: int + bad: int + +E_FREE_IN_3D : Slvs_Entity +E_NONE : Slvs_Entity + +def quaternion_u( + qw: float, + qx: float, + qy: float, + qz: float +) -> Tuple[float, float, float]: + ... + +def quaternion_v( + qw: float, + qx: float, + qy: float, + qz: float +) -> Tuple[float, float, float]: + ... + +def quaternion_n( + qw: float, + qx: float, + qy: float, + qz: float +) -> Tuple[float, float, float]: + ... + +def make_quaternion( + ux: float, + uy: float, + uz: float, + vx: float, + vy: float, + vz: float +) -> Tuple[float, float, float, float]: + ... + +def add_base_2d(grouph: int) -> Slvs_Entity: + ... + +def add_point_2d(grouph: int, u: float, v: float, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_point_3d(grouph: int, x: float, y: float, z: float) -> Slvs_Entity: + ... + +def add_normal_2d(grouph: int, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_normal_3d(grouph: int, qw: float, qx: float, qy: float, qz: float) -> Slvs_Entity: + ... + +def add_distance(grouph: int, d: float, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_line_2d(grouph: int, p1: Slvs_Entity, p2: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_line_3d(grouph: int, p1: Slvs_Entity, p2: Slvs_Entity) -> Slvs_Entity: + ... + +def add_cubic(grouph: int, p1: Slvs_Entity, p2: Slvs_Entity, p3: Slvs_Entity, p4: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_arc(grouph: int, nm: Slvs_Entity, ct: Slvs_Entity, start: Slvs_Entity, end: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_circle(grouph: int, nm: Slvs_Entity, ct: Slvs_Entity, radius: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Entity: + ... + +def add_workplane(grouph: int, origin: Slvs_Entity, nm: Slvs_Entity) -> Slvs_Entity: + ... + +def add_constraint( + grouph: int, + c_type: ConstraintType, + wp: Slvs_Entity, + v: float, + p1: Slvs_Entity = E_NONE, + p2: Slvs_Entity = E_NONE, + e1: Slvs_Entity = E_NONE, + e2: Slvs_Entity = E_NONE, + e3: Slvs_Entity = E_NONE, + e4: Slvs_Entity = E_NONE, + other: int = 0, + other2: int = 0 +) -> Slvs_Constraint: + ... + +def coincident(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def distance( + grouph: int, + e1: Slvs_Entity, + e2: Slvs_Entity, + value: float, + wp: Slvs_Entity = E_FREE_IN_3D +) -> Slvs_Constraint: + ... + +def equal(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def equal_angle( + grouph: int, + e1: Slvs_Entity, + e2: Slvs_Entity, + e3: Slvs_Entity, + e4: Slvs_Entity, + wp: Slvs_Entity = E_FREE_IN_3D +) -> Slvs_Constraint: + ... + +def equal_point_to_line( + grouph: int, + e1: Slvs_Entity, + e2: Slvs_Entity, + e3: Slvs_Entity, + e4: Slvs_Entity, + wp: Slvs_Entity = E_FREE_IN_3D +) -> Slvs_Constraint: + ... + +def ratio(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, value: float, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def symmetric(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, e3: Slvs_Entity = E_NONE, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def symmetric_h(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Constraint: + ... + +def symmetric_v(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Constraint: + ... + +def midpoint(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def horizontal(grouph: int, e1: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Constraint: + ... + +def vertical(grouph: int, e1: Slvs_Entity, wp: Slvs_Entity) -> Slvs_Constraint: + ... + +def diameter(grouph: int, e1: Slvs_Entity, value: float) -> Slvs_Constraint: + ... + +def same_orientation(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity) -> Slvs_Constraint: + ... + +def angle(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, value: float, wp: Slvs_Entity = E_FREE_IN_3D, inverse: bool = False) -> Slvs_Constraint: + ... + +def perpendicular(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D, inverse: bool = False) -> Slvs_Constraint: + ... + +def parallel(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def tangent(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def distance_proj(grouph: int, e1: Slvs_Entity, e2: Slvs_Entity, value: float) -> Slvs_Constraint: + ... + +def length_diff(grouph: int, Slvs_entityA: Slvs_Entity, Slvs_entityB: Slvs_Entity, value: float, workplane: Slvs_Entity) -> Slvs_Constraint: + ... + +def dragged(grouph: int, e1: Slvs_Entity, wp: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + ... + +def clear_sketch() -> None: + ... + +def solve_sketch(grouph: int, calculateFaileds: bool) -> Slvs_SolveResult: + ... + +def get_param_value(ph: int) -> float: + ... + +def set_param_value(ph: int, value: float) -> None: + ... \ No newline at end of file diff --git a/python/tests/__main__.py b/python/tests/__main__.py new file mode 100644 index 0000000..7cbb027 --- /dev/null +++ b/python/tests/__main__.py @@ -0,0 +1,4 @@ +from unittest import defaultTestLoader, TextTestRunner + +if __name__ == '__main__': + TextTestRunner().run(defaultTestLoader.discover('tests', '*.py')) diff --git a/python/tests/test.py b/python/tests/test.py new file mode 100644 index 0000000..9a37d73 --- /dev/null +++ b/python/tests/test.py @@ -0,0 +1,253 @@ +from unittest import TestCase +import slvs +# from solvespace import ConstraintType, E_NONE +from math import radians + +class CoreTest(TestCase): + def test_crank_rocker(self): + """Crank rocker example.""" + print("Crank rocker") + slvs.clear_sketch() + g = 1 + wp = slvs.add_base_2d(g) + p0 = slvs.add_point_2d(g, 0, 0, wp) + slvs.dragged(g, p0, wp) + p1 = slvs.add_point_2d(g, 90, 0, wp) + slvs.dragged(g, p1, wp) + line0 = slvs.add_line_2d(g, p0, p1, wp) + p2 = slvs.add_point_2d(g, 20, 20, wp) + p3 = slvs.add_point_2d(g, 0, 10, wp) + p4 = slvs.add_point_2d(g, 30, 20, wp) + slvs.distance(g, p2, p3, 40, wp) + slvs.distance(g, p2, p4, 40, wp) + slvs.distance(g, p3, p4, 70, wp) + slvs.distance(g, p0, p3, 35, wp) + slvs.distance(g, p1, p4, 70, wp) + line1 = slvs.add_line_2d(g, p0, p3, wp) + slvs.angle(g, line0, line1, 45, wp, False) + # slvs.add_constraint(g, ConstraintType.ANGLE, wp, 45.0, E_NONE, E_NONE, line0, line1) + + result = slvs.solve_sketch(g, False) + self.assertEqual(result['result'], slvs.ResultFlag.OKAY) + x = slvs.get_param_value(p2['param'][0]) + y = slvs.get_param_value(p2['param'][1]) + self.assertAlmostEqual(39.54852, x, 4) + self.assertAlmostEqual(61.91009, y, 4) + + def test_involute(self): + """Involute example.""" + print("Involute") + r = 10 + angle = 45 + slvs.clear_sketch() + g = 1 + wp = slvs.add_base_2d(g) + p0 = slvs.add_point_2d(g, 0, 0, wp) + slvs.dragged(g, p0, wp) + p1 = slvs.add_point_2d(g, 0, 10, wp) + slvs.distance(g, p0, p1, r, wp) + line0 = slvs.add_line_2d(g, p0, p1, wp) + + p2 = slvs.add_point_2d(g, 10, 10, wp) + line1 = slvs.add_line_2d(g, p1, p2, wp) + slvs.distance(g, p1, p2, r * radians(angle), wp) + slvs.perpendicular(g, line0, line1, wp, False) + + p3 = slvs.add_point_2d(g, 10, 0, wp) + slvs.dragged(g, p3, wp) + line_base = slvs.add_line_2d(g, p0, p3, wp) + slvs.angle(g, line0, line_base, angle, wp, False) + + result = slvs.solve_sketch(g, False) + print("result", result) + self.assertEqual(result['result'], slvs.ResultFlag.OKAY) + x = slvs.get_param_value(p2['param'][0]) + y = slvs.get_param_value(p2['param'][1]) + self.assertAlmostEqual(12.62467, x, 4) + self.assertAlmostEqual(1.51746, y, 4) + + def test_jansen_linkage(self): + """Jansen's linkage example.""" + + print("Jansen's linkage") + slvs.clear_sketch() + g = 1 + wp = slvs.add_base_2d(g) + p0 = slvs.add_point_2d(g, 0, 0, wp) + slvs.dragged(g, p0, wp) + + p1 = slvs.add_point_2d(g, 0, 20, wp) + slvs.distance(g, p0, p1, 15, wp) + line0 = slvs.add_line_2d(g, p0, p1, wp) + + p2 = slvs.add_point_2d(g, -38, -7.8, wp) + slvs.dragged(g, p2, wp) + p3 = slvs.add_point_2d(g, -50, 30, wp) + p4 = slvs.add_point_2d(g, -70, -15, wp) + slvs.distance(g, p2, p3, 41.5, wp) + slvs.distance(g, p3, p4, 55.8, wp) + slvs.distance(g, p2, p4, 40.1, wp) + + p5 = slvs.add_point_2d(g, -50, -50, wp) + p6 = slvs.add_point_2d(g, -10, -90, wp) + p7 = slvs.add_point_2d(g, -20, -40, wp) + slvs.distance(g, p5, p6, 65.7, wp) + slvs.distance(g, p6, p7, 49.0, wp) + slvs.distance(g, p5, p7, 36.7, wp) + + slvs.distance(g, p1, p3, 50, wp) + slvs.distance(g, p1, p7, 61.9, wp) + + p8 = slvs.add_point_2d(g, 20, 0, wp) + line_base = slvs.add_line_2d(g, p0, p8, wp) + slvs.angle(g, line0, line_base, 45, wp, False) + + result = slvs.solve_sketch(g, False) + print("result", result) + self.assertEqual(result['result'], slvs.ResultFlag.OKAY) + x = slvs.get_param_value(p8['param'][0]) + y = slvs.get_param_value(p8['param'][1]) + self.assertAlmostEqual(18.93036, x, 4) + self.assertAlmostEqual(13.63778, y, 4) + + def test_nut_cracker(self): + print("Nut cracker") + + h0 = 0.5 + b0 = 0.75 + r0 = 0.25 + n1 = 1.5 + n2 = 2.3 + l0 = 3.25 + + slvs.clear_sketch() + g = 1 + wp = slvs.add_base_2d(g) + p0 = slvs.add_point_2d(g, 0, 0, wp) + slvs.dragged(g, p0, wp) + + p1 = slvs.add_point_2d(g, 2, 2, wp) + p2 = slvs.add_point_2d(g, 2, 0, wp) + line0 = slvs.add_line_2d(g, p0, p2, wp) + slvs.horizontal(g, line0, wp) + line1 = slvs.add_line_2d(g, p1, p2, wp) + p3 = slvs.add_point_2d(g, b0 / 2, h0, wp) + slvs.dragged(g, p3, wp) + slvs.distance(g, p3, line1, r0, wp) + slvs.distance(g, p0, p1, n1, wp) + slvs.distance(g, p1, p2, n2, wp) + + result = slvs.solve_sketch(g, False) + print("result", result) + self.assertEqual(result['result'], slvs.ResultFlag.OKAY) + x = slvs.get_param_value(p2['param'][0]) + print("x", x) + ans_min = x - b0 / 2 + ans_max = l0 - r0 - b0 / 2 + self.assertAlmostEqual(1.01576, ans_min, 4) + self.assertAlmostEqual(2.625, ans_max, 4) + + def test_pydemo(self): + """Some sample code for slvs.dll. + We draw some geometric entities, provide initial guesses for their positions, + and then constrain them. The solver calculates their new positions, + in order to satisfy the constraints. + + Copyright 2008-2013 Jonathan Westhues. + Copyright 2016-2017 Yuan Chang [pyslvs@gmail.com] Solvespace bundled. + + An example of a constraint in 2d. In our first group, we create a workplane + along the reference frame's xy plane. In a second group, we create some + entities in that group and dimension them. + """ + + slvs.clear_sketch() + g1 = 1 + g2 = 2 + # First, we create our workplane. Its origin corresponds to the origin + # of our base frame (x y z) = (0 0 0) + p101 = slvs.add_point_3d(g1, 0, 0, 0) + # and it is parallel to the xy plane, so it has basis vectors (1 0 0) + # and (0 1 0). + (w, vx, vy, vz) = slvs.make_quaternion(1, 0, 0, 0, 1, 0) + n102 = slvs.add_normal_3d(g1, w, vx, vy, vz) + wp200 = slvs.add_workplane(g1, p101, n102) + + # Now create a second group. We'll solve group 2, while leaving group 1 + # constant; so the workplane that we've created will be locked down, + # and the solver can't move it. + p301 = slvs.add_point_2d(g2, 10, 20, wp200) + p302 = slvs.add_point_2d(g2, 20, 10, wp200) + + # And we create a line segment with those endpoints. + l400 = slvs.add_line_2d(g2, p301, p302, wp200) + + # Now three more points. + p303 = slvs.add_point_2d(g2, 100, 120, wp200) + p304 = slvs.add_point_2d(g2, 120, 110, wp200) + p305 = slvs.add_point_2d(g2, 115, 115, wp200) + + # And arc, centered at point 303, starting at point 304, ending at + # point 305. + a401 = slvs.add_arc(g2, n102, p303, p304, p305, wp200) + + # Now one more point, and a distance + p306 = slvs.add_point_2d(g2, 200, 200, wp200) + d307 = slvs.add_distance(g2, 30, wp200) + + # And a complete circle, centered at point 306 with radius equal to + # distance 307. The normal is 102, the same as our workplane. + c402 = slvs.add_circle(g2, n102, p306, d307, wp200) + + # The length of our line segment is 30.0 units. + slvs.distance(g2, p301, p302, 30, wp200) + + # And the distance from our line segment to the origin is 10.0 units. + slvs.distance(g2, p101, l400, 10, wp200) + + # And the line segment is vertical. + slvs.vertical(g2, l400, wp200) + + # And the distance from one endpoint to the origin is 15.0 units. + slvs.distance(g2, p301, p101, 15, wp200) + + # The arc and the circle have equal radius. + slvs.equal(g2, a401, c402, wp200) + + # The arc has radius 17.0 units. + slvs.diameter(g2, a401, 17 * 2) + + # If the solver fails, then aslvs it to report which constraints caused + # the problem. + + # And solve. + g1result = slvs.solve_sketch(g1, False) + g2result = slvs.solve_sketch(g2, False) + self.assertEqual(g2result['result'], slvs.ResultFlag.OKAY) + x = slvs.get_param_value(p301['param'][0]) + y = slvs.get_param_value(p301['param'][1]) + self.assertAlmostEqual(10, x, 4) + self.assertAlmostEqual(11.18030, y, 4) + x = slvs.get_param_value(p302['param'][0]) + y = slvs.get_param_value(p302['param'][1]) + self.assertAlmostEqual(10, x, 4) + self.assertAlmostEqual(-18.81966, y, 4) + x = slvs.get_param_value(p303['param'][0]) + y = slvs.get_param_value(p303['param'][1]) + self.assertAlmostEqual(101.11418, x, 4) + self.assertAlmostEqual(119.04153, y, 4) + x = slvs.get_param_value(p304['param'][0]) + y = slvs.get_param_value(p304['param'][1]) + self.assertAlmostEqual(116.47661, x, 4) + self.assertAlmostEqual(111.76171, y, 4) + x = slvs.get_param_value(p305['param'][0]) + y = slvs.get_param_value(p305['param'][1]) + self.assertAlmostEqual(117.40922, x, 4) + self.assertAlmostEqual(114.19676, y, 4) + x = slvs.get_param_value(p306['param'][0]) + y = slvs.get_param_value(p306['param'][1]) + self.assertAlmostEqual(200, x, 4) + self.assertAlmostEqual(200, y, 4) + x = slvs.get_param_value(d307['param'][0]) + self.assertAlmostEqual(17, x, 4) + self.assertEqual(6, g2result['dof']) diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt new file mode 100644 index 0000000..7e1b2db --- /dev/null +++ b/res/CMakeLists.txt @@ -0,0 +1,326 @@ +# First, set up registration functions for the kinds of resources we handle. +set(resource_root ${CMAKE_CURRENT_SOURCE_DIR}/) +set(resource_list) +if(WIN32) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win32/versioninfo.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/win32/versioninfo.rc) + + set(rc_file ${CMAKE_CURRENT_BINARY_DIR}/resources.rc) + file(WRITE ${rc_file} "// Autogenerated; do not edit\n") + file(APPEND ${rc_file} "#include \n") + file(APPEND ${rc_file} "#include \"${CMAKE_CURRENT_BINARY_DIR}/win32/versioninfo.rc\"\n") + + function(add_resource name) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + + if(${ARGC} GREATER 1) + set(id ${ARGV1}) + else() + string(REPLACE ${resource_root} "" id ${source}) + endif() + if(${ARGC} GREATER 2) + set(type ${ARGV2}) + else() + set(type RCDATA) + endif() + file(SHA512 "${source}" hash) + file(APPEND ${rc_file} "${id} ${type} \"${source}\" // ${hash}\n") + # CMake doesn't track file dependencies across directories, so we force + # a reconfigure (which changes the RC file because of the hash above) + # every time a resource is changed. + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${source}") + endfunction() +elseif(APPLE) + set(app_resource_dir ${CMAKE_BINARY_DIR}/Resources) + set(cli_resource_dir ${CMAKE_BINARY_DIR}/res) + + function(add_resource name) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + set(target_app ${app_resource_dir}/${name}) + set(target_cli ${cli_resource_dir}/${name}) + set(resource_list "${resource_list};${target_app};${target_cli}" PARENT_SCOPE) + + get_filename_component(target_app_dir ${target_app} DIRECTORY) + get_filename_component(target_cli_dir ${target_cli} DIRECTORY) + add_custom_command( + OUTPUT ${target_app} ${target_cli} + COMMAND ${CMAKE_COMMAND} -E make_directory ${target_app_dir} + COMMAND ${CMAKE_COMMAND} -E copy ${source} ${target_app} + COMMAND ${CMAKE_COMMAND} -E make_directory ${target_cli_dir} + COMMAND ${CMAKE_COMMAND} -E copy ${source} ${target_cli} + COMMENT "Copying resource ${name}" + DEPENDS ${source} + VERBATIM) + endfunction() + + function(add_xib name) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + get_filename_component(basename ${name} NAME_WE) + set(target ${app_resource_dir}/${basename}.nib) + set(resource_list "${resource_list};${target}" PARENT_SCOPE) + + add_custom_command( + OUTPUT ${target} + COMMAND ${CMAKE_COMMAND} -E make_directory ${app_resource_dir} + COMMAND ibtool --errors --warnings --notices --output-format human-readable-text + --compile ${target} ${source} + COMMENT "Building Interface Builder file ${name}" + DEPENDS ${source} + VERBATIM) + endfunction() + + function(add_iconset name) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + get_filename_component(basename ${name} NAME_WE) + set(target ${app_resource_dir}/${basename}.icns) + set(resource_list "${resource_list};${target}" PARENT_SCOPE) + + add_custom_command( + OUTPUT ${target} + COMMAND ${CMAKE_COMMAND} -E make_directory ${app_resource_dir} + COMMAND iconutil -c icns -o ${target} ${source} + COMMENT "Building icon set ${name}" + DEPENDS ${source} + VERBATIM) + endfunction() +elseif(EMSCRIPTEN) + function(add_resource name) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + set(resource_list "${resource_list};${source}" PARENT_SCOPE) + endfunction() +else() # Unix + include(GNUInstallDirs) + + set(app_resource_dir ${CMAKE_BINARY_DIR}/res) + + function(add_resource name) + set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + set(target ${app_resource_dir}/${name}) + set(resource_list "${resource_list};${target}" PARENT_SCOPE) + + get_filename_component(target_dir ${target} DIRECTORY) + add_custom_command( + OUTPUT ${target} + COMMAND ${CMAKE_COMMAND} -E make_directory ${target_dir} + COMMAND ${CMAKE_COMMAND} -E copy ${source} ${target} + COMMENT "Copying resource ${name}" + DEPENDS ${source} + VERBATIM) + + get_filename_component(name_dir ${name} DIRECTORY) + install(FILES ${source} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/solvespace/${name_dir}) + endfunction() +endif() + +function(add_resources) + foreach(name ${ARGN}) + add_resource(${name}) + set(resource_list "${resource_list}" PARENT_SCOPE) + endforeach() +endfunction() + +# Second, register all resources. +if(WIN32) + add_resource(win32/icon.ico 4000 ICON) + add_resource(win32/manifest.xml 1 RT_MANIFEST) +elseif(APPLE) + add_iconset (cocoa/AppIcon.iconset) + add_xib (cocoa/MainMenu.xib) + add_xib (cocoa/SaveFormatAccessory.xib) +else() + add_resource(freedesktop/solvespace-48x48.png) + + if(FLATPAK) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace-flatpak.desktop.in + ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace-flatpak.desktop) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace-flatpak.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications + RENAME com.solvespace.SolveSpace.desktop) + + set(DESKTOP_FILE_NAME com.solvespace.SolveSpace.desktop) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/com.solvespace.SolveSpace.metainfo.xml.in + ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/com.solvespace.SolveSpace.metainfo.xml) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/com.solvespace.SolveSpace.metainfo.xml + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo) + + install(FILES freedesktop/solvespace-flatpak-mime.xml + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages + RENAME com.solvespace.SolveSpace-slvs.xml) + + install(FILES freedesktop/solvespace-scalable.svg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps + RENAME com.solvespace.SolveSpace.svg) + install(FILES freedesktop/solvespace-scalable.svg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/mimetypes + RENAME com.solvespace.SolveSpace.svg) + + foreach(SIZE 16x16 24x24 32x32 48x48) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/apps + RENAME com.solvespace.SolveSpace.png) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/mimetypes + RENAME com.solvespace.SolveSpace.png) + endforeach() + elseif(SNAP) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace-snap.desktop + DESTINATION / + RENAME solvespace.desktop) + + # snapd does not support registering new mime types + + install(FILES freedesktop/solvespace-scalable.svg + DESTINATION /meta/icons/hicolor/scalable/apps + RENAME snap.solvespace.svg) + + foreach(SIZE 16x16 24x24 32x32 48x48) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION /meta/icons/hicolor/${SIZE}/apps + RENAME snap.solvespace.png) + endforeach() + else() + if(USE_QT_GUI) + set(SS_EXE solvespace-qt) + else() + set(SS_EXE solvespace) + endif() + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace.desktop.in + ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/${SS_EXE}.desktop) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/${SS_EXE}.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) + + set(DESKTOP_FILE_NAME ${SS_EXE}.desktop) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/com.solvespace.SolveSpace.metainfo.xml.in + ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/com.solvespace.SolveSpace.metainfo.xml) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/com.solvespace.SolveSpace.metainfo.xml + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo) + + install(FILES freedesktop/solvespace-mime.xml + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages + RENAME solvespace-slvs.xml) + + install(FILES freedesktop/solvespace.thumbnailer + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/thumbnailers + RENAME solvespace.thumbnailer) + + install(FILES freedesktop/solvespace-scalable.svg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps + RENAME solvespace.svg) + install(FILES freedesktop/solvespace-scalable.svg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/mimetypes + RENAME application-x-solvespace.svg) + + foreach(SIZE 16x16 24x24 32x32 48x48) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/apps + RENAME solvespace.png) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/mimetypes + RENAME application-x-solvespace.png) + endforeach() + endif() +endif() + +add_resources( + banner.txt + icons/graphics-window/angle.png + icons/graphics-window/arc.png + icons/graphics-window/assemble.png + icons/graphics-window/bezier.png + icons/graphics-window/circle.png + icons/graphics-window/construction.png + icons/graphics-window/equal.png + icons/graphics-window/extrude.png + icons/graphics-window/helix.png + icons/graphics-window/horiz.png + icons/graphics-window/image.png + icons/graphics-window/in3d.png + icons/graphics-window/lathe.png + icons/graphics-window/length.png + icons/graphics-window/line.png + icons/graphics-window/ontoworkplane.png + icons/graphics-window/other-supp.png + icons/graphics-window/parallel.png + icons/graphics-window/perpendicular.png + icons/graphics-window/pointonx.png + icons/graphics-window/point.png + icons/graphics-window/rectangle.png + icons/graphics-window/ref.png + icons/graphics-window/revolve.png + icons/graphics-window/same-orientation.png + icons/graphics-window/sketch-in-3d.png + icons/graphics-window/sketch-in-plane.png + icons/graphics-window/step-rotate.png + icons/graphics-window/step-translate.png + icons/graphics-window/symmetric.png + icons/graphics-window/tangent-arc.png + icons/graphics-window/text.png + icons/graphics-window/trim.png + icons/graphics-window/vert.png + icons/text-window/constraint.png + icons/text-window/constraint-dimo.png + icons/text-window/constraint-wo.png + icons/text-window/construction.png + icons/text-window/edges.png + icons/text-window/faces.png + icons/text-window/occluded-visible.png + icons/text-window/occluded-stippled.png + icons/text-window/occluded-invisible.png + icons/text-window/mesh.png + icons/text-window/normal.png + icons/text-window/outlines.png + icons/text-window/point.png + icons/text-window/shaded.png + icons/text-window/workplane.png + locales.txt + locales/cs_CZ.po + locales/de_DE.po + locales/en_US.po + locales/fr_FR.po + locales/uk_UA.po + locales/es_AR.po + locales/tr_TR.po + locales/ru_RU.po + locales/zh_CN.po + locales/ja_JP.po + fonts/unifont.hex.gz + fonts/private/0-check-false.png + fonts/private/1-check-true.png + fonts/private/2-radio-false.png + fonts/private/3-radio-true.png + fonts/private/4-stipple-dot.png + fonts/private/5-stipple-dash-long.png + fonts/private/6-stipple-dash.png + fonts/private/7-stipple-zigzag.png + fonts/unicode.lff.gz + fonts/BitstreamVeraSans-Roman-builtin.ttf + shaders/imesh.frag + shaders/imesh.vert + shaders/imesh_point.frag + shaders/imesh_point.vert + shaders/imesh_tex.frag + shaders/imesh_texa.frag + shaders/imesh_tex.vert + shaders/mesh.frag + shaders/mesh.vert + shaders/mesh_fill.frag + shaders/mesh_fill.vert + shaders/edge.frag + shaders/edge.vert + shaders/outline.vert + threejs/three-r111.min.js.gz + threejs/hammer-2.0.8.js.gz + threejs/SolveSpaceControls.js) + +# Third, distribute the resources. +add_custom_target(resources + DEPENDS ${resource_list} + SOURCES ${resource_list}) +if(WIN32) + set_property(TARGET resources PROPERTY EXTRA_SOURCES ${rc_file}) +endif() diff --git a/res/banner.txt b/res/banner.txt new file mode 100644 index 0000000..ad8f4f8 --- /dev/null +++ b/res/banner.txt @@ -0,0 +1 @@ +SolveSpace! diff --git a/res/cocoa/AppIcon.iconset/icon_128x128.png b/res/cocoa/AppIcon.iconset/icon_128x128.png new file mode 100644 index 0000000..363e891 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_128x128.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_128x128@2x.png b/res/cocoa/AppIcon.iconset/icon_128x128@2x.png new file mode 100644 index 0000000..81f40c8 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_128x128@2x.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_16x16.png b/res/cocoa/AppIcon.iconset/icon_16x16.png new file mode 100644 index 0000000..50242e9 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_16x16.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_16x16@2x.png b/res/cocoa/AppIcon.iconset/icon_16x16@2x.png new file mode 100644 index 0000000..d9f276a Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_16x16@2x.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_256x256.png b/res/cocoa/AppIcon.iconset/icon_256x256.png new file mode 100644 index 0000000..2030bf4 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_256x256.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_256x256@2x.png b/res/cocoa/AppIcon.iconset/icon_256x256@2x.png new file mode 100644 index 0000000..a380eb7 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_256x256@2x.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_32x32.png b/res/cocoa/AppIcon.iconset/icon_32x32.png new file mode 100644 index 0000000..60bf2c5 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_32x32.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_32x32@2x.png b/res/cocoa/AppIcon.iconset/icon_32x32@2x.png new file mode 100644 index 0000000..359b341 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_32x32@2x.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_512x512.png b/res/cocoa/AppIcon.iconset/icon_512x512.png new file mode 100644 index 0000000..6dcc757 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_512x512.png differ diff --git a/res/cocoa/AppIcon.iconset/icon_512x512@2x.png b/res/cocoa/AppIcon.iconset/icon_512x512@2x.png new file mode 100644 index 0000000..d451520 Binary files /dev/null and b/res/cocoa/AppIcon.iconset/icon_512x512@2x.png differ diff --git a/res/cocoa/MainMenu.xib b/res/cocoa/MainMenu.xib new file mode 100644 index 0000000..38db0d9 --- /dev/null +++ b/res/cocoa/MainMenu.xib @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/cocoa/SaveFormatAccessory.xib b/res/cocoa/SaveFormatAccessory.xib new file mode 100644 index 0000000..3baf4c6 --- /dev/null +++ b/res/cocoa/SaveFormatAccessory.xib @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/fonts/BitstreamVeraSans-Roman-builtin.ttf b/res/fonts/BitstreamVeraSans-Roman-builtin.ttf new file mode 100644 index 0000000..550fe36 Binary files /dev/null and b/res/fonts/BitstreamVeraSans-Roman-builtin.ttf differ diff --git a/res/fonts/private/0-check-false.png b/res/fonts/private/0-check-false.png new file mode 100644 index 0000000..b9020c3 Binary files /dev/null and b/res/fonts/private/0-check-false.png differ diff --git a/res/fonts/private/1-check-true.png b/res/fonts/private/1-check-true.png new file mode 100644 index 0000000..7f6a42c Binary files /dev/null and b/res/fonts/private/1-check-true.png differ diff --git a/res/fonts/private/2-radio-false.png b/res/fonts/private/2-radio-false.png new file mode 100644 index 0000000..f35d6ee Binary files /dev/null and b/res/fonts/private/2-radio-false.png differ diff --git a/res/fonts/private/3-radio-true.png b/res/fonts/private/3-radio-true.png new file mode 100644 index 0000000..5322f58 Binary files /dev/null and b/res/fonts/private/3-radio-true.png differ diff --git a/res/fonts/private/4-stipple-dot.png b/res/fonts/private/4-stipple-dot.png new file mode 100644 index 0000000..52fc219 Binary files /dev/null and b/res/fonts/private/4-stipple-dot.png differ diff --git a/res/fonts/private/5-stipple-dash-long.png b/res/fonts/private/5-stipple-dash-long.png new file mode 100644 index 0000000..b73853c Binary files /dev/null and b/res/fonts/private/5-stipple-dash-long.png differ diff --git a/res/fonts/private/6-stipple-dash.png b/res/fonts/private/6-stipple-dash.png new file mode 100644 index 0000000..1cec678 Binary files /dev/null and b/res/fonts/private/6-stipple-dash.png differ diff --git a/res/fonts/private/7-stipple-zigzag.png b/res/fonts/private/7-stipple-zigzag.png new file mode 100644 index 0000000..470a7f2 Binary files /dev/null and b/res/fonts/private/7-stipple-zigzag.png differ diff --git a/res/fonts/unicode.lff.gz b/res/fonts/unicode.lff.gz new file mode 100644 index 0000000..2227958 Binary files /dev/null and b/res/fonts/unicode.lff.gz differ diff --git a/res/freedesktop/com.solvespace.SolveSpace.metainfo.xml.in b/res/freedesktop/com.solvespace.SolveSpace.metainfo.xml.in new file mode 100644 index 0000000..9e49ecc --- /dev/null +++ b/res/freedesktop/com.solvespace.SolveSpace.metainfo.xml.in @@ -0,0 +1,129 @@ + + + com.solvespace.SolveSpace + + SolveSpace + A free (GPLv3) parametric 3d CAD tool + + CC0-1.0 + GPL-3.0-or-later + rylie_AT_ryliepavlik.com + The SolveSpace Community, originally by Jonathan Westhues and other authors + + + Graphics + 3DGraphics + Engineering + + +

+ SolveSpace is a free (GPLv3) parametric 2d/3d CAD (computer-aided design) tool. Applications include: +

+
    +
  • Modeling 3d parts — draw with extrudes, revolves/helix, and Boolean operations
  • +
  • Modeling 2d parts — draw the part as a single section, and export; use 3d assembly to verify fit
  • +
  • Modeling 3d-printed parts — export the STL or other triangle mesh expected by most slicers
  • +
  • Preparing 2D CAM data — export 2d vector art for a waterjet machine or laser cutter
  • +
  • Mechanism design — use the constraint solver to simulate planar or spatial linkages
  • +
  • Plane and solid geometry — replace hand-solved trigonometry with a live dimensioned drawing
  • +
+
+ https://solvespace.com + https://github.com/solvespace/solvespace/issues + + @DESKTOP_FILE_NAME@ + + + + Main window with an empty document + https://solvespace.com/pics/window-linux-main.png + + + Property Browser with an empty document + https://solvespace.com/pics/window-linux-property-browser.png + + + Viewing and editing constraints on a model + https://solvespace.com/pics/front-page-pic.png + + + 3D view of a stand made from notched angle iron, from the "ex-stand" project + https://solvespace.com/pics/ex-stand-detail.jpg + + + Dimensioning a 2D sketch for a case for a printed circuit board, from the "ex-case" project + https://solvespace.com/pics/ex-case-outline.png + + + Showing tracing of Chebyshev's linkage, from the "ex-chebyshev" project + https://solvespace.com/pics/ex-chebyshev.png + + + + + application/x-solvespace + + + + + + + +

Major new stable release. Includes new arc and line length ratio and difference + constraints, comments associated with point entities. Adds "exploded view" to sketches, + and support for displaying measurements in "feet-inches". Adds a pitch parameter to + helix extrusions. Allows use of Point and Normal to define a new workplane to sketch in. + Adds live updating of Property Browser while dragging the sketch, and active links for + all points, normals, and vectors in the Property Browser. Adds the ability to link STL + files into a model. Includes a variety of UI improvements. Speeds up complex sketches + by up to 8x and doubles the maximum unknowns.

+
+ https://github.com/solvespace/solvespace/releases/tag/v3.0 +
+ + +

Major new stable release. Includes new intersection boolean operation, + new types of groups, solid model suppression, usability improvements + (especially regarding redundant constraints and automatic constraints), + and more. Also includes performance and scalability improvements.

+
+ https://github.com/solvespace/solvespace/releases/tag/v3.0 +
+ + + +

Second release candidate for the 3.0 stable release.

+
+ https://github.com/solvespace/solvespace/releases/tag/v3.0.rc2 +
+ + + +

First release candidate for the 3.0 stable release.

+
+ https://github.com/solvespace/solvespace/releases/tag/v3.0.rc1 +
+ + + +

Bug-fix release in the 2.x series, fixing some crashes.

+
+ https://github.com/solvespace/solvespace/releases/tag/v2.3 +
+ + + +

Bug-fix release, including performance improvements.

+
+ https://github.com/solvespace/solvespace/releases/tag/v2.2 +
+ + + +

Introduced *nix compatibility, internationalization, technical drawing mode, improved import and export, and other features and fixes.

+
+ https://github.com/solvespace/solvespace/releases/tag/v2.1 +
+
+ +
diff --git a/res/freedesktop/solvespace-16x16.png b/res/freedesktop/solvespace-16x16.png new file mode 100644 index 0000000..2d2b23f Binary files /dev/null and b/res/freedesktop/solvespace-16x16.png differ diff --git a/res/freedesktop/solvespace-24x24.png b/res/freedesktop/solvespace-24x24.png new file mode 100644 index 0000000..7ba03ee Binary files /dev/null and b/res/freedesktop/solvespace-24x24.png differ diff --git a/res/freedesktop/solvespace-32x32.png b/res/freedesktop/solvespace-32x32.png new file mode 100644 index 0000000..a24bf6a Binary files /dev/null and b/res/freedesktop/solvespace-32x32.png differ diff --git a/res/freedesktop/solvespace-48x48.png b/res/freedesktop/solvespace-48x48.png new file mode 100644 index 0000000..cd22c42 Binary files /dev/null and b/res/freedesktop/solvespace-48x48.png differ diff --git a/res/freedesktop/solvespace-flatpak-mime.xml b/res/freedesktop/solvespace-flatpak-mime.xml new file mode 100644 index 0000000..760799d --- /dev/null +++ b/res/freedesktop/solvespace-flatpak-mime.xml @@ -0,0 +1,8 @@ + + + + SolveSpace model + + + + diff --git a/res/freedesktop/solvespace-flatpak.desktop.in b/res/freedesktop/solvespace-flatpak.desktop.in new file mode 100644 index 0000000..f07f293 --- /dev/null +++ b/res/freedesktop/solvespace-flatpak.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=SolveSpace +Comment=A parametric 2d/3d CAD +Exec=${CMAKE_INSTALL_FULL_BINDIR}/solvespace %f +MimeType=application/x-solvespace +Icon=com.solvespace.SolveSpace +Type=Application +Categories=Graphics;3DGraphics;Engineering; +Keywords=parametric;cad;2d;3d; diff --git a/res/freedesktop/solvespace-mime.xml b/res/freedesktop/solvespace-mime.xml new file mode 100644 index 0000000..8ee132c --- /dev/null +++ b/res/freedesktop/solvespace-mime.xml @@ -0,0 +1,8 @@ + + + + SolveSpace model + + + + diff --git a/res/freedesktop/solvespace-scalable.svg b/res/freedesktop/solvespace-scalable.svg new file mode 100644 index 0000000..0d060d1 --- /dev/null +++ b/res/freedesktop/solvespace-scalable.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/res/freedesktop/solvespace-snap.desktop b/res/freedesktop/solvespace-snap.desktop new file mode 100644 index 0000000..7beceb0 --- /dev/null +++ b/res/freedesktop/solvespace-snap.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=SolveSpace +Comment=A parametric 2d/3d CAD +Exec=solvespace %f +MimeType=application/x-solvespace +Icon=${SNAP}/meta/icons/hicolor/scalable/apps/snap.solvespace.svg +Type=Application +Categories=Graphics;3DGraphics;Engineering; +Keywords=parametric;cad;2d;3d; diff --git a/res/freedesktop/solvespace.desktop.in b/res/freedesktop/solvespace.desktop.in new file mode 100644 index 0000000..a8e4db7 --- /dev/null +++ b/res/freedesktop/solvespace.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=SolveSpace +Comment=A parametric 2d/3d CAD +Exec=${CMAKE_INSTALL_FULL_BINDIR}/${SS_EXE} %f +MimeType=application/x-solvespace +Icon=solvespace +Type=Application +Categories=Graphics;3DGraphics;Engineering; +Keywords=parametric;cad;2d;3d; diff --git a/res/freedesktop/solvespace.thumbnailer b/res/freedesktop/solvespace.thumbnailer new file mode 100644 index 0000000..2b84c75 --- /dev/null +++ b/res/freedesktop/solvespace.thumbnailer @@ -0,0 +1,4 @@ +[Thumbnailer Entry] +TryExec=solvespace-cli +Exec=solvespace-cli thumbnail --view isometric --size %sx%s --output %o %i +MimeType=application/x-solvespace diff --git a/res/icons/graphics-window/angle.png b/res/icons/graphics-window/angle.png new file mode 100644 index 0000000..8b82ba3 Binary files /dev/null and b/res/icons/graphics-window/angle.png differ diff --git a/res/icons/graphics-window/arc.png b/res/icons/graphics-window/arc.png new file mode 100644 index 0000000..0acded4 Binary files /dev/null and b/res/icons/graphics-window/arc.png differ diff --git a/res/icons/graphics-window/assemble.png b/res/icons/graphics-window/assemble.png new file mode 100644 index 0000000..8436dcd Binary files /dev/null and b/res/icons/graphics-window/assemble.png differ diff --git a/res/icons/graphics-window/bezier.png b/res/icons/graphics-window/bezier.png new file mode 100644 index 0000000..fd7d438 Binary files /dev/null and b/res/icons/graphics-window/bezier.png differ diff --git a/res/icons/graphics-window/circle.png b/res/icons/graphics-window/circle.png new file mode 100644 index 0000000..6ec2c83 Binary files /dev/null and b/res/icons/graphics-window/circle.png differ diff --git a/res/icons/graphics-window/construction.png b/res/icons/graphics-window/construction.png new file mode 100644 index 0000000..6f48aed Binary files /dev/null and b/res/icons/graphics-window/construction.png differ diff --git a/res/icons/graphics-window/equal.png b/res/icons/graphics-window/equal.png new file mode 100644 index 0000000..ba9053a Binary files /dev/null and b/res/icons/graphics-window/equal.png differ diff --git a/res/icons/graphics-window/extrude.png b/res/icons/graphics-window/extrude.png new file mode 100644 index 0000000..a8eb88b Binary files /dev/null and b/res/icons/graphics-window/extrude.png differ diff --git a/res/icons/graphics-window/helix.png b/res/icons/graphics-window/helix.png new file mode 100644 index 0000000..ac4f509 Binary files /dev/null and b/res/icons/graphics-window/helix.png differ diff --git a/res/icons/graphics-window/horiz.png b/res/icons/graphics-window/horiz.png new file mode 100644 index 0000000..3c23d67 Binary files /dev/null and b/res/icons/graphics-window/horiz.png differ diff --git a/res/icons/graphics-window/image.png b/res/icons/graphics-window/image.png new file mode 100644 index 0000000..5df953a Binary files /dev/null and b/res/icons/graphics-window/image.png differ diff --git a/res/icons/graphics-window/in3d.png b/res/icons/graphics-window/in3d.png new file mode 100644 index 0000000..bf395f6 Binary files /dev/null and b/res/icons/graphics-window/in3d.png differ diff --git a/res/icons/graphics-window/lathe.png b/res/icons/graphics-window/lathe.png new file mode 100644 index 0000000..cb91631 Binary files /dev/null and b/res/icons/graphics-window/lathe.png differ diff --git a/res/icons/graphics-window/length.png b/res/icons/graphics-window/length.png new file mode 100644 index 0000000..552c87c Binary files /dev/null and b/res/icons/graphics-window/length.png differ diff --git a/res/icons/graphics-window/line.png b/res/icons/graphics-window/line.png new file mode 100644 index 0000000..356130f Binary files /dev/null and b/res/icons/graphics-window/line.png differ diff --git a/res/icons/graphics-window/ontoworkplane.png b/res/icons/graphics-window/ontoworkplane.png new file mode 100644 index 0000000..66642a3 Binary files /dev/null and b/res/icons/graphics-window/ontoworkplane.png differ diff --git a/res/icons/graphics-window/other-supp.png b/res/icons/graphics-window/other-supp.png new file mode 100644 index 0000000..a557776 Binary files /dev/null and b/res/icons/graphics-window/other-supp.png differ diff --git a/res/icons/graphics-window/parallel.png b/res/icons/graphics-window/parallel.png new file mode 100644 index 0000000..5f76105 Binary files /dev/null and b/res/icons/graphics-window/parallel.png differ diff --git a/res/icons/graphics-window/perpendicular.png b/res/icons/graphics-window/perpendicular.png new file mode 100644 index 0000000..2127714 Binary files /dev/null and b/res/icons/graphics-window/perpendicular.png differ diff --git a/res/icons/graphics-window/point.png b/res/icons/graphics-window/point.png new file mode 100644 index 0000000..a1a5666 Binary files /dev/null and b/res/icons/graphics-window/point.png differ diff --git a/res/icons/graphics-window/pointonx.png b/res/icons/graphics-window/pointonx.png new file mode 100644 index 0000000..0fa9506 Binary files /dev/null and b/res/icons/graphics-window/pointonx.png differ diff --git a/res/icons/graphics-window/rectangle.png b/res/icons/graphics-window/rectangle.png new file mode 100644 index 0000000..3f9ea7c Binary files /dev/null and b/res/icons/graphics-window/rectangle.png differ diff --git a/res/icons/graphics-window/ref.png b/res/icons/graphics-window/ref.png new file mode 100644 index 0000000..6bc2894 Binary files /dev/null and b/res/icons/graphics-window/ref.png differ diff --git a/res/icons/graphics-window/revolve.png b/res/icons/graphics-window/revolve.png new file mode 100644 index 0000000..0569907 Binary files /dev/null and b/res/icons/graphics-window/revolve.png differ diff --git a/res/icons/graphics-window/same-orientation.png b/res/icons/graphics-window/same-orientation.png new file mode 100644 index 0000000..7223d0c Binary files /dev/null and b/res/icons/graphics-window/same-orientation.png differ diff --git a/res/icons/graphics-window/sketch-in-3d.png b/res/icons/graphics-window/sketch-in-3d.png new file mode 100644 index 0000000..d15a0d3 Binary files /dev/null and b/res/icons/graphics-window/sketch-in-3d.png differ diff --git a/res/icons/graphics-window/sketch-in-plane.png b/res/icons/graphics-window/sketch-in-plane.png new file mode 100644 index 0000000..30c99be Binary files /dev/null and b/res/icons/graphics-window/sketch-in-plane.png differ diff --git a/res/icons/graphics-window/step-rotate.png b/res/icons/graphics-window/step-rotate.png new file mode 100644 index 0000000..a64eae4 Binary files /dev/null and b/res/icons/graphics-window/step-rotate.png differ diff --git a/res/icons/graphics-window/step-translate.png b/res/icons/graphics-window/step-translate.png new file mode 100644 index 0000000..493f853 Binary files /dev/null and b/res/icons/graphics-window/step-translate.png differ diff --git a/res/icons/graphics-window/symmetric.png b/res/icons/graphics-window/symmetric.png new file mode 100644 index 0000000..4192684 Binary files /dev/null and b/res/icons/graphics-window/symmetric.png differ diff --git a/res/icons/graphics-window/tangent-arc.png b/res/icons/graphics-window/tangent-arc.png new file mode 100644 index 0000000..88feddb Binary files /dev/null and b/res/icons/graphics-window/tangent-arc.png differ diff --git a/res/icons/graphics-window/text.png b/res/icons/graphics-window/text.png new file mode 100644 index 0000000..886a80a Binary files /dev/null and b/res/icons/graphics-window/text.png differ diff --git a/res/icons/graphics-window/trim.png b/res/icons/graphics-window/trim.png new file mode 100644 index 0000000..de11e17 Binary files /dev/null and b/res/icons/graphics-window/trim.png differ diff --git a/res/icons/graphics-window/vert.png b/res/icons/graphics-window/vert.png new file mode 100644 index 0000000..996b191 Binary files /dev/null and b/res/icons/graphics-window/vert.png differ diff --git a/res/icons/text-window/constraint-dimo.png b/res/icons/text-window/constraint-dimo.png new file mode 100644 index 0000000..bbe6e22 Binary files /dev/null and b/res/icons/text-window/constraint-dimo.png differ diff --git a/res/icons/text-window/constraint-wo.png b/res/icons/text-window/constraint-wo.png new file mode 100644 index 0000000..c3a445e Binary files /dev/null and b/res/icons/text-window/constraint-wo.png differ diff --git a/res/icons/text-window/constraint.png b/res/icons/text-window/constraint.png new file mode 100644 index 0000000..431ed75 Binary files /dev/null and b/res/icons/text-window/constraint.png differ diff --git a/res/icons/text-window/construction.png b/res/icons/text-window/construction.png new file mode 100644 index 0000000..0ecc9a1 Binary files /dev/null and b/res/icons/text-window/construction.png differ diff --git a/res/icons/text-window/edges.png b/res/icons/text-window/edges.png new file mode 100644 index 0000000..f428de1 Binary files /dev/null and b/res/icons/text-window/edges.png differ diff --git a/res/icons/text-window/faces.png b/res/icons/text-window/faces.png new file mode 100644 index 0000000..57345df Binary files /dev/null and b/res/icons/text-window/faces.png differ diff --git a/res/icons/text-window/mesh.png b/res/icons/text-window/mesh.png new file mode 100644 index 0000000..260b083 Binary files /dev/null and b/res/icons/text-window/mesh.png differ diff --git a/res/icons/text-window/normal.png b/res/icons/text-window/normal.png new file mode 100644 index 0000000..95a8339 Binary files /dev/null and b/res/icons/text-window/normal.png differ diff --git a/res/icons/text-window/occluded-invisible.png b/res/icons/text-window/occluded-invisible.png new file mode 100644 index 0000000..ed35301 Binary files /dev/null and b/res/icons/text-window/occluded-invisible.png differ diff --git a/res/icons/text-window/occluded-stippled.png b/res/icons/text-window/occluded-stippled.png new file mode 100644 index 0000000..04ee458 Binary files /dev/null and b/res/icons/text-window/occluded-stippled.png differ diff --git a/res/icons/text-window/occluded-visible.png b/res/icons/text-window/occluded-visible.png new file mode 100644 index 0000000..23415c3 Binary files /dev/null and b/res/icons/text-window/occluded-visible.png differ diff --git a/res/icons/text-window/outlines.png b/res/icons/text-window/outlines.png new file mode 100644 index 0000000..f947ec7 Binary files /dev/null and b/res/icons/text-window/outlines.png differ diff --git a/res/icons/text-window/point.png b/res/icons/text-window/point.png new file mode 100644 index 0000000..a1a5666 Binary files /dev/null and b/res/icons/text-window/point.png differ diff --git a/res/icons/text-window/shaded.png b/res/icons/text-window/shaded.png new file mode 100644 index 0000000..0dff1ae Binary files /dev/null and b/res/icons/text-window/shaded.png differ diff --git a/res/icons/text-window/workplane.png b/res/icons/text-window/workplane.png new file mode 100644 index 0000000..8e293cd Binary files /dev/null and b/res/icons/text-window/workplane.png differ diff --git a/res/locales.txt b/res/locales.txt new file mode 100644 index 0000000..377d657 --- /dev/null +++ b/res/locales.txt @@ -0,0 +1,12 @@ +# This file lists the ISO locale codes (ISO 639-1/ISO 3166-1), Windows LCIDs, +# and human-readable names for every culture supported by SolveSpace. +cs-CZ,1029,Česky +de-DE,0407,Deutsch +en-US,0409,English (US) +fr-FR,040C,Français +es-AR,2C0A,español (AR) +ru-RU,0419,Русский +tr-TR,041F,Türkçe +uk-UA,0422,Українська +zh-CN,0804,简体中文 +ja-JP,0411,日本語 diff --git a/res/locales/cs_CZ.po b/res/locales/cs_CZ.po new file mode 100644 index 0000000..b0a3e3d --- /dev/null +++ b/res/locales/cs_CZ.po @@ -0,0 +1,2300 @@ +# Czech translations for SolveSpace package. +# Copyright (C) 2022 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# Pavel Stržínek , 2022 +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.1\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2022-06-19 20:16+0200\n" +"Last-Translator: Pavel Stržínek \n" +"Language-Team: none\n" +"Language: cs_CZ\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Kopírování, vkládání a vyjímání je funkční jen v pracovní rovině.\n" +"\n" +"Aktivuj ji přes Náčrt -> V pracovní rovině." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Schránka je prázdná; nic ke vložení." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Je třeba zadat alespoň jednu kopii ke vložení." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "Měřítko nemůže být nulové." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Vyber jeden bod pro určení počátku otočení." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Vyber dva body pro určení vektoru posunutí." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "Transformace je identická. VÅ¡echny kopie budou přesně nad sebou." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "PříliÅ¡ mnoho položek ke vložení; rozděl je a vlož po částech." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Není aktivní žádná pracovní rovina." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Chybný formát: zadej souřadnice jako x, y, z" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Chybný formát: zadej barvu jako r, g, b" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"Faktor perspektivy nebude mít žádný vliv, dokud nezvolíš Pohled -> Použít " +"perspektivní projekci." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Urči počet platných číslic za desetinnou čárkou mezi 0 a %d." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "Měřítko exportu nesmí být nulové!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Posunutí poloměru výřezu nesmí být záporné!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "Chybná hodnota: interval automatického ukládání by měl být kladný" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Chybný formát: zadej interval v celých minutách" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "shoda-bodů" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "vzdálenost-dvou-bodů" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "vzdálenost-bodu-a-úsečky" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "vzdálenost-bodu-a-roviny" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "vzdálenost-bodu-a-stěny" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "proj-vzdálenost-dvou-bodů" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "bod-v-rovině" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "bod-na-přímce" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "bod-na-stěně" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "shodná-délka" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "shodná-délka-a-vzdálenost-bodu-a-úsečky" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "shodná-vzdálenost-bodu-a-úsečky" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "poměr-délky" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "poměr-délky-dvou-oblouků" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "poměr-délky-oblouku-a-úsečky" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "rozdíl-délky" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "rozdíl-délky-dvou-oblouků" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "rozdíl-délky-oblouku-a-úsečky" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "symetrie" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "symetrie-h" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "symetrie-v" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "symetrie-přímka" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "ve-středu" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "horizontála" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "vertikála" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "průměr" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "bod-na-kruhu" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "shodná-orientace" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "úhel" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "rovnoběžnost" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "tečný-oblouk-a-úsečka" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "tečná-splajna-a-úsečka" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "tečné-dvě-křivky" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "kolmost" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "shodný-poloměr" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "shodný-úhel" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "shodná-délka-úsečky-a-oblouku" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "zámek-kam-přetažen" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "komentář" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"Vámi vybraný bod nepatří do oblouku. Oblouk a úsečka " +"nemají společný koncový bod.\n" +"\n" +"Vyberte koncový bod oblouku, ve kterém má být tečný k " +"přímce." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"Oblouk a tečná úsečka musejí mít společný koncový bod. Omez je nejdříve " +"příkazem Omezit -> Na bodě / křivce / ploÅ¡e.\n" +"\n" +"Případně vyberte koncový bod oblouku, ve kterém má být " +"tečný k přímce." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"Vybraný bod není koncovým bodem splajnu. Splajn " +"a úsečka nemají společný koncový bod.\n" +"\n" +"Vyberte koncový bod splajnu, ve kterém má být tečný k " +"přímce." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"Tečný splajn a úsečka musejí mít společný koncový bod. Omez je nejdříve " +"příkazem Omezit -> Na bodě / křivce / ploÅ¡e.\n" +"\n" +"Případně vyberte koncový bod splajnu, ve kterém má být tečný k " +"přímce." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"Vybrané body nejsou koncovými body dvou křivek. Křivky " +"nemají společný koncový bod.\n" +"\n" +"Vyberte koncové body obou křivek, v nichž mají být vůči sobě " +"tečné" + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Křivky musejí mít společný koncový bod. Omez je příkazem Omezit -> V bodě " +"před omezením tečny.\n" +"\n" +"Případně vyberte koncové body obou křivek, v nichž mají být vůči sobě " +"tečné" + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Chybný výběr pro omezení vzdálenosti / průměru. Toto omezení lze použít " +"pro:\n" +"\n" +" * dva body (vzdálenost mezi body)\n" +" * úsečku (délka)\n" +" * dva body a úsečku nebo normálu (promítnutá vzdálenost)\n" +" * pracovní rovinu a bod (minimální vzdálenost)\n" +" * úsečku a bod (minimální vzdálenost)\n" +" * rovinnou plochu a bod (minimální vzdálenost)\n" +" * kružnici nebo oblouk (průměr)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Chybný výběr pro omezení na bod / křivku / rovinu. Toto omezení lze použít " +"pro:\n" +"\n" +" * dva a více bodů (body se shodují)\n" +" * bod a pracovní rovinu (bod v rovině)\n" +" * bod a úsečku (bod na přímce)\n" +" * bod a kružnici nebo oblouk (bod na křivce)\n" +" * bod a jednu až tři rovinné plochy (bod na ploÅ¡e/plochách)\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Chybný výběr pro omezení stejné délky / poloměru. Toto omezení lze použít " +"pro:\n" +"\n" +" * dvě a více úseček (stejné délky)\n" +" * dvě úsečky a dva body (stejné vzdálenosti bodů od úseček)\n" +" * úsečku a dva body (stejné vzdálenosti bodů od přímky)\n" +" * úsečku a bod a úsečku (vzdálenost bodu od přímky se rovná délce)\n" +" * dvě a více kružnic nebo oblouků (stejný poloměr)\n" +" * úsečku a oblouk (délka úsečky se rovná délce oblouku)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Chybný výběr pro omezení poměru délky. Toto omezení lze použít pro:\n" +"\n" +" * dvě úsečky\n" +" * dva oblouky\n" +" * jeden oblouk a jednu úsečku\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Chybný výběr pro omezení rozdílu délek. Toto omezení lze použít pro:\n" +"\n" +" * dvě úsečky\n" +" * dva oblouky\n" +" * jeden oblouk a jednu úsečku\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Chybný výběr pro omezení ve středovém bodě. Toto omezení lze použít pro: \n" +"\n" +" * úsečku a bod (bod ve středovém bodě)\n" +" * úsečku a pracovní rovinu (střed úsečky v rovině)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Chybný výběr pro symetrické omezení. Toto omezení lze použít pro:\n" +"\n" +" * dva body nebo úsečku (symetrickou vůči souřadnicím osy pracovní " +"roviny)\n" +" * úsečku a dva body nebo úsečku (symetrická k úsečce)\n" +" * pracovní rovinu a dva body nebo úsečku (symetrická k pracovní rovině)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Pracovní rovina musí být aktivní, pokud je omezena symetricky bez explicitní " +"symetrické roviny." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Aktivuj pracovní rovinu (pomocí Náčrt -> V pracovní rovině) před použitím " +"omezení horizontály nebo vertikály." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Chybný výběr pro horizontální / vertikální omezení. Toto omezení lze použít " +"pro:\n" +"\n" +" * dva a více bodů\n" +" * jednu a více úseček\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Chybný výběr pro omezení stejné orientace. Toto omezení lze použít pro: \n" +" \n" +" * dvě normály\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Je nutné vybrat omezení úhlu." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "Je nutné vybrat omezení s přiřazeným Å¡títkem." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Chybný výběr pro omezení úhlu. Toto omezení lze použít pro: \n" +"\n" +"Úhel mezi:\n" +" * dvěma úsečkami\n" +" * úsečkou a normálou\n" +" * dvěma normálami\n" +"\n" +"Shodné úhly:\n" +" * čtyři úsečky nebo normály (shodný úhel mezi A,B a C,D)\n" +" * tři úsečky nebo normály (shodný úhel mezi A,B a B,C)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "Tečnost dvou křivek musí být použita v pracovní rovině." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Chybný výběr pro rovnoběžné / tečné omezení. Toto omezení lze použít pro:\n" +" \n" +" * dvě plochy\n" +" * dvě a více úseček (rovnoběžné)\n" +" * jednu a více úseček a jednu a více normál (rovnoběžné)\n" +" * dvě a více normál (rovnoběžné)\n" +" * dvě úsečky, oblouky nebo beziéry, které mají společný koncový bod " +"(tečné)\n" +" * dvě úsečky, oblouky nebo beziéry, které nemají společný koncový bod, a " +"koncový(é) bod(y) křivky(ek) (tečné)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Chybný výběr pro omezení kolmosti. Toto omezení lze použít pro: \n" +"\n" +" * dvě plochy\n" +" * dvě úsečky\n" +" * úsečku a normálu\n" +" * dvě normály\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Chybný výběr pro omezení uzamčení v místě přetažení. Toto omezení lze použít " +"pro: \n" +"\n" +" * bod\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "NOVÝ KOMENTÁŘ -- UPRAVIT DVOJKLIKEM" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "klikni na střed textu komentáře" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"Není přítomen žádný model tělesa; vytvoř model pomocí extruzí a rotací nebo " +"použij Exportovat 2D pohled... pro export prostých čar a křivek." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Chybný výběr části pro export. Vyber prosím:\n" +"\n" +" * nic, s aktivní pracovní rovinou (pracovní rovina je rovina řezu)\n" +" * plochu (rovina řezu procházející plochou)\n" +" * bod a dvě úsečky (rovina procházející bodem a rovnoběžná s přímkami)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Síť aktivní skupiny je prázdná; není co exportovat." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "volné úsečky byly nahrazeny souvislými" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "klikaté úsečky byly nahrazeny souvislými" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Některé prvky výkresu nemají ekvivalent ve formátu DXF a nebyly " +"exportovány:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"Velikost stránky PDF přesahuje 200 x 200 palců; mnoho prohlížečů může tento " +"soubor odmítnout." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "náčrt-v-rovině" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#odkazy" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "Soubor je prázdný. Může být poÅ¡kozený." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Nerozpoznaná data v souboru. Tento soubor může být poÅ¡kozený nebo pochází z " +"novější verze programu." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Chybějící soubor" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "Odkazovaný soubor “%s” není k dispozici." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"ChceÅ¡ jej vyhledat ručně?\n" +"\n" +"Pokud odmítneÅ¡, vÅ¡echny geometrie, které závisí na chybějícím souboru, budou " +"trvale odstraněny." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Ano" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&Ne" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&ZruÅ¡it" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Soubor" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&Nový" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Otevřít..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Otevřít &nedávný" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Uložit" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Uložit &jako..." + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Exportovat &Obrázek..." + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Exportovat 2D &pohled..." + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Exportovat 2D čá&st..." + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Exportovat 3D &drátěný model..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Exportovat &trojúhelníkovou síť (mesh)..." + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Exportovat &povrchy..." + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "&Importovat..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "U&končit" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "Up&ravit" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Zpět" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "Z&novu" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Znovu vÅ¡e &generovat" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Přichytit výběr k &mřížce" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Otočit importované o &90°" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Vyjmou&t" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "&Kopírovat" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "V&ložit" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "Vložit &transformované..." + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "O&dstranit" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Vybrat ř&etězec hran" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "Vybr&at vÅ¡e" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "Zr&uÅ¡it výběr vÅ¡eho" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "Sty&ly čar..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&Projekční pohled..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "Nastave&ní..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&Zobrazení" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "Přiblíž&it" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "&Oddálit" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Přiblížit na &míru" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Zarovnat pohled na pracovní rovinu" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Nejbližší &ortogonální pohled" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Nejbližší &izometrický pohled" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Pohled na střed v bodě" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Zobrazit mřížku přichy&cení" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Ztmavit neaktivní tělesa" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Použít &perspektivní projekci" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Zobrazit &rozbalený pohled" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "&Jednotky rozměru" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Rozměry v &milimetrech" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Rozměry v m&etrech" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Rozměry v &palcích" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Rozměry ve &stopách a palcích" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Zobrazit panel &nástrojů" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Zobrazit ¶metry" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "Na &celou obrazovku" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "&Nová skupina" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "Náčrt ve &3D" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "Náčrt v nové pracovní &rovině" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "Krokový &posun" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "Krokové &otočení" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "Extruze (e&xtrude)" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "Å roubovice (&helix)" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "Plná rotace (&lathe)" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "Volná rotace (re&volve)" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Odkaz / Sestavení..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Odkaz na nedávný" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Náčrt" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "V &pracovní rovině" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "Kdekoliv ve &3D" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "Vztažný &Bod" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "&Pracovní rovina" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "Úsečka" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "Konstrukční úsečka" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Obdélník" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "&Kružnice" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "&Oblouk kružnice" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "&Bézierův kubický splajn" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "&Text v písmu TrueType" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "&Obrázek" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "Přepnout &konstrukci" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Tečný &oblouk v bodě" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Rozdělit kř&ivky v průsečíku" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "Ome&zení" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Vzdálenost / průměr" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Re&ferenční rozměr" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "Úhe&l / shodný úhel" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Refe&renční úhel" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Další doplňkový úh&el" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Přepnout r&eferenční rozměr" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Horizontála" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Vertikála" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&Na bodě / křivce / ploÅ¡e" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "Shodná dél&ka / poloměr" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "Poměr délky / oblo&uku" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Rozdíl &délky / oblouku" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "Ve středové&m bodě" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "S&ymetrie" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Rovno&běžnost / tečna" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "&Kolmost" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Shodná orient&ace" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Uzamčení v místě pře&tažení" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Komentář" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Analyzovat" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "Měření &objemu" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Měření &plochy" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Měření ob&vodu" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Zobrazit kol&idující části" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Zobrazit ob&nažené hrany" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Zobrazit &těžiÅ¡tě" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Zobrazit &nedostatečně omezené body" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "&Trasovat bod" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "&Zastavit trasování..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "&Rozměr kroku..." + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Nápověda" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Jazyk" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Web / Manuál" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "Revize na &GitHubu" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "O &aplikaci" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(žádné nedávné soubory)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "Soubor '%s' neexistuje." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "Žádná pracovní rovina není aktivní, proto nebude mřížka zobrazena." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"Faktor perspektivy je nastaven na nulu, proto bude pohled vždy rovnoběžnou " +"projekcí.\n" +"\n" +"Pro perspektivní projekci uprav faktor perspektivy v konfigurační obrazovce. " +"Typická hodnota je kolem 0,3." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "Vyber bod; tento bod se stane středem pohledu na obrazovce." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "Žádné další entity nesdílejí koncové body s vybranými entitami." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"ChceÅ¡-li použít tento příkaz, vyber bod nebo jinou entitu z propojené části " +"nebo vyber skupinu propojení jako aktivní skupinu." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"Žádná pracovní rovina není aktivní. Aktivuj pracovní rovinu (pomocí Náčrt -> " +"V pracovní rovině) pro nastavení roviny přichytávání na mřížku." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Tyto položky nelze přichytit k mřížce; vyber body, textové komentáře nebo " +"omezení se Å¡títkem. ChceÅ¡-li přichytit úsečku, vyber její koncové body." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"Není vybrána žádná pracovní rovina. Aktivuji výchozí pracovní rovinu pro " +"tuto skupinu." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"Není vybrána žádná pracovní rovina a aktivní skupina nemá výchozí pracovní " +"rovinu přiřazenu. Zkus vybrat pracovní rovinu nebo aktivovat skupinu náčrt-v-" +"rovině." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Chybný výběr tečného oblouku v bodě. Vyber jeden bod nebo výběr zruÅ¡ pro " +"nastavení parametrů oblouku." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "klikni na bod oblouku (kresleno proti směru hodinových ručiček)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "klikni pro umístění vztažného bodu" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "klikni na první bod úsečky" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "klikni na první bod konstrukční úsečky" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "klikni na první bod segmentu splajnu" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "klikni na střed kružnice" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "klikni na počátek pracovní roviny" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "klikni na jeden roh obdélníku" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "klikni na levý horní roh textu" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "klikni na levý horní roh obrázku" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"Nejsou vybrány žádné entity. Před přepnutím stavu konstrukce nějaké entity " +"vyber." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "náčrt-ve-3D" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Chybný výběr nového náčrtu v pracovním plánu. Tuto skupinu lze vytvořit " +"pomocí:\n" +"\n" +" * bodu (přes bod, kolmo na souřadnicové osy)\n" +" * bodu a dvou úseček (procházející bodem, rovnoběžná s přímkami)\n" +" * bodu a normály (procházející bodem, kolmá na normálu)\n" +" * pracovní roviny (kopie pracovní roviny)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Před extruzí aktivuj pracovní rovinu (Náčrt -> V pracovní rovině). Náčrt " +"bude extrudován ve směru normály k pracovní rovině." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "extruze" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "Operace plné rotace lze použít pouze na rovinné náčrty.." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Chybný výběr pro novou skupinu plné rotace. Tuto skupinu lze vytvořit " +"pomocí:\n" +"\n" +" * bodu a úsečky nebo normály (rotací kolem osy rovnoběžné k přímce / " +"normále, procházející bodem)\n" +" * úsečky (rotací kolem úsečky)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "plná-rotace" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "Operaci volné rotace lze použít pouze na rovinné náčrty." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Chybný výběr pro novou skupinu volné rotace. Tuto skupinu lze vytvořit " +"pomocí:\n" +"\n" +" * bodu a úsečky nebo normály (rotace kolem osy rovnoběžné s přímkou / " +"normálou, procházející bodem)\n" +" * úsečky (rotace kolem úsečky)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "volná-rotace" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "Operaci Å¡roubovice lze použít pouze na rovinné náčrty." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Chybný výběr pro novou skupinu Å¡roubovice. Tuto skupinu lze vytvořit " +"pomocí:\n" +"\n" +" * bodu a úsečky nebo normály (rotací kolem osy rovnoběžné k přímce / " +"normále, procházející bodem)\n" +" * úsečky (rotací kolem úsečky)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "Å¡roubovice" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Chybný výběr pro nové krokové otočení. Tuto skupinu lze vytvořit pomocí:\n" +"\n" +" * bodu, přičemž je uzamčen v pracovní rovině (otočení v rovině, kolem " +"tohoto bodu)\n" +" * bodu a úsečky nebo normály (otočení kolem osy procházející bodem a " +"rovnoběžně s přímkou / normálou)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "otočení" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "posun" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(nepojmenované)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "Obrys není uzavřený nebo není celý v jednotném stylu!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "Ne vÅ¡echny body jsou v rovině!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "Obrys se sám protíná!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "Nulová délka hrany!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Textové soubory STL nejsou v této chvíli podporovány." + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "Pro vytvoření tečného oblouku je nutné kreslit v pracovní rovině." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"ChceÅ¡-li vytvořit tečný oblouk, vyber bod, kde se s pracovní rovinou stýkají " +"dvě nekonstrukční úsečky nebo kružnice v této skupině." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Tento roh nelze zaoblit. Zkus menší poloměr nebo zkus vytvořit požadovanou " +"geometrii ručně pomocí tečných omezení." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" +"Tuto entitu se nepodařilo rozdělit; pouze úsečky, kružnice nebo splajny." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "Rozdělení lze provést pouze při náčrtu v pracovní rovině." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Vyber dvě entity, které se vzájemně protínají (např. dvě čáry / kružnice / " +"oblouky nebo úsečka / kružnice / oblouk a bod)." + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Nelze rozdělit, nebyla nalezena žádná průsečnice." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Přiřadit ke stylu" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Žádný styl" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Nově vytvořený vlastní styl..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Info o skupině" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Info o stylu" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Vybrat řetězec hran" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Přepnout referenční rozměr" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Další doplňkový úhel" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Přichytit k mřížce" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Odebrat bod splajnu" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Přidat bod splajnu" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "Nelze přidat bod splajnu: bylo dosaženo maximálního počtu bodů." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Přepnout konstrukci" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Odstranit omezení kolidujícího bodu" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Vyjmout" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Kopírovat" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Vybrat vÅ¡e" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Vložit" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Vložit transformované..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Odstranit" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "ZruÅ¡it výběr vÅ¡eho" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "ZruÅ¡it výběr při najetí" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Přiblížit na míru" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "klikni na další bod úsečky nebo stiskni klávesu Esc" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Nelze nakreslit obdélník ve 3D; nejprve aktivuj pracovní rovinu pomocí Náčrt " +"-> V pracovní rovině." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "kliknutím umísti další roh obdélníku" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "kliknutím nastav poloměr" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Nelze nakreslit oblouk ve 3D; nejprve aktivuj pracovní rovinu pomocí Náčrt -" +"> V pracovní rovině." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "kliknutím umísti bod" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "klikni na další bod splajnu nebo stiskni Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Kreslení v pracovní rovině již probíhá; před vytvořením nové pracovní roviny " +"kresli ve 3D." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Nelze kreslit text ve 3D; nejprve aktivuj pracovní rovinu pomocí Náčrt -> V " +"pracovní rovině." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "klikni pro umístění pravého dolního rohu textu" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Nelze nakreslit obrázek ve 3d; nejprve aktivuj pracovní rovinu pomocí Náčrt -" +"> V pracovní rovině." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpace modely" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "VÅ E" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF deska ploÅ¡ných spojů" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL trojúhelníková síť" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG obrázek" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL síť (mesh)" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ síť (mesh)" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js-compatibilní síť (mesh), s prohlížečem" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js-compatibilní síť (mesh), bez prohlížeče" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML textový soubor" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP soubor" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF soubor" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "Zapouzdřený PostScript" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "SVG soubor" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF soubor (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL soubor" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G kód (G Code)" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF a DWG soubory" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "CSV soubor" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "nepojmenovaný" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Uložit soubor" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Otevřít soubor" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_ZruÅ¡it" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Uložit" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Otevřít" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Dostupné automatické ukládání" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Pro tento náčrt je k dispozici automatické ukládání souboru." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "ChceÅ¡ místo toho načíst automaticky uložený soubor?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Načíst automaticky uložený" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "&Nenačítat" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Upravený soubor" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "ChceÅ¡ uložit změny, které jsi provedl v náčrtu “%s”?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "ChceÅ¡ provedené změny uložit do nového náčrtu?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Pokud změny neuložíš, budou ztraceny." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Uložit" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "&Neukládat" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(nový náčrt)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Parametry" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Omezení jsou aktuálně zobrazena a budou exportována do cesty nástroje. To " +"pravděpodobně není to, co chceÅ¡; skryj je kliknutím na odkaz v horní části " +"textového okna." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"Nelze určit typ souboru podle přípony názvu souboru '%s'; zkus .dxf nebo ." +"dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "Omezení musí mít popisek a nesmí být referenčním rozměrem." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "Chybný výběr rozměru kroku; vyber omezení." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "V pořádku, sestava se nepřekrývá." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"Objem modelu tělesa je:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"Objem aktuální mesh skupiny je:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Zakřivené plochy byly aproximovány jako trojúhelníky.\n" +"To přináší chybu, obvykle kolem 1%%." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Plocha vybraných stěn je:\n" +"\n" +" %s\n" +"\n" +"Křivky byly aproximovány jako po částech lineární.\n" +"To přináší chybu, obvykle kolem 1%%." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Tato skupina neobsahuje správně vytvořenou uzavřenou 2D oblast. Je otevřená, " +"není koplanární ani se neprotíná." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Plocha regionu zakresleného v této skupině je:\n" +"\n" +" %s\n" +"\n" +"Křivky byly aproximovány jako po částech lineární.\n" +"To přináší chybu, obvykle kolem 1%%." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Celková délka vybraných entit je:\n" +"\n" +" %s\n" +"\n" +"Křivky byly aproximovány jako po částech lineární.\n" +"To přináší chybu, obvykle kolem 1%%." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "Chybný výběr obvodu; vyber úsečky, oblouky a křivky." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Chybný výběr pro trasování; vyber jeden bod." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "Nelze zapisovat do '%s'" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "Síť se sama protíná (NENÍ v pořádku, je neplatná)." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "Síť se sama neprotíná (je v pořádku, je platná)." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "Síť má obnažené hrany (NENÍ v pořádku, je neplatná)." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "Síť je vodotěsná (je v pořádku, je platná)." + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"Model obsahuje %d trojúhelníků z %d povrchů." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Žádné problematické hrany, v pořádku.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Chyba, počet problematických hran: %d.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Toto je SolveSpace verze %s.\n" +"\n" +"Další informace naleznete na adrese http://solvespace.com/\n" +"\n" +"SolveSpace je svobodný software: můžete jej svobodně upravovat\n" +"a/nebo jej šířit za podmínek GNU\n" +"General Public License (GPL) verze 3 nebo novější.\n" +"\n" +"V rozsahu povoleném zákonem není poskytována ŽÁDNÁ ZÁRUKA.\n" +"Podrobnosti najdete na adrese http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues a další autoři.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Nelze přiřadit styl entitě, která je odvozena od jiné entity; zkus přiřadit " +"styl nadřazené entitě." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Název stylu nemůže být prázdný" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "Nelze opakovat méně než 1krát." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "Nelze opakovat více než 999krát." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Název skupiny nemůže být prázdný" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "Neprůhlednost musí být mezi nulou a jedničkou." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Poloměr nemůže být nulový nebo záporný." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Náčrt úsečky" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Náčrt obdélníku" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Náčrt kružnice" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Náčrt oblouku kružnice" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Náčrt křivek z textu v písmu TrueType" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Náčrt obrázku ze souboru" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Vytvořit tečný oblouk ve vybraném bodě" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Náčrt kubického Bézierova splajnu" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Náčrt vztažného bodu" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Přepnout konstrukci" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Rozdělení úseček / křivek v místě jejich průsečíku" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Omezení vzdálenosti / průměru / délky" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Omezení úhlu" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Omezení horizontály" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Omezení vertikály" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Omezení rovnoběžnosti nebo tečny" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Omezení kolmosti" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Omezení bodu na přímce / křivce / rovině / bodu" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Omezení symetrie" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Omezení shodné délky / poloměru / úhlu" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Omezení normál se stejnou orientací" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Další doplňkový úhel" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Přepnout referenční rozměr" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Nová skupina extruzí aktivního náčrtu" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Nová skupina plnou rotací aktivního náčrtu" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Nová skupina Å¡roubovicí aktivního náčrtu" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Nová skupina volnou rotací aktivního náčrtu" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Nová skupina krokovým otočením" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Nová skupina krokovým posunem" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "Nová skupina v pracovní rovině (přes dané entity)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "Nová skupina ve 3D" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Nová skupina odkazem / sestavením souboru" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Nejbližší isometrický pohled" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Zarovnat pohled na aktivní pracovní rovinu" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Chyba" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Zpráva" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&OK" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "Měřítko nemůže být nulové nebo záporné." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Chybný formát: zadej x, y, z" diff --git a/res/locales/de_DE.po b/res/locales/de_DE.po new file mode 100644 index 0000000..ab509c3 --- /dev/null +++ b/res/locales/de_DE.po @@ -0,0 +1,2617 @@ +# German translations for the SolveSpace package. +# Copyright (C) 2018 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# Guido Hoss , 2018. #zanata +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2022-04-30 16:44+0200\n" +"Last-Translator: Reini Urban \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.4.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Ausschneiden, Einfügen und Kopieren sind nur in einer Arbeitsebene " +"zulässig.\n" +"\n" +"Aktivieren Sie eine mit \"Skizze -> In Arbeitsebene\"." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Zwischenablage ist leer; es gibt nichts einzufügen." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Die Anzahl der einzufügenden Kopien muss mind. 1 sein." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "Maßstab kann nicht Null sein." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Wählen Sie einen Punkt, um den Drehmittelpunkt zu definieren." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Wählen Sie zwei Punkte, um den Verschiebungsvektor zu definieren." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "" +"Die Transformation ist die Identität. Alle Kopien werden deckungsgleich " +"übereinanderliegen." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "" +"Zuviele Objekte zum Einfügen; teilen Sie diese in kleinere " +"Einfügeoperationen auf." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Es ist keine Arbeitsebene aktiv." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Ungültiges Format: geben Sie Koordinaten als x, y, z an" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Ungültiges Format: geben Sie Farben als r, g, b an" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"Der Perspektivfaktor wird sich nicht auswirken, bis Sie Ansicht -> " +"Perspektive Projektion aktivieren." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Geben Sie 0 bis %d Ziffern nach dem Dezimalzeichen an." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "Der Exportmaßstab darf nicht Null sein!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Der Werkzeugradialabstand darf nicht negativ sein!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "" +"Ungültiger Wert: Interval für automatisches Speichern muss positiv sein" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Ungültiges Format: geben Sie das Interval in ganzen Minuten an" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "Pkt-Deckung" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "Pkt-Pkt-Abstand" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "Pkt-Linie-Abstand" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "Pkt-Ebene-Abstand" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "Pkt-Fläche-Abstand" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "Proj-Pkt-Pkt-Abstand" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "Pkt-in-Ebene" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "Pkt-auf-Linie" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "Pkt-auf-Fläche" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "gl-Länge" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "gl-Länge-und-Pkt-Linie-Abstand" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "gl-Pkt-Linie-Abstände" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "Längenverhältnis" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "Bogen-Bogen-Längenverhältnis" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "Bogen-Linien-Längenverhältnis" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "Längendifferenz" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "Bogen-Bogen-Längendifferenz" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "Bogen-Linien-Längendifferenz" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "Symmetrisch" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "Symmetrisch-H" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "Symmetrisch-V" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "Symmetrisch-Linie" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "auf-Mittelpunkt" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "Horizontal" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "Vertikal" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "Durchmesser" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "Pkt-auf-Kreis" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "gl-Orientierung" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "Winkel" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "Parallel" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "Bogen-Linie-Tangente" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "Kub-Linie-Tangente" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "Kurve-Kurve-Tangente" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "Rechtwinklig" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "gl-Radius" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "gl-Winkel" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "gl-Linie-Länge-Bogen-Länge" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "Fix-an-Position" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "Kommentar" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"Der ausgewählte Punkt gehört nicht zum Bogen. Der Bogen und das " +"Liniensegment haben keinen gemeinsamen Endpunkt.\n" +"\n" +"Wählen Sie den Endpunkt des Bogens aus, an dem Sie ihn tangential zur Linie " +"anpassen möchten." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"Die Bogentangente und das Liniensegment müssen einen gemeinsamen Endpunkt " +"haben. Schränken Sie mit \"Einschränkung / Auf Punkt\" ein, bevor Sie die " +"Tangente einschränken.\n" +"\n" +"Alternativ können Sie den Endpunkt des Bogens auswählen, an dem Sie die " +"Tangente an die Linie anpassen möchten." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"Der ausgewählte Punkt ist kein Endpunkt der kubischen Spline. Die Spline und " +"das Liniensegment haben keinen gemeinsamen Endpunkt.\n" +"\n" +"Wählen Sie den Endpunkt der Spline aus, an dem Sie sie tangential zur Linie " +"anpassen möchten." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"Die Kurventangente und das Liniensegment müssen einen gemeinsamen Endpunkt " +"haben. Schränken Sie mit \"Einschränkung / Auf Punkt\" ein, bevor Sie die " +"Tangente einschränken.\n" +"\n" +"Alternativ können Sie den Endpunkt der kubischen Spline auswählen, an dem " +"Sie die Tangente an die Linie anpassen möchten." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"Die ausgewählten Punkte sind keine Endpunkte der beiden Kurven. Die Kurven " +"haben keinen gemeinsamen Endpunkt.\n" +"\n" +"Wählen Sie die Endpunkte beider Kurven aus, an denen Sie sie tangential " +"zueinander anpassen möchten." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Die Kurven müssen einen gemeinsamen Endpunkt haben. Schränken Sie mit " +"\"Einschränkung / Auf Punkt\" ein, bevor Sie die Tangente einschränken.\n" +"\n" +"Alternativ können Sie die Endpunkte beider Kurven auswählen, an denen Sie " +"sie tangential zueinander anpassen möchten." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Ungültige Auswahl für Einschränkung Abstand / Durchmesser Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei Punkte [Abstand zwischen Punkten]\n" +" * ein Liniensegment [Länge]\n" +" * zwei Punkte und ein Liniensegment oder Normale [projizierter Abstand]\n" +" * eine Arbeitsebene und ein Punkt [minimaler Abstand] \n" +" * ein Liniensegment und ein Punkt [minimaler Abstand]\n" +" * eine Seitenfläche und ein Punkt [minimaler Abstand]\n" +" * ein Kreis oder ein Bogen [Durchmesser]\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Auf Punkt / Kurve / Ebene\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei oder mehr Punkte [deckungsgleich]\n" +" * einen Punkt und eine Arbeitsebene [Punkt auf Ebene]\n" +" * einen Punkt und ein Liniensegment [Punkt auf Linie]\n" +" * einen Punkt und einen Kreis oder Bogen [Punkt auf Kurve]\n" +" * einen Punkt und ein bis drei Seitenflächen [Punkt auf Fläche]\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"gleicher Abstand / Radius\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei oder mehr Liniensegmente [gleiche Länge]\n" +" * zwei Liniensegmente und zwei Punkte [gleiche Punkt-Linien-Abstände]\n" +" * ein Liniensegment und zwei Punkte [gleiche Punkt-Linien-Abstände]\n" +" * ein Liniensegment und ein Punkt oder Liniensegment [Abstand Punkt-" +"Linie gleich Länge]\n" +" * zwei oder mehr Kreise oder Bögen [gleicher Radius]\n" +" * ein Liniensegment und ein Bogen [Länge des Liniensegments gleich " +"Bogenlänge]\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Längenverhältnis\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei Liniensegmente\n" +" * zwei Bögen\n" +" * einen Bogen und ein Liniensegment\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Längendifferenz\". Diese Einschränkung " +"ist anwendbar auf:\n" +"\n" +" * zwei Liniensegmente\n" +" * zwei Bögen\n" +" * einen Bogen und ein Liniensegment\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Mittelpunkt\". Diese Einschränkung ist " +"anwendbar auf:\n" +"\n" +" * ein Liniensegment und ein Punkt [Punkt auf Mittelpunkt]\n" +" * ein Liniensegment und eine Arbeitsebene [Mittelpunkt der Linie auf " +"Ebene]\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Symmetrisch\". Diese Einschränkung ist " +"anwendbar auf:\n" +"\n" +" * zwei Punkte oder ein Liniensegment [symmetrisch zu Koordinatenachse " +"der Arbeitsebene]\n" +" * ein Liniensegment und zwei Punkte oder ein Liniensegment [symmetrisch " +"zu Liniensegment]\n" +" * eine Arbeitsebene und zwei Punkte oder ein Liniensegment [symmetrisch " +"zu Arbeitsebene]\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Eine Arbeitsebene muss aktiv sein, um die Symmetrie ohne explizite " +"Symmetrieebene einzuschränken." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Aktivieren Sie eine Arbeitsebene (mit Skizze -> In Arbeitsebene), bevor Sie " +"horizontal oder vertikal einschränken." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"horizontal / vertikal\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei oder mehr Punkte\n" +" * ein oder mehr Liniensegmente\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"gleiche Orientierung\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei Normale\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Sie müssen einen eingeschränkten Winkel auswählen." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "Sie müssen eine Einschränkung mit zugeordneter Kennzeichnung angeben." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Winkel\". Diese Einschränkung ist " +"anwendbar auf:\n" +"\n" +"Winkel zwischen:\n" +" * zwei Liniensegmente\n" +" * ein Liniensegment und eine Normale\n" +" * zwei Normale\n" +"\n" +"Gleicher Winkel:\n" +" * vier Liniensegmente oder Normale [gleicher Winkel zwischen A,B und C," +"D]\n" +" * drei Liniensegmente oder Normale [gleicher Winkel zwischen A,B und B," +"C]\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "" +"Die Kurven-Kurven-Tangente muss in der Arbeitsebene eingeschränkt werden." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Parallel / Tangente\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * zwei Flächen\n" +" * zwei oder mehr Liniensegmente [parallel]\n" +" * ein oder mehr Liniensegmente und eine oder mehr Normalen [parallel]\n" +" * zwei oder mehr Normalen [parallel]\n" +" * zwei Liniensegmente, Bögen oder Beziers mit gemeinsamem Endpunkt " +"[Tangente]\n" +" * zwei Liniensegmente, Bögen oder Beziers ohne gemeinsamen Endpunkt und " +"die Endpunkte der Kurve(n) [Tangente]\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Rechtwinklig\". Diese Einschränkung " +"ist anwendbar auf:\n" +"\n" +" * zwei Flächen\n" +" * zwei Liniensegmente\n" +" * ein Liniensegment und eine Normale\n" +" * zwei Normale\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Ungültige Auswahl für Einschränkung \"Punkt an Position\". Diese " +"Einschränkung ist anwendbar auf:\n" +"\n" +" * einen Punkt\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "NEUER KOMMENTAR -- DOPPELKLICKEN ZUM BEARBEITEN" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "Klicken Sie auf die Mitte des Kommentartextes" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"Kein Festkörper vorhanden; zeichnen Sie eines mit Extrusionen und Drehungen, " +"oder exportieren Sie bloße Linien und Kurven mit \"2D-Ansicht exportieren\"." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Ungültige Auswahl für teilweisen Export. Bitte wählen Sie aus:\n" +"\n" +" * nichts, mit einer aktiven Arbeitsebene [Arbeitsebene ist " +"Schnittebene]\n" +" * eine Seitenfläche [Schnittebene durch Seitenfläche]\n" +" * einen Punkt und zwei Liniensegmente [Schnittebene durch Punkt und " +"parallel zu Linien]\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Das Netz der aktiven Gruppe ist leer; es gibt nichts zu exportieren." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "Freihandlinien wurden mit durchgehenden Linien ersetzt" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "Zickzacklinien wurden mit durchgehenden Linien ersetzt" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Teile der Zeichnung haben keine Entsprechung in DXF und wurden nicht " +"exportiert:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"Die PDF-Seitengröße überschreitet 200 x 200 Zoll; die Datei kann u.U. in " +"vielen Programmen nicht geöffnet werden." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "Skizze-in-Ebene" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#Referenzen" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "Die Datei ist leer. Es kann beschädigt sein." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Nicht erkannte Daten in der Datei. Diese Datei könnte beschädigt sein oder " +"von einer neueren Version des Programms stammen." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Fehlende Datei" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "Die verlinkte Datei “%s” fehlt." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"Möchten Sie sie selber auswählen?\n" +"Falls Sie ablehnen, wird jegliche mit der fehlenden Datei verknüpfte " +"Geometrie verworfen." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Ja" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&Nein" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&Abbrechen" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Datei" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&Neu" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Öffnen..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Öffne &letzte" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Speichern" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Speichern &Als…" + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Exportiere &Bild…" + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Exportiere 2D-Ansicht…" + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Exportiere 2D-Auswahl…" + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Exportiere 3D-Drahtgittermodell..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Exportiere Dreiecksnetz…" + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Exportiere Oberflächen…" + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "Im&portiere…" + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "Beenden" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "&Bearbeiten" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Rückgängig machen" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Wiederholen" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Alles &neu zeichnen" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Auswahl auf &Raster ausrichten" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Importierte Objekte &90° drehen" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Ausschneiden" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "Kopieren" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "Einfügen" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "&Transformiert einfügen…" + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Löschen" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "&Kantenverlauf auswählen" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "&Alle auswählen" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "Alle &deselektieren" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "&Linien Stile..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "An&sichts Projektion..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "&Einstellungen..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "Ansicht" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "Zoom größer" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "Zoom kleiner" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Zoom anpassen" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Ansicht auf Arbeitsebene ausrichten" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Nächste Ortho-Ansicht" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Nächste isometrische Ansicht" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "Ansicht auf Punkt zentrieren" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Arbeitsraster anzeigen" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Dunklere inaktive Festkörper" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Perspektivische Projektion" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Zeige e&xplodierte Ansicht" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "Maßeinheit" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Maße in Millimeter" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Masse in M&etern" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Maße in Zoll" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Maße in &Fuß und Inch" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Werkzeugleiste anzeigen" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Attributbrowser anzeigen" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "Vollbildschirm" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "Neue Gruppe" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "In 3D skizzieren" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "In neuer Arbeitsebene skizzieren" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "Kopieren und verschieben" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "Kopieren und drehen" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "E&xtrudieren" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "&Helix" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "R&otieren" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "D&rehen" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Verknüpfen / Zusammensetzen..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Letzte verknüpfen" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Skizze" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "In Arbeitsebene" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "Im 3D-Raum" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "Bezugspunkt" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "Arbeits&ebene" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "&Linie" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "K&onstruktionslinie" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Rechteck" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "&Kreis" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "Kreisbogen" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "Kubischer &Bezier-Spline" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "&Text in Truetype-Font" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "B&ild" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "Konstruktionselement an/aus" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Bogentangente an Punkt" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Kurven im Schnittpunkt trennen" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Einschränkung" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "Abstand / Durchmesser" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Referenzangabe" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "Winkel / Gleicher Winkel" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Referenzwinkel" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Komplementärwinkel" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Referenzangabe ein/aus" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "Horizontal" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Vertikal" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "Auf Punkt / Kurve / Ebene" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "Gleicher Abstand / Radius" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "Länge / Bogen Verhäl&tnis" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Länge / Bogen Diff&erenz" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "Auf &Mittelpunkt" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "Symmetrisch" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Paral&llel / Tangente" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "Rechtwinklig" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Gleiche Orientierung" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Punkt an Position fixieren" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Kommentar" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Analyse" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "&Volumen bestimmen" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Fläche bestimmen" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Umfang bestimmen" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Überlagernde Teile anzeigen" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Freiliegende Kanten anzeigen" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Massenmittelpunkt anzeigen" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "&Unterbeschränkte Punkte anzeigen" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "Punkt nachzeichnen" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "Nachzeichnen beenden..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "Schrittgröße…" + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Hilfe" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "Sprache" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Website / Anleitung" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "&Gehe zu GitHub commit" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "Über" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(keine vorhergehenden Dateien)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "Datei '%s' existiert nicht." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "" +"Das Raster wird nicht angezeigt, weil keine Arbeitsebene ausgewählt ist." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"Der Perspektivfaktor is auf Null gesetzt, also wird die Ansicht eine " +"Parallelprojektion sein.\n" +"\n" +"Ändern Sie den Faktor für die Perspektivprojektion in der " +"Konfigurationsmaske. Ein typischer Wert ist ca. 0,3." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "" +"Wählen Sie einen Punkt aus; dieser Punkt wird im Mittelpunkt der " +"Bildschirmansicht sein." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "" +"Die ausgewählten Objekte teilen keine gemeinsamen Endpunkte mit anderen " +"Objekten." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"Für diesen Befehl wählen Sie einen Punkt oder ein anderes Objekt von einem " +"verknüpften Teil aus, oder aktivieren Sie eine verknüpfte Gruppe." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"Es wurde keine Arbeitsebene ausgewählt. Aktivieren Sie eine Arbeitsebene " +"(mit Skizze -> In Arbeitsebene), um die Ebene für das Gitterraster zu " +"definieren." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Diese Objekte können nicht auf das Raster ausgerichtet werden. Dies geht nur " +"für Punkte, Textkommentare, oder Einschränkungen mit einer Bezeichnung. Um " +"eine Linie auf das Raster auszurichten, wählen Sie deren Endpunkte aus." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"Es wurde keine Arbeitsebene ausgewählt. Die Standard-Arbeitsebene für diese " +"Gruppe wird aktiviert." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"Es wurde keine Arbeitsebene ausgewählt, und die aktive Gruppe hat keine " +"standardmäßige Arbeitsebene. Wählen Sie eine Arbeitsebene aus, oder " +"erstellen Sie eine Gruppe in einer neuen Arbeitsebene." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Ungültige Auswahl für Bogentangente an Punkt. Wählen Sie einen einzelnen " +"Punkt. Um die Bogenparameter anzugeben, wählen Sie nichts aus." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "" +"Erstellen Sie einen Punkt auf dem Bogen (zeichnet im Gegenuhrzeigersinn)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "Klicken Sie, um einen Bezugspunkt zu platzieren" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "Klicken Sie auf den ersten Punkt des Liniensegments" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "Klicken Sie auf den ersten Punkt der Konstruktionslinie" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "Klicken Sie auf den ersten Punkt der kubischen Linie" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "Klicken Sie auf den Kreismittelpunkt" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "Klicken Sie auf den Ursprungspunkt der Arbeitsebene" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "Klicken Sie auf eine Ecke des Rechtecks" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "Klicken Sie auf die obere linke Ecke des Texts" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "Klicken Sie auf die obere linke Ecke des Bilds" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"Es wurden keine Objekte ausgewählt Wählen Sie Objekte aus, bevor Sie sie von/" +"zu Konstruktionsmerkmalen umwandeln." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "Skizze-in-3D" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Ungültige Auswahl für neue Skizze in der Arbeitsebene. Diese Gruppe kann " +"erstellt werden mit:\n" +"\n" +" * einem Punkt (durch den Punkt, orthogonal zur Koordinatenachse)\n" +" * einem Punkt und zwei Linienabschnitten (durch den Punkt, parallel zu " +"den Linien)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Aktivieren Sie vor der Extrusion eine Arbeitsebene (mit Skizze -> In " +"Arbeitsebene). Die Skizze wird senkrecht zur Arbeitsebene extrudiert." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "Extrusion" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "Rotieren kann nur mit planaren Skizzen ausgeführt werden." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Ungültige Auswahl für neue Gruppe mit Drehquerschnitt. Diese Gruppe kann " +"erstellt werden mit:\n" +"\n" +" * einem Punkt und einem Liniensegment oder einer Normale (Drehung um " +"eine Achse parallel zur Linie/Normalen, durch den Punkt)\n" +" * einem Liniensegment (Drehung um das Liniensegment)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "Drehung" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "Revolve kann nur mit planaren Skizzen ausgeführt werden." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Ungültige Auswahl für eine neue Revolve Gruppe. Diese Gruppe kann erzeugt " +"werden mit:\n" +"\n" +" * einem Punkt und einem Liniensegment oder Normale (gedreht um eine " +"Achse parallel zu Linie / Normale, durch Punkt)\n" +" * einem Liniensegment (gedreht um Liniensegment)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "Revolve" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "Helix kann nur mit planaren Skizzen ausgeführt werden." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Ungültige Auswahl für eine neue Helix Gruppe. Diese Gruppe kann erzeugt " +"werden mit:\n" +"\n" +" * einem Punkt und einem Liniensegment oder Normale (gedreht um eine " +"Achse parallel zu Linie / Normale, durch Punkt)\n" +" * einem Liniensegment (gedreht um Liniensegment)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "Helix" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Ungültige Auswahl für neue Rotation. Diese Gruppe kann erstellt werden mit:\n" +"\n" +" * einem Punkt in vorgegebener Arbeitsebene (gedreht in der Ebene um den " +"Punkt)\n" +" * einem Punkt und einer Linie oder einer Normale (gedreht um eine Achse " +"durch den Punkt, parallel zur Linie / Normale)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "Drehen" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "Versetzen" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "unbenannt" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "Kontur nicht geschlossen, oder kein einheitlicher Linientyp!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "Punkte sind nicht alle koplanar!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "Kontur überschneidet sich selbst!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "Kante mit Länge Null!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Text-formatierte STL Dateien werden aktuell nicht unterstützt" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "Eine Bogentangente kann nur in einer Arbeitsebene erstellt werden." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"Um eine Bogentangente zu erstellen, wählen Sie einen Punkt, in dem sich zwei " +"nicht-Konstruktionslinien oder -kreise in dieser Gruppe und Arbeitsebene " +"treffen." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Diese Ecke konnte nicht abgerundet werden. Versuchen Sie einen kleineren " +"Radius, oder erstellen Sie die gewünschte Geometrie von Hand mit " +"\"Tangente\"-Einschränkungen." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" +"Dieses Objekt konnte nicht geteilt werden. Dies geht nur für Linien, Kreise " +"oder kubische Splines." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "Trennen ist nur in einer Arbeitsebene möglich." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Wählen Sie zwei Objekte aus, die sich schneiden (z.B. zwei Linien/Kreise/" +"Bögen, oder eine Linie/Kreis/Bogen und ein Punkt)." + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Trennen nicht möglich; keine Überschneidung gefunden." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Linientyp zuordnen" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Kein Linientyp" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Neu erstellter benutzerdefinierter Linientyp…" + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Info zu Gruppe" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Info zu Linientyp" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Kantenverlauf auswählen" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Von/zu Referenzangabe wechseln" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Anderer Komplementärwinkel" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Auf Raster ausrichten" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Spline-Punkt löschen" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Spline-Punkt hinzufügen" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" +"Spline-Punkt kann nicht hinzugefügt werden: maximale Anzahl der Punkte " +"erreicht." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Konstruktionselement an/aus" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Einschränkung \"Punkte deckungsgleich\" löschen" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Ausschneiden" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Kopieren" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Alle auswählen" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Einfügen" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Einfügen und transformieren…" + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Löschen" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Alle deselektieren" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Aktive deselektieren" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Zoom an Bildschirm anpassen" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "Klicken Sie auf den nächsten Punkt der Linie, oder drücken Sie Esc" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Ein Rechteck kann nicht in 3D erstellt werden. Aktivieren Sie zuerst eine " +"Arbeitsebene mit \"Skizze -> In Arbeitsebene\"." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "Klicken Sie auf die gegenüberliegende Ecke des Rechtecks" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "Klicken Sie, um den Radius festzulegen" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Ein Kreisbogen kann nicht in 3D erstellt werden. Aktivieren Sie zuerst eine " +"Arbeitsebene mit \"Skizze -> In Arbeitsebene\"." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "Klicken Sie, um einen Punkt zu platzieren" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "" +"Klicken Sie auf den nächsten Punkt der kubischen Linie, oder drücken Sie Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Eine Arbeitsebene ist bereits aktiv. Skizzieren Sie in 3D, bevor Sie eine " +"neue Arbeitsebene erstellen." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Text kann nicht in 3D erstellt werden. Aktivieren Sie zuerst eine " +"Arbeitsebene mit \"Skizze -> In Arbeitsebene\"." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "Klicken Sie auf die untere rechte Ecke des Texts" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Das Bild kann nicht in 3D erstellt werden. Aktivieren Sie zuerst eine " +"Arbeitsebene mit \"Skizze -> In Arbeitsebene\"." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpace-Modelle" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "ALLE" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF Leiterplatte" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL-Dreiecks-Netz" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG-Datei" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL-Netz" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ-Netz" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js-kompatibles Netz, mit Ansicht" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js-kompatibles Netz, nur Netz" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML Textdatei" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP-Datei" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF-Datei" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "Eingebettetes Postscript" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "Skalierbare Vektorgrafik" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF-Datei (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL-Datei" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G-Code" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF- und DWG-Dateien" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "Werte durch Komma getrennt (CSV)" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "unbenannt" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Datei speichern" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Datei öffnen" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_Abbrechen" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Speichern" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Öffnen" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Automatische Sicherungsdatei verfügbar" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Eine automatische Sicherung ist für diese Skizze verfügbar." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "Wollen Sie die automatische Sicherungsdatei stattdessen laden?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "AutoDatei &öffnen" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "&Nicht laden" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Geänderte Datei" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "Wollen Sie die Änderungen an der Skizze “%s” sichern?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "Wollen Sie die Änderungen an der Skizze sichern?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Ihre Änderungen werden verworfen, wenn sie nicht abgespeichert werden." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Sichern" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "&Verwerfen" + +# solvespace.cpp:557 +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(Neue Skizze)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Attribut-Browser" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Einschränkungen sind momentan sichtbar und werden exportiert. Das wollen Sie " +"wahrscheinlich nicht. Verstecken Sie sie in dem auf den Link oben im " +"Textfenster klicken." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"Kann den Dateityp der Datei '%s' nicht auf Grund der Dateierweiterung " +"erkennen. Versuchen Sie .dxf oder .dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "" +"Die Einschränkung muss einen Namen haben, und darf keine " +"Referenzdimensionierung sein." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "" +"Falsche Auswahl für die Schrittdimensionierung. Wählen Sie eine " +"Einschränkung." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "Der Zusammenbau funktioniert, gut." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"Das Volumen des Modell ist:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"Das Volumen des Netz der aktiven Gruppe ist:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Gekrümmte Flächen wurden als Dreiecksnetz angenähert.\n" +"Das verursacht Fehler, typischerweise um 1%." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Die Fläche der ausgewählten Flächen ist:\n" +"\n" +" %s\n" +"\n" +"Kurven wurden als gerade Linienstücke angenähert.\n" +"Das verursacht Fehler, typischerweise um 1%%." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Diese Gruppe beinhaltet keine korrekt geschlossene 2D Fläche. Sie ist offen, " +"nicht koplanar, oder überschneidet sich selbst." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Die Summe der Flächen in dieser Gruppe ist:\n" +"\n" +" %s\n" +"\n" +"Kurven wurden als gerade Linienstücke angenähert.\n" +"Das verursacht Fehler, typischerweise um 1%%." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Die Gesamtlänge der ausgwählten Elemente ist:\n" +"\n" +" %s\n" +"\n" +"Kurven wurden als gerade Linienstücke angenähert.\n" +"Das verursacht Fehler, typischerweise um 1%%." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "Falsche Auswahl für Umfang. Wähle Liniensegmente, Bögen und Kurven." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Falsche Auswahl für Punkt nachzeichnen. Wähle einen einzelnen Punkt." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "Konnte '%s' nicht schreiben" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "Das Netz schneidet sich selbst: Falsch, ungültig." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "Das Netz schneidet sich nicht: Gut, gültig." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "Das Netz hat lose Kanten: Falsch, ungültig." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "Das Netz hat keine lose Kanten: Gut, gültig." + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"Das Modell hat %d Dreiecke, von %d Flächen." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Keine problematischen Kanten, gut.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematische Kanten, schlecht.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Das ist SolveSpace version %s.\n" +"\n" +"Für mehr Information siehe http://solvespace.com/\n" +"\n" +"SolveSpace ist freie Software: Sie steht Ihnen frei sie zu ändern\n" +"und/oder zu vervielfältigen unter der Auflage der GNU\n" +"General Public License (GPL) Version 3 oder späterer Versionen.\n" +"\n" +"Es besteht keinerlei Gewährleistung und Haftung für das Programm, soweit " +"dies gesetzlich zulässig ist.\n" +"Für Details siehe http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues und andere.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Ein Linientyp kann keinem Objekt zugeordnet werden, das von einem anderen " +"Objekt abgeleitet wurde. Versuchen Sie, dem übergeordneten Objekt einen Typ " +"zuzuordnen." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Name des Linientyps kann nicht leer sein" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "Nicht weniger als 1 Wiederholung möglich." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "Nicht mehr als 999 Wiederholungen möglich." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Der Name der Gruppe darf nicht leer sein" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "Durchsichtigkeit muss zwischen Null und Eins sein." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Radius darf nicht null oder negativ sein." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Liniensegment erstellen" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Rechteck erstellen" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Kreis erstellen" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Kreisbogen erstellen" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Kurven aus Text in einem TrueType-Font erzeugen" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Skizze von einer Bilddatei erstellen" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Bogentangente im ausgewählten Punkt erstellen" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Kubischen Bezier-Spline erstellen" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Bezugspunkt erstellen" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Konstruktionselement an/aus" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Linien / Kurven im Schnittpunkt trennen" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Abstand / Durchmesser / Länge einschränken" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Winkel einschränken" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Horizontale Einschränkung" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Vertikale Einschränkung" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Einschränkung auf Parallele oder Tangente" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Rechtwinklige Einschränkung" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Punkt auf Linie / Kurve / Ebene / Punkt einschränken" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Symmetrische Einschränkung" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Gleiche Länge / Radius / Winkel einschränken" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Normale auf gleiche Richtung einschränken" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Anderer Komplementärwinkel" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Von/zu Referenzangabe wechseln" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Neue Gruppe mit extrudierter aktiver Skizze" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Neue Gruppe mit rotierter aktiver Skizze" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Neue Gruppe Helix von aktiver Skizze" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Neue Gruppe mit gedrehter aktiver Skizze" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Neue Gruppe mit kopierter gedrehter Skizze" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Neue Gruppe mit kopierter versetzter Skizze" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "" +"Neue Gruppe in neuer Arbeitsebene (definiert durch ausgewählte Objekte)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "Neue Gruppe in 3D" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Neue Gruppe mit verknüpfter Datei" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Nächste isometrische Ansicht" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Ansicht auf Arbeitsebene ausrichten" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Fehler" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Mitteilung" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&OK" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "Der Maßstab kann nicht Null oder negativ sein." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Ungültiges Format: geben Sie x, y, z ein" + +#~ msgid "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"Auf Punkt / Kurve / Ebene\". Diese " +#~ "Einschränkung ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Punkte [deckungsgleich]\n" +#~ " * einen Punkt und eine Arbeitsebene [Punkt auf Ebene]\n" +#~ " * einen Punkt und ein Liniensegment [Punkt auf Linie]\n" +#~ " * einen Punkt und einen Kreis oder Bogen [Punkt auf Kurve]\n" +#~ " * einen Punkt und eine Seitenfläche [Punkt auf Fläche]\n" + +#~ msgid "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"gleicher Abstand / Radius\". Diese " +#~ "Einschränkung ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Liniensegmente [gleiche Länge]\n" +#~ " * zwei Liniensegmente und zwei Punkte [gleiche Punkt-Linien-" +#~ "Abstände]\n" +#~ " * ein Liniensegment und zwei Punkte [gleiche Punkt-Linien-Abstände]\n" +#~ " * ein Liniensegment und ein Punkt oder Liniensegment [Abstand Punkt-" +#~ "Linie gleich Länge]\n" +#~ " * vier Liniensegmente oder Normale [gleicher Winkel zwischen A,B und " +#~ "C,D]\n" +#~ " * drei Liniensegmente oder Normale [gleicher Winkel zwischen A,B und " +#~ "B,C]\n" +#~ " * zwei Kreise oder Bögen [gleicher Radius]\n" +#~ " * ein Liniensegment und ein Bogen [Länge des Liniensegments gleich " +#~ "Bogenlänge]\n" + +#~ msgid "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"horizontal / vertikal\". Diese " +#~ "Einschränkung ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Punkte\n" +#~ " * ein Liniensegment\n" + +#~ msgid "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"Winkel\". Diese Einschränkung ist " +#~ "anwendbar auf:\n" +#~ "\n" +#~ " * zwei Liniensegmente\n" +#~ " * ein Liniensegment und eine Normale\n" +#~ " * zwei Normale\n" + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"Parallel / Tangente\". Diese " +#~ "Einschränkung ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Liniensegmente [parallel]\n" +#~ " * ein Liniensegment und eine Normale [parallel]\n" +#~ " * zwei Normalen [parallel]\n" +#~ " * zwei Liniensegmente, Bögen oder Beziers mit gemeinsamem Endpunkt " +#~ "[Tangente]\n" + +#~ msgid "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"Rechtwinklig\". Diese Einschränkung " +#~ "ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Liniensegmente\n" +#~ " * ein Liniensegment und eine Normale\n" +#~ " * zwei Normale\n" + +#~ msgid "A&ngle" +#~ msgstr "Winkel" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "Gleicher Abstand / Radius / Winkel" + +#~ msgid "" +#~ "Bad selection for length ratio constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"Längenverhältnis\". Diese " +#~ "Einschränkung ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Liniensegmente\n" + +#~ msgid "" +#~ "Bad selection for length difference constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Einschränkung \"Längendifferenz\". Diese " +#~ "Einschränkung ist anwendbar auf:\n" +#~ "\n" +#~ " * zwei Liniensegmente\n" + +#~ msgid "Length Ra&tio" +#~ msgstr "Längenverhältnis" + +#~ msgid "Length Diff&erence" +#~ msgstr "Längendifferenz" + +#~ msgid "" +#~ "Bad selection for new sketch in workplane. This group can be created " +#~ "with:\n" +#~ "\n" +#~ " * a point (through the point, orthogonal to coordinate axes)\n" +#~ " * a point and two line segments (through the point, parallel to the " +#~ "lines)\n" +#~ " * a workplane (copy of the workplane)\n" +#~ msgstr "" +#~ "Ungültige Auswahl für Skizze in neuer Arbeitsebene. Diese Gruppe kann " +#~ "erstellt werden mit:\n" +#~ "\n" +#~ " * einem Punkt (durch den Punkt, orthogonal zu den Koordinatenachsen)\n" +#~ " * einem Punkt und zwei Liniensegmenten (durch den Punkt, parallel zu " +#~ "den Linien)\n" +#~ " * einer Arbeitsebene (Kopie der Arbeitsebene)\n" + +#~ msgctxt "file-type" +#~ msgid "Q3D Object file" +#~ msgstr "Q3D Objektdatei" + +#~ msgid "Specify between 0 and 8 digits after the decimal." +#~ msgstr "Geben Sie 0 bis 8 Ziffern nach dem Dezimalzeichen an." + +#~ msgid "click to place bottom left of text" +#~ msgstr "Klicken Sie auf die untere linke Ecke des Texts" + +#~ msgid "Do you want to save the changes you made to the new sketch?" +#~ msgstr "Möchten Sie die Änderungen in Ihrer Skizze speichern?" + +#~ msgid "Your changes will be lost if you don't save them." +#~ msgstr "" +#~ "Ihre Änderungen werden verworfen, wenn sie nicht abgespeichert werden." + +#~ msgctxt "button" +#~ msgid "Save" +#~ msgstr "Speichern" + +#~ msgctxt "button" +#~ msgid "Cancel" +#~ msgstr "Abbrechen" + +#~ msgctxt "button" +#~ msgid "Don't Save" +#~ msgstr "Nicht speichern" + +#~ msgid "An autosave file is available for this project." +#~ msgstr "" +#~ "Eine automatisch gespeicherte Datei ist für dieses Projekt vorhanden." + +#~ msgid "Do you want to load the autosave file instead?" +#~ msgstr "Möchten Sie die automatische Speicherdatei stattdessen öffnen?" + +#~ msgctxt "button" +#~ msgid "Load" +#~ msgstr "Öffnen" + +#~ msgctxt "button" +#~ msgid "Don't Load" +#~ msgstr "Nicht öffnen" + +#~ msgid "" +#~ "Do you want to locate it manually?\n" +#~ "If you select “No”, any geometry that depends on the missing file will be " +#~ "removed." +#~ msgstr "" +#~ "Möchten Sie sie selber auswählen?\n" +#~ "Falls Sie \"Nein\" wählen, wird jegliche mit der fehlenden Datei " +#~ "verknüpfte Geometrie verworfen." + +#~ msgctxt "button" +#~ msgid "Yes" +#~ msgstr "Ja" + +#~ msgctxt "button" +#~ msgid "No" +#~ msgstr "Nein" + +#~ msgctxt "button" +#~ msgid "OK" +#~ msgstr "OK" + +#~ msgid "_Cancel" +#~ msgstr "_Abbrechen" + +#~ msgid "_Open" +#~ msgstr "_Öffnen" + +#~ msgid "" +#~ "The file has changed since it was last saved.\n" +#~ "\n" +#~ "Do you want to save the changes?" +#~ msgstr "" +#~ "Die Datei wurde seit der letzten Speicherung geändert.\n" +#~ "\n" +#~ "Möchten Sie die Änderungen speichern?" + +#~ msgctxt "button" +#~ msgid "Do_n't Save" +#~ msgstr "Nicht speichern" + +#~ msgid "" +#~ "An autosave file is available for this project.\n" +#~ "\n" +#~ "Do you want to load the autosave file instead?" +#~ msgstr "" +#~ "Eine automatisch gespeicherte Datei ist für dieses Projekt vorhanden.\n" +#~ "\n" +#~ "Wollen Sie die automatisch gespeicherte Datei öffnen?" + +#~ msgctxt "button" +#~ msgid "_Load autosave" +#~ msgstr "AutoDatei öffnen" + +#~ msgctxt "button" +#~ msgid "Do_n't Load" +#~ msgstr "Nicht öffnen" + +#~ msgctxt "button" +#~ msgid "_Yes" +#~ msgstr "_Ja" + +#~ msgctxt "button" +#~ msgid "_No" +#~ msgstr "_Nein" diff --git a/res/locales/en_US.po b/res/locales/en_US.po new file mode 100644 index 0000000..4de392b --- /dev/null +++ b/res/locales/en_US.po @@ -0,0 +1,2518 @@ +# English translations for SolveSpace package. +# Copyright (C) 2017 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# Automatically generated, 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2017-01-05 10:30+0000\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Clipboard is empty; nothing to paste." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Number of copies to paste must be at least one." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "Scale cannot be zero." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Select one point to define origin of rotation." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Select two points to define translation vector." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "Too many items to paste; split this into smaller pastes." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "No workplane active." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Bad format: specify coordinates as x, y, z" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Bad format: specify color as r, g, b" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Specify between 0 and %d digits after the decimal." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "Export scale must not be zero!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Cutter radius offset must not be negative!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "Bad value: autosave interval should be positive" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Bad format: specify interval in integral minutes" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "pts-coincident" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "pt-pt-distance" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "pt-line-distance" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "pt-plane-distance" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "pt-face-distance" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "proj-pt-pt-distance" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "pt-in-plane" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "pt-on-line" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "pt-on-face" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "eq-length" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "eq-length-and-pt-ln-dist" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "eq-pt-line-distances" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "length-ratio" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "arc-arc-length-ratio" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "arc-line-length-ratio" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "length-difference" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "arc-arc-len-difference" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "arc-line-len-difference" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "symmetric" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "symmetric-h" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "symmetric-v" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "symmetric-line" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "at-midpoint" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "horizontal" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "vertical" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "diameter" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "pt-on-circle" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "same-orientation" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "angle" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "parallel" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "arc-line-tangent" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "cubic-line-tangent" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "curve-curve-tangent" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "perpendicular" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "eq-radius" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "eq-angle" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "eq-line-len-arc-len" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "lock-where-dragged" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "comment" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Must select an angle constraint." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "Must select a constraint with associated label." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "Curve-curve tangency must apply in workplane." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "NEW COMMENT -- DOUBLE-CLICK TO EDIT" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "click center of comment text" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Active group mesh is empty; nothing to export." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "freehand lines were replaced with continuous lines" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "zigzag lines were replaced with continuous lines" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "sketch-in-plane" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#references" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "The file is empty. It may be corrupt." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Missing File" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "The linked file “%s” is not present." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Yes" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&No" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&Cancel" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&File" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&New" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Open..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Open &Recent" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Save" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Save &As..." + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Export &Image..." + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Export 2d &View..." + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Export 2d &Section..." + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Export 3d &Wireframe..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Export Triangle &Mesh..." + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Export &Surfaces..." + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "Im&port..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "E&xit" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "&Edit" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Undo" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Redo" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Re&generate All" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Snap Selection to &Grid" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Rotate Imported &90°" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Cu&t" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "&Copy" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "&Paste" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "Paste &Transformed..." + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Delete" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Select &Edge Chain" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "Select &All" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "&Unselect All" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "&Line Styles..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&View Projection..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "Con&figuration..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&View" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "Zoom &In" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "Zoom &Out" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Zoom To &Fit" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Align View to &Workplane" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Nearest &Ortho View" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Nearest &Isometric View" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Center View At Point" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Show Snap &Grid" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Darken Inactive Solids" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Use &Perspective Projection" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Show E&xploded View" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "Dimension &Units" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Dimensions in &Millimeters" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Dimensions in M&eters" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Dimensions in &Inches" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Dimensions in &Feet and Inches" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Show &Toolbar" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Show Property Bro&wser" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "&Full Screen" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "&New Group" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "Sketch In &3d" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "Sketch In New &Workplane" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "Step &Translating" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "Step &Rotating" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "E&xtrude" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "&Helix" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "&Lathe" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "Re&volve" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Link / Assemble..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Link Recent" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Sketch" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "In &Workplane" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "Anywhere In &3d" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "Datum &Point" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "Wor&kplane" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "Line &Segment" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "C&onstruction Line Segment" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Rectangle" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "&Circle" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "&Arc of a Circle" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "&Bezier Cubic Spline" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "&Text in TrueType Font" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "I&mage" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "To&ggle Construction" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Ta&ngent Arc at Point" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Split Curves at &Intersection" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Constrain" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Distance / Diameter" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Re&ference Dimension" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "A&ngle / Equal Angle" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Reference An&gle" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Other S&upplementary Angle" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Toggle R&eference Dim" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Horizontal" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Vertical" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&On Point / Curve / Plane" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "E&qual Length / Radius" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "Length / Arc Ra&tio" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Length / Arc Diff&erence" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "At &Midpoint" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "S&ymmetric" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Para&llel / Tangent" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "&Perpendicular" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Same Orient&ation" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Lock Point Where &Dragged" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Comment" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Analyze" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "Measure &Volume" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Measure A&rea" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Measure &Perimeter" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Show &Interfering Parts" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Show &Naked Edges" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Show &Center of Mass" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Show &Underconstrained Points" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "&Trace Point" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "&Stop Tracing..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "Step &Dimension..." + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Help" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Language" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Website / Manual" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "&Go to GitHub commit" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "&About" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(no recent files)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "File '%s' does not exist." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "No workplane is active, so the grid will not appear." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "" +"Select a point; this point will become the center of the view on screen." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "No additional entities share endpoints with the selected entities." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "No workplane selected. Activating default workplane for this group." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "click point on arc (draws anti-clockwise)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "click to place datum point" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "click first point of line segment" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "click first point of construction line segment" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "click first point of cubic segment" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "click center of circle" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "click origin of workplane" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "click one corner of rectangle" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "click top left of text" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "click top left of image" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "sketch-in-3d" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "extrude" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "Lathe operation can only be applied to planar sketches." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "lathe" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "Revolve operation can only be applied to planar sketches." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "revolve" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "Helix operation can only be applied to planar sketches." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "helix" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "rotate" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "translate" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(unnamed)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "not closed contour, or not all same style!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "points not all coplanar!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "contour is self-intersecting!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "zero-length edge!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Text-formated STL files are not currently supported" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "Must be sketching in workplane to create tangent arc." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "Couldn't split this entity; lines, circles, or cubics only." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "Must be sketching in workplane to split." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Can't split; no intersection found." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Assign to Style" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "No Style" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Newly Created Custom Style..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Group Info" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Style Info" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Select Edge Chain" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Toggle Reference Dimension" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Other Supplementary Angle" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Snap to Grid" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Remove Spline Point" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Add Spline Point" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "Cannot add spline point: maximum number of points reached." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Toggle Construction" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Delete Point-Coincident Constraint" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Cut" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Copy" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Select All" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Paste" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Paste Transformed..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Delete" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Unselect All" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Unselect Hovered" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Zoom to Fit" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "click next point of line, or press Esc" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "click to place other corner of rectangle" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "click to set radius" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "click to place point" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "click next point of cubic, or press Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "click to place bottom right of text" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpace models" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "ALL" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF circuit board" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL triangle mesh" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG image" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL mesh" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ mesh" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js-compatible mesh, with viewer" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js-compatible mesh, mesh only" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML text file" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP file" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF file" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "Encapsulated PostScript" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "Scalable Vector Graphics" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF file (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL file" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G Code" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF and DWG files" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "Comma-separated values" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "untitled" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Save File" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Open File" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_Cancel" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Save" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Open" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Autosave Available" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "An autosave file is available for this sketch." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "Do you want to load the autosave file instead?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Load autosave" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "Do&n't Load" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Modified File" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "Do you want to save the changes you made to the sketch “%s”?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "Do you want to save the changes you made to the new sketch?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Your changes will be lost if you don't save them." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Save" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "Do&n't Save" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(new sketch)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Property Browser" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "Constraint must have a label, and must not be a reference dimension." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "Bad selection for step dimension; select a constraint." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "The assembly does not interfere, good." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"The volume of the solid model is:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "Bad selection for perimeter; select line segments, arcs, and curves." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Bad selection for trace; select a single point." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "Couldn't write to '%s'" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "The mesh is self-intersecting (NOT okay, invalid)." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "The mesh is not self-intersecting (okay, valid)." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "The mesh has naked edges (NOT okay, invalid)." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "The mesh is watertight (okay, valid)." + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Style name cannot be empty" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "Can't repeat fewer than 1 time." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "Can't repeat more than 999 times." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Group name cannot be empty" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "Opacity must be between zero and one." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Radius cannot be zero or negative." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Sketch line segment" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Sketch rectangle" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Sketch circle" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Sketch arc of a circle" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Sketch curves from text in a TrueType font" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Sketch image from a file" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Create tangent arc at selected point" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Sketch cubic Bezier spline" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Sketch datum point" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Toggle construction" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Split lines / curves where they intersect" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Constrain distance / diameter / length" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Constrain angle" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Constrain to be horizontal" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Constrain to be vertical" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Constrain to be parallel or tangent" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Constrain to be perpendicular" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Constrain point on line / curve / plane / point" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Constrain symmetric" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Constrain equal length / radius / angle" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Constrain normals in same orientation" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Other supplementary angle" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Toggle reference dimension" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "New group extruding active sketch" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "New group rotating active sketch" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "New group helix from active sketch" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "New group revolve active sketch" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "New group step and repeat rotating" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "New group step and repeat translating" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "New group in new workplane (thru given entities)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "New group in 3d" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "New group linking / assembling file" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Nearest isometric view" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Align view to active workplane" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Error" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Message" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&OK" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "Scale cannot be zero or negative." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Bad format: specify x, y, z" + +#~ msgid "" +#~ "The tangent arc and line segment must share an endpoint. Constrain them " +#~ "with Constrain -> On Point before constraining tangent." +#~ msgstr "" +#~ "The tangent arc and line segment must share an endpoint. Constrain them " +#~ "with Constrain -> On Point before constraining tangent." + +#~ msgid "" +#~ "The tangent cubic and line segment must share an endpoint. Constrain them " +#~ "with Constrain -> On Point before constraining tangent." +#~ msgstr "" +#~ "The tangent cubic and line segment must share an endpoint. Constrain them " +#~ "with Constrain -> On Point before constraining tangent." + +#~ msgid "" +#~ "The curves must share an endpoint. Constrain them with Constrain -> On " +#~ "Point before constraining tangent." +#~ msgstr "" +#~ "The curves must share an endpoint. Constrain them with Constrain -> On " +#~ "Point before constraining tangent." + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two faces\n" +#~ " * two or more line segments (parallel)\n" +#~ " * one or more line segments and one or more normals (parallel)\n" +#~ " * two or more normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two faces\n" +#~ " * two or more line segments (parallel)\n" +#~ " * one or more line segments and one or more normals (parallel)\n" +#~ " * two or more normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" + +#~ msgid "&Workplane" +#~ msgstr "&Workplane" + +#~ msgid "&Image" +#~ msgstr "&Image" + +#~ msgid "Tangent &Arc at Point" +#~ msgstr "Tangent &Arc at Point" + +#~ msgid "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" +#~ msgstr "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" + +#~ msgid "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" +#~ msgstr "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" + +#~ msgid "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" +#~ msgstr "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" + +#~ msgid "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" + +#~ msgid "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" + +#~ msgid "A&ngle" +#~ msgstr "A&ngle" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "E&qual Length / Radius / Angle" + +#~ msgid "&Mirror" +#~ msgstr "&Mirror" + +#~ msgctxt "group-name" +#~ msgid "mirror" +#~ msgstr "mirror" + +#~ msgid "" +#~ "Bad selection for length ratio constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Bad selection for length ratio constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" + +#~ msgid "" +#~ "Bad selection for length difference constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Bad selection for length difference constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" + +#~ msgid "Length Ra&tio" +#~ msgstr "Length Ra&tio" + +#~ msgid "Length Diff&erence" +#~ msgstr "Length Diff&erence" + +#~ msgid "" +#~ "Bad selection for new sketch in workplane. This group can be created " +#~ "with:\n" +#~ "\n" +#~ " * a point (through the point, orthogonal to coordinate axes)\n" +#~ " * a point and two line segments (through the point, parallel to the " +#~ "lines)\n" +#~ " * a workplane (copy of the workplane)\n" +#~ msgstr "" +#~ "Bad selection for new sketch in workplane. This group can be created " +#~ "with:\n" +#~ "\n" +#~ " * a point (through the point, orthogonal to coordinate axes)\n" +#~ " * a point and two line segments (through the point, parallel to the " +#~ "lines)\n" +#~ " * a workplane (copy of the workplane)\n" + +#~ msgctxt "file-type" +#~ msgid "Q3D Object file" +#~ msgstr "Q3D Object file" diff --git a/res/locales/es_AR.po b/res/locales/es_AR.po new file mode 100644 index 0000000..28cb363 --- /dev/null +++ b/res/locales/es_AR.po @@ -0,0 +1,2319 @@ +# Spanish/Argentina translations for SolveSpace package. +# Copyright (C) 2017 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# Maxi , 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2021-09-17 \n" +"Last-Translator: Maxi Vasquez \n" +"Language-Team: AndesFreeDesign\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.4.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Cortar, pegar y copiar funciona solo en un plano de trabajo.\n" +"\n" +"Activar uno con Croquis -> En Plano de trabajo." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "El portapapeles está vacío; nada que pegar." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "El número de copias para pegar debe ser al menos una." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "La escala no puede ser cero." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Seleccione un punto para definir el origen de la rotación." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Seleccione dos puntos para definir el vector de traslación." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "" +"La transformación es identidad. Entonces todas las copias estarán " +"exactamente una encima de la otra." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "Demasiados elementos para pegar; divida esto en partes más pequeñas." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Ningún plano de trabajo activo." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Formato incorrecto: especifique las coordenadas como x, y, z" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Formato incorrecto: especifique color como r, g, b" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"El factor de perspectiva no tendrá ningún efecto hasta que habilite Ver -> " +"Usar Proyección Perspectiva." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Especifique entre 0 y %d dígitos después del decimal." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "¡La escala de exportación no debe ser cero!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "¡El desfase del radio de corte no debe ser negativo!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "Valor incorrecto: el intervalo de autoguardado debe ser positivo" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Formato incorrecto: especifique el intervalo en minutos integrales" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "ps-coincidente" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "p-p-distancia" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "p-línea-distancia" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "p-plano-distancia" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "p-cara-distancia" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "proy-p-p-distancia" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "p-en-plano" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "p-sobre-línea" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "p-sobre-cara" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "igual-longitud" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "igual-longitud-y-p-línea-dist" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "igual-p-línea-distancias" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "longitud-radio" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "arco-arco-longitud-relación" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "arco-línea-longitud-relación" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "longitud-diferencia" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "arco-arco-long-diferencia" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "arco-línea-long-diferencia" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "simetría" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "simetría-h" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "simetría-v" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "simetría-línea" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "en-puntoMedio" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "horizontal" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "vertical" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "diámetro" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "p-sobre-círculo" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "misma-orientación" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "ángulo" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "paralela" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "arco-línea-tangente" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "cúbica-línea-tangente" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "curva-curva-tangente" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "perpendicular" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "igual-radio" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "igual-ángulo" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "igual-línea-long-arco-long" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "fijación" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "comentario" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"El arco tangente y la línea deben compartir un punto final. Restringirlos " +"con Restringir -> En el punto antes de restringir la tangente.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"La tangente cúbica y la línea deben compartir un punto final. Restringirlos " +"con Restringir -> En el punto antes de restringir la tangente.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Las curvas deben compartir un punto final. Restringirlos con Restringir -> " +"En el punto antes de restringir la tangente.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Selección incorrecta para la restricción de distancia / diámetro. Esta " +"restricción puede aplicarse a:\n" +"\n" +" * dos puntos (distancia entre puntos)\n" +" * un segmento de línea (longitud)\n" +" * dos puntos y un segmento de línea o normal (distancia proyectada)\n" +" * un plano de trabajo y un punto (distancia mínima)\n" +" * un segmento de línea y un punto (distancia mínima)\n" +" * una cara plana y un punto (distancia mínima)\n" +" * un círculo o un arco (diámetro)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Selección incorrecta para la restricción de punto / curva / plano. Esta " +"restricción puede aplicarse a:\n" +"\n" +" * dos o más puntos (puntos coincidentes) \n" +" * un punto y un plano de trabajo (punto en el plano) \n" +" * un punto y un segmento de línea (punto en la línea) \n" +" * un punto y un círculo o arco (punto en la curva) \n" +" * un punto y de una a tres caras planas (punto en la(s) cara(s)) \n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Selección incorrecta para la restricción de igualdad longitud / radio. Esta " +"restricción puede aplicarse a:\n" +"\n" +" * dos o más segmentos de línea (igual longitud)\n" +" * dos segmentos de línea y dos puntos (distancias de línea-punto " +"iguales)\n" +" * un segmento de línea y dos puntos (distancias punto-línea iguales)\n" +" * un segmento de línea, y un punto y un segmento de línea (distancia " +"punto-línea igual a la longitud)\n" +" * dos o más círculos o arcos (igual radio)\n" +" * un segmento de línea y un arco (la longitud del segmento de línea es " +"igual a la longitud del arco)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Selección incorrecta por restricción de la relación de longitud. Esta " +"restricción puede aplicarse a:\n" +"\n" +" * dos segmentos de línea\n" +" * dos arcos\n" +" * un arco y un segmento de línea\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Selección incorrecta para restricción de diferencia de longitud. Esta " +"restricción puede aplicarse a:\n" +"\n" +" * dos segmentos de línea\n" +" * dos arcos\n" +" * un arco y un segmento de línea\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Selección incorrecta para una restricción de punto medio. Esta restricción " +"se puede aplicar a:\n" +"\n" +" * un segmento de línea y un punto (punto en el punto medio)\n" +" * un segmento de línea y un plano de trabajo (punto medio de la línea en " +"el plano)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Selección incorrecta para restricción de simetría. Esta restricción puede " +"aplicarse a:\n" +"\n" +" * dos puntos o un segmento de línea (simétrico con respecto al eje de " +"coordenadas del plano de trabajo)\n" +" * segmento de línea, y dos puntos o un segmento de línea (simétrico con " +"respecto al segmento de línea)\n" +" * plano de trabajo, y dos puntos o un segmento de recta (simétrico sobre " +"plano de trabajo)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Un plano de trabajo debe estar activo al restringirse simétrico sin un plano " +"de simetría explícito." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Active un plano de trabajo (con Croquis -> En Plano de trabajo) antes de " +"aplicar una restricción horizontal o vertical." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Selección incorrecta por restricción horizontal / vertical. Esta restricción " +"puede aplicarse a:\n" +"\n" +" * dos o más puntos\n" +" * uno o más segmentos de línea\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Selección incorrecta para la misma restricción de orientación. Esta " +"restricción puede aplicarse a:\n" +"\n" +" * dos normales\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Debe seleccionar una restricción de ángulo." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "Debe seleccionar una restricción con etiqueta asociada." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Selección incorrecta por restricción de ángulo. Esta restricción se puede " +"aplicarse a:\n" +"\n" +"Ángulo entre:\n" +" * dos segmentos de línea\n" +" * un segmento de linea y una normal\n" +" * dos normales\n" +"\n" +"Ángulos iguales:\n" +" * cuatro segmentos de línea o normales (ángulo igual entre A,B y C,D)\n" +" * tres segmentos de línea o normales (ángulo igual entre A,B y B,C)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "La tangencia curva-curva debe aplicarse en el plano de trabajo." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Mala selección para restricción de paralelo / tangente. Esta restricción " +"puede aplicarse a:\n" +"\n" +" * dos caras\n" +" * dos o más segmentos de línea (paralelos)\n" +" * uno o más segmentos de línea y una o más normales (paralelas)\n" +" * dos o más normales (paralelas)\n" +" * dos segmentos de línea, arcos, o beziers, que comparten un punto final " +"(tangente)\n" +" * dos segmentos de línea, arcos, o beziers, que no comparten un punto " +"final y el punto(s) final(es) de la(s) curva(s)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Selección incorrecta por restricción perpendicular. Esta restricción se " +"puede aplicarse a:\n" +"\n" +" * dos caras\n" +" * dos segmentos de línea\n" +" * un segmento de línea y una normal\n" +" * dos normales\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Selección incorrecta para el punto de bloqueo donde se arrastró la " +"restricción. Esta restricción puede aplicarse a:\n" +"\n" +" * un punto\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "NUEVO COMENTARIO -- DOBLE-CLIC PARA EDITAR" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "clic en el centro del texto del comentario" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"No hay un modelo sólido presente; dibuje uno con extrusiones y revoluciones, " +"o use Exportar Vista 2d para exportar líneas y curvas simples." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Selección incorrecta para la sección de exportación. Por favor seleccione:\n" +"\n" +" * nada, con un plano de trabajo activo (el plano de trabajo es un plano " +"de sección)\n" +" * una cara (plano de sección a través de la cara)\n" +" * un punto y dos segmentos de línea (plano que pasa por el punto y " +"paralelo a las líneas)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "La malla del grupo activo está vacía; nada para exportar." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "las líneas a mano alzada fueron reemplazadas por líneas continuas" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "las líneas en zigzag fueron reemplazadas por líneas continuas" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Algunos aspectos del dibujo no tienen equivalente DXF y no se exportaron:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"El tamaño de la página PDF supera los 5080mm x 5080mm; muchos usuarios " +"pueden rechazar este archivo." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "croquis-en-plano" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#referencias" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "El archivo esta vacío. Puede estar corrupto." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Datos no reconocidos en el archivo. Este archivo puede estar dañado o ser de " +"una versión más reciente del programa." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Archivo perdido" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "El archivo vinculado “%s” no esta presente." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"¿Querés localizarlo manualmente?\n" +"\n" +"Si lo rechaza, cualquier geometría que dependa del archivo faltante se " +"eliminará permanentemente." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Si" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&No" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&Cancelar" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Archivo" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&Nuevo" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Abrir..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Abrir &Reciente" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Guardar" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Guardar &Como..." + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Exportar &Imagen..." + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Exportar &Vista 2d..." + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Exportar &Corte 2d..." + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Exportar &Estructura alámbrica 3d..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Exportar &Malla Triangular..." + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Exportar &Superficies..." + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "Im&portar..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "S&alir" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "&Editar" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Deshacer" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Rehacer" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Re&generar Todo" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Selección Enganche a &Cuadrícula" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Rotar Importado a &90°" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Co&rtar" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "&Copiar" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "&Pegar" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "Pegar &Transformado..." + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Eliminar" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Seleccionar &Cadena de Aristas" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "Seleccionar &Todo" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "&Deseleccionar Todo" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "Estilos de &Línea..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&Ver Proyección..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "Con&figuración..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&Vista" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "Acer&car" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "Ale&jar" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Ajustar a &Pantalla" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Alinear Vista a &Plano de trabajo" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Vista &Ortogonal más cercana" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Vista &Isométrica más cercana" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Vista Central en Punto" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Mostrar Enganches &Cuadrícula" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Oscurecer Sólidos Inactivos" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Usar &Proyección Perspectiva" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Mostrar Vista E&xplotada" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "&Unidades de Cota" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Cotas en &Milímetros" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Cotas en M&etros" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Cotas en &Pulgadas" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Cotas en &Pies y Pulgadas" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Mostrar &Barra de herramientas" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Mostrar Navegador de Pro&piedades" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "&Pantalla Completa" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "&Nuevo Grupo" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "Croquis En &3d" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "Croquis En Nuevo &Plano de trabajo" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "Paso &Traslación" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "Paso &Rotación" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "E&xtrusión" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "&Hélice" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "&Torno" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "Re&volución" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Enlace / Ensamblar..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Enlace Reciente" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Croquis" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "En &Plano de trabajo" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "En cualquier lugar en &3d" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "&Punto de Referencia" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "&Plano de trabajo" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "&Segmento de Línea" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "S&egmento de Línea de Construcción" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Rectángulo" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "&Círculo" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "&Arco de un Círculo" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "Spline Cúbico &Bezier" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "&Texto en Fuente TrueType" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "&Imagen" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "Al&ternar Construcción" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Tangente &Arco en el Punto" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Dividir Curvas en &Intersección" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Restricción" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Distancia / Diámetro" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Co&ta de Referencia" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "Á&ngulo / Igual ángulo" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Ángulo de Re&ferencia" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Otro Á&ngulo Suplementario" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Alternar Cota de R&eferencia" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Horizontal" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Vertical" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&Sobre Punto / Curva / Plano" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "I&gual Longitud / Radio" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "Relación Longi&tud / Arco" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Dif&erencia Longitud / Arco" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "En Punto &Medio" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "S&imetría" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Para&lela / Tangente" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "&Perpendicular" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Misma Orient&ación" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Punto de Bloqueo &Donde se Arrastró" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Comentario" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Analizar" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "Medir &Volumen" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Medir Á&rea" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Medir &Perímetro" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Mostrar &Piezas que Interfieren" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Mostrar &Aristas Visibles" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Mostrar &Centro de Masa" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Mostrar &Puntos Subrestringidos" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "&Punto de Rastro" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "Detener ra&streo..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "Paso de &Cota..." + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Ayuda" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Idioma" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Sitio Web / Manual" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "Ir a &GitHub" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "&Acerca" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(no hay archivos recientes)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "El archivo '%s' no existe." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "" +"No hay ningún plano de trabajo activo, por lo que la cuadrícula no aparecerá." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"El factor de perspectiva se establece en cero, por lo que la vista siempre " +"será una proyección paralela.\n" +"\n" +"Para una proyección en perspectiva, modifique el factor de perspectiva en la " +"pantalla de configuración. Un valor alrededor de 0.3 es típico." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "" +"Seleccione un punto; este punto se convertirá en el centro de la vista en " +"pantalla." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "" +"Ninguna entidad adicional comparte puntos finales con las entidades " +"seleccionadas." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"Para usar este comando, seleccione un punto u otra entidad de una pieza " +"vinculada, o convertir un grupo de enlaces en el grupo activo." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"No hay ningún plano de trabajo activo. Activar un plano de trabajo (con " +"Croquis -> En plano de trabajo) para definir el plano para el enganche a " +"cuadrícula." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"No se pueden enganchar estos elementos a la cuadrícula; seleccionar puntos, " +"comentarios de texto o restricciones con una etiqueta. Para enganchar una " +"línea, seleccione sus puntos finales." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"No se seleccionó ningún plano de trabajo. Activando el plano de trabajo " +"predeterminado para este grupo." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"No se selecciona ningún plano de trabajo y el grupo activo no tiene un plano " +"de trabajo. Intente seleccionar un plano de trabajo o activar un croquis-en-" +"nuevo-grupo de plano de trabajo." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Selección incorrecta de arco tangente en el punto. Seleccione un solo punto " +"o no seleccione nada para configurar los parámetros del arco." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "clic en el punto en el arco (dibuja en sentido antihorario)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "clic para colocar el punto de referencia" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "clic en el primer punto del segmento de línea" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "clic en el primer punto del segmento de línea de construcción" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "clic en el primer punto del segmento cúbico" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "clic en el centro del círculo" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "clic en origen del plano de trabajo" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "clic en una esquina del rectángulo" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "clic en la parte superior izquierda del texto" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "clic en la parte superior izquierda de la imagen" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"No se seleccionaron entidades. Seleccione entidades antes de intentar " +"alternar su estado de construcción." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "croquis-en-3d" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Selección incorrecta para un nuevo croquis en el plano de trabajo. Este " +"grupo se puede crear con:\n" +"\n" +" * un punto (a través del punto, ortogonal a los ejes de coordenadas)\n" +" * un punto y dos segmentos de línea (a través del punto, paralelo a " +"líneas)\n" +" * un punto y una normal (a través del punto, ortogonal a la normal)\n" +" * un plano de trabajo (copia de un plano de trabajo)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Active un plano de trabajo (Croquis -> En plano de trabajo) antes de " +"extruir. El croquis se extruirá normal al plano de trabajo." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "extrusión" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "La operación de torno solo se puede aplicar a croquis planos." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Selección incorrecta para el nuevo grupo de torno. Este grupo se puede crear " +"con:\n" +"\n" +" * un punto y un segmento de línea o normal (revolucionado alrededor de " +"un eje paralelo a la línea / normal, a través del punto)\n" +" * un segmento de línea (revolucionado sobre un segmento de línea)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "torno" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "La operación de revolución solo se puede aplicar a croquis planos." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Selección incorrecta para el nuevo grupo de revolución. Este grupo se puede " +"crear con:\n" +"\n" +" * un punto y un segmento de línea o normal (revolucionado alrededor de " +"un eje paralelo a la línea / normal, a través del punto)\n" +" * un segmento de línea (revolucionado sobre un segmento de línea)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "revolución" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "La operación de hélice solo se puede aplicar a croquis planos." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Selección incorrecta para el nuevo grupo de hélice. Este grupo se puede " +"crear con:\n" +"\n" +" * un punto y un segmento de línea o normal (girado alrededor de un eje " +"paralelo a la línea / normal, a través del punto)\n" +" * un segmento de línea (girado sobre un segmento de línea)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "hélice" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Selección incorrecta para nueva rotación. Este grupo se puede crear con:\n" +"\n" +" * un punto, mientras está bloqueado en el plano de trabajo (girar en el " +"plano, sobre ese punto)\n" +" * un punto y una línea o una normal (rotar alrededor de un eje a través " +"de un punto y paralela a la línea / normal)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "rotación" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "traslación" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(sin nombre)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "¡Contorno no cerrado, o no todos del mismo estilo!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "¡No todos los puntos son coplanares!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "¡El contorno se intersecta a sí mismo!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "¡arista de longitud cero!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Los archivos STL con formato de texto no son compatibles actualmente" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "" +"Debe estar dibujando en el plano de trabajo para crear un arco tangente." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"Para crear un arco tangente, seleccione un punto donde dos líneas que no " +"sean de construcción o los círculos de este grupo y el plano de trabajo se " +"unen." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"No pude redondear esta esquina. Pruebe con un radio más pequeño o intente " +"crear la geometría deseada a mano con restricciones de tangencia." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "No se pudo dividir esta entidad; solo líneas, círculos o cúbicos." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "Debe estar dibujando en el plano de trabajo para dividir." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Seleccione dos entidades que se crucen entre sí (por ejemplo, dos líneas/" +"círculos/arcos o una línea/círculo/arco y un punto)." + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "No se puede dividir; no se encontró ninguna intersección." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Asignar a Estilo" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Sin Estilo" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Estilo Personalizado Recién Creado..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Información de Grupo" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Información de Estilo" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Seleccionar Cadena de Arista" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Alternar Cota de Referencia" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Otro Ángulo Suplementario" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Enganchar a la cuadrícula" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Remover Punto de Spline" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Agregar Punto de Spline" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" +"No se puede agregar un punto de spline: se alcanzó el número máximo de " +"puntos." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Alternar Construcción" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Eliminar Restricción de Punto-Coincidente" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Cortar" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Copiar" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Seleccionar Todo" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Pegar" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Pegar Transformado..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Eliminar" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Deseleccionar Todo" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Deselección Flotante" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Ajustar a Pantalla" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "clic en el siguiente punto de la línea o presione Esc" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"No se puede dibujar un rectángulo en 3d; primero, active un plano de trabajo " +"con Croquis -> En Plano de trabajo." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "clic para colocar la otra esquina del rectángulo" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "clic para establecer el radio" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"No se puede dibujar un arco en 3d; primero, active un plano de trabajo con " +"Croquis -> En Plano de trabajo." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "clic para colocar el punto" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "clic en el siguiente punto del cúbico, o presione Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Croquizando en un plano de trabajo ya; croquis en 3d antes de crear un nuevo " +"plano de trabajo." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"No se puede dibujar texto en 3D; primero, active un plano de trabajo con " +"Croquis -> En Plano de trabajo." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "clic para colocar la parte inferior derecha del texto" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"No se puede dibujar una imagen en 3D; primero, active un plano de trabajo " +"con Croquis -> En Plano de Trabajo." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "Modelos SolveSpace" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "TODO" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "Placa circuito IDF" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "Malla de triángulo STL" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "Imagen PNG" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "Malla STL" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Malla Wavefront OBJ" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Malla compatible-Three.js, con visor" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Malla compatible-Three.js, solo malla" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "Archivo texto VRML" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "Archivo STEP" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "Archivo PDF" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "PostScript Encapsulado" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "Gráficos Vectoriales Escalables SVG" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "Archivo DXF (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "Archivo HPGL" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G Code" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "Archivos AutoCAD DXF y DWG" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "Valores separados por comas" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "sin título" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Guardar Archivo" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Abrir Archivo" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_Cancelar" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Guardar" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Abrir" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Autoguardado Disponible" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Un archivo de autoguardado está disponible para este croquis." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "¿Desea cargar el archivo de autoguardado en su lugar?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Cargar autoguardado" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "&No Cargar" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Archivo Modificado" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "¿Desea guardar los cambios que realizó en el croquis “%s”?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "¿Desea guardar los cambios que realizó en el nuevo croquis?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Sus cambios se perderán si no los guarda." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Guardar" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "&No Guardar" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(nuevo croquis)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Explorador de Propiedades" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Las restricciones se muestran actualmente y se exportarán en la trayectoria. " +"Probablemente esto no sea lo que querés; ocultalos haciendo clic en el " +"enlace en la parte superior de la ventana de texto." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"No se puede identificar el tipo de archivo a partir de la extensión del " +"nombre del archivo '%s'; intente .dxf o .dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "" +"La restricción debe tener una etiqueta y no debe ser una cota de referencia." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "" +"Selección incorrecta para la cota del paso; seleccione una restricción." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "El ensamble no interfiere, bien." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"El volumen del modelo sólido es:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"El volumen de la malla del grupo actual es:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Las superficies curvas se han aproximado como triángulos.\n" +"Esto introduce un error, normalmente alrededor del 1%." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"El área de la superficie de las caras seleccionadas es:\n" +"\n" +" %s\n" +"\n" +"Las curvas se han aproximado como lineales por partes.\n" +"Esto introduce un error, normalmente alrededor del 1%%." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Este grupo no contiene un área cerrada 2d correctamente formada. Está " +"abierta, no coplanares, o auto-intersectantes." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"El área de la región croquizada en este grupo es:\n" +"\n" +" %s\n" +"\n" +"Las curvas se han aproximado como lineales por partes.\n" +"Esto introduce un error, normalmente alrededor del 1%%." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"La longitud total de las entidades seleccionadas es:\n" +"\n" +" %s\n" +"\n" +"Las curvas se han aproximado como lineales por partes.\n" +"Esto introduce un error, normalmente alrededor del 1%%." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "" +"Selección incorrecta de perímetro; seleccione segmentos de línea, arcos y " +"curvas." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Selección incorrecta de rastreo; seleccione un solo punto." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "No pude escribir a '%s'" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "La malla se intersecta a si misma (NO está bien, no es válida)." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "La malla no se intersecta (está bien, es válida)." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "La malla tiene bordes desnudos (NO está bien, no es válida)." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "La malla es estanca (está bien, es válida)." + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"El modelo contiene %d triángulos, desde %d superficies." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Cero aristas problemáticas, bien.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d aristas problemáticas, mal.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Esto es SolveSpace versión %s.\n" +"\n" +"Para más información, ver http://solvespace.com/\n" +"\n" +"SolveSpace es software libre: sos libre de modificarlo\n" +"y/o redistribuirlo bajo los términos de la GNU\n" +"Licencia Pública General (GPL) versión 3 o posterior.\n" +"\n" +"NO HAY GARANTÍA, en la medida permitida por\n" +"ley. Para detalles, visitá http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues y otros autores.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"No se puede asignar estilo a una entidad derivada de otra entidad;; intenta " +"asignar un estilo al padre de esta entidad." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "El nombre del estilo no puede estar vacío" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "No se puede repetir menos de 1 vez." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "No se puede repetir más de 999 veces." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "El nombre del grupo no puede estar vacío" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "La opacidad debe estar entre cero y uno." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "El radio no puede ser cero o negativo." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Croquizar segmento de línea" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Croquizar rectángulo" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Croquizar círculo" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Croquizar arco de un círculo" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Croquizar curvas desde texto en fuente TrueType" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Croquizar imagen desde un archivo" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Crear arco tangente en el punto seleccionado" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Croquizar spline de Bezier cúbico" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Croquizar punto de referencia" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Alternar construcción" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Dividir líneas / curvas donde se intersectan" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Restringir distancia / diámetro / longitud" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Restringir ángulo" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Restringir para ser horizontal" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Restringir para ser vertical" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Restringir para ser paralela o tangente" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Restringir para ser perpendicular" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Restringir punto sobre línea / curva / plano / punto" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Restringir simetría" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Restringir igual longitud / radio / ángulo" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Restringir normales en misma orientación" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Otro ángulo suplementario" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Alternar cota de referencia" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Nuevo croquis activo de grupo de extrusión" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Nuevo croquis activo de grupo de rotación" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Nuevo croquis activo de grupo de hélice" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Nuevo croquis activo de grupo de revolución" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Nuevo paso de grupo y rotación repetida" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Nuevo paso de grupo y traslación repetida" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "Nuevo grupo en nuevo plano de trabajo (a través de entidades dadas)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "Nuevo grupo en 3d" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Nuevo enlace de grupo / archivo de ensamble" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Vista isométrica más cercana" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Alinear vista al plano de trabajo activo" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Error" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Mensaje" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&Aceptar" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "La escala no debe ser cero o negativa." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Formato incorrecto: especifica x, y, z" diff --git a/res/locales/fr_FR.po b/res/locales/fr_FR.po new file mode 100644 index 0000000..4724dc0 --- /dev/null +++ b/res/locales/fr_FR.po @@ -0,0 +1,2641 @@ +# French translations for the SolveSpace package. +# Copyright (C) 2018 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# whitequark , 2018. #zanata +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2025-01-26 21:48+0100\n" +"Last-Translator: whitequark \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 3.2.2\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Couper, coller et copier fonctionnent uniquement dans un plan de travail.\n" +"\n" +"Activez un plan avec « Dessin -> Dans le plan de travail »." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Presse papier vide ; rien à coller." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Le nombre de copies à coller doit être d'au moins un." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "L'échelle ne peut pas être zéro." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Sélectionnez un point pour définir l'origine de la rotation." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Sélectionnez deux points pour définir le vecteur de translation." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "" +"Transformation identique. Donc, toutes les copies seront exactement les unes " +"au-dessus des autres." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "Trop d'éléments à coller ; divisez-les en plus petits groupes." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Pas d'espace de travail actif." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Mauvais format : spécifiez les coordonnées comme x, y, z" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Mauvais format ; spécifiez la couleur comme r, v, b" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"Le facteur de perspective n'aura aucun effet tant que vous n'aurez pas " +"activé « Affichage -> Utiliser la Vue en perspective »." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Spécifier entre 0 et %d chiffres après la virgule." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "L'échelle d'export ne doit pas être zéro !" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Le décalage du rayon de coupe ne doit pas être négatif !" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "" +"Mauvaise valeur : l'intervalle d'enregistrement automatique devrait être " +"positif" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Mauvais format : spécifiez un nombre entier de minutes" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "pts-coïncidence" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "pt-pt-distance" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "pt-ligne-distance" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "pt-plan-distance" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "pt-face-distance" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "proj-pt-pt-distance" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "pt-dans-plan" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "pt-sur-ligne" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "pt-sur-face" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "eg-longueur" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "eg-longueur-et-pt-dans-dist" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "eg-pt-ligne-distances" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "longueur-ratio" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "arc-arc-longueur-ratio" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "arc-ligne-longueur-ratio" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "longueur-difference" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "arc-arc-longueur-différence" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "arc-ligne-longueur-différence" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "symétrique" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "symétrique-h" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "symétrique-v" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "symétrique-ligne" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "au-point-milieu" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "horizontal" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "vertical" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "diamètre" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "pt-sur-cercle" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "même-orientation" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "angle" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "parallèle" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "arc-ligne-tangente" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "cubique-ligne-tangente" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "courbe-courbe-tangente" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "perpendiculaire" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "eg-rayon" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "eg-angle" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "eg-ligne-long-arc-long" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "verrouillé-où-déplacé" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "commentaire" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"Le point sélectionné n'appartient pas à l'arc. L'arc et le segment de ligne " +"n'ont pas d'extrémité en commun.\n" +"\n" +"Sélectionnez une extrémité de l'arc que vous voulez être tangent à la ligne." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"L'arc tangent et le segment de ligne doivent partager une extrémité. " +"Contraignez-les avec « Contraintes -> Sur Point » avant de contraindre la " +"tangente.\n" +"\n" +"Alternativement, sélectionnez l'extrémité de l'arc que vous voulez " +"tangent à la ligne." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"Le point sélectionné n'est pas une extrémité de la spline cubique. La spline " +"et le segment de ligne n'ont pas d'extrémité en commun.\n" +"\n" +"Sélectionnez l'extrémité de la spline que vous voulez être tangente à la " +"ligne." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"La tangente cubique et le segment de ligne doivent partager une extrémité. " +"Contraignez-les avec « Contraintes -> Sur Point » avant de contraindre la " +"tangente.\n" +"\n" +"Alternativement, sélectionnez l'extrémité de la spline cubique où vous la " +"voulez tangent à la ligne." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"Les points sélectionnés ne sont pas les extrémités des des courbes. Les " +"courbes n'ont pas d'extrémité en commun.\n" +"\n" +"Sélectionnez les extrémités des deux courbes que vous voulez tangentes." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Les courbes doivent partager une extrémité. Contraignez-les avec " +"« Contraintes -> Sur Point » avant de contraindre la tangente.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +"Alternativement, sélectionnez les extrémités des deux courbes là où vous " +"les voulez tangentes." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Mauvaise sélection pour la contrainte distance / diamètre. Cette contrainte " +"peut s'appliquer à :\n" +"\n" +" – Deux points (distance entre points)\n" +" – Un segment de ligne (longueur)\n" +" – Deux points et un segment de ligne ou normal (distance projetée)\n" +" – Un plan de travail et un point (distance minimale)\n" +" – Un segment de ligne et un point (distance minimale)\n" +" – Une face plane et un point (distance minimale)\n" +" – Un cercle ou un arc (diamètre)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Mauvaise sélection pour la contrainte point / courbe / plan. Cette " +"contrainte peut s'appliquer à :\n" +"\n" +" – Au moins deux points (points coïncidents)\n" +" – Un point et un plan de travail (point dans le plan)\n" +" – Un point et un segment de ligne (point en ligne)\n" +" – Un point et un cercle ou un arc (point sur courbe)\n" +" – Un point, et entre une et trois faces planes (point sur face(s))\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Mauvaise sélection pour une contrainte de longueur / rayon égale. Cette " +"contrainte peut s'appliquer à :\n" +"\n" +" – Au moins deux segments de ligne(s) (longueur égale)\n" +" – Deux segments de ligne et deux points (distances point-ligne égales)\n" +" – Un segment de ligne et deux points (distances point-ligne égales)\n" +" – Un segment de ligne ou un segment de ligne et point (distance point-" +"ligne de longueur égale)\n" +" – Au moins deux cercles ou arcs (rayon égaux)\n" +" – Un segment de ligne et un arc (la longueur de segment de ligne est " +"égale à la longueur d'arc)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Mauvaise sélection pour une contrainte de ratio de longueur. Cette " +"contrainte peut s'appliquer à :\n" +"\n" +" – Deux segments de ligne\n" +" – Deux arcs\n" +" – Un arc et un segment de ligne\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Mauvaise sélection pour une contrainte de différence de longueur. Cette " +"contrainte peut s'appliquer à :\n" +"\n" +" – Deux segments de ligne\n" +" – Deux arcs\n" +" – Un arc et un segment de ligne\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Mauvaise sélection pour une contrainte de point médian. Cette contrainte " +"peut s'appliquer à :\n" +"\n" +" – Un segment de ligne et un point (point au milieu)\n" +" – Un segment de ligne et un plan de travail (point médian dans le plan)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Mauvaise sélection pour la contrainte symétrique. Cette contrainte peut " +"s'appliquer à :\n" +"\n" +" – Deux points ou un segment de ligne (symétrique à l'axe des coordonnées " +"du plan de travail)\n" +" – Segment de ligne, et deux points ou un segment de ligne (symétrique " +"sur le segment de ligne)\n" +" – Plan de travail, et deux points ou un segment de ligne (symétrique au " +"plan de travail)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Un plan de travail doit être actif lors d'une contrainte de symétrie sans " +"plan de symétrie explicite." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Activez un plan de travail (avec Dessin -> Dans le plan de travail) avant " +"d'appliquer une contrainte horizontale ou verticale." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Mauvaise sélection pour la contrainte horizontale / verticale. Cette " +"contrainte peut s'appliquer à :\n" +"\n" +" – Au moins deux points\n" +" – Au moins un segment de ligne(s)\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Mauvaise sélection pour la même contrainte d'orientation. Cette contrainte " +"peut s'appliquer à :\n" +"\n" +" – Deux normales\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Vous devez sélectionner une contrainte d'angle." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "Vous devez sélectionner une contrainte avec une étiquette associée." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Mauvaise sélection pour une contrainte d'angle. Cette contrainte peut " +"s'appliquer à :\n" +"\n" +"Angle entre :\n" +" – Deux segments de ligne\n" +" – Un segment de ligne et une normale\n" +" – Deux normales\n" +"\n" +"Angles égaux :\n" +" – Quatre segments de ligne ou des normales (angle entre A, B et C, D " +"égaux)\n" +" – Trois segments de ligne ou des normales (angle entre A, B et B, C " +"égaux)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "La tangence courbe-courbe doit s'appliquer dans le plan de travail." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Mauvaise sélection pour la contrainte parallèle / tangente. Cette contrainte " +"peut s'appliquer à :\n" +"\n" +" – Deux faces\n" +" – Au moins deux segments de ligne(s) (parallèle)\n" +" – Au moins un segment de ligne et au moins une normale (parallèle)\n" +" – Au moins deux normales (parallèle)\n" +" – Deux segments de ligne, des arcs ou des Béziers, qui partagent une " +"extrémité (tangente)\n" +" * Deux segments de lignes, arcs, ou béziers, qui n'ont pas d'extrémité " +"en commun et la/les extrémité(s) des courbe(s) (tangente)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Mauvaise sélection pour une contrainte perpendiculaire. Cette contrainte " +"peut s'appliquer à :\n" +"\n" +" – Deux faces\n" +" – Deux segments de ligne\n" +" – Un segment de ligne et une normale\n" +" – Deux normales\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Mauvaise sélection pour le point de verrouillage où la contrainte déplacé. " +"Cette contrainte peut s'appliquer à :\n" +"\n" +" – un point\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "NOUVEAU COMMENTAIRE — DOUBLE-CLIQUEZ POUR EDITER" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "cliquez le centre du texte de commentaire" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"Aucun modèle solide présent ; dessinez-en un avec une extrusion et " +"révolution, ou utilisez « Exporter vue 2d » pour exporter les lignes et les " +"courbes dépouillées." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Mauvaise sélection pour la section export. Sélectionnez :\n" +"\n" +" – Rien, avec un plan de travail actif (plan de travail est un plan de " +"section)\n" +" – Une face (plan de coupe au-travers d'une face)\n" +" – Un point et deux segments de ligne (plan au-travers d'un point et " +"parallèle aux lignes)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Le maillage du groupe actif est vide ; Rien à exporter." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "les lignes à main levée ont été remplacées par des lignes continues" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "les lignes en zigzag ont été remplacées par des lignes continues" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Certains aspects du dessin n'ont pas d'équivalent DXF et n'ont pas été " +"exportés :\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"La taille de la page PDF dépasse 200 par 200 pouces ; de nombreux lecteurs " +"risquent rejeter ce fichier." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "dessin-dans-plan" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#références" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "Le fichier est vide. Il est possible qu'il soit corrompu." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Données non reconnues dans le fichier. Ce fichier peut être corrompu, ou " +"venir d'une version plus récente du programme." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Fichier manquant" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "Le fichier lié « %s » n'est pas présent." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"Voulez-vous le chercher manuellement ?\n" +"\n" +"Sinon, toute géométrie qui dépend du fichier manquant sera définitivement " +"supprimée." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Oui" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&Non" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&Annuler" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Fichier" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&Nouveau" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Ouvrir..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Ouvrir &Récent" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Sauver" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Sauver &Comme..." + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Exporter &Image..." + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Exporter &vue 2D..." + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Exporter &Section 2d..." + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Exporter &Fil de fer 3d..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Exporter Triangle &Maillage..." + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Export &Surfaces..." + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "Im&porter..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "&Quitter" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "&Editer" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Annuler" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Refaire" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Re&générer Tout" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Accrocher la sélection à la &Grille" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Tourner l'import de &90°" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Co&uper" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "&Copier" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "Co&ller" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "Coller &Transformer..." + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Effacer" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Sélectionner une Chaîne d'&Arêtes" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "Sélectionner &Tout" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "&Désélectionner Tout" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "&Styles de Ligne..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&Affichage Perspective..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "Con&figuration..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&Affichage" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "Zoom &Avant" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "Zoom A&rrière" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Zoom A&justé" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Aligner la vue au &Plan de travail" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Vue &Orthogonale la plus proche" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Vue &Isométrique la plus proche" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Centrer la Vue sur le Point" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Afficher la &grille d'accrochage" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Noircir Solides Inactifs" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Utiliser la Vue en &Perspective" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Afficher Vue Éclatée" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "&Unités de dimensions" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Dimensions en &Millimètres" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Dimensions en &Mètres" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Dimensions en &Pouces" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Dimensions en &Pieds et Pouces" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Affichage &Barre d'outils" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Affichage du &Navigateur de Propriété" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "&Plein Ecran" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "&Nouveau Groupe" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "Dessin en &3d" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "Dessin dans un nouveau &Plan de travail" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "Répéter par &Translation" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "Répéter par &Rotation" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "E&xtruder" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "&Hélice" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "&Tour (révolution complète)" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "Ré&volution" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Lier / Assembler..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Lier Récent" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Dessin" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "Dans le &Plan de travail" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "N'importe où dans la &3d" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "&Point" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "&Plan de travail" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "Ligne - &Polyligne" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "Ligne de C&onstruction" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Rectangle" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "&Cercle" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "&Arc de Cercle" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "Spline Cubique de &Bézier" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "&Texte en Police TrueType" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "I&mage" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "&Basculer en mode « Construction »" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Rendre l'Arc Ta&ngent au Point" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Diviser les Courbes à l'&Intersection" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Contraintes" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Distance / Diamètre" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Dimension Maîtresse / Indicative" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "A&ngle / Égalité Angle" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "An&gle Maître / Indicatif" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Autre angle S&upplémentaire" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Basculer cote Maîtresse / cote Indicative" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Horizontal" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Vertical" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&Sur Point / Courbe / Plan" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "É&galité Longueur / Rayon" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "Ratio Longueur / Arc" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Différence Longueur / Arc" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "Au &Milieu" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "&Symétrique" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Para&llèle / Tangent" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "&Perpendiculaire" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Même Orient&ation" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Accrocher le point à l'&Emplacement" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Commentaire" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Analyse" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "Mesurer &Volume" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Mesurer &Aire" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Mesurer &Périmètre" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Montrer les Pièces &Interférentes" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Montrer les Arêtes &Nues" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Montrer le &Centre de Gravité" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Montrer les &sous-contraintes Points" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "&Tracer Point" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "&Arrêter Tracé..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "&Dimension pas-à-pas..." + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Aide" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Langue" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Site web / Manuel" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "Voir le commit sur &GitHub" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "&A propos" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(pas de fichier récent)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "Le fichier « %s » n'existe pas." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "Pas de plan de travail actif, la grille ne va donc pas apparaître." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"Le facteur de perspective est réglé à 0, donc la vue restera une projection " +"parallèle.\n" +"\n" +"Pour une projection en perspective, modifiez le facteur de perspective dans " +"l'écran de configuration. Une valeur d'environ 0,3 est typique." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "" +"Sélectionnez un point. Ce point deviendra le centre de la vue à l'écran." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "" +"Aucune entité supplémentaire ne partage des points d'extrémité avec les " +"entités sélectionnées." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"Pour utiliser cette commande, sélectionnez un point ou une autre entité à " +"partir d'une pièce liée ou créez un groupe de liens dans le groupe actif." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"Aucun plan de travail n'est actif. Activez un plan de travail (avec Dessin -" +"> Dans le plan de travail) pour définir le plan pour la grille d'accrochage." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Impossible d'accrocher ces éléments à la grille. Sélectionnez des points, " +"des textes de commentaires ou des contraintes avec une étiquette. Pour " +"accrocher une ligne, sélectionnez ses extrémités." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"Aucun plan de travail sélectionné. Activation du plan de travail par défaut " +"pour ce groupe." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"Aucun plan de travail n'est sélectionné et le groupe actif n'a pas de plan " +"de travail par défaut. Essayez de sélectionner un plan de travail ou " +"d'activer un groupe de « Dessin dans nouveau plan travail »." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Mauvaise sélection pour l'arc tangent au point. Sélectionnez un seul point, " +"ou ne sélectionnez rien pour configurer les paramètres de l'arc." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "cliquez un point sur l'arc (dessine dans le sens anti-horaire)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "cliquez pour placer un point" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "cliquez le premier point du segment de ligne" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "cliquez le premier point de la ligne de construction" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "cliquez le premier point du segment cubique" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "cliquez pour placer le centre du cercle" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "cliquez pour placer l'origine du plan de travail" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "cliquez un coin du rectangle" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "cliquez le haut à gauche du texte" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "cliquez le haut à gauche de l'image" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"Aucune entité n'est sélectionnée. Sélectionnez les entités avant d'essayer " +"de basculer leurs états de construction." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "dessin-en-3d" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Mauvaise sélection pour un nouveau dessin. Ce groupe peut être créé avec :\n" +"\n" +" – Un point (passant par le point, orthogonal aux axes de coordonnées)\n" +" – Un point et deux segments de lignes (passant par le point, parallèle " +"aux deux lignes)\n" +" – Un point et une normale (passant par le point, orthogonal à la " +"normale)\n" +" – Un plan de travail (copie du plan de travail)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Activez un plan de travail (Dessin -> Dans le plan de travail) avant " +"l'extrusion. Le croquis sera extrudé normalement au plan de travail." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "extruder" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "L'opération tour ne peut être appliquée qu'à des dessins plans." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Mauvaise sélection pour un nouveau groupe de révolution. Ce groupe peut être " +"créé avec :\n" +"\n" +" – Un point et un segment de ligne ou normal (révolution autour d'un axe " +"parallèle à la ligne / point normal, par le point)\n" +" – Un segment de ligne (révolution sur le segment de ligne)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "tour" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "L'opération révolution ne peut être appliquée qu'à des dessins plans." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Mauvaise sélection pour un nouveau groupe de révolution. Ce groupe peut être " +"créé avec :\n" +"\n" +" – Un point et un segment de ligne ou normal (révolution autour d'un axe " +"parallèle à la ligne / point normal, par le point)\n" +" – Un segment de ligne (révolution sur le segment de ligne)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "révolution" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "L'opération hélice ne peut être appliquée qu'à des dessins plans." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Mauvaise sélection pour un nouveau groupe d'hélice. Ce groupe peut être créé " +"avec :\n" +"\n" +" – Un point et un segment de ligne ou normal (révolution autour d'un axe " +"parallèle à la ligne / point normal, par le point)\n" +" – Un segment de ligne (révolution sur le segment de ligne)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "hélice" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Mauvaise sélection pour une nouvelle rotation. Ce groupe peut être créé " +"avec :\n" +"\n" +" – Un point, lorsqu'il est verrouillé dans un plan de travail (rotation " +"dans le plan, autour de ce point)\n" +" – Un point et une ligne ou une normale (tourner autour d'un axe par le " +"point et parallèle à la ligne / normale)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "rotation" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "translation" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(sans nom)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "contour non fermé ou tout n'est pas du même style !" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "les points ne sont pas tous coplanaires !" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "le contour s'entrecroise !" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "arête de longueur nulle !" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Les fichiers STL textuels ne sont pas actuellement pas supportés" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "Vous devez dessiner dans un plan pour créer un arc tangent." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"Pour créer un arc tangent, sélectionnez un point où deux lignes ou cercles " +"(pas de construction) de ce groupe et de ce plan se rejoignent." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Impossible d'arrondir ce coin. Essayez un rayon plus petit, ou essayez de " +"créer la géométrie souhaitée à la main avec des contraintes tangentielles." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" +"Impossible de diviser cette entité ; Lignes, cercles ou cubiques uniquement." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "Vous devez dessiner dans un plan de travail pour diviser." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Sélectionnez deux entités qui s'intersectent (par exemple deux lignes/" +"cercles/arcs, ou une ligne/cercle/arc et un point)." + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Impossible de diviser ; pas d'intersection trouvée." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Appliquer au style" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Pas de style" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Style personnalisé nouvellement créé ..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Info Groupe" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Info Style" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Sélection Chaîne d'arêtes" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Basculer cote maîtresse / cote indicative" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Autre angle supplémentaire" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Accrocher à la grille" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Effacer le point de la Spline" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Ajouter un point à la Spline" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" +"Impossible d'ajouter le point spline : nombre maximum de points atteints." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Basculer en mode « construction »" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Effacer la contraint Point-Coïncident" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Couper" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Copier" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Sélectionner tout" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Coller" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Coller transformé..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Effacer" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Désélectionner tout" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Désélectionner survolé" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Zoom pour ajuster" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "cliquez pou le prochain point de ligne or appuyez sur Esc" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Impossible de dessiner un rectangle en 3d ; D'abord, activez un plan de " +"travail avec « Dessin -> Dans le plan de travail »." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "cliquez pour placer un autre coin de rectangle" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "cliquez pour ajuster le rayon" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Ne peut pas dessiner l'arc en 3d ; D'abord, activez un plan de travail avec " +"« Dessin -> Dans le plan de travail »." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "cliquez pour placer un point" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "cliquez le prochain point cubique ou appuyez sur Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Vous dessinez déjà dans un plan de travail ; Sélectionner « Dessiner en 3d » " +"avant de créer un nouveau plan de travail." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Impossible de dessiner du texte en 3d ; D'abord, activer un plan de travail " +"avec « Dessin -> Dans le plan de travail »." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "cliquer pour placer le coin inférieur droit du texte" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Impossible de dessiner l'image en 3d ; D'abord, activez un plan de travail " +"avec « Dessin -> Dans le plan de travail »." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "modèles SolveSpace" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "TOUT" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "circuit imprimé IDF" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "maillage de triangles STL" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "image PNG" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "maillage STL" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Mesh Wavefront OBJ" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Mesh compatible avec Three.js, avec visionneuse" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Mesh compatible avec Three.js, mesh seulement" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "Fichier texte VRML" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "fichier STEP" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "fichier PDF" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "PostScript encapsulé" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "image vectorielle SVG" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "fichier DXF (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "fichier HPGL" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G Code" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "fichiers AutoCAD DXF et DWG" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "CSV (Comma-separated values)" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "sans nom" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Sauver fichier" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Ouvrir Fichier" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_Annuler" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Sauver" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Ouvrir" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Sauvegarde automatique existante" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Un fichier de sauvegarde automatique est disponible pour ce dessin." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "Voulez-vous charger la sauvegarde automatique à la place ?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Charger la sauvegarde automatique" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "Ne &pas la charger" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Fichier modifié" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "" +"Voulez-vous sauver les changements que vous avez fait au dessin « %s » ?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "" +"Voulez-vous sauver les changements que vous avez fait au nouveau dessin ?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Vos changements seront perdus si vous ne les sauvez pas." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Sauver" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "&Ne pas sauver" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(nouveau dessin)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Navigateur de propriété" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Les contraintes sont actuellement affichées, et seront exportées dans le " +"toolpath. Ce n'est probablement pas ce que vous voulez, cachez-le en cliquer " +"le lien en haut de la fenêtre de texte." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"Impossible d'identifier le type de fichier à partir de l'extension '%s' ; " +"essayez .dxf ou .dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "" +"La contrainte doit avoir un nom, et ne doit pas référencer une dimension." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "" +"Mauvaise sélection pour le pas-à-pas dimension ; sélectionnea une contrainte." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "Cet assemblage n'interfère pas, bien." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"Le volume du modèle de solide est :\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"Le volume de ce groupe mesh est :\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Les surfaces courbes ont été approximée par des triangles.\n" +"Cela introduit une erreur, d'environ 1% en général." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"La surface des faces sélectionnées est :\n" +"\n" +" %s\n" +"\n" +"Les courbes ont été approximée comme étant linéaires par morceau.\n" +"Cela introduit une erreur, d'environ 1%% en général." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Ce groupe ne contient pas de surface 3d fermée correcte. Elle est ouverte, " +"non coplanaire, ou s'intersecte." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"La surface de la région dessinée dans ce groupe est :\n" +"\n" +" %s\n" +"\n" +"Les courbes ont été approximée comme linéaires par morceau.\n" +"Cela introduit une erreur, d'environ 1%% en général." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"La longueur totale des entités sélectionnées est :\n" +"\n" +" %s\n" +"\n" +"\n" +"Les courbes ont été approximée comme linéaires par morceau.\n" +"Cela introduit une erreur, d'environ 1%% en général." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "" +"Mauvaise sélection pour un périmètre ; sélectionnez des segments de ligne, " +"des arcs, et des coubres." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Mauvaise sélection pour le tracé ; sélectionnez un unique point." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "Impossible d'écrire « %s »" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "Le mesh s'intersecte (NON valide)." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "Le mesh ne s'intersecte pas (valide)." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "Le mesh a des arêtes nues (NON valide)." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "Le mesh est étanche (valide)." + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"Le modèle contient %d triangles, répartis sur %d surfaces." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Pas d'arête problématique, bien.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d arêtes problématiques, pas bien.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Ceci est SolveSpace version %s.\n" +"\n" +"Pour plus d'information, visitez http://solvespace.com/\n" +"\n" +"SolveSpace est un logiciel libre : vous êtes libre de le\n" +"modifier et/ou le redistribuer selon les termes de la GNU\n" +"General Public License (GPL) version 3 ou supérieure.\n" +"\n" +"Il n'y a AUCUNE GARANTIE, dans les limites légales.\n" +"Pour plus de détails, visitez http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues et autres auteurs.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Impossible d'attribuer le style à une entité dérivée d'une autre entité ; " +"Essayez d'attribuer un style au parent de cette entité." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Le nom d'un style ne peut pas être vide" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "Je ne peux pas répéter moins de 1 fois." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "Je ne peux pas répéter plus de 999 fois." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Un nom de groupe ne peut pas être vide" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "L'opacité doit être entre 0 et 1." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Le rayon ne peut pas être zéro ou négatif." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Dessin ligne - polyligne" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Dessin d'un rectangle" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Dessin d'un cercle" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Dessin d'un arc de cercle" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Dessin de courbes depuis un texte en police TrueType" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Dessin d'une image depuis un fichier" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Créer un arc tangent au point sélectionné" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Dessin d'une spline cubique de Bézier" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Dessin d'un point" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Basculer en mode « construction »" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Diviser lignes / courbes où elles se croisent" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Contraindre distance / diamètre / longueur" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Contraindre angle" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Contraindre à être horizontal" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Contraindre à être vertical" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Contraindre à être parallèle ou tangent" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Contraindre à être perpendiculaire" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Contraindre point sur ligne / courbe / plan / point" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Contrainte symétrique" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Contrainte égale longueur / rayon / angle" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Contrainte normales dans la même direction" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Autre angle supplémentaire" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Basculer cote maîtresse / cote indicative" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Nouveau groupe d'extrusion du dessin actif" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Nouveau groupe de révolution du dessin actif (tour complet)" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Nouveau groupe hélice du dessin actif" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Nouveau groupe de révolution partielle du dessin actif" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Nouveau groupe de répétition circulaire" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Nouveau groupe de répétition linéaire" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "" +"Nouveau groupe dans un nouveau plan de travail (Par des entités données)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "Nouveau groupe en 3d" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Nouveau groupe lié / assemblage" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Vue isométrique la plus proche" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Aligner la vue sur le plan de travail actif" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Erreur" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Message" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&Ok" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "L'échelle ne peut pas être zéro ou négative." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Mauvais format : Spécifiez x, y, z" + +#~ msgid "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" +#~ msgstr "" +#~ "Mauvaise sélection pour la contrainte point / courbe / plan. Cette " +#~ "contrainte peut s'appliquer à :\n" +#~ "\n" +#~ " – Deux points (points coïncidents)\n" +#~ " – Un point et un plan de travail (point dans le plan)\n" +#~ " – Un point et un segment de ligne (point en ligne)\n" +#~ " – Un point et un cercle ou un arc (point sur courbe)\n" +#~ " – Un point et une face plane (point sur une face)\n" + +#~ msgid "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" +#~ msgstr "" +#~ "Mauvaise sélection pour une contrainte de longueur / rayon égale. Cette " +#~ "contrainte peut s'appliquer à :\n" +#~ "\n" +#~ " – Deux segments de ligne (longueur égale)\n" +#~ " – Deux segments de ligne et deux points (distances point-ligne " +#~ "égales)\n" +#~ " – Un segment de ligne et deux points (distances point-ligne égales)\n" +#~ " – Un segment de ligne ou un segment de ligne et point (distance point-" +#~ "ligne de longueur égale)\n" +#~ " – Quatre segments de ligne ou des normales (angle entre A, B et C, D " +#~ "égaux)\n" +#~ " – Trois segments de ligne ou des normales (angle entre A, B et B, C " +#~ "égaux)\n" +#~ " – Deux cercles ou arcs (rayon égaux)\n" +#~ " – Un segment de ligne et un arc (la longueur de segment de ligne est " +#~ "égale à la longueur d'arc)\n" + +#~ msgid "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" +#~ msgstr "" +#~ "Mauvaise sélection pour la contrainte horizontale / verticale. Cette " +#~ "contrainte peut s'appliquer à :\n" +#~ "\n" +#~ " – deux points\n" +#~ " – Un segment de ligne\n" + +#~ msgid "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Mauvaise sélection pour une contrainte d'angle. Cette contrainte peut " +#~ "s'appliquer à :\n" +#~ "\n" +#~ " – Deux segments de ligne\n" +#~ " – Un segment de ligne et une normale\n" +#~ " – Deux normales\n" + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "Mauvaise sélection pour la contrainte parallèle / tangente. Cette " +#~ "contrainte peut s'appliquer à :\n" +#~ "\n" +#~ " – Deux segments de ligne (parallèles)\n" +#~ " – Un segment de ligne et un parallèle (parallèle)\n" +#~ " – Deux normales (parallèles)\n" +#~ " – Deux segments de ligne, des arcs ou des Béziers, qui partagent une " +#~ "extrémité (tangente)\n" + +#~ msgid "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Mauvaise sélection pour une contrainte perpendiculaire. Cette contrainte " +#~ "peut s'appliquer à :\n" +#~ "\n" +#~ " – Deux segments de ligne\n" +#~ " – Un segment de ligne et une normale\n" +#~ " – Deux normales\n" + +#~ msgid "A&ngle" +#~ msgstr "A&ngle" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "É&galité Longueur / Rayon / Angle" + +#~ msgid "" +#~ "Bad selection for length ratio constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Mauvaise sélection pour la contrainte du rapport de longueur. Cette " +#~ "contrainte peut s'appliquer à :\n" +#~ "\n" +#~ "    * Deux segments de ligne\n" + +#~ msgid "" +#~ "Bad selection for length difference constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Mauvaise sélection pour la contrainte de différence de longueur. Cette " +#~ "contrainte peut s'appliquer à :\n" +#~ "\n" +#~ "    * Deux segments de ligne\n" + +#~ msgid "Length Ra&tio" +#~ msgstr "R&apport de Longueur" + +#~ msgid "Length Diff&erence" +#~ msgstr "D&ifférence de Longueur" + +#~ msgid "" +#~ "Bad selection for new sketch in workplane. This group can be created " +#~ "with:\n" +#~ "\n" +#~ " * a point (through the point, orthogonal to coordinate axes)\n" +#~ " * a point and two line segments (through the point, parallel to the " +#~ "lines)\n" +#~ " * a workplane (copy of the workplane)\n" +#~ msgstr "" +#~ "Mauvaise sélection pour un nouveau dessin dans le plan de travail. Ce " +#~ "groupe peut être créé avec :\n" +#~ "\n" +#~ "    * Un point (par le point, orthogonal aux axes de coordonnées)\n" +#~ "    * Un point et deux segments de ligne (par le point, parallèle aux " +#~ "lignes)\n" +#~ "    * Un plan de travail (copie du plan de travail)\n" + +#~ msgid "Specify between 0 and 8 digits after the decimal." +#~ msgstr "Spécifiez entre 0 et 8 chiffres après la virgule." + +#~ msgid "Show Degrees of &Freedom" +#~ msgstr "Montrer les Degrés de &Liberté" + +#~ msgid "click to place bottom left of text" +#~ msgstr "cliquez pour placer le bas gauche du texte" + +#~ msgid "Do you want to save the changes you made to the new sketch?" +#~ msgstr "" +#~ "Voulez-vous enregistrer les modifications que vous avez apportées au " +#~ "nouveau dessin ?" + +#~ msgid "Your changes will be lost if you don't save them." +#~ msgstr "Vos modifications seront perdues si vous ne les enregistrez pas." + +#~ msgctxt "button" +#~ msgid "Save" +#~ msgstr "Sauver" + +#~ msgctxt "button" +#~ msgid "Cancel" +#~ msgstr "Annuler" + +#~ msgctxt "button" +#~ msgid "Don't Save" +#~ msgstr "Ne pas sauver" + +#~ msgid "Do you want to load the autosave file instead?" +#~ msgstr "Voulez-vous charger le fichier de sauvegarde à la place ?" + +#~ msgctxt "button" +#~ msgid "Load" +#~ msgstr "Charger" + +#~ msgctxt "button" +#~ msgid "Don't Load" +#~ msgstr "Ne pas charger" + +#~ msgid "" +#~ "Do you want to locate it manually?\n" +#~ "If you select “No”, any geometry that depends on the missing file will be " +#~ "removed." +#~ msgstr "" +#~ "Voulez-vous le localiser manuellement ?\n" +#~ "Si vous sélectionnez « Non », toute géométrie qui dépend du fichier " +#~ "manquant sera supprimée." + +#~ msgctxt "button" +#~ msgid "Yes" +#~ msgstr "Oui" + +#~ msgctxt "button" +#~ msgid "No" +#~ msgstr "Non" + +#~ msgctxt "button" +#~ msgid "OK" +#~ msgstr "Valider" + +#~ msgid "_Cancel" +#~ msgstr "_Annuler" + +#~ msgid "_Open" +#~ msgstr "_Ouvrir" + +#~ msgid "" +#~ "The file has changed since it was last saved.\n" +#~ "\n" +#~ "Do you want to save the changes?" +#~ msgstr "" +#~ "Le fichier a changé depuis sa dernière sauvegarde.\n" +#~ "\n" +#~ "Voulez-vous enregistrer les modifications ?" + +#~ msgctxt "button" +#~ msgid "Do_n't Save" +#~ msgstr "_Ne pas sauver" + +#~ msgctxt "button" +#~ msgid "_Load autosave" +#~ msgstr "_Charger la sauvegarde automatique" + +#~ msgctxt "button" +#~ msgid "Do_n't Load" +#~ msgstr "_Ne pas charger" + +#~ msgctxt "button" +#~ msgid "_Yes" +#~ msgstr "_Oui" + +#~ msgctxt "button" +#~ msgid "_No" +#~ msgstr "_Non" + +#~ msgid "SolveSpace models" +#~ msgstr "Modèles SolveSpace" + +#~ msgid "PNG file" +#~ msgstr "Fichier PNG" + +#~ msgid "STL mesh" +#~ msgstr "Maillage STL" + +#~ msgid "Wavefront OBJ mesh" +#~ msgstr "Maillage Wavefront OBJ" + +#~ msgid "Three.js-compatible mesh, with viewer" +#~ msgstr "Maillage Three-js-compatible, avec visualisateur" + +#~ msgid "Three.js-compatible mesh, mesh only" +#~ msgstr "Maillage Three-js-compatible, maillage seul" + +#~ msgid "STEP file" +#~ msgstr "Fichier STEP" + +#~ msgid "PDF file" +#~ msgstr "Fichier PDF" + +#~ msgid "Encapsulated PostScript" +#~ msgstr "Encapsulated PostScript" + +#~ msgid "Scalable Vector Graphics" +#~ msgstr "Scalable Vector Graphics" + +#~ msgid "DXF file (AutoCAD 2007)" +#~ msgstr "Fichier DXF (AutoCAD 2007)" + +#~ msgid "HPGL file" +#~ msgstr "Fichier HPGL" + +#~ msgid "G Code" +#~ msgstr "G Code" + +#~ msgid "AutoCAD DXF and DWG files" +#~ msgstr "Fichiers AutoCAD DXF et DWG" + +#~ msgid "Comma-separated values" +#~ msgstr "Valeurs CSV séparées par des virgules" diff --git a/res/locales/ja_JP.po b/res/locales/ja_JP.po new file mode 100644 index 0000000..211c43c --- /dev/null +++ b/res/locales/ja_JP.po @@ -0,0 +1,2384 @@ +# Japanese translations for SolveSpace package. +# Copyright (C) 2022 the Solvespace authors +# This file is distributed under the same license as the SolveSpace package. +# verylowfreq, 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2025-02-01 10:31+0900\n" +"Last-Translator: https://github.com/verylowfreq\n" +"Language-Team: \n" +"Language: ja_JP\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"切り取り・貼り付け・コピーは作業平面でのみ利用できます。\n" +"\n" +"作業平面は「スケッチ -> 作業平面上でスケッチする」から指定してください。" + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "クリップボードは空です。貼り付けるものはありません。" + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "貼り付ける個数は1以上でなければなりません。" + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "縮尺は0にできません。" + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "回転の原点を決めるために、点を1つ選択してください。" + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "移動方向を決めるために、点を2つ選択してください。" + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "移動量が 0 です。すべての複製は同一位置にあります。" + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "複製の数が多すぎます。分割してください。" + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "作業平面がアクティブでありません。" + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "書式が誤っています。座標を \"x, y, z\" で指定してください。" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "書式が誤っています。色を \"r, g, b\" で指定してください。" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"透視投影の拡大率は、「表示 -> 透視投影で表示」を有効にするまで反映されませ" +"ん。" + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "小数点以下の桁数は、0 から %d の範囲で指定してください。" + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "エクスポートの比率には0を指定できません。" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "ドリル径は負の値にできません。" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "値が誤っています。オートセーブの間隔は正の値を指定してください。" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "書式が誤っています。間隔は分単位で整数を指定してください。" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"選択された点は円弧上にありません。円弧と直線が同じ端点を共有していません。\n" +"\n" +"線分に正接させたい円弧の端点を選択してください。" + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"正接する円弧と線分は端点を共有している必要があります。正接拘束をする前に「拘" +"束 -> 一致」で拘束してください。\n" +"\n" +"もしくは、線分に正接させたい円弧の端点を選択してください。" + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"選択された点は三次スプラインの端点ではありません。スプラインと線分が同じ端点" +"を共有していません。\n" +"\n" +"線分に正接させたいスプラインの端点を選択してください。" + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"ベジェ曲線と線分は端点を共有している必要があります。正接拘束をする前に「拘束 " +"-> 一致」で拘束してください。\n" +"\n" +"もしくは、線分に正接させたいベジェ曲線の端点を選択してください。" + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"選択された点は2つのカーブの端点ではありません。カーブが同じ端点を共有していま" +"せん。\n" +"\n" +"互いに正接させたいカーブの共通の端点を選択してください。" + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"曲線同士は端点を共有している必要があります。正接拘束をする前に「拘束 -> 一" +"致」で拘束してください。\n" +"\n" +"もしくは、正接させたい曲線の共通の端点を選択してください。" + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"距離・直径拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2 つの点 (点同士の距離)\n" +" * 1 つの線分 (長さ)\n" +" * 2 つの点と、1 つの線分もしくは法線 (投影された距離)\n" +" * 1 つの作業平面と 1 つの点 (最小の距離)\n" +" * 1 つの線分と 1 つの点 (最小の距離)\n" +" * 1 つの平面フェイスと1つの点 (最小の距離)\n" +" * 1 つの円もしくは円弧 (直径)\n" +"\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"一致拘束ができませんでした。次の要素に適用できます。\n" +"\n" +" * 2 つの点 (点を同一位置に)\n" +" * 1 つの点と 1 つの作業平面 (点を平面上に)\n" +" * 1 つの点と 1 つの線分 (点を直線状に)\n" +" * 1 つの点と、1つの円もしくは円弧 (点を曲線上に)\n" +" * 1 つの点と、1 から3つの平面フェイス (点をフェイス上に)\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"長さ・半径の同値拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2 つ以上の線分 (長さを同じに)\n" +" * 2 つの線分と 2 つの点 (それぞれ直線と点の距離を同じに)\n" +" * 1 つの線分と 2 つの点 (直線とそれぞれの点の距離を同じに)\n" +" * 1 つの線分と、1 つの点と 1 つの線分 (線分の長さと、直線と点の距離を同じ" +"に)\n" +" * 2 つ以上の円もしくは円弧 (半径を同じに)\n" +" * 1 つの線分と 1 つの円弧 (線分の長さと円弧の長さを同じに)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"長さの比率の拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2 つの線分\n" +" * 2 つの円弧\n" +" * 円弧と線分\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"長さの差の拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2 つの線分\n" +" * 2 つの円弧\n" +" * 円弧と線分\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"中点拘束できませんでした。次の要素に適用できます:\n" +"\n" +" * 線分と点 (点を直線の中点に置きます)\n" +" * 線分と作業平面 (直線の中点を作業平面上に置きます)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"対象拘束ができませんでした。次の要素の適用できます:\n" +"\n" +" * 2 つの点、もしくは 1 つの線分 (作業平面の座標軸について対称をとります)\n" +" * 線分と、2 つの点もしくは 1 つの線分 (線分について対称をとります)\n" +" * 作業平面と、2 つの点もしくは 1 つの線分 (作業平面について対称をとりま" +"す)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"明示的に対称平面を指定しない場合は、対象拘束をするには作業平面をアクティブに" +"してください。" + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"垂直拘束や水平拘束をする前に、「スケッチ -> 作業平面上でスケッチする」で作業" +"平面をアクティブにしてください。" + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"垂直・水平拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2つ以上の点\n" +" * 1つ以上の線分\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"同じ方向の拘束ができませんでした。次の要素に適用できます。\n" +"\n" +" * 2 つの法線\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "角度拘束を選択してください。" + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "値を持つ拘束を選択してください。" + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"角度拘束ができませんでした。\n" +"\n" +"次の要素間の角度に適用できます:\n" +" * 2つの線分\n" +" * 1つの線分と1つの法線\n" +" * 2つの法線\n" +"\n" +"次の要素を同じ角度に拘束できます:\n" +" * 4つの線分もしくは法線 (AとB、CとDの角度を同じにする)\n" +" * 3つの線分もしくは法線 (AとB、BとCの角度を同じにする)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "曲線同士の正接は作業平面上で適用できます。" + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"平行・正接拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2つのフェイス\n" +" * 2つ以上の線分 (平行に)\n" +" * 1つ以上の線分と1つ以上の法線 (平行に)\n" +" * 2つ以上の法線 (平行に)\n" +" * 端点の1つが一致する、2つの線分か円弧かベジェ曲線 (正接に)\n" +" * 正接する曲線と端点を共有しない、2つの線分か円弧かベジェ曲線\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"垂線拘束ができませんでした。次の要素に適用できます:\n" +"\n" +" * 2つのフェイス\n" +" * 2つの線分\n" +" * 1つの線分と1つの法線\n" +" * 2つの法線\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"点の位置の拘束 (点を他のオブジェクトに連動して動かさない) ができませんでし" +"た。次の要素に適用できます:\n" +"\n" +" * 1 つの点\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "(コメント - ダブルクリックで編集)" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "コメントテキストの中心をクリックで指定" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"ソリッドモデルがありません。押し出しや周回、回転を利用するか、平面への投影視" +"点のエクスポートで直線や曲線をそのまま出力します。" + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"2D断面の出力ができませんでした。次のように選択してください:\n" +"\n" +" * なにも選択せず、作業平面がアクティブである (作業平面を断面とします)\n" +" * フェイス (フェイスを通る断面を用います)\n" +" * 1 つの点と 2 つの線分 (点を通り直線と平行する断面を用います)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "" +"アクティブなグループのメッシュは空です。エクスポートは行なわれませんでした。" + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "フリーハンドの線は実線に置き換えられました。" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "ジグザグ線は実線に置き換えられました。" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"図面のうち一部の側面は、対応するものがDXFにないため、それらは出力されませんで" +"した:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"PDFのページ寸法が 200x200 インチを超えています。多くのPDFリーダーでは正常に読" +"み込めません。" + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "ファイルが空です。ファイルが破損している可能性があります。" + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"ファイルに処理できないデータが含まれています。ファイルが破損しているか、より" +"新しいバージョンで作成されたファイルの可能性があります。" + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "不明ファイル" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "リンクされたファイル \"%s\" が見つかりません。" + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"手動で配置しますか?\n" +"\n" +"キャンセルした場合、不明なファイルに依存しているすべての寸法は削除されます。" + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "はい (&Y)" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "いいえ (&N)" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "キャンセル (&C)" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "ファイル (&F)" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "新規作成 (&N)" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "開く... (&O)" + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "最近使用したファイル (&R)" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "保存 (&S)" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "名前を付けて保存... (&A)" + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "画像をエクスポート... (&I)" + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "平面への投影視点をエクスポート... (&V)" + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "2D断面をエクスポート... (&S)" + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "三次元ワイヤーフレームをエクスポート... (&W)" + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "三角メッシュをエクスポート... (&M)" + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "サーフェスをエクスポート... (&S)" + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "インポート... (&I)" + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "終了 (&E)" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "編集 (&E)" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "取り消し (&U)" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "やり直し (&R)" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "すべて再生成 (&g)" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "選択したオブジェクトをグリッドに合わせる (&G)" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "リンクした部品を90度回転する (&9)" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "切り取り (&t)" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "コピー (&C)" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "貼り付け (&P)" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "複製しながら貼り付け... (&T)" + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "削除 (&D)" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "接続しているエッジを選択" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "すべてを選択 (&A)" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "選択を解除 (&U)" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "線のスタイル... (&L)" + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "カメラの設定... (&V)" + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "設定 (&f)" + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "表示 (&V)" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "拡大 (&I)" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "縮小 (&O)" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "選択オブジェクトの最適表示" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "作業平面に合わせる (&W)" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "近傍の正面図視点へ移動 (&O)" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "近傍の等角図視点へ移動 (&I)" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "点を表示の中心にする" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "グリッドを表示 (&G)" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "アクティブでないソリッドを暗くする" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "透視投影で表示 (&P)" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "分解立体図を表示 (&x)" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "表示単位の選択 (&U)" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "ミリメートル (&M)" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "メートル (&e)" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "インチ (&I)" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "フィート・インチ (&F)" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "ツールバーを表示 (&T)" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "プロパティブラウザを表示 (&w)" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "全画面表示 (&F)" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "グループ (&N)" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "三次元空間内でスケッチを始める (&3)" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "新しい作業平面上でスケッチを始める (&W)" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "直線上にコピー (&T)" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "円上にコピー (&R)" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "押し出し (&x)" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "周回 (&H)" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "螺旋 (&L)" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "回転 (&v)" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "リンク・アセンブル..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "最近使用したファイルとリンク" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "スケッチ (&S)" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "作業平面上でスケッチする (&W)" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "三次元空間内でスケッチする (&3)" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "点 (&P)" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "作業平面 (&k)" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "線分 (&S)" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "補助線の線分 (&o)" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "四角形 (&R)" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "円 (&C)" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "円弧 (&A)" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "ベジェ曲線 (&B)" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "TrueTypeフォントのテキスト (&T)" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "画像 (&m)" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "補助線との切り替え (&g)" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "フィレット(&n)" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "交差箇所で分割 (&I)" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "拘束 (&C)" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "距離・直径 (&D)" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "参照寸法 (&f)" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "指定角度 / 角度を等しく (&n)" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "参照角度 (&g)" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "補角 (&u)" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "拘束と参照を切り替え (&e)" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "æ°´å¹³ (&H)" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "垂直 (&V)" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "一致 (&O)" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "長さ・半径を等値にする (&q)" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "長さ・円弧の比率 (&t)" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "長さ・円弧の差 (&e)" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "中点 (&M)" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "対称 (&y)" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "平行・正接 (&l)" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "垂線 (&P)" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "同じ方向 (&a)" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "点を他のオブジェクトに連動して動かさない (&D)" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "コメントを配置" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "解析 (&A)" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "体積を計測 (&V)" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "面積を計測 (&r)" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "外周長を計測 (&P)" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "部品の干渉を強調表示 (&I)" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "浮いたエッジを強調表示 (&N)" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "重心を表示 (&C)" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "拘束されていない点を強調表示 (&U)" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "点の位置の記録を開始 (&T)" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "記録を終了して保存する... (&S)" + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "寸法を段階的に変更... (&D)" + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "ヘルプ (&H)" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "言語 (&L)" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "Webサイト・マニュアル" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "GitHubの該当コミットへ移動 (&G)" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "SolveSpaceについて (&A)" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(履歴なし)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "ファイル '%s' は存在しません。" + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "作業平面がアクティブでないため、グリッドは表示されません。" + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"透視投影の係数が 0 になっているため、表示は常に平行投影になります。\n" +"\n" +"透視投影にするには、係数を configuration から変更してください。値は 0.3 くら" +"いが一般的です。" + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "スクリーンの中央とする点を指定してください。" + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "選択した要素と端点を共有する要素は、これ以上ありません。" + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"このコマンドを利用するには、リンクされた部品の要素や点を選択するか、リンクの" +"グループをアクティブにしてください。" + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"作業平面がアクティブではありません。グリッドの平面を指定するには作業平面をア" +"クティブにしてください (「スケッチ -> 作業平面上でスケッチする」)。" + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"この要素をグリッドに合わせることはできません。点、コメントテキスト、もしくは" +"値のある拘束を選択してください。直線をグリッドに合わせるには、端点を選択して" +"ください。" + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"作業平面がアクティブではありません。現在のグループのデフォルトの作業平面をア" +"クティブにします。" + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"作業平面がアクティブではありません。また、現在のグループにはデフォルトの作業" +"平面がありません。作業平面を選択するか、新しく作業平面グループを作成してくだ" +"さい。" + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"フィェットの作成には無効な選択です。ひとつの点が選択されていればフィレットを" +"作成します。なにも選択されていなければ、フィレット作成時のパラメーターを設定" +"できます。" + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "円弧上の点をクリックで指定 (反時計回りに描きます)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "点の位置をクリックで指定" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "線分の最初の点をクリックで指定" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "補助線の線分の最初の点をクリックで指定" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "ベジェ曲線の最初の点をクリックで指定" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "円の中央をクリックで指定" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "作業平面の原点をクリックで指定" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "四角形の角のひとつをクリックで指定" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "テキストの右上をクリックで指定する" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "画像の右上をクリックで指定する" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"スケッチ要素が選択されていません。拘束と参照を切り替えるには、最初に要素を選" +"択してください。" + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"作業平面にスケッチを作成できませんでした。次のように選択してください。\n" +"\n" +" * 点 (点を通り、座標軸に直交する作業平面を作成します)\n" +" * 点と、2 つの線分 (点を通り、直線に平行する作業平面を作成します)\n" +" * 点と、法線 (点を通り、法線と直交する作業平面を作成します)\n" +" * 作業平面 (あるいは作業平面のコピー)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"押し出しを作成する前に、「スケッチ -> 作業平面上でスケッチする」で作業平面を" +"アクティブにしてください。作業平面の法線方向へ押し出しを作成します。" + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "周回操作は作業平面上にあるスケッチにのみ適用できます。" + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"周回を作成できませんでした。次のように選択してください。\n" +"\n" +" * 点と、線分もしくは法線 (点を通る回転軸を仮定し、直線・法線に平行に回転し" +"ます)\n" +" * 線分 (直線を回転軸とします)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "回転操作は作業平面上にあるスケッチにのみ適用できます。" + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"回転を作成できませんでした。次のように選択してください。\n" +"\n" +" * 点と、線分もしくは法線 (点を通る回転軸を仮定し、直線・法線に平行に回転し" +"ます)\n" +" * 線分 (直線を回転軸とします)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "螺旋操作は作業平面上にあるスケッチにのみ適用できます。" + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"螺旋を作成できませんでした。次のように選択してください。\n" +"\n" +" * 点と、線分もしくは法線 (点を通る回転軸を仮定し、直線・法線に平行に螺旋を" +"作成します)\n" +" * 線分 (直線を回転軸とします)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"円上にコピーを作成できませんでした。次のように選択してください。\n" +"\n" +" * 作業平面上にある点 (作業平面上で、これを原点として周回します)\n" +" * 点と、直線もしくは法線 (点を通る回転軸を仮定し、直線・法線と平行に周回し" +"ます)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(名称未設定)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "" +"閉じた輪郭でない、もしくは、輪郭を構成する要素のスタイルが同一ではありませ" +"ん。" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "点が同一平面上にありません。" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "輪郭線が自己交差しています。" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "長さが 0 のエッジです。" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "テキスト形式のSTLファイルは、いまのところサポートされていません。" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "正接円弧をスケッチするには、作業平面上でスケッチしてください。" + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"正接円弧を作成するには、同じグループかつ同じ作業平面上にある、補助線ではない2" +"つの直線もしくは円が交差している点を選択してください。" + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"この角をフィレットにできませんでした。もっと小さい半径を指定するか、手作業で" +"拘束してください。" + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "この要素は分割できません。分割できるのは直線・円・ベジェ曲線のみです。" + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "分割するには作業平面上でスケッチしてください。" + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "互いに交差している 2 つの要素を選択してください (直線・円・円弧・点)" + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "交差箇所が見つからないため、分割できません。" + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "スタイルを割り当て" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "スタイル指定なし" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "スタイルを作成して割り当て..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "グループ情報" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "スタイル情報" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "接続しているエッジをまとめて選択" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "参照寸法と切り替え" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "補角と切り替え" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "グリッドに沿わせる" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "スプラインの制御点を削除" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "スプラインの制御点を追加" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" +"スプラインの制御点を追加できませんでした。点の個数の上限に達しています。" + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "補助線との切り替え" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "点の一致拘束を削除する" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "切り取り" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "コピー" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "すべてを選択" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "貼り付け" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "複製しながら貼り付け..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "削除" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "選択を解除" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "カーソルを当てている要素の選択を解除" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "選択オブジェクトの最適表示" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "直線の次の点をクリックで指定、もしくはESCで終了" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"三次元空間内に四角形はスケッチできません。「スケッチ -> 作業平面上でスケッチ" +"する」で作業平面をアクティブにしてください。" + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "四角形のもう一つの角をクリックで指定" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "半径をクリックで指定" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"三次元空間内に円弧はスケッチできません。「スケッチ -> 作業平面上でスケッチす" +"る」で作業平面をアクティブにしてください。" + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "点の位置をクリックで指定" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "ベジェ曲線の次の点をクリックで指定、もしくはESCで終了" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"すでに作業平面上でのスケッチをしています。新しい作業平面を作成する前に、三次" +"元空間内でスケッチしてください。" + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"三次元空間内にテキストはスケッチできません。「スケッチ -> 作業平面上でスケッ" +"チする」で作業平面をアクティブにしてください。" + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "テキストの左下の位置をクリックで指定" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"三次元空間内に画像はスケッチできません。「スケッチ -> 作業平面上でスケッチす" +"る」で作業平面をアクティブにしてください。" + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpaceモデル" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "(すべてのファイル)" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF 電子基板" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL 三角メッシュ" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG 画像" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL メッシュ" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ メッシュ" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js 互換のメッシュ (ビューワー付)" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js 互換のメッシュ (メッシュのみ)" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML テキストファイル" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP ファイル" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF ファイル" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "EPS ファイル (Encapsulated PostScript)" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "SVG ファイル" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF ファイル (AutoDesk 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPG ファイル" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G コード" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AudoCAD DXF/DWG ファイル" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "CSV ファイル (Comma-separated values)" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "名称未設定" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "ファイルを保存" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "ファイルを開く" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "キャンセル (_C)" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "保存 (_S)" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "開く (_O)" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "オートセーブファイルがあります" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "このスケッチにはオートセーブファイルがあります。" + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "代わりにオートセーブファイル読み込みますか?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "オートセーブファイルを読み込む (&L)" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "読み込まない (&n)" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "編集済みファイル" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "スケッチ \"%s\" への変更を保存しますか?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "新規スケッチへの変更を保存しますか?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "(未保存の変更があります。)" + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "保存する (&S)" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "保存しない (&n)" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(新規スケッチ)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "プロパティブラウザ" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"表示されている拘束はツールパスとしてエクスポートされます。これはあなたが期待" +"した動作ではないかもしれません。プロパティブラウザの上部にあるボタンで非表示" +"にできます。" + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"拡張子からファイル形式を特定できませんでした ( '%s' )。 \".dxf\" や \".dwg\" " +"を試してください。" + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "参照寸法ではなく、かつ、値のある拘束を選択してください。" + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "寸法の段階的変更には無効な選択です。値のある拘束を選択してください。" + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "部品の干渉はありませんでした。" + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"ソリッドモデルの容積:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"現在のグループのメッシュの容積:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"曲面はトライアングルに近似します。\n" +"これにより通常、約 1% の誤差が発生します。" + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"選択した面のファーフェスの面積:\n" +"\n" +" %s\n" +"\n" +"曲線は区分線形に近似します。\n" +"これにより通常、約 1%% の誤差が発生します。" + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"このグループは正常に構成された二次元の閉じた領域が含まれていません。領域が開" +"いているか、同一平面上にないか、自己交差しています。" + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"このグループ内のスケッチされた領域の面積:\n" +"\n" +" %s\n" +"\n" +"曲線は区分線形に近似します。\n" +"これにより通常、約 1%% の誤差が発生します。" + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"選択された要素の合計の長さ:\n" +"\n" +" %s\n" +"\n" +"曲線は区分線形に近似します。\n" +"これにより通常、約 1%% の誤差が発生します。" + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "" +"外周長の計測には無効な選択です。線分、円弧、もしくは曲線を選択してください。" + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "点の位置の記録には無効な選択です。ひとつの点を選択してください。" + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "'%s' へ書き込めませんでした。" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "メッシュが自身と交差しています (警告)" + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "メッシュは自己交差していません (適切)" + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "メッシュには浮いたエッジが含まれています (警告)" + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "メッシュには隙間はありません (適切)" + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"モデルには %d 個のトライアングルがあり、これが %d 個のサーフェスを構成しま" +"す。" + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"問題のあるエッジは見つかりませんでした。%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d 個の問題のあるエッジが見つかりました。%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"他の要素から派生した要素には個別のスタイルを割り当てることはできません。親要" +"素にスタイルを割り当ててください。" + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "スタイル名は空にできません" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "繰り返しは 1 以上の回数を指定してください。" + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "999回を超えて繰り返すことはできません。" + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "グループ名は空にできません" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "透明度は0から1の間で指定してください。" + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "半径は0もしくは負の値にできません。" + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "線分をスケッチ" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "四角形をスケッチ" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "円をスケッチ" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "円弧をスケッチ" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "TrueTypeフォントのテキストからアウトラインをスケッチ" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "ファイルから画像を取り込む" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "選択された点でフィレットを作る" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "ベジェ曲線をスケッチ" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "点をスケッチ" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "補助線と切り替え" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "直線・曲線を交差箇所で分割" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "距離・直径・長さを拘束" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "角度を拘束" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "水平に拘束" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "垂直に拘束" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "平行もしくは正接で拘束" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "垂線で拘束" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "点を線・曲線・面・点の上に拘束" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "対称に拘束" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "長さ・半径・角度を等値に拘束" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "法線を同じ方向に拘束" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "角度の拘束を補角へ移動" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "拘束と参照寸法を切り替え" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "押し出しを作成" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "周回を作成" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "螺旋を作成" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "回転を作成" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "円上にコピーを作成" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "直線上にコピーを作成" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "選択した要素で定義される作業平面でスケッチを開始" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "三次元空間内でスケッチを開始" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "他のファイルをリンクする" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "近傍の等角図視点" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "アクティブな作業平面に視点を合わせる" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "エラー" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "メッセージ" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "OK (&O)" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "縮尺は 0 や負の値にはできません。" + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "書式が誤っています。\"x, y, z\" で指定してください。" + +#~ msgid "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" +#~ msgstr "" +#~ "一致拘束ができませんでした。次の要素に適用できます:\n" +#~ "\n" +#~ " * 2 つの点 (点を同一位置に)\n" +#~ " * 1 つの点と 1 つの作業平面 (点を平面上に)\n" +#~ " * 1 つの点と 1 つの線分 (点を直線状に)\n" +#~ " * 1 つの点と、1つの円もしくは円弧 (点を曲線上に)\n" +#~ " * 1 つの点と 1 つの平面フェイス (点をフェイス上に)\n" + +#~ msgid "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" +#~ msgstr "" +#~ "長さ・半径・角度の同値拘束ができませんでした。次の要素に適用できます:\n" +#~ "\n" +#~ " * 2 つの線分 (長さを同じに)\n" +#~ " * 2 つの線分と 2 つの点 (それぞれ直線と点の距離を同じに)\n" +#~ " * 1 つの線分と 2 つの点 (直線とそれぞれの点の距離を同じに)\n" +#~ " * 1 つの線分と、1 つの点と 1 つの線分 (線分の長さと、直線と点の距離を同" +#~ "じに)\n" +#~ " * 4つの線分もしくは法線 (直線A,B、直線C,Dそれぞれの交差する角度を同じ" +#~ "に)\n" +#~ " * 3 つの線分もしくは法線 (直線A,B、直線B,Cそれぞれの交差する角度を同じ" +#~ "に)\n" +#~ " * 2 つの円もしくは円弧 (半径を同じに)\n" +#~ " * 1 つの線分と 1 つの円弧 (線分の長さと円弧の長さを同じに)\n" + +#~ msgid "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" +#~ msgstr "" +#~ "垂直・水平拘束ができませんでした。次の要素に適用できます:\n" +#~ "\n" +#~ " * 2 つの点\n" +#~ " * 1 つの線分\n" + +#~ msgid "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "角度拘束ができませんでした。次の要素に適用できます:\n" +#~ "\n" +#~ " * 2 つの線分\n" +#~ " * 線分と法線\n" +#~ " * 2 つの法線\n" + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "平行・正接拘束ができませんでした。次の要素に適用できます:\n" +#~ "\n" +#~ " * 2 つの線分 (平行)\n" +#~ " * 1 つの線分と 1 つの法線 (平行)\n" +#~ " * 2 つの法線 (平行)\n" +#~ " * 片方の端点を共有する 2 つの線分、円弧、もしくはベジェ曲線 (正接)\n" + +#~ msgid "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "垂線拘束ができませんでした。次の要素に適用できます:\n" +#~ "\n" +#~ " * 2 つの線分\n" +#~ " * 1 つの線分と 1 つの法線\n" +#~ " * 2 つの法線\n" + +#~ msgid "A&ngle" +#~ msgstr "角度 (&n)" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "長さ・半径・角度を等値にする (&q)" diff --git a/res/locales/ru_RU.po b/res/locales/ru_RU.po new file mode 100644 index 0000000..36f1d2e --- /dev/null +++ b/res/locales/ru_RU.po @@ -0,0 +1,2642 @@ +# Russian translations for SolveSpace package. +# Copyright (C) 2017 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# EvilSpirit , 2017. +# Olesya Gerasimenko , 2021. +# Alexandre Prokoudine , 2023. +# Milan Djurovic , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2025-02-22 14:48-0800\n" +"Last-Translator: Milan Djurovic \n" +"Language-Team: Russian \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"X-Generator: Gtranslator 41.0\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Копировать, вставить или вырезать можно\n" +"только находясь в рабочей плоскости.\n" +"Активируйте ее через Эскиз->В рабочей плоскости." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Буфер обмена пуст; нечего вставлять." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Укажите в поле 'количество' хотя бы одну копию для вставки." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "Масштабный коэффициент не может быть нулевым." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Выберите одну точку в качестве центра вращения." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Выберите две точки, чтобы задать вектор смещения." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "" +"Трансформация не задана. Все копии будут расположены в одном и том же месте." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "Слишком много элементов для вставки; разбейте на несколько частей." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Нет активной рабочей плоскости." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Неверный формат: введите координаты как x, y, z" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Неверный формат: введите цвет как r, g, b" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"Коэффициент перспективы не будет иметь эффект, пока вы не включите Вид-" +">Перспективная Проекция." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Введите число от 0 до %d." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "Масштабный коэффициент не может быть нулевым!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Радиус режущего инструмента не может быть отрицательным!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "" +"Неверное значение: интервал автосохранения должен быть положительным числом" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "" +"Неверный формат: введите целое число, чтобы задать интервал автосохранения" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "тчк-тчк-совпадение" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "тчк-тчк-расстояние" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "тчк-линия-расстояние" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "тчк-плоск-расстояние" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "тчк-грань-расстояние" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "проекц-тчк-тчк-расст" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "тчк-на-плоск" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "тчк-на-линии" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "тчк-на-грани" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "равенство-длин" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "равен-длины-и-тчк-лин-расст" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "равен-тчк-линия-расстояний" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "отношение-длин" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "отношение-длин-дуга-дуга" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "отношение-длин-дуга-отрезок" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "разность-длин" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "разность-длин-дуга-дуга" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "разность-длин-дуга-отрезок" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "симметричность" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "симметричность-гориз" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "симметричность-верт" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "симметричность-по-оси" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "на-середине" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "горизонтальность" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "вертикальность" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "диаметр" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "тчк-на-окружности" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "идентичная-ориентация" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "угол" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "параллельность" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "кас-дуга-линия" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "кас-сплайн-линия" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "кас-кривых" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "перпендикулярность" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "равенство-радиусов" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "равенство-углов" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "равен-длины-линии-длины-дуги" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "фиксация" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "комментарий" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"Выбранная точка не принадлежит дуге. Дуга и отрезок не имеют общей конечной " +"точки.\n" +"\n" +"Выберите конечную точку дуги, в которой вы хотите, чтобы она была " +"касательной к отрезку." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"Дуга и отрезок должны быть соединены. Соедините их крайние точки с помощью " +"'Ограничения -> Точка на примитиве' перед тем, как применять ограничения " +"касательности.\n" +"\n" +"Или выберите конечную точку дуги, в которой вы хотите, чтобы она была " +"касательной к отрезку." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"Выбранная вами точка не является конечной точкой кубического сплайна. Сплайн " +"и отрезок не имеют общей конечной точки.\n" +"\n" +"Выберите конечную точку сплайна, в которой вы хотите, чтобы он был " +"касательным к отрезку." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"Сплайн и отрезок должны быть соединены. Соедините их крайние точки с помощью " +"'Ограничения -> Точка на Примитиве' перед тем, как применять ограничение " +"касательности.\n" +"\n" +"Или выберите конечную точку кубического сплайна, в которой вы хотите, чтобы " +"он былкасательным к отрезку." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"Выбранные вами точки не являются конечными точками двух кривых. У кривых нет " +"общей конечной точки.\n" +"\n" +"Выберите конечные точки обеих кривых, в которых вы хотите, чтобы они были " +"касательными друг к другу." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Кривые должны быть соединены. Соедините их крайние точки с помощью " +"'Ограничения -> Точка на Примитиве' перед тем, как применять ограничение " +"касательности.\n" +"\n" +"Или выберите конечные точки обеих кривых, в которых вы хотите, чтобы они " +"быликасательными." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Неправильное выделение для ограничения расстояния / диаметра.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * две точки (расстояние между точками)\n" +" * отрезок (длина отрезка)\n" +" * две точки и отрезок / нормаль (расстояние между точками, " +"спроецированное на линию / нормаль)\n" +" * рабочую плоскость и точку (расстояние от точки до плоскости)\n" +" * отрезок и точку (расстояние от точки до линии)\n" +" * грань и точку (расстояние от точки до плоскости грани)\n" +" * окружность или дугу (диаметр / радиус)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Неправильное выделение для ограничения 'точка на примитиве'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * две или более точек (совпадение точек)\n" +" * точку и рабочую плоскость (точка в плоскости)\n" +" * точку и отрезок (точка на линии)\n" +" * точку и окружность / дугу / сплайн (точка на кривой)\n" +" * точку и от одной до трех граней (точка на грани)\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Неправильное выделение для ограничения 'равенство примитивов'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * два или более отрезка (равенство длин отрезков)\n" +" * два отрезка и две точки (равенство расстояний от точек до линий)\n" +" * отрезок и две точки (равенство расстояний от точек до линии)\n" +" * отрезок, точку и отрезок (равенство длины отрезка расстоянию от точки " +"до линии)\n" +" * две или более окружностей / дуги (равенство радиусов)\n" +" * отрезок и дугу (равенство длины отрезка и длины дуги)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Неправильное выделение для ограничения 'отношение длин'. Ограничение может " +"принимать в качестве выделения следующие примитивы:\n" +"\n" +" * два отрезка\n" +" * две дуги\n" +" * дугу и отрезок\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Неправильное выделение для ограничения 'разность длин'. Ограничение может " +"принимать в качестве выделения следующие примитивы:\n" +"\n" +" * два отрезка\n" +" * две дуги\n" +" * дугу и отрезок\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Неправильное выделение для ограничения 'на середине'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * точку и отрезок (точка на середине отрезка)\n" +" * отрезок и рабочую плоскость (середина отрезка на плоскости)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Неправильное выделение для ограничения 'симметрия'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * две точки / отрезок (симметричность точек по горизонтали/вертикали в " +"зависимости от вида)\n" +" * отрезок, две точки / отрезок (симметричность точек по оси отрезка)\n" +" * рабочую плоскость и две точки / отрезок (симметричность относительно " +"рабочей плоскости\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Рабочая плоскость должна быть активна для того, чтобы создать\n" +"ограничение симметричности без явного указания плоскости симметрии." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Рабочая плоскость должна быть активирована (Эскиз -> В рабочей плоскости)\n" +"перед тем, как накладывать ограничения горизонтальности / вертикальности." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Неправильное выделение для ограничения 'горизонтальность / вертикальность'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * две или более точек\n" +" * один или более отрезков\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Неправильное выделение для ограничения 'идентичная ориентация'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * два координатных базиса('нормали')\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "" +"Переключатся между смежными углами можно только выбрав ограничение угла." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "" +"Переключать режим 'размера для справок' возможно только для ограничений, " +"имеющих размерное значение." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Неправильное выделение для ограничения углов.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +"Угол между:\n" +" * два отрезка\n" +" * отрезок и координатный базис (нормаль)\n" +" * два координатных базиса (нормали)\n" +"\n" +"Равные углы:\n" +" * четыре отрезка или нормали (равенство углов A,B и C,D)\n" +" * три отрезка или нормали (равенство углов A,B and B,C)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "" +"Ограничение касательности может быть наложено только в рабочей плоскости." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Неправильное выделение для ограничения параллельности / касательности.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * две граней\n" +" * два или более отрезка (параллельность)\n" +" * два или более отрезка и одинь или более координатных базисов (нормали) " +"(параллельность)\n" +" * два или более координатных базиса (нормали) (параллельность)\n" +" * два отрезка, две дуги или два сплайна, соединенных крайними точками " +"(касательность)\n" +" * два отрезка, две дуги или два сплайна, не имеющие общей крайней точки," +"но с выбранными крайними точками (касательность)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Неправильное выделение для ограничения перпендикулярности.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * две граней\n" +" * два отрезка\n" +" * отрезок и координатный базис (нормаль)\n" +" * два координатных базиса (нормали)\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Неправильное выделение для ограничения 'фиксация'.\n" +"Ограничение может принимать в качестве выделения следующие примитивы:\n" +"\n" +" * точку\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "КОММЕНТАРИЙ -- ДВОЙНОЙ ЩЕЛЧОК ДЛЯ РЕДАКТИРОВАНИЯ" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "кликните мышью там, где будет расположен текстовый комментарий" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"Тела не найдены; создайте их или используйте экспорт двумерных объектов." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Неправильное выделение для экспорта сечения. Необходимо выделить:\n" +"\n" +" * Ничего, но с активированной рабочей плоскостью (рабочая плоскость " +"будет плоскостью сечения)\n" +" * грань (сечение через грань)\n" +" * точку и два отрезка (сечение плоскостью, заданной двумя отрезками, " +"построенной через указанную точку)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Активная группа не содержит тел; нечего экспортировать." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "стили линии 'от руки' были заменены сплошными линиями" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "ломаные линии были заменены сплошными линиями" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Некоторые элементы чертежа не имеют аналогов в DXF-представлении и не были " +"экспортированы:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"Размер страницы PDF превышает 200x200 дюймов; некоторые программы просмотра " +"не смогут прочитать такой файл." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "эскиз-в-плоскости" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "система-координат" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "Файл пуст. Возможно он поврежден." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Некоторые данные из этого файла не распознаны. Возможно, файл поврежден или " +"создан в более новой версии программы." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Файл Отсутствует" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "Связанный файл “%s” отсутствует." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"Хотите найти их вручную?\n" +"Если вы ответите \"Нет\", то вся геометрия, которая зависит от " +"отсутствующего файла будет удалена." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "Да" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "Нет" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "Отменить" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Файл" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "Соз&дать" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Открыть..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Открыть н&едавние файлы" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Сохранить" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Сохранить &Как…" + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Экспортировать и&зображение…" + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Экспортировать &2d-вид…" + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Экспортировать 2d-се&чение…" + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Экспортировать &3d-каркас…" + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Экспортировать &полигональную сетку…" + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Экспортировать повер&хности…" + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "&Импортировать..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "&Выход" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "&Правка" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Отменить" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Вернуть" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "&Перегенерировать все" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Привязать выделение к &сетке" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Повернуть импортированное на &90°" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Вы&резать" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "&Копировать" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "В&ставить" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "Вставить с &трансформацией…" + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Удалить" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Вы&делить последовательность ребер" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "В&ыделить всё" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "С&бросить выделение" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "Стили линий…" + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&Проекция вида..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "Настройки..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&Вид" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "&Приблизить" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "От&далить" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Показать &всё / выделенное" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Выровнять вид по &рабочей плоскости" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Ближайший &ортогональный вид" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Ближайший &изометрический вид" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Центрировать вид на точке" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Показать &сетку" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Затемнять неактивные тела" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Перспективная прое&кция" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Показать &развернутый вид" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "Единицы &измерения" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Размеры в ми&ллиметрах" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Размеры в метрах" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Размеры в дю&ймах" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Размеры в &футах и дюймах" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Показывать па&нель инструментов" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Показывать брау&зер" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "Полно&экранный режим" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "&Новая группа" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "Создать эскиз в &3d" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "Создать эскиз в новой &рабочей плоскости" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "&Линейный массив" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "&Круговой массив" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "Тело &выдавливания" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "Тело в&интовое" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "Тело в&ращения" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "Тело в&ращения на угол" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "&Импортировать деталь/сборку…" + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Импортировать недавний файл" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Эскиз" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "В &рабочей плоскости" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "Режим &3d" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "Опорная &точка" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "Рабочая &плоскость" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "&Отрезок" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "&Вспомогательный отрезок" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "Прямоу&гольник" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "О&кружность" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "Д&уга окружности" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "Кубический &сплайн Безье" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "Т&екст TrueType" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "И&зображение" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "Переключить режим вс&помогательных построений" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Кас&ательная в точке" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Ра&збить кривые пересечением" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Ограничение" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Расстояние / Диаметр" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Справочный ра&змер" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "&Угол / Равенство углов" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Справочный &угол" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Переключить сме&жный угол" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Переключить &режим справочного размера" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Горизонтальность" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Вертикальность" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&Точка на примитиве" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "&Равенство длин / радиусов" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "&Отношение длин (дуга)" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Р&азность длин (дуга)" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "&На середине" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "С&имметричность" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Пара&ллельность / Касательность" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "Перпендикул&ярность" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Идентичная &ориентация" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "За&фиксировать" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Комментарий" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Анализ" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "Измерить &объем" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Измерить п&лощадь" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Измерить п&ериметр" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Показать пе&ресекающиеся детали" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Показать про&блемные ребра" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Показать &центр массы" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Показать c&вободные точки" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "Включить &трассировку точки" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "Остановить тра&ссировку..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "Плавное из&менение размера…" + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Справка" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Язык" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "Вебсайт / &Справка" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "Пере&йти к коммиту на GitHub" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "О &Программе" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(пусто)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "Файл '%s' не существует." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "Сетку не будет видно, пока рабочая плоскость не активирована." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"Коэффициент перспективы установлен в ноль, что соответствует ортогональной " +"проекции.\n" +"Чтобы получить перспективную проекцию, отредактируйте значение коэффициента " +"перспективы на конфигурационной странице браузера.\n" +"Значение по умолчанию 0.3." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "Выделите точку. Вид будет отцентрован по этой точке." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "Нет дополнительных объектов, соединенных с выбранными примитивами." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"Чтобы использовать эту команду, выделите точку или другой примитив, " +"принадлежащий импортированной детали, или активируйте группу импортированной " +"детали." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"Рабочая плоскость не активна. Активируйте ее через Эскиз -> В Рабочей " +"Плоскости чтобы определить плоскость для сетки." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Невозможно привязать выбранные примитивы к сетке. Необходимо выбирать точки, " +"текстовые комментарии или ограничения с размерными значениями. Чтобы " +"привязать отрезок или другой примитив, выбирайте его точки." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"Рабочая плоскость не активна. Активирована рабочая плоскость по умолчанию " +"для данной группы." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"Рабочая плоскость не выбрана и активная группа не содержит рабочей плоскости " +"по умолчанию. Попробуйте выделить рабочую плоскость или создать новую с " +"помощью Группа -> Создать Эскиз в Новой Рабочей Плоскости." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Неправильное выделение для создания скругления в точке. Выделите либо одну " +"точку, либо запустите команду без выделения, чтобы перейти к окну настроек " +"этой команды." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "" +"кликните мышью там, где хотите создать дугу окружности (дуга будет " +"нарисована против часовой стрелки)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "кликните мышью там, где хотите создать опорную точку" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "кликните мышью там, где хотите создать первую точку отрезка" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "" +"кликните мышью там, где хотите создать первую точку вспомогательного отрезка" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "" +"кликните мышью там, где хотите создать первую точку кубического сплайна Безье" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "кликните мышью там, где будет находиться центр окружности" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "" +"кликните мышью там, где будет находиться точка, через которую будет " +"построена рабочая плоскость" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "кликните мышью там, где будет находиться один из углов прямоугольника" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "кликните мышью там, где хотите создать текст" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "" +"кликните мышью там, где будет расположен левый верхний угол изображения" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"Не выбран ни один примитив. Выберите примитивы перед тем, как переключать их " +"режим дополнительных построений." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "эскиз-в-3d" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Неправильное выделение для создания эскиза в рабочей плоскости. Группа может " +"быть создана, используя в качестве выделения следующие примитивы:\n" +"\n" +" * точку (через точку, ортогонально осям координат)\n" +" * точку и два отрезка (через точку, параллельно отрезкам)\n" +" * точку и нормаль (через точку, ортогонально нормали)\n" +" * рабочую плоскость (копию рабочей плоскости)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Выберите рабочую плоскость (Эскиз -> В Рабочей Плоскости) перед созданием " +"группы выдавливания. Эскиз будет выдавлен по нормали к рабочей плоскости." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "тело-выдавливания" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "" +"Операция создания тела вращения может быть применена только к плоским " +"эскизам." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Неправильное выделение для создания группы тела вращения. \n" +"Группа может быть создана, используя в качестве выделения следующие " +"примитивы:\n" +"\n" +" * точку и отрезок / координатный базис (нормаль) (вращение вокруг оси, " +"проходящей через точку и параллельной отрезку / нормали)\n" +" * отрезок (вращение вокруг оси, проходящей через отрезок)\n" +"\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "тело-вращения" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "" +"Операция создания тела вращения на угол может быть применена только к " +"плоским эскизам." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Неправильное выделение для создания группы тела вращения на угол. \n" +"Группа может быть создана, используя в качестве выделения следующие " +"примитивы:\n" +"\n" +" * точку и отрезок / координатный базис (нормаль) (вращение вокруг оси, " +"проходящей через точку и параллельной отрезку / нормали)\n" +" * отрезок (вращение вокруг оси, проходящей через отрезок)\n" +"\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "тело-вращения-на-угол" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "" +"Операция создания винтового тела может быть применена только к плоским " +"эскизам." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Неправильное выделение для создания винтового тела.\n" +"Группа может быть создана, используя в качестве выделения следующие " +"примитивы:\n" +"\n" +" * точку и отрезок или координатный базис (нормаль) (вращение вокруг " +"направления, параллельного линии / нормали, построенное через выбранную " +"точку)\n" +" * отрезок (вращение вокруг отрезка)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "тело-винтовое" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Неправильное выделение для создания группы кругового массива. \n" +"Группа может быть создана, используя в качестве выделения следующие " +"примитивы:\n" +"\n" +" * точку при активной рабочей плоскости (вращение в плоскости вокруг " +"выбранной точки)\n" +" * точку и отрезок / координатный базис (нормаль) (вращение вокруг оси, " +"проходящей через точку и параллельной отрезку / нормали)\n" +"\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "круговой-массив" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "линейный-массив" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(без имени)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "незамкнутый контур или несовпадение стилей!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "не все точки лежат в одной плоскости!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "контур имеет самопересечения!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "ребро нулевой длины!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Текстовые файлы STL пока не поддерживаются" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "" +"Скругления эскиза можно создавать только когда рабочая плоскость " +"активирована." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"Чтобы создать скругление эскиза, выберите точку, где соединяются два " +"примитива, не принадлежащих к вспомогательной геометрии." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Невозможно скруглить угол. Попробуйте радиус поменьше или создайте требуемую " +"геометрию с помощью Ограничения -> Параллельность / Касательность." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" +"Невозможно разделить такие примитивы. Выберите линии, окружности или " +"кубические сплайны." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "" +"Пересечение примитивов работает только когда рабочая плоскость активна." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Выберите два пересекающихся примитива (два отрезка/окружности/дуги или " +"отрезок/окружность/дугу и точку)" + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Невозможно разделить пересекаемые примитивы: пересечений нет." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Назначить стилю" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Без стиля" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Создать новый стиль…" + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Настройки группы" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Настройки стиля" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Выделить последовательность ребер" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Переключить справочный размер" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Переключить смежный угол" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Привязать к сетке" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Удалить точку сплайна" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Добавить точку сплайна" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" +"Невозможно добавить точку сплайна: достигнуто ограничение максимального " +"количества точек для сплайна." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Переключить режим «Дополнительные построения»" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Удалить ограничение совпадения точек" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Вырезать" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Копировать" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Выделить всё" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Вставить" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Вставить с трансформацией…" + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Удалить" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Сбросить выделение" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Снять выделение с выбранного" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Показать всё" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "кликните мышью там, где хотите расположить следующую точку" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Невозможно начертить прямоугольник, когда рабочая плоскость не активна." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "кликните мышью там, где хотите расположить другой угол прямоугольника" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "кликните, чтобы задать радиус" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "Невозможно создать дугу, когда нет активной рабочей плоскости." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "кликните мышью там, где хотите создать точку" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "кликните следующую точку сплайна или нажмите Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Рабочая плоскость уже активна. Перейдите в режим 3d перед созданием новой " +"рабочей плоскости." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "Невозможно создать текст, когда нет активной рабочей плоскости." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "кликните, чтобы расположить правый нижний угол текста" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "Невозможно создать изображение. Активируйте рабочую плоскость." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "Проекты SolveSpace" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "ВСЕ" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF печатная плата" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL треугольная сетка" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG изображение" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL полигональная сетка" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ полигональная сетка" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js-совместимая полигональная сетка с просмотрщиком" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js-совместимая полигональная сетка" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML файл" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP файл" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF документ" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "Encapsulated PostScript" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "SVG изображение" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF файл (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL файл" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G Code" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF и DWG файлы" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "CSV файлы (значения, разделенные запятой)" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "без имени" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Сохранить файл" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Открыть файл" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "О_тменить" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Сохранить" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Открыть" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Доступно автосохранение" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Автоматически сохраненный файл доступен для данного проекта." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "Хотите загрузить автосохраненный файл вместо исходного?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Загрузить автосохранение" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "&Не загружать" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Измененный файл" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "Сохранить изменения, сделанные в файле “%s”?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "Сохранить изменения, сделанные в новом проекте?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Изменения будут утеряны, если их не сохранить." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Сохранить" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "&Не сохранять" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(новый проект)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Браузер" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Ограничения отображаются, и будут экспортированы в файл. Предположительно, " +"это не то, что требуется, если так, необходимо спрятать их, нажав ссылку " +"вверху окна Браузера." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"Неподдерживаемый тип файла '%s'. Поддерживаются файлы с расширением .dxf и ." +"dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "У ограничения должно быть значение и оно не должно быть справочным." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "" +"Неправильное выделение для операции изменения значения с заданным шагом; " +"необходимо выбрать ограничение со значением." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "Сборка не содержит пересечения деталей - это хорошо." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"Объем тел:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"Объем тел текущей группы:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Кривые аппроксимированы кусочно-линейными функциями.\n" +"Это приводит к ошибке в расчетах, обычно в пределах 1%." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Площадь поверхности выбранных граней:\n" +"\n" +" %s\n" +"\n" +"Кривые аппроксимированы кусочно-линейными функциями.\n" +"Это приводит к ошибке в расчетах, обычно в пределах 1%%." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Эта группа не содержит замкнутых областей. В ней нет замкнутых контуров, " +"примитивы не лежат в одной плоскости или самопересекаются." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Площадь замкнутой области текущей группы:\n" +"\n" +" %s\n" +"\n" +"Кривые аппроксимированы кусочно-линейными функциями.\n" +"Это приводит к ошибке в расчетах, обычно в пределах 1%%." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Длина выбранных примитивов:\n" +"\n" +" %s\n" +"\n" +"Кривые аппроксимированы кусочно-линейными функциями.\n" +"Это приводит к ошибке в расчетах, обычно в пределах 1%%." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "" +"Неправильное выделение для расчета периметра; необходимо выбирать только " +"отрезки, дуги и кривые." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Неправильное выделение для трассировки; необходимо выбрать одну точку." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "Невозможно записать в '%s'" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "Полигональная сетка содержит самопересечения (это плохо)" + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "Полигональная сетка не содержит самопересечений (это хорошо)" + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "Полигональная сетка содержит \"оголенные\" ребра (это плохо)" + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "Полигональная сетка герметична (это хорошо)" + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"Модель содержит %d треугольников, содержащихся в %d поверхностях." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Нет проблемных ребер - это хорошо.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d найдены проблемные ребра - это плохо.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Это SolveSpace версии %s.\n" +"\n" +"Для дополнительной информации посетите сайт: http://solvespace.com/\n" +"\n" +"SolveSpace — свободное программное обеспечение: поощряется изменение, " +"улучшение\n" +"распространение программы по условиям лицензии GNU\n" +"General Public License (GPL) версии 3 или новее.\n" +"\n" +"НИКАКИХ ГАРАНТИЙ за пределами прав, \n" +"предусмотренных законом. Дополнительная информация на сайте: http://gnu.org/" +"licenses/\n" +"\n" +"© 2008-%d Джонатан Уэстхьюс и другие авторы.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Невозможно применить стиль к примитиву, который произошел от другого " +"примитива. Попробуйте применить стиль к исходному примитиву." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Имя стиля не может быть пустым" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "Невозможно сделать повторение меньше, чем 1 раз." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "Невозможно сделать повтор больше, чем 999 раз." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Имя группы не может быть пустым" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "Прозрачность должна быть числом от нуля до единицы." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Радиус не может быть нулевым или отрицательным." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Начертить отрезок прямой" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Начертить прямоугольник" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Начертить окружность" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Начертить дугу окружности" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Начертить текст TrueType" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Импортировать изображение из файла" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Создать скругление в выбранной точке" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Начертить кубический сплайн Безье" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Начертить опорную точку" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Переключить вспомогательную геометрию" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Разбить кривые по пересечению" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Ограничение расстояния / диаметра / длины" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Ограничение угла" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Ограничение горизонтальности" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Ограничение вертикальности" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Ограничение параллельности / касательности" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Ограничение перпендикулярности" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Ограничение точка на точке / линии / окружности / дуге / плоскости" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Симметричность" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Ограничение равенства длин / радиусов / углов" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Ограничение идентичности ориентации координатных базисов" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Переключить смежный угол" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Переключить режим размера для справок" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Создать группу выдавливания текущего эскиза" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Создать группу тела вращения текущего эскиза" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Создать группу тела выдавливания по винтовой линии из текущего эскиза" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Создать группу тела вращения на угол из текущего эскиза" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Создать группу кругового массива" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Создать группу линейного массива" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "Создать группу в новой рабочей плоскости (через выбранные примитивы)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "Новая группа в 3d" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Новая группа импорта детали / сборки" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Ближайший изометрический вид" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Выровнять вид по рабочей плоскости" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Ошибка" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Сообщение" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&OK" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "Масштабный коэффициент не может быть нулевым или отрицательным." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Неверный формат: введите данные как x, y, z" + +#~ msgid "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения 'точка на примитиве'.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * две точки (совпадение точек)\n" +#~ " * точку и рабочую плоскость (точка в плоскости)\n" +#~ " * точку и отрезок (точка на линии)\n" +#~ " * точку и окружность / дугу / сплайн (точка на кривой)\n" +#~ " * точку и грань (точка на грани)\n" + +#~ msgid "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения 'равенство примитивов'.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * два отрезка (равенство длин отрезков)\n" +#~ " * два отрезка и две точки (равенство расстояний от точек до линий)\n" +#~ " * отрезок и две точки (равенство расстояний от точек до линии)\n" +#~ " * отрезок, точку и отрезок (равенство длины отрезка расстоянию от " +#~ "точки до линии)\n" +#~ " * четыре отрезка или нормали (равенство углов A,B и C,D)\n" +#~ " * три отрезка или нормали (равенство углов A,B and B,C)\n" +#~ " * две окружности / дуги (равенство радиусов)\n" +#~ " * отрезок и дугу (равенство длины отрезка и длины дуги)\n" + +#~ msgid "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения 'горизонтальность / " +#~ "вертикальность'.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * две точки\n" +#~ " * отрезок\n" + +#~ msgid "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения углового размера.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * два отрезка\n" +#~ " * отрезок и координатный базис (нормаль)\n" +#~ " * два координатных базиса (нормали)\n" + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения параллельности / касательности.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * два отрезка (параллельность)\n" +#~ " * отрезок и координатный базис (нормаль) (параллельность)\n" +#~ " * два координатных базиса (нормали) (параллельность)\n" +#~ " * два отрезка, две дуги или два сплайна, соединенных крайними точками " +#~ "(касательность)\n" + +#~ msgid "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения перпендикулярности.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * два отрезка\n" +#~ " * отрезок и координатный базис (нормаль)\n" +#~ " * два координатных базиса (нормали)\n" + +#~ msgid "A&ngle" +#~ msgstr "&Угол" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "&Равенство Длин / Радиусов / Углов" + +#~ msgid "" +#~ "Bad selection for length ratio constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения 'отношение длин'.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * два отрезка\n" + +#~ msgid "" +#~ "Bad selection for length difference constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "Неправильное выделение для ограничения 'разница длин'.\n" +#~ "Ограничение может принимать в качестве выделения следующие примитивы:\n" +#~ "\n" +#~ " * два отрезка\n" + +#~ msgid "Length Ra&tio" +#~ msgstr "Отно&шение Длин" + +#~ msgid "Length Diff&erence" +#~ msgstr "Ра&зница Длин" + +#~ msgid "" +#~ "Bad selection for new sketch in workplane. This group can be created " +#~ "with:\n" +#~ "\n" +#~ " * a point (through the point, orthogonal to coordinate axes)\n" +#~ " * a point and two line segments (through the point, parallel to the " +#~ "lines)\n" +#~ " * a workplane (copy of the workplane)\n" +#~ msgstr "" +#~ "Неправильное выделение для создания эскиза.\n" +#~ "Группа может быть создана, используя в качестве выделения следующие " +#~ "примитивы:\n" +#~ "\n" +#~ " * точку (рабочая плоскость, ориентированная к ближайшему виду, " +#~ "проходящая через точку)\n" +#~ " * точку и два отрезка (рабочая плоскость, проходящая через точку и " +#~ "параллельная отрезкам)\n" +#~ " * рабочую плоскость (копия рабочей плоскости)\n" + +#~ msgid "Specify between 0 and 8 digits after the decimal." +#~ msgstr "Введите число от 0 до 8." + +#~ msgid "Show Degrees of &Freedom" +#~ msgstr "Показать Степени С&вободы" + +#~ msgid "click to place bottom left of text" +#~ msgstr "кликните мышью, чтобы расположить текст" + +#~ msgid "Do you want to save the changes you made to the new sketch?" +#~ msgstr "Хотите сохранить ваши изменения?" + +#~ msgid "Your changes will be lost if you don't save them." +#~ msgstr "Ваши изменения будут утеряны, если вы их не сохраните." + +#~ msgctxt "button" +#~ msgid "Save" +#~ msgstr "Сохранить" + +#~ msgctxt "button" +#~ msgid "Cancel" +#~ msgstr "Отменить" + +#~ msgctxt "button" +#~ msgid "Don't Save" +#~ msgstr "Не Сохранять" + +#~ msgid "An autosave file is available for this project." +#~ msgstr "Файлы автосохранения доступны для данного проекта." + +#~ msgid "Do you want to load the autosave file instead?" +#~ msgstr "Хотите загрузить их вместо открываемого файла?" + +#~ msgctxt "button" +#~ msgid "Load" +#~ msgstr "Загрузить Автосохранение" + +#~ msgctxt "button" +#~ msgid "Don't Load" +#~ msgstr "Просто Открыть Файл" + +#~ msgid "" +#~ "Do you want to locate it manually?\n" +#~ "If you select “No”, any geometry that depends on the missing file will be " +#~ "removed." +#~ msgstr "" +#~ "Хотите найти их вручную?\n" +#~ "Если вы ответите \"Нет\", то вся геометрия, которая зависит от " +#~ "отсутствующего файла будет удалена." + +#~ msgctxt "button" +#~ msgid "Yes" +#~ msgstr "Да" + +#~ msgctxt "button" +#~ msgid "No" +#~ msgstr "Нет" + +#~ msgctxt "button" +#~ msgid "OK" +#~ msgstr "ХОРОШО" + +#~ msgid "_Cancel" +#~ msgstr "Отменить" + +#~ msgid "_Open" +#~ msgstr "Открыть" + +#~ msgid "" +#~ "The file has changed since it was last saved.\n" +#~ "\n" +#~ "Do you want to save the changes?" +#~ msgstr "" +#~ "Файл имеет несохраненные изменения.\n" +#~ "\n" +#~ "Хотите сохранить их?" + +#~ msgctxt "button" +#~ msgid "Do_n't Save" +#~ msgstr "Не Сохранять" + +#~ msgid "" +#~ "An autosave file is available for this project.\n" +#~ "\n" +#~ "Do you want to load the autosave file instead?" +#~ msgstr "" +#~ "Файлы автосохранения доступны для данного проекта.\n" +#~ "\n" +#~ "Хотите загрузить их вместо открываемого файла?" + +#~ msgctxt "button" +#~ msgid "_Load autosave" +#~ msgstr "Загрузить Автосохранение" + +#~ msgctxt "button" +#~ msgid "Do_n't Load" +#~ msgstr "Не Загружать" + +#~ msgctxt "button" +#~ msgid "_Yes" +#~ msgstr "Да" + +#~ msgctxt "button" +#~ msgid "_No" +#~ msgstr "Нет" + +#~ msgid "" +#~ "Select two entities that intersect each other (e.g. two lines or two " +#~ "circles or a circle and a line)." +#~ msgstr "" +#~ "Выберите два пересекающихся примитива. Например, две линии или две " +#~ "окружности или линию и окружность." + +#~ msgid "Show Menu &Bar" +#~ msgstr "Показывать Мен&ю" + +#~ msgctxt "group-name" +#~ msgid "link" +#~ msgstr "ссылка-на-деталь" + +#~ msgid "Scale must not be zero or negative!" +#~ msgstr "" +#~ "Коэффициент масштабирования не может быть нулевым или отрицательным!" diff --git a/res/locales/tr_TR.po b/res/locales/tr_TR.po new file mode 100644 index 0000000..097e14a --- /dev/null +++ b/res/locales/tr_TR.po @@ -0,0 +1,2330 @@ +# Turkish translations for SolveSpace package. +# Copyright (C) 2017 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# SPDX-FileCopyrightText: 2022, 2025 Mustafa Halil GÖRENTAŞ +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.1\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2025-01-29 21:16+0300\n" +"Last-Translator: mustafa halil \n" +"Language-Team: Turkish \n" +"Language: tr_TR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Lokalize 23.08.5\n" + +#: clipboard.cpp:314 +#, fuzzy +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Çalışmayı yalnızca bir çalışma düzleminde kesin, yapıştırın ve kopyalayın.\n" +"\n" +"Çizim -> Çalışma Düzleminde menüsü ile bir düzlemi etkinleştirin." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Pano boş; yapıştırılacak bir şey yok." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Yapıştırılacak kopya sayısı en az bir olmalıdır." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "Ölçek sıfır olamaz." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Çevirme merkezini tanımlamak için bir nokta seçin." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Doğrusal kopyalama vektörünü tanımlamak için iki nokta seçin." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "Dönüşüm özdeştir. Yani tüm kopyalar tam olarak üst üste gelecek." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "" +"Yapıştırılamayacak kadar çok öğe; bunu daha küçük yapıştıma şeklinde bölün." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Etkin çalışma düzlemi yok." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Hatalı biçim: koordinatları x, y, z olarak belirtin" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Hatalı biçim: rengi r, g, b olarak belirtin" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"Görünüm -> Perspektif Projeksiyonu Kullan'ı etkinleştirene kadar perspektif " +"katsayısının hiçbir etkisi olmayacaktır." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Ondalık basamak sonrası 0 ile %d arasında rakam belirtin." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "Dışa aktarma ölçeği sıfır olmamalıdır!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Kesici yarıçap ofseti negatif olmamalıdır!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "Hatalı değer: otomatik kaydetme süresi pozitif olmalıdır" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Hatalı biçim: süre aralığını dakika cinsinden belirtin" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "çakışık-nktlar" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "nkt-nkt-mesafe" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "nkt-çizgi-mesafesi" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "nkt-düzlem-mesafesi" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "nkt-yüzey-mesafesi" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "proj-nkt-nkt-mesafesi" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "düzlemde-nkt" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "çizgide-nkt" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "yüzeyde-nkt" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "eşit-uzunluk" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "eşit-uzunluk-ve-çzg-nkt-mesafesi" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "eşit-nkt-çizgi-mesafesi" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "uzunluk-oranı" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "yay-yay-uzunluk-oranı" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "yay-çizgi-uzunluk-oranı" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "uzunluk-farkı" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "yay-yay-uzunluk-farkı" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "yay-çizgi-uzunluk-farkı" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "simetrik" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "simetrik-y" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "simetrik-d" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "simetrik-çizgi" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "orta noktada" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "yatay" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "dikey" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "çap" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "çemberde-nkt" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "aynı-yön" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "açı" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "paralel" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "yay-çizgi-teğet" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "k.eğri-çizgi-teğet" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "eğri-eğri-teğet" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "dik" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "eşit-yarıçap" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "eşit-açı" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "eşit-çizgi-uzn-yay-uzn" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "sürüklendiği-yerde-kilitli" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "yorum" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"Seçtiğiniz nokta yaya ait değildir. Yay ve doğru parçası bir bitiş " +"noktasını paylaşmaz.\n" +"\n" +"Çizgiye teğet olmasını istediğiniz yayın bitiş noktasını seçin." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"Teğet için yay ve çizgi parçası bir uç noktayı paylaşmalıdır. Teğet " +"kısıtlamasından önce bunları Kısıtla -> Noktada ile kısıtlayın.\n" +"\n" +"Alternatif olarak, çizgiye teğet olmasını istediğiniz yayın uç " +"noktasını seçin." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"Seçtiğiniz nokta kübik eğrinin bir uç noktası değildir. Eğri ve doğru " +"parçası bir bitiş noktasını paylaşmaz.\n" +"\n" +"Çizgiye teğet olmasını istediğiniz eğrinin uç noktasını seçin." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"Teğet için kübik eğri ve çizgi parçası bir uç noktayı paylaşmalıdır. Teğet " +"kısıtlamasından önce onları Kısıtla -> Noktada ile kısıtlayın.\n" +"\n" +"Alternatif olarak, kübik eğrinin çizgiye teğet olmasını istediğiniz uç " +"noktasını seçin." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"Seçtiğiniz noktalar iki eğrinin uç noktaları değildir. Eğriler bir uç" +" noktasını " +"paylaşmazlar.\n" +"\n" +"Birbirlerine teğet olmalarını istediğiniz her iki eğrinin uç noktalarını" +" seçin." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Eğriler bir uç noktayı paylaşmalıdır. Teğet kısıtlamasından önce onları " +"Kısıtla -> Noktada ile kısıtlayın.\n" +"\n" +"Alternatif olarak, teğet olmasını istediğiniz eğrilerin iki uç noktalarını " +"seçin." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Mesafe / çap kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +" * iki nokta (noktalar arası mesafe)\n" +" * bir çizgi parçası (uzunluk)\n" +" * iki nokta ve bir çizgi parçası veya normal (izdüşüm mesafesi)\n" +" * bir çalışma düzlemi ve bir nokta (minimum mesafe)\n" +" * bir çizgi parçası ve bir nokta (minimum mesafe)\n" +" * bir düzlem yüzeyi ve bir nokta (minimum mesafe)\n" +" * bir daire veya yay (çap)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Noktada / Eğride / Düzlemde kısıtlaması oluşturmak için hatalı seçim. Bu " +"kısıtlama şunlara uygulanabilir:\n" +"\n" +" * iki nokta (çakışan noktalar)\n" +" * bir nokta ve bir çalışma düzlemi (nokta ile düzlem çakışır)\n" +" * bir nokta ve bir çizgi parçası (nokta ile çizgi çakışır)\n" +" * bir nokta ve bir daire veya yay (nokta ile eğri çakışır)\n" +" * bir nokta ve bir düzlem yüzeyi (nokta ile yüzey çakışır)\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Eşit uzunluk / yarıçap kısıtlaması oluşturmak için hatalı seçim. Bu " +"kısıtlama şunlara uygulanabilir:\n" +"\n" +" * iki veya daha fazla çizgi parçası (eşit uzunlukta)\n" +" * iki çizgi parçası ve iki nokta (eşit nokta-çizgi mesafeleri)\n" +" * bir çizgi parçası ve iki nokta (eşit nokta-çizgi mesafeleri)\n" +" * bir çizgi parçası ile bir nokta ve çizgi parçası (nokta-çizgi mesafesi " +"uzunluğu eşit)\n" +" * iki veya daha fazla daire veya yay (eşit yarıçap)\n" +" * bir çizgi parçası ve bir yay (çizgi parçası uzunluğu yay uzunluğuna " +"eşittir)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Uzunluk oranı kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama " +"aşağıdakiler için geçerli olabilir:\n" +"\n" +" * iki çizgi parçası\n" +" * iki yay\n" +" * bir yay ve bir çizgi parçası\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Uzunluk farkı kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama " +"aşağıdakiler için geçerli olabilir:\n" +"\n" +" * iki çizgi parçası\n" +" * iki yay\n" +" * bir yay ve bir çizgi parçası\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Orta nokta kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +" * bir çizgi parçası ve bir nokta (nokta çizgi ortasında)\n" +" * bir çizgi parçası ve bir çalışma düzlemi (çizgi düzlemin ortasına " +"taşınır )\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Simetri kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +" * iki nokta veya bir çizgi parçası (çalışma düzleminin koordinat " +"eksenine göre simetrik)\n" +" * çizgi parçası ve iki nokta veya bir çizgi parçası (çizgi parçası " +"etrafında simetrik)\n" +" * çalışma düzlemi ve iki nokta veya bir çizgi parçası (çalışma düzlemine " +"göre simetrik)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Simetri kısıtlamasında simetri düzlemini olarak kullanılacak bir çalışma " +"düzlemi etkin olmalıdır." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Yatay veya dikey bir kısıtlama uygulamadan önce bir çalışma düzlemini (Çizim " +"-> Çalışma Düzleminde menüsü ile) etkinleştirin." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Yatay / Dikey kısıtlama oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +" * iki nokta\n" +" * bir çizgi parçası\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Aynı yön kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +" * iki normal\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Bir açı kısıtlaması seçilmelidir." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "İlgili etikete sahip bir kısıtlama seçilmelidir." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Açı kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +"Şunların arasındaki açı:\n" +" * iki çizgi parçası\n" +" * bir çizgi parçası ve bir normal\n" +" * iki normal\n" +"\n" +"Eşit açılar:\n" +" * dört çizgi parçası veya normal (A,B ve C,D arasında eşit açı)\n" +" * üç çizgi parçası veya normal (A,B ve B,C arasında eşit açı)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "Eğri-eğri teğetliği çalışma düzlemine uygulanmalıdır." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Paralel / Teğet kısıtlaması oluşturmak için hatalı seçim. Bu kısıtlama " +"şunlara uygulanabilir:\n" +"\n" +" * iki yüzey\n" +" * iki veya daha fazla doğru parçası (paralel)\n" +" * bir veya daha fazla doğru parçası ve bir veya daha fazla normal " +"(paralel)\n" +" * iki veya daha fazla normal (paralel)\n" +" * bir uç noktayı (teğet) paylaşan iki doğru parçası, yay veya bezier " +"eğriler\n" +" *bir uç noktayı paylaşmayan iki doğru parçası, yay veya bezier eğriler ve " +"eğri(ler)in son noktası(ları) (teğet)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Dikey kısıtlama oluşturmak için hatalı seçim. Bu kısıtlama şunlara " +"uygulanabilir:\n" +"\n" +" * iki yüzey\n" +" * iki çizgi parçası\n" +" * bir çizgi parçası ve bir normal\n" +" * iki normal\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Sürüklendiği yerde noktayı kısıtlamak için hatalı seçim. Bu kısıtlama " +"şunlara uygulanabilir:\n" +"\n" +" * bir nokta\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "YENI YORUM -- DÜZENLEMEK ICIN CIFT-TIKLAYIN" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "yorum metninin ortasını tıklatın" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"Katı model yok; katılama ve döndürme komutları ile bir model çizin veya açık " +"çizgileri ve eğrileri dışa vermek için Görüntüyü 2d olarak Dışa Aktar'ı " +"kullanın." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Kesiti Dışa Aktarmak için hatalı seçim. Lütfen şunlardan birini seçin:\n" +"\n" +" * aktif bir çalışma düzleminde iken hiçbir şey seçmeyin (çalışma " +"düzlemi, kesit düzlemidir)\n" +" * bir yüzey (yüzeyden kesit düzlemi)\n" +" * bir nokta ve iki çizgi parçası (nokta ve paralel çizgiler boyunca " +"düzlem)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Etkin grup ağı boş; dışa aktarılacak bir şey yok." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "serbest çizgiler, sürekli çizgilerle değiştirildi" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "zikzak çizgiler sürekli çizgilerle değiştirildi" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "Çizimin bazı yönlerinin DXF eşdeğeri yoktur ve dışa aktarılmamıştır:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"PDF sayfa boyutu 200 x 200 inç'i aşıyor; birçok görüntüleyici bu dosyayı " +"reddedebilir." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "düzlemde çizim" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#referanslar" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "Dosya boş. Bozuk olabilir." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Dosyada veriler tanınmadı. Bu dosya bozuk veya programın daha yeni bir " +"sürümü ile oluşturulmuş olabilir." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Kayıp Dosya" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "\"%s\" bağlantılı dosya yok." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"Konumu El ile bulmak istiyor musunuz?\n" +"\n" +"Reddederseniz, eksik dosyaya bağlı olan geometri kalıcı olarak " +"kaldırılacaktır." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Evet" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&Hayır" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&İptal" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Dosya" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&Yeni" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Aç..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "&Son Erişilenden Aç" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Kaydet" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "&Farklı kaydet..." + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "&Resim olarak dışa aktar..." + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "&Görüntüyü 2d olarak dışa aktar..." + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "&Kesiti 2d olarak dışa aktar..." + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "3d &TelKafes olarak dışa aktar..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "&Üçgensel Ağ olarak dışa aktar..." + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Y&üzeyleri dışa aktar..." + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "&İçe Aktar..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "&Çıkış" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "D&üzen" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Geri al" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Yinele" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Tümünü Yeniden &Oluştur" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Seçimi &Izgaraya Tuttur" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "İçe Aktarılanları &90° Döndür" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "&Kes" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "K&opyala" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "Y&apıştır" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "&Dönüştürerek Yapıştır..." + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Sil" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Kenar &Zincirini Seç" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "&Tümünü Seç" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "Tüm Seçimi &Kaldır" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "&Çizgi Biçimi..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&Projeksiyonu Görüntüle..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "Y&apılandır..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&Görünüm" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "&Yakınlaş" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "&Uzaklaş" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "&Sığacak Şekilde Yakınlaş" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Görünümü &Çalışma Düzlemine Hizala" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "En Yakın &Dik Görünüm" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "En Yakın &İzometrik Görünüm" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Noktayı Merkezde Görüntüle" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Yakalama &Izgarasını Göster" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Aktif Olmayan Katıları &Koyulaştır" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "&Perspektif Projeksiyonu Kullan" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Pat&latılmış Görünümü Göster" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "Ölçü &Birimleri" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "&Milimetre cinsinden ölçü" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "M&etre cinsinden ölçü" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "&İnç cinsinden ölçü" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "&Fit ve İnç cinsinden ölçü" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "&Araç Çubuğunu Göster" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "&Özellik Penceresini Göster" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "&Tam Ekran" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "Yeni &Grup" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "&3d'de Çizim Yap" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "&Yeni Çalışma Düzleminde Çizim Yap" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "&Doğrusal Kopya" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "D&airesel Kopya" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "&Uzatarak Katıla" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "&Helis" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "&Tam döndürerek katıla" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "&Kısmen döndürerek katıla" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Bağla / Montajla..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Son Erişilenden Bağla" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Çizim" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "Ç&alışma Düzleminde" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "&3d'de Herhangi Bir Yerde" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "Referasn &Noktası" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "Ça&lışma Düzlemi" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "Ç&izgi" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "&Yardımcı Çizgi" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Dikdörtgen" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "D&aire" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "Çember &Yayı" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "Bezier Kübik &Eğri" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "TrueType Yazı Tipinde &Metin" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "&Resim / Görüntü" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "Yap&ıyı Değiştir" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "&Yuvarlat (Radyus)" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Eğrileri Kesişim Yerinden &Böl" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Kısıtla" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Mesafe / Çap" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "&Referans Ölçü" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "&Açı / Eşit Açı" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Referans A&çı" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Diğer &Bütünler Açı" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Ölçüyü Re&ferans Yap / Yapma" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Yatay" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Dikey" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&Noktada / Eğride / Düzlemde" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "&Eşit Uzunluk / Yarıçap" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "&Uzunluk / Yay Oranı" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Uzunluk / Yay &Farkı" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "&Orta Noktada" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "&Simetrik" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "&Paralel / Teğet" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "D&ik" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Aynı &Yön" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Sürüklendiği Yerde Noktayı &Kilitle" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Y&orum" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Analiz" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "&Hacmi Hesapla" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "&Alanı Hesapla" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "&Çevre Uzunluğunu Hesapla" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "&Engelleyici Parçaları Göster" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "A&çık Kenarları Göster" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "&Kütle Merkezini Göster" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Kı&sıtlanmamış Noktaları Göster" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "&İzlenecek Nokta" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "&İzlemeyi Durdur..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "Adım &Ölçüsünü Ayarla..." + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Yardım" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Dil" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Web sitesi / Kılavuz" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "GitHub Commitlere git" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "&Hakkında" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(son dosyalar yok)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "'%s' dosyası mevcut değil." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "Etkin çalışma düzlemi yok, bu nedenle ızgara görünmeyecektir." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"Perspektif katsayısı sıfıra ayarlanmıştır, bu nedenle görünüm her zaman " +"paralel bir projeksiyon olacaktır.\n" +"\n" +"Perspektif bir projeksiyon için, yapılandırma ekranındaki perspektif " +"katsayısını değiştirin. 0.3 civarında bir değer normaldir." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "Bir nokta seçin; bu nokta ekrandaki görüntünün merkezi olacaktır." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "Hiçbir ek öğe, seçili öğeler ile uç noktaları paylaşmıyor." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"Bu komutu kullanmak için, bağlantılı bir parçadan bir nokta veya başka bir " +"öğe seçin veya bir bağlantı grubunu etkin grup haline getirin." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"Hiçbir çalışma düzlemi etkin değil. Izgaranın yakalanacağı düzlemini " +"tanımlamak için bir çalışma düzlemini (Çizim -> Çalışma Düzleminde ile) " +"etkinleştirin." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Bu öğeler ızgaraya tutturulamıyor; etiketli noktaları, metin yorumlarını " +"veya kısıtlamaları seçin. Bir çizgiyi tutturmak için uç noktalarını seçin." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"Çalışma düzlemi seçilmedi. Bu grup için varsayılan çalışma düzlemi " +"etkinleştiriliyor." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"Hiçbir çalışma düzlemi seçilmedi ve aktif grubun varsayılan bir çalışma " +"düzlemi yok. Bir çalışma düzlemi seçmeyi veya bir yeni çalışma düzleminde " +"çizim grubunu etkinleştirmeyi deneyin." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Noktada teğet yay (radyus) oluşturmak için hatalı seçim. Tek bir nokta seçin " +"veya yay parametrelerini ayarlamak için hiçbir şey seçmeyin." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "yayın ilk noktası için tıklayın (saat yönünün tersine çizilir)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "referans noktayı yerleştirmek için tıklayın" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "çizgi parçasının ilk noktası için tıklayın" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "yardımcı çizginin ilk noktası için tıklayın" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "kübik eğri parçanın ilk noktası için tıklayın" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "dairenin merkez konumu için tıklayın" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "çalışma düzleminin merkez konumu için tıklayın" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "dikdörtgenin bir köşe noktası için tıklayın" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "metnin sol üst köşe konumu için tıklayın" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "görüntünün sol üst köşe konumu için tıklayın" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "" +"Hiçbir öğe seçilmedi. Yapı durumlarını değiştirmeye çalışmadan önce öğeleri " +"seçin." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "3d-de-çizim" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Çalışma düzleminde yeni çizim oluşturmak için hatalı seçim. Bu grup " +"aşağıdakilerle oluşturulabilir:\n" +"\n" +" * bir nokta (noktadan geçen, koordinat eksenine dik)\n" +" * bir nokta ve iki doğru parçası (noktadan geçen, doğrulara paralel)\n" +" * bir nokta ve bir normal (noktadan normale dik)\n" +" * bir çalışma düzlemi (çalışma düzleminin kopyası)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Katılama işleminden önce bir çalışma düzlemini etkinleştirin. Çizim, " +"çalışma düzlemine dik olarak katılanacaktır." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "doğrusal katıla" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "" +"Tam tur döndürerek katılama işlemi, yalnızca düzlemsel çizimlere " +"uygulanabilir." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Tamamen döndürerek yeni katılama grubu oluşturmak için hatalı seçim. Bu grup " +"şu şekilde oluşturulabilir:\n" +"\n" +" * bir nokta ve bir çizgi parçası veya normal (çizgiye / normale paralel " +"bir eksen etrafında, nokta boyunca döndürülür )\n" +" * bir çizgi parçası (çizgi parçası etrafında döndürülür)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "tamamen döndürerek katıla" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "" +"Kısmen döndürerek katılama işlemi, yalnızca düzlemsel çizimlere " +"uygulanabilir." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Kısmen döndürerek yeni katılama grubu oluşturmak için hatalı seçim. Bu grup " +"şu şekilde oluşturulabilir:\n" +"\n" +" * bir nokta ve bir çizgi parçası veya normal (çizgiye / normale paralel, " +"noktadan geçen bir eksen etrafında döndürülür)\n" +" * bir çizgi parçası (çizgi parçası etrafında döndürülür)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "kısmen döndürerek katıla" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "Helis işlemi yalnızca düzlemsel çizimlere uygulanabilir." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Yeni helis grubu oluşturmak için hatalı seçim. Bu grup şunlarla " +"oluşturulabilir:\n" +"\n" +" * bir nokta ve bir çizgi parçası veya normal (çizgiye / normale paralel, " +"noktadan geçen bir eksen etrafında döndürülür)\n" +" * bir çizgi parçası (çizgi parçası etrafında döndürülür)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "helis" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Yeni dairesel kopyalama/çoğaltma oluşturmak için hatalı seçim. Bu grup " +"şunlarla oluşturulabilir:\n" +"\n" +" * bir nokta, çalışma düzleminde kilitli olduğu sürece (düzlemde o nokta " +"etrafında çevirin)\n" +" * bir nokta ve bir çizgi veya bir normal ( çizgiye / normale paralel ve " +"noktadan geçen bir eksen etrafında çevirin)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "dairesel kopya" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "doğrusal kopya" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(isimsiz)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "kapali olmayan kontur veya tümü ayni bicimde degil!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "noktaların hepsi aynı düzlemde değil!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "kontur kendisiyle kesisiyor!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "sıfır-uzunluklu kenar!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Metin-biçimli STL dosyaları şu anda desteklenmiyor" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "Teğet yay oluşturmak için çalışma düzleminde çizim yapılmalıdır." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"Bir teğet yay oluşturmak için, bu gruptaki iki (yardımcı) referans-olmayan " +"çizginin veya dairenin ve çalışma düzleminin birleştiği bir nokta seçin." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Bu köşe yuvarlatılamadı. Daha küçük bir yarıçap deneyin veya teğet " +"kısıtlamaları ile istenen geometriyi elle oluşturmayı deneyin." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" +"Bu öğe bölünemedi; yalnızca çizgiler, daireler veya kübik eğriler " +"bölünebilir." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "Bölmek için çalışma düzleminde çizim yapılıyor olmalı." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Birbiriyle kesişen iki öğe seçin (örneğin iki çizgi / daire / yay veya bir " +"çizgi / daire / yay ve bir nokta)." + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Bölünemez; kesişim bulunamadı." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Biçim Ata" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Biçim Yok" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Yeni Oluşturulan Özel Biçim ..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Grup Bilgisi" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Biçim Bİlgisi" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Kenar Zinciri Seç" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Referans Ölçüyü Değiştir" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Diğer Bütünler Açı" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Izgaraya Tuttur" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Eğri Noktasını Sil" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Eğri Noktası Ekle" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "Eğri noktası eklenemiyor: en fazla nokta sayısına ulaşıldı." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Yapıyı değiştir" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Çakışık-Nokta Kısıtlamasını Sil" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Kes" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Kopyala" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Tümünü Seç" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Yapıştır" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Dönüştürerek Yapıştır..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Sil" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Tüm Seçimi Kaldır" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Üzerine Gelinen Seçimi Kaldır" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Sığdırmak için Yakınlaştır" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "çizginin sonraki noktası için tıklayın veya Esc tuşuna basın" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"3d'de dikdörtgen çizilemez; önce Çizim -> Çalışma Düzleminde menüsü ile bir " +"çalışma düzlemini etkinleştirin." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "dikdörtgenin diğer köşesini belirtmek için tıklayın" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "yarıçapı ayarlamak için tıklayın" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"3d'de yay çizemez; önce Çizim -> Çalışma Düzleminde menüsü ile bir çalışma " +"düzlemini etkinleştirin." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "noktayı yerleştirmek için tıklayın" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "sonraki kübik eğri noktasını tıklayın veya Esc tuşuna basın" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Zaten bir çalışma düzleminde çizim yapılıyor; 3d'de çizim yapmadan önce yeni " +"çalışma düzlemi oluşturun." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"3d'de metin yazılamaz; önce Çizim -> Çalışma Düzleminde menüsü ile bir " +"çalışma düzlemini etkinleştirin." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "metnin sağ alt konumunu belirtmek için tıklayın" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"3d'de görüntü/resim eklenemez; önce Çizim -> Çalışma Düzleminde menüsü ile " +"bir çalışma düzlemini etkinleştirin." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpace Modelleri" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "TÜMÜ" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF devre kartı" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL üçgensel mesh (ağ/kafes)" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG Görüntüsü" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL mesh (ağ/kafes)" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ mesh (ağ/kafes)" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Görüntüleyicili, Three.js-uyumlu mesh (ağ/kafes)" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js-uyumlu mesh, sadece mesh (ağ/kafes)" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML metin dosyası" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP dosyası" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF dosyası" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "Encapsulated PostScript (EPS)" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "Ölçeklenebilir Vektör Grafikleri (SVG)" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF dosyası (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL dosyası" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G Kodu" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF ve DWG dosyaları" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "Virgülle ayrılmış değerler (CSV)" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "isimsiz" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Dosyayı Kaydet" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Dosyayı Aç" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_İptal" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Kaydet" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Aç" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Otomatik Kaydetme Kullanılabilir" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Bu çizim için otomatik kaydetme dosyası kullanılabilir." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "Bunun yerine otomatik kaydetme dosyasını yüklemek istiyor musunuz?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Otomatik kaydı yükle" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "&Yükleme" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Değiştirilen Dosya" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "\"%s\" çiziminde yaptığınız değişiklikleri kaydetmek istiyor musunuz?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "Yeni çizimde yaptığınız değişiklikleri kaydetmek istiyor musunuz?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Bunları kaydetmezseniz değişiklikleriniz kaybolur." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Kaydet" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "K&aydetme" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(yeni çizim)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Özellik Penceresi" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Kısıtlamalar şu anda gösterilmektedir ve takım yolunda dışa aktarılacaktır. " +"Muhtemelen istediğiniz bu değil; Özellik Penceresinin üst kısmındaki " +"bağlantıya tıklayarak bunları gizleyin." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "" +"'%s' dosya adının dosya uzantısından dosya türü belirlenemiyor; .dxf veya ." +"dwg'yi deneyin." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "Kısıtlamanın bir etiketi olmalı ve bir referans ölçüsü olmamalıdır." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "Adım ölçüsü ayarlamak için hatalı seçim; bir kısıtlama seçin." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "Montajda engel oluşturan parça yok, iyi." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"Katı modelin hacmi:\n" +"\n" +" % s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"Mevcut ağ (kafes) grubunun hacmi:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Kavisli (Eğri) yüzeyler üçgenler olarak yaklaştırılmıştır.\n" +"Bu, genel olarak yaklaşık 1% hataya neden olur." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Seçili yüzlerin yüzey alanı:\n" +"\n" +" %s\n" +"\n" +"Eğriler, doğrusal parçalı olarak yaklaştırılmıştır.\n" +"Bu, genel olarak yaklaşık 1%% hataya neden olur." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Bu grup, doğru biçimlendirilmiş 2d kapalı alan içermiyor. Açık, eş-düzlemli " +"değil veya kendisiyle kesişiyor." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Bu grupta çizilen bölgenin alanı:\n" +"\n" +" %s\n" +"\n" +"Eğriler, doğrusal parçalı olarak yaklaştırılmıştır.\n" +"Bu, genel olarak yaklaşık 1%% hataya neden olur." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Seçilen öğelerin toplam uzunluğu:\n" +"\n" +" %s\n" +"\n" +"Eğriler, parçalı doğrusal olarak yaklaştırıldı.\n" +"Bu, genel olarak yaklaşık 1%% hataya neden olur." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "" +"Çevre uzunluğunu hesabı için hatalı seçim; çizgi parçalarını, yayları ve " +"eğrileri seçin." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Nokta izleme işlemi için hatalı seçim; tek bir nokta seçin." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "\"%s\" öğesine yazılamadı" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "Ağ (Kafes) kendisiyle kesişiyor (İyi DEĞİL, geçersiz)." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "Ağ (Kafes) kendisi ile kesişmiyor (iyi, geçerli)." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "Ağın (Kafesin) açık kenarları var (iyi DEĞİL, geçersiz)." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "Ağ (Kafes) çok sıkı (iyi, geçerli)" + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"Model, %d yüzeyden %d üçgen içeriyor." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Sıfır sorunlu kenar, iyi.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d sorunlu kenar, kötü.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Bu SolveSpace'in %s sürümüdür.\n" +"\n" +"Daha fazla bilgi için bkz., http://solvespace.com/\n" +"\n" +"SolveSpace ücretsiz bir yazılımdır: GNU Genel Kamu \n" +"Lisansı (GPL) sürüm 3 veya daha sonraki hükümleri altında \n" +"onu değiştirmekte ve / veya yeniden dağıtmakta özgürsünüz.\n" +"\n" +"Lisans kuralları haricinde GARANTİ YOKTUR.\n" +"Ayrıntılar için http://gnu.org/licenses/ adresini ziyaret edin.\n" +"\n" +"© 2008-% d Jonathan Westhues ve diğer yazarlar.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Başka bir öğeden türetilen bir öğeye biçim atayamazsınız; bu öğenin " +"üst öğesine bir biçim atamayı deneyin." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Biçim adı boş olamaz" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "1 defadan az tekrarlanamaz." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "999 defadan fazla tekrarlanamaz." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Grup adı boş olamaz" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "Şeffaflık değeri sıfır ile bir arasında olmalıdır." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Yarıçap sıfır veya negatif değer olamaz." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Çizgi parçası çiz" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Dikdörtgen çiz" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Daire çiz" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Bir çember yayı çiz" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "TrueType yazı tipindeki metinden eğriler çiz" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Bir dosyadan görüntü (resim) ekle" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Seçilen noktada radyus (teğet yay) oluştur" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Kübik Bezier Eğri Çiz" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Referans Nokta Ekle" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Yapıyı değiştir" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Çizgileri / eğrileri kesiştikleri yerden böl" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Mesafeyi / çapı / uzunluğu kısıtla" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Açıyı kısıtla" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Yatay olarak kısıtla" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Dikey olarak kısıtla" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Paralel veya teğet olarak kısıtla" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Dik olarak kısıtla" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Noktayı çizgi / eğri / düzlem / nokta ile çakıştırarak kısıtla" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Simetrik olarak kısıtla" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Eşit uzunluk / yarıçap / açı olarak kısıtla" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Normalleri aynı yönde kısıtla" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Diğer bütünler açı" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Ölçüyü Referans Yap / Yapma" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Etkin çizimi uzatıp katılayarak yeni grup oluştur" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Etkin çizimi tam döndürerek yeni grup oluştur" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Etkin çizimden sarmal yeni grup oluştur" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Etkin çizimi kısmen döndürerek yeni grup oluştur" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Adım ve tekrar değeri belirterek dairesel kopya grubu oluştur" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Adım ve tekrar değeri belirterek yeni doğrusal kopyalama grup oluştur" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "" +"Yeni çalışma düzleminde yeni grup oluştur (verilen öğeler aracılığıyla)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "3d'de yeni grup oluştur" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Bağlantı / Montaj dosyası ile yeni grup oluştur" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "En yakın izometrik görünüm" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Görünümü etkin çalışma düzlemine hizala" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Hata" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Mesaj" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&Tamam" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "Ölçek sıfır veya negatif olamaz." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Kötü biçim: x, y, z'yi belirtin" + + diff --git a/res/locales/uk_UA.po b/res/locales/uk_UA.po new file mode 100644 index 0000000..24ca895 --- /dev/null +++ b/res/locales/uk_UA.po @@ -0,0 +1,2329 @@ +# Ukrainian translations for SolveSpace package. +# Copyright (C) 2017 the SolveSpace authors +# This file is distributed under the same license as the SolveSpace package. +# app4soft , 2021. +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.0\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2025-01-27 12:58+0200\n" +"Last-Translator: https://github.com/Symbian9\n" +"Language-Team: app4soft\n" +"Language: uk_UA\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.5\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"Вирізання, вставка та копіювання працює лише у площині.\n" +"\n" +"Активуйте одну через Креслення -> У площині." + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "Буфер обміну порожній; немає чого вставляти." + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "Кількість копій для вставки має бути не менше одної." + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "Масштаб не може бути нульовим." + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "Оберіть одну точку для визначення центру обертання." + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "Оберіть дві точки для визначення вектору розміщення." + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "Трансформація ідентична, тому усі копії будуть точно одна на одній." + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "" +"Забагато об'єктів для вставки; розділіть копіювання на кілька менших етапів." + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "Немає активної площини." + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "Некоректний формат: визначте координати як X, Y, Z" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "Некоректний формат: визначте колір як R, G, B" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "" +"Значення перспективи не матиме ефекту допоки не ввімкнено Вигляд -> " +"Використовувати Перспективну Проєкцію." + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "Визначте кількість десяткових знаків від 0 до %d." + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "Масштаб експорту не може бути нульовим!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "Радіус відступу різання не може бути від'ємним!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "Некоректне значення: інтервал автозбереження має бути додатнім" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "Некоректний формат: визначте інтервал цілим числом у хвилинах" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "співпадіння-тчк" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "відстань-тчк-тчк" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "відстань-тчк-лінія" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "відстань-тчк-площина" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "відстань-тчк-грань" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "проєкційна-відстань-тчк-тчк" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "тчк-у-площині" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "тчк-на-лінії" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "тчк-на-грані" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "рівні-довжини" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "рівні-довжина-відстань-тчк-лінія" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "рівна-відстань-тчк-лінія" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "пропорція-довжин" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "пропорція-довжин-дуга-дуга" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "пропорція-довжини-дуга-лінія" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "різниця-довжин" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "різниця-довжин-дуга-дуга" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "різниця-довжин-дуга-лінія" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "симетрія" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "симетрія-вертикально" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "симетрія-горизонтально" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "симетрія-відносно-лінії" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "на-середині" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "горизонталь" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "вертикаль" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "діаметр" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "тчк-на-колі" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "співнапрямленість" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "кут" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "паралель" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "дотичні-дуга-лінія" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "дотичні-сплайн-лінія" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "дотичні-крива-крива" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "перпендикуляр" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "рівнозначні-радіуси" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "рівнозначні-кути" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "рівнозначні-лінія-дуга" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "фіксоване-положення" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "коментар" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"Обрана вами точка не належить до дуги. Дуга та відрізок не мають спільної " +"кінцевої точки.\n" +"\n" +"Оберіть кінцеву точку дуги, в якій ви хочете зробити дугу дотичною до лінії." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"Дотичні дуга та лінія повинні мати спільну кінцеву точку. Використайте " +"Обмежити -> На точці перед застосуванням дотичного обмеження.\n" +"\n" +"Або оберіть кінцеву точку дуги в якій ви хочете зробити її дотичною до лінії." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"Обрана вами точка не є кінцевою точкою кубічного сплайну. Сплайн та відрізок " +"не мають спільної кінцевої точки.\n" +"\n" +"Оберіть кінцеву точку сплайну в якій ви хочете зробити його дотичним до " +"лінії." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"Дотичні сплайн та відрізок повинні мати спільну кінцеву точку. Використайте " +"Обмежити -> На точці перед застосуванням дотичного обмеження.\n" +"\n" +"Або оберіть кінцеву точку сплайну в якій ви хочете зробити його дотичним до " +"лінії." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"Обрані вами точки не є кінцевими точками двох дуг. Дуги не поділяють кінцеву " +"точку.\n" +"\n" +"Оберіть кінцеві точки обох дуг, в яких ви бажаєте зробити їх дотичними одна " +"одній." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"Дотичні дуги повинні мати спільну кінцеву точку. Використайте Обмежити -> На " +"точці перед застосуванням дотичного обмеження.\n" +"\n" +"Або оберіть кінцеві точки обох дуг в яких ви хочете зробити дуги дотичними." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"Поганий вибір для обмеження за Відстанню / Діаметром. Це обмеження можна " +"застосувати до:\n" +"\n" +" * двох точок (відстань між точками)\n" +" * відрізку прямої (довжина)\n" +" * двох точок та відрізку прямої чи нормалі (відстань між проєкціями " +"точок)\n" +" * робочої площини та точки (найменша відстань)\n" +" * відрізку прямої та точки (найменша відстань)\n" +" * грані та точки (найменша відстань)\n" +" * кола або дуги (діаметр)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"Поганий вибір для обмеження На Точці / Кривій / Площині. Це обмеження можна " +"застосувати до:\n" +"\n" +" * двох або більше точок (точки збігаються)\n" +" * точки та площини (точка лежить в площині)\n" +" * точки та відрізку прямої (точка лежить на прямій)\n" +" * точки та кола чи дуги (точка лежить на дузі)\n" +" * точки та від одієї до трьох граней (точка лежить на грані(ях))\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"Поганий вибір для обмеження Рівні Довжина / Радіус. Це обмеження можна " +"застосувати до:\n" +"\n" +" * двох або більше відрізків прямої (рівні довжини)\n" +" * двох відрізків та двох точок (рівні відстані від точок до відповідних " +"відрізків)\n" +" * відрізка та двох точок (рівні відстані від точок до відрізка)\n" +" * відрізка, точки, та другого відрізка (відстань від точки до другого " +"відрізка дорівнює першому)\n" +" * двох або більше кіл чи дуг (рівні радіуси)\n" +" * відрізку та дуги (довжина відрізку дорівнює довжині дуги) \n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Поганий вибір для обмеження Пропорція Довжин. Це обмеження можна застосувати " +"до:\n" +"\n" +" * двох відрізків прямої\n" +" * двох дуг\n" +" * дуги та відрізка прямої\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"Поганий вибір для обмеження Різниця Довжин. Це обмеження можна застосувати " +"до:\n" +"\n" +" * двох відрізків\n" +" * двох дуг\n" +" * відрізка та дуги\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"Поганий вибір для обмеження До Середини. Це обмеження можна застосувати до:\n" +"\n" +" * відрізка та точки (точка на середині відрізку)\n" +" * відрізка та робочої площини (середина відрізку лежить в площині)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"Поганий вибір для обмеження за симетрією. Це обмеження можна застосувати " +"до:\n" +"\n" +" * двох точок або відрізку прямої (симетрія відносно початку координат " +"робочої площини)\n" +" * відрізка та двох точок або іншого відрізка (симетрія відносно " +"відрізка)\n" +" * робочої площини та двох точок або відрізка (симетрія відносно робочої " +"площини)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "" +"Робоча площина має бути активною коли використовується обмеження за " +"симетрією без явного вибору площини." + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "" +"Активуйте площину (в Креслення -> У Робочій Площині) перед застосуванням " +"обмеження Горизонтально або Вертикально." + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"Поганий вибір для обмеження Горизонтально / Вертикально. Це обмеження можна " +"застосувати до:\n" +"\n" +" * двох або більше точок\n" +" * одного або більше відрізків\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"Поганий вибір для обмеження Однакова Орієнтація. Це обмеження можна " +"застосувати до:\n" +"\n" +" * двох перпендикулярів\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "Необхідно обрати кут." + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "Необхідно обрати обмежувач з відповідною міткою." + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"Поганий вибір для обмеження за Кутом. Це обмеження можна застосувати до:\n" +"\n" +"Кута між:\n" +" * двома відрізками\n" +" * відрізком та перпендикуляром\n" +" * двома перпендикулярами\n" +"\n" +"Рівних кутів між:\n" +" * чотирма відрізками чи перпендикулярами (рівні кути між А,Б та В,Г)\n" +" * трьома відрізками чи перпендикулярами (рівні кути між А,Б та Б,В)\n" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "Обмеження дотичності дуг має відбуватися у робочій площині." + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"Поганий вибір для обмеження Паралельно / Дотична. Це обмеження можна " +"застосувати до:\n" +"\n" +" * двох граней\n" +" * двох або більше відрізків (паралельно)\n" +" * одного або більше відрізка та одного або більше перпендикуляра " +"(паралельно)\n" +" * двох або більше перпендикулярів (паралельно)\n" +" * двох відрізків, дуг, чи кривих Безьє, що мають спільну кінцеву " +"точку(дотична)\n" +" * двох відрізків, дуг, чи кривих Безьє, що не мають спільної кінцевої " +"точки та кінцевою точкою(точками) дуги(дуг) (дотична)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"Поганий вибір для обмеження Перпендикулярно. Це обмеження можна застосувати " +"до:\n" +"\n" +" * двох граней\n" +" * двох відрізків\n" +" * відрізка та перпендикуляра\n" +" * двох перпендикулярів\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"Поганий вибір для обмеження Фіксувати Точку Після Переміщення. Це обмеження " +"можна застосувати до:\n" +"\n" +" * точки\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "КОМЕНТАР -- ДВІЧІ КЛІКНІТЬ ДЛЯ РЕДАГУВАННЯ" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "клікніть в місце де буде центр коментаря" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"Вісутня об'ємна модель; створіть модель за допомогою екструдування та " +"обертання або скористайтеся функцією \"Експортувати 2D Вигляд\" для еспорту " +"лише ліній та кривих." + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"Поганий вибір для експорту розрізу. Будьласка, оберіть:\n" +"\n" +" * нічого, з активною робочою площиною (робоча площина буде площиною " +"розрізу)\n" +" * грань (площина розрізу через грань)\n" +" * точку та два відрізки (площина розрізу через точку та паралельно " +"відрізкам)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "Активна група не містить сітку; немає чого експортувати." + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "довільні лінії було замінено на неперервні відрізки" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "zigzag лінії було замінено на неперервні відрізки" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" +"Деякі аспекти креслення на мають відповідників у форматі DXF і не будуть " +"експортовані:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" +"Розмір аркуша у PDF перевищує 200×200 дюймів; багато переглядачів можуть не " +"підтримувати цей файл." + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "креслення-в-площині" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#базові-площини" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "Файл порожній. Він може бути пошкодженим." + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "" +"Нерозпізнані дані у файлі. Цей файл може бути пошкодженим або збереженим " +"новою версією програми." + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "Втрачений Файл" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "Приєднаний файл “%s” відсутній." + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "" +"Шукати файл вручну?\n" +"\n" +"При відмові, уся геометрія, що залежить від втраченого файлу буде видалена." + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "&Так" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "&Ні" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "&Відмінити" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "&Файл" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "&Новий" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "&Відкрити..." + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "Відкрити &Недавні" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "&Зберегти" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "Зберегти &Як..." + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "Експортувати &Зображення..." + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "Експортувати 2D &Вигляд..." + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "Експортувати 2D &Секцію..." + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "Експортувати 3D &Скелет..." + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "Експортувати Тригранний &Каркас..." + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "Експортувати &Поверхні..." + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "Ім&портувати..." + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "В&ихід" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "&Редагувати" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "&Відмінити" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "&Повторити" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "Ре&генерувати Все" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "Прикріпити Виділене до &Сітки" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "Обернути Імпортоване на &90°" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "Ви&різати" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "&Копіювати" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "&Вставити" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "Вставити &Трансфмованим..." + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "&Видалити" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "Виділити Ланцуг &Ребер" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "Виділити &Усе" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "&Зняти Виділення з Усього" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "Стилі &Ліній..." + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "&Проекція Відображення..." + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "&Налаштування..." + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "&Відображення" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "На&близити" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "Від&далити" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "Умістити на &Екрані" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "Вирівняти Вигляд до Робочої &Площини" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "Найближчий &Ортогональний Вигляд" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "Найближчий &Ізометричний Вигляд" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "&Центрувати Вигляд на Точці" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "Показати &Сітку Прикріплення" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "Затінювати Неактивні Тіла" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "Використовувати &Перспективну Проекцію" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "Показати С&кладальне Креслення" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "Розмірні &Одиниці" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "Розміри у &Міліметрах" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "Розміри у &Метрах" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "Розміри у &Дюймах" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "Розміри в &Футах та Дюймах" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "Показати Панель &Інструментів" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "Показати Вікно Власти&востей" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "&Повний Екран" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "&Нова Група" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "Креслення у &3D" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "Креслення у Новій &Площині" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "Покрокове &Переміщення" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "Покрокове &Обертання" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "Ви&давити" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "&Спіраль" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "&Виточити" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "&Обертати" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "Приєднати / Зібрати..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "Приєднати Нещодавні" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "&Креслення" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "У Робочій &Площині" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "Будь-де в &3D" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "Опорна &Точка" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "Робоча &Площина" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "&Відрізок Прямої" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "Контсрук&ційний Відрізок Прямої" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "&Прямокутник" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "&Коло" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "&Дуга Кола" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "Кубічний Сплайн &Без'є" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "&Текст із TrueType Шрифтом" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "&Зображення" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "Пере&мкнути Конструктивність" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "Дотична &Дуга на Точці" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "Розрізати Криві на &Перетині" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "&Обмежити" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "&Відстань / Діаметр" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "Від&носний Розмір" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "К&ут / Рівний Кут" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "Відносний К&ут" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "Інший Су&міжний Кут" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "Перемкнути Від&носність Розмірів" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "&Горизонтально" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "&Вертикально" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "&На точці / Кривій / Площині" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "Р&івна Довжина / Радіус" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "Пропорція довжин" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "Різниця довжин" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "До &Середини" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "Си&метрично" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "Пара&лельно / Дотична" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "&Препендикулярно" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "Однакова Орієн&тація" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "Фіксувати Точку Після &Переміщення" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "Коментар" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "&Аналізувати" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "Обрахувати &Об'єм" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "Обрахувати Пл&ощу" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "Обрахувати &Периметр" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "Показати &Дотичні Частини" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "Показати &Приховані Ребра" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "Показати &Центр Масс" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "Показати &Надмірно Обмежені Точки" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "&Трасувати Точку" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "&Зупити Трасування..." + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "Прорахувати &Розмір..." + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "&Довідка" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "&Мова" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "&Вебсайт / Посібник" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "&До коміту на GitHub" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "&Про програму" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(нємає нещодавніх файлів)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "Файл '%s' відсутній." + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "Відсутня активна площина - сітка не відображатиметься." + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"Встановлено нульовий коефіцієнт перспективи, тому відображення завжди буде " +"паралельною проєкцією." + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "Оберіть точку. Ця точка стане центром відображення на екрані." + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "Жодні сутності не мають спільних кінцевих точок з обраними сутностями." + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"Для використання цієї команди оберіть точку або іншу сутність з приєднаної " +"деталі, або зробіть приєднану групу активною." + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"Жодної активної площини. Активуйте площину (в Креслення -> У Робочій " +"Площині) щоб визначити площину для сітки." + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"Неможливо прикріпити ці штуки до сітки; оберіть точки, текстові коментарі чи " +"обмеження з назвою. Щоб прикріпити лінію, оберіть її кінцеві точки." + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" +"Жодної робочої площини не обрано. Активую площину за замовченням для цієї " +"групи." + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"Жодної робочої площини не обрано, і активна група не має площини за " +"замовченням. Спробуйте обрати площину, або активувати групу Креслення У " +"Робочій Площині." + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "" +"Поганий вибір для дотичної дуги у точці. Оберіть одну точку, або оберіть " +"нічого щоб налаштувати дугу." + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "клікніть для встановлення точки дуги (проти годинникової стрілки)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "клікніть для встановлення вихідної точки" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "клікніть першу точку прямої лінії" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "клікніть першу точку конструктивної прямої лінії" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "клікніть першу точку кривої" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "клікніть в місце де буде центр коментаря" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "клікніть в центр відліку площини" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "клікніть для встановлення першого кута прямокутника" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "клікніть для встановлення верхньої лівої межі тексту" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "клікніть для встановлення верхньої лівої межі зображення" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "Жодної сутності не обрано. Оберіть сутності для перключення їх стану." + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "ескіз-в-3D" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"Поганий вибір для ного креслення в робочій площині. Ця група може бути " +"створена з:\n" +"\n" +" * точки (через точку, ортогонально до координатних осей)\n" +" * точки та двох відрізків (через точку, паралельно до відрізків)\n" +" * точку та перпендикуляр (через точку, ортогонально перпендикуляру)\n" +" * робочої площини (створиться копія площини)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "" +"Активуйте робочу площину ( Ескіз -> У Площині) перед екструдуванням. Ескіз " +"буде екструдовано перпендикулярно до робочої площини." + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "видавлювання" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "" +"Операція виточування може бути застосована тільки для пласких креслень." + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Поганий вибір для нової групи проточування. Ця група може бути створена з:\n" +"\n" +" * точки та відрізка або перпендикуляра (обертається крізь точку навколо " +"осі, паралельної до відрізку / перпендикуляру)\n" +" * відрізка (обертається навколо відрізка)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "проточування" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "" +"Операція прокручування може бути застосована тільки для пласких креслень." + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Поганий вибір для нової групи прокручування. Ця група може бути створена з:\n" +"\n" +" * точки та відрізка або перпендикуляра (обертається крізь точку навколо " +"осі, паралельної до відрізку / перпендикуляру)\n" +" * відрізка (обертається навколо відрізка)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "прокручування" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "Спіраль може бути створена лише на основі площинного ескізу." + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"Поганий вибір для нової групи проточування. Ця група може бути створена з:\n" +"\n" +" * точки та відрізка або перпендикуляра (обертається крізь точку навколо " +"осі, паралельної до відрізку / перпендикуляру)\n" +" * відрізка (обертається навколо відрізка)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "спіраль" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"Поганий вибір для нової групи проточування. Ця група може бути створена з:\n" +"\n" +" * точки, доки закріплено в робочій площині (обертається в площині, " +"навколо цієї точки)\n" +" * точки та відрізка чи перпендикуляря (обертається навколо осі, що " +"проходить крізь цю точку, і паралельна до відрізку / перпендикуляру)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "крутіння" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "перекладання" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(безіменне)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "не замкнений контур або не все в єдиному стилі!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "не всі точки знаходяться в одній площині!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "контур самоперетинається!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "ребро нульової довжини!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "Файли STL з текстовим форматуванням наразі не підтримуються" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "" +"Для створення дотичної дуги має бути обраний режим креслення в робочій " +"площині." + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "" +"Для створення дотичної дуги оберіть точку де два відрізки або дуги " +"поєднуються." + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "" +"Неможливо закруглити цей кут. Спробуйте менший радіус або створіть необхідну " +"геометрію вручну задопомогою омеження Дотичності." + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" +"Неможливо розділити цей об'єкт. Дозволено тільки для відрізків, кіл(дуг), чи " +"сплайнів." + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "" +"Креслення має відбуватися у робочій площині для використання розділення." + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "" +"Оберіть дві сутності, що перетинаються (наприклад лінії/кола/дуги або лінія/" +"коло/дуга та точка)" + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "Неможливо розділити; відсутній перетин." + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "Встановити Стиль" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "Без Стилю" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "Створити Користувацький Стиль..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "Параметри Групи" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "Параметри Стилю" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "Виділити Ланцюг Ребер" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "Перемкнути Відносність Розміру" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "Інший Суміжний Кут" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "Прикріпити до Сітки" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "Видалити Точку Сплайну" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "Додати Точку Сплайну" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" +"Неможливо додати точку сплайна: перевищено максимальну кількість точок." + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "Пермкнути Конструктивність" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "Роз'єднати З'єднання Точок" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "Вирізати" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "Копіювати" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "Виділити Усе" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "Вставити" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "Вставити Трансформованим..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "Видалити" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "Зняти Виділення з Усього" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "Зняти Виділення з Наведеного" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "Умістити на Екрані" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "клікніть наступну точку лінії або натисніть Esc" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Неможливо накреслити прямокутник у 3d; спочатку активуйте робочу площину в " +"Креслення -> У Робочій Площині." + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "клікніть для встановлення іншого кута прямокутника" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "клікніть для визначення радіусу" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Неможливо накреслити дугу у 3d; спочатку активуйте робочу площину в " +"Креслення -> У Робочій Площині." + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "клікніть для встановлення точки" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "клікніть наступну точку кривої або натисніть Esc" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" +"Вже обрано креслення у робочій площині; поверніться у креслення будь-ду в 3D " +"для створення нової робочої площини." + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Неможливо накреслити текст у 3д; спочатку активуйте робочу площину в " +"Креслення -> У Робочій Площині." + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "клікніть для встановлення нижньої правої межі тексту" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "" +"Неможливо накреслити зображення у 3д; спочатку активуйте робочу площину в " +"Креслення -> У Робочій Площині." + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpace модел" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "УСІ" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF друкована плата" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL трикутникова сітка" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG зображення" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL сітка" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront OBJ меш" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js-сумісний меш, з переглядачем" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js-сумісний меш, лише меш" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML меш, текстовий формат" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP файл" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF файл" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "Encapsulated PostScript" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "Scalable Vector Graphics, векторний формат" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF файл (AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL файл" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G Code" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF та DWG файли" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "Comma-separated values" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "без імені" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "Зберегти Файл" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "Відкрити Файл" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "_Скасувати" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "_Зберегти" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "_Відкрити" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "Наявні автозбереження" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "Наявні автозбереження для цього креслення." + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "Завантажити файл автозбереження?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "&Завантажити автозбереження" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "&Не Завантажувати" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "Файл Змінено" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "Чи хочете ви зберегти зміни зроблені вами у ескізі “%s”?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "Чи хочете ви зберегти зміни зроблені вами у новому ескізі?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "Ваші зміни буде втрачено якщо ви не збережете їх." + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "&Зберегти" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "&Не Зберігати" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(нове креслення)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "Браузер Властивостей" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"Зараз обмеження відображаються, і будуть експортовані в шлях інструменту. " +"Скоріш за все, це не те, чого ви домагаєтеся; cховайте їх клікнувши на " +"посилання над текстовим вікном." + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf " +"or .dwg." +msgstr "" +"Неможливо визначити тип файлу з розширення '%s'; спробуйте .dxf чи .dwg." + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "Обмежувач має містити мітку і бути не відносним розміром." + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "Поганий вибір для крокової зміни розміру; оберіть обмежувач." + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "Збірка не перетинається, очман." + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"Об'єм твердого тіла становить:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"Об'єм поточної групи мешу становить:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"Скруглені поверхні були апроксимовані до трикутників.\n" +"Це створює похибку, зазвичай біля 1%." + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Площа поверхні обраної грані:\n" +"\n" +" %s\n" +"\n" +"Криві були апроксимовані як дрібні відрізки.\n" +"Це створює похибку, зазвичай біля 1%%." + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "" +"Ця група не місить коректно сформованого замкненої 2D площини. Вона " +"відкрита, не компланарна, або ж самоперетинається." + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Площа заповнення ескізу у цій групі становить:\n" +"\n" +" %s\n" +"\n" +"Криві наближено до ламаних ліній.\n" +"Це вносить похибку, зазвичай близько 1%%." + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"Загальна довжина обраних елементів становить:\n" +"\n" +" %s\n" +"\n" +"Криві наближено до ламаних ліній.\n" +"Це вносить похибку, зазвичай близько 1%%." + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "Поганий вибір для периметру; оберіть відрізки, дуги та криві." + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "Поганий вибір для вістежування шляху; оберіть одну точку." + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "Неможливо записати у '%s'" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "Меш самоперетинається (НЕ добре, недійсний)." + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "Меш самоперетинається (добре, дійсний)." + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "Меш містить оголені ребра (НЕ добре, недійсний)." + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "Меш водонепроникний (добре, дійсний)." + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"Модель складається з %d трикутників, що розташовані на %d поверхнях." + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"Відсутні проблемні ребра, добре.%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d проблемних ребер, погано.%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"Це SolveSpace версії %s.\n" +"\n" +"Більше інформації на сайті http://solvespace.com/\n" +"\n" +"SolveSpace є вільною програмою: ви можете модифікувати\n" +"та/або розповсюджувати її відповідно до ліцензії GNU\n" +"General Public License (GPL) версії 3 чи новішої.\n" +"\n" +"ВІЧСУТНІ БУДЬ-ЯКІ ГАРАНТІЇ, в межах, доволених\n" +"законом. Деталі на сайті http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues та інші автори.\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "" +"Неможливо призначити стиль елементу який походить від іншого елемента; " +"спробуйте призначити стиль батьківському елементу." + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "Стиль не може містити порожнє ім'я" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "Не можливо повторити менше 1 разу." + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "Не можливо повторити понад 999 разів." + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "Група не може містити порожнє ім'я" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "Непрозорість має бути між 0 та 1." + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "Радіус не може бути нульовим чи від'ємним." + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "Накреслети відрізок прямої" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "Накреслити прямокутник" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "Накреслити коло" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "Накреслити дугу кола" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "Накреслити криві з тексту на TrueType шрифті" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "Вставити зображення з файлу" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "Створити дотичну дугу у вибраній точці" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "Накреслити кубічний сплайн Без'є" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "Накреслити опорну точку" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "Перемкнути конструктивність" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "Розрізати лініх / криві в місцях перетину" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "Визначити відстань / діаметр / довжину" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "Визначити кут" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "Встановити горизонтально" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "Встановити перпендикулярно" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "Встановити паралельно або дотично" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "Встановити перпендикулярно" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "Прив'язати точку до лінії / кривої / площини / точки" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "Встановити симетрично" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "Встановити однаковими відстань / радіус / кут" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "Спрямувати нормалі в одному напрямку" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "Інший суміжний кут" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "Перемкнути відносність розміру" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "Нова група екструдування активного ескізу" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "Нова група обертання актиного ескізу" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "Нова група спіралі з активного ескізу" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "Нова група обертання активного ескізу" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "Нова група крокування і повторення обертання" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "Нова група крокування і повторення зміщення" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "Нова група в новій площині (через обрані об'екти)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "Нова група в 3D" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "Нова група приєднання / монтування файлу" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "Найближчий ізометричний вигляд" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "Вирівняти вигляд до активної робочої площини" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "Помилка" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "Повідомлення" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "&OK" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "Масштаб не може бути нульовим чи від'ємним." + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "Некоректний формат: визначте X, Y, Z" + +#~ msgid "A&ngle" +#~ msgstr "К&ут" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "Рі&вні Довжина / Радіус / Кут" + +#~ msgid "Length Ra&tio" +#~ msgstr "Про&порція Довжин" + +#~ msgid "Length Diff&erence" +#~ msgstr "Рі&зниця Довжин" + +#~ msgid "Show Degrees of &Freedom" +#~ msgstr "Показати Степені &Свободи" + +#~ msgid "Show Menu &Bar" +#~ msgstr "Показати Панель &Меню" diff --git a/res/locales/zh_CN.po b/res/locales/zh_CN.po new file mode 100644 index 0000000..2a992b4 --- /dev/null +++ b/res/locales/zh_CN.po @@ -0,0 +1,2383 @@ +# Chinese translations for SolveSpace package. +# Copyright (C) 2020 the PACKAGE authors +# This file is distributed under the same license as the SolveSpace package. +# , 2020. +# , 2023. +# , 2025. +# +# 译词一致性 +# mesh网格 grid格线 +# text文本 comment备注 +# vertical竖直 perpendicular垂直 +# Rotate旋转 Lathe转圈 Revolve扫略 +# solid实心体 object对象 entity物件 +# plane点线面/平面 face/surface表面 plane_faces平表面 +# +# 约束的选择错误。此约束可用于:A与(B和C) +# 一点/工作面 一条线段 一个表面 一个以上 +# +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.2\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: 2023-04-30 15:58+0800\n" +"Last-Translator: liuxilu@live.com\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.4.2\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" +"剪切、粘贴、复制在工作面内才可用。\n" +"\n" +"用\"绘图 -> 在工作面内\"来激活一个。" + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "剪贴板为空;没有能粘贴的。" + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "至少要粘贴 1 个副本。" + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "缩放不能为零。" + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "选择一个点来定义旋转中心。" + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "选择两个点来定义平移向量。" + +#: clipboard.cpp:458 +msgid "" +"Transformation is identity. So all copies will be exactly on top of each " +"other." +msgstr "输入的变换是不动,因此所有副本将互相重叠。" + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "要粘贴的项目太多; 请把他们拆分。" + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "无活动工作面。" + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "格式错误:请用 x,y,z 指定坐标" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "格式错误:请用 r,g,b 指定颜色" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use " +"Perspective Projection." +msgstr "若不启用\"查看 -> 使用透视投影\",透视因数将不起作用。" + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "请指定小数点后 0 到 %d 位。" + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "导出比例不能为零!" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "刀具半径偏移不能为负!" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "值错误:自动保存间隔应为正" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "格式错误:间隔应为整分钟" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "点点重合" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "点点距离" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "点线距离" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "点面距离" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "点面距离" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "点点投影距离" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "点在面上" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "点在直线上" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "点在表面上" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "线长相等" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "线长与点线距离相等" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "点线距离相等" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "线长比例" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "弧长比例" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "弧长与线长比例" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "线长之差" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "弧长之差" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "弧长与线长之差" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "对称" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "水平对称" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "竖直对称" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "关于直线对称" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "中点" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "æ°´å¹³" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "竖直" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "直径" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "点在圆上" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "同向" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "角度" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "平行" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "弧和线相切" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "三次曲线和直线相切" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "曲线相切" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "垂直" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "半径相等" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "角度相等" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "线长和弧长相等" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "定位后锁定" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "备注" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment " +"do not share an end point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the " +"line." +msgstr "" +"您选择的点不属于弧线, 弧线与线段不共享端点\n" +"\n" +"在样条曲线上选择一个您想要与目标线相切的端点." + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with " +"Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be " +"tangent to the line." +msgstr "" +"要相切的弧和线段必须有共同端点。约束相切之前,用\"约束 -> 在点上\"来约束它" +"们。\n" +"\n" +"此外, 可以在曲线上选择一个您想要与目标线相切的端点." + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline " +"and line segment do not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the " +"line." +msgstr "" +"您选中的点不是三次样条曲线端点. 样条线和线段并不共享端点.\n" +"\n" +"在样条曲线上选择一个您想要与目标线相切的端点." + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain " +"them with Constrain -> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it " +"to be tangent to the line." +msgstr "" +"要相切的三次曲线段和线段必须有共同端点。约束相切之前,使用\"约束 -> 在点上" +"\"来约束它们。\n" +"\n" +"此外, 可以在三次样条曲线上选择一个您想要与目标线相切的端点." + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do " +"not share an end point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to " +"each other." +msgstr "" +"您选择的端点不属于二个曲线, 曲线并不共有一个端点.\n" +"\n" +"在二个曲线上选择一个您想要二者相切的共有端点." + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point " +"before constraining tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the " +"curves to be tangent." +msgstr "" +"要约束的曲线必须有共同端点。约束相切之前,使用\"约束 -> 在点上\"来约束它们。\n" +"\n" +"此外, 可以在二个曲线上选择相切的端点." + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply " +"to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" +"距离/直径约束的选择错误。此约束可用于:\n" +"\n" +" * 两点(点距)\n" +" * 线段(长度)\n" +" * 两点与一条线段或法线(投影距离)\n" +" * 一点与一工作面(最小距离)\n" +" * 一点与一条线段(最小距离)\n" +" * 一点与一平表面(最小距离)\n" +" * 一个圆或一条弧(直径)\n" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" +"在点/线/面上约束的选择错误。此约束可用于:\n" +"\n" +" * 两个以上的点(点点重合)\n" +" * 一点与一平面(点在面上)\n" +" * 一点与一条线段(点在直线上)\n" +" * 一点与一个圆或弧(点在曲线上)\n" +" * 一点与一到三个平表面(点在表面上)\n" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance " +"equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" +"长度/半径相等约束的选择错误。此约束可用于:\n" +"\n" +" * 两条以上线段(长度相等)\n" +" * 两条线段与两点(点线距离相等)\n" +" * 一条线段与两点(点线距离相等)\n" +" * 一条线段与一点和线段(点线距离等于长度)\n" +" * 一条线段和一条弧(线长等于弧长)\n" +" * 两个以上圆或弧(半径相等)\n" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"长度比例约束的选择错误。此约束可用于:\n" +"\n" +" * 两条线段\n" +" * 两条弧线\n" +" * 一条弧线与一条线段\n" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply " +"to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" +"长度差约束选择错误。此约束可用于:\n" +"\n" +" * 两条线段\n" +" * 两条弧线\n" +" * 一条弧线与一条线段\n" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" +"中点约束的选择错误。此约束可用于:\n" +"\n" +" * 一条线段和一点(点在线段中点上)\n" +" * 一条线段和一工作面(线段中点在平面上)\n" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate " +"axis)\n" +" * line segment, and two points or a line segment (symmetric about line " +"segment)\n" +" * workplane, and two points or a line segment (symmetric about " +"workplane)\n" +msgstr "" +"对称约束的选择错误。此约束可用于:\n" +"\n" +" * 两点或一条线段(关于工作面坐标轴对称)\n" +" * 一条线段与两点或一条线段(关于直线对称)\n" +" * 一工作面和两点或一条线段(关于工作面对称)\n" + +#: constraint.cpp:623 +msgid "" +"A workplane must be active when constraining symmetric without an explicit " +"symmetry plane." +msgstr "没有明显的对称面时,约束对称必须有活动工作面。" + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a " +"horizontal or vertical constraint." +msgstr "使用水平或竖直约束之前应激活工作面(用\"绘图 -> 在工作面内\")。" + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can " +"apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" +"æ°´å¹³/竖直约束的选择错误。此约束可用于:\n" +"\n" +" * 两个以上的点\n" +" * 一条以上的线段\n" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply " +"to:\n" +"\n" +" * two normals\n" +msgstr "" +"同向约束的选择错误。此约束可用于:\n" +"\n" +" * 两条法线\n" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "必须选择角度约束。" + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "必须选择有尺寸的约束。" + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" +"角度约束的选择错误。此约束可用于:\n" +"\n" +" * 两条线段\n" +" * 两条法线\n" +" * 一条线段和一条法线\n" +"之间的角度\n" +" * 四条线段或法线(AB之间与CD之间角度相等)\n" +" * 三条线段或法线(AB之间与BC之间角度相等)\n" +"之间的角度相等" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "曲线相切必须在工作面内应用。" + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply " +"to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and " +"the end point(s) of the curve(s) (tangent)\n" +msgstr "" +"平行/相切约束的选择错误。此约束可用于:\n" +"\n" +" * 两个表面\n" +" * 两条以上线段(平行)\n" +" * 两条以上法线(平行)\n" +" * 一条以上线段与一条以上法线(平行)\n" +" * 有共同端点的两条弧/线段/贝塞尔曲线(相切)\n" +" * 无共同端点的两条线段/曲线/贝塞尔曲线, 及曲线的端点不共有 (相切)\n" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" +"垂直约束的选择错误。此约束可用于:\n" +"\n" +" * 两个表面\n" +" * 两条线段\n" +" * 两条法线\n" +" * 一条线段与一条法线\n" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can " +"apply to:\n" +"\n" +" * a point\n" +msgstr "" +"定位后锁定点约束的选择错误。此约束可用于:\n" +"\n" +" * 一点\n" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "新备注——双击编辑" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "单击备注文本的中心" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export " +"2d View to export bare lines and curves." +msgstr "" +"不存在实心体模型;用拉伸和扫略来绘制,或使用\"导出2D视图\"导出光杆直线和曲" +"线。" + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to " +"lines)\n" +msgstr "" +"导出截面的选择错误。请选择:\n" +"\n" +" * 空,有活动工作面时(工作面为截面)\n" +" * 一个表面(截面穿过表面)\n" +" * 一点与两条线段(截面穿过点并与线平行)\n" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "活动组网格为空;没有能导出的。" + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "手绘样式的线已替换为连续线" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "锯齿样式的线已替换为连续线" + +#: exportvector.cpp:592 +msgid "" +"Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "图纸的某些方面没有DXF等效项,并且未导出:\n" + +#: exportvector.cpp:838 +msgid "" +"PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "PDF页面大小超过200x200英寸;许多查看器可能会拒绝此文件。" + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "平面草图" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "#参考" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "文件为空,可能已损坏。" + +#: file.cpp:560 +msgid "" +"Unrecognized data in file. This file may be corrupt, or from a newer version " +"of the program." +msgstr "文件内数据无法识别。该文件可能损坏,或来自新版本程序。" + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "文件丢失" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "不存在连接的文件\"%s\"。" + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be " +"permanently removed." +msgstr "您是否想手动查找?如果拒绝,基于丢失文件的所有几何图形将被永久删除。" + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "是(&Y)" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "否(&N)" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "取消(&C)" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "文件(&F)" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "新建(&N)" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "打开...(&O)" + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "打开最近文件(&R)" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "保存(&S)" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "另存为...(&A)" + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "导出图片...(&I)" + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "导出2D视图...(&V)" + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "导出2D截面...(&S)" + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "导出3D线框...(&W)" + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "导出三角网格...(&M)" + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "导出表面...(&S)" + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "导入...(&P)" + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "退出(&E)" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "编辑(&E)" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "撤销(&U)" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "重做(&R)" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "全部重新生成(&G)" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "吸附所选到格线(&G)" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "导入的模型旋转90°(&9)" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "剪切(&T)" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "复制(&C)" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "粘贴(&P)" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "粘贴并变换...(&T)" + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "删除(&D)" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "选择相连边(&E)" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "全选(&A)" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "全不选(&U)" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "线的样式...(&L)" + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "投影视图...(&V)" + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "配置...(&F)" + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "查看(&V)" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "放大(&I)" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "缩小(&O)" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "适合窗口(&F)" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "视图对齐至工作面(&W)" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "最接近的正交视图(&O)" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "最接近的等轴视图(&I)" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "视图中心置于点(&C)" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "显示吸附格线(&G)" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "非活动实心体变暗" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "使用透视投影(&P)" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "显示爆炸视图(&E)" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "尺寸单位(&U)" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "毫米(&M)" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "ç±³(&E)" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "英寸(&I)" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "英尺和英寸(&F)" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "显示工具栏(&T)" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "显示属性浏览器(&W)" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "全屏(&F)" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "新建组(&N)" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "在三维空间绘制(&3)" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "在新工作面绘制(&W)" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "步进平移(&T)" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "步进旋转(&R)" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "挤出(&E)" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "螺旋(&H)" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "转圈(&L)" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "扫略(&V)" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "连接/装配..." + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "连接最近文件" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "绘图(&S)" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "在工作面内(&W)" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "在三维空间(&3)" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "基准点(&P)" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "工作面(&k)" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "线段(&S)" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "构造线线段(&C)" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "矩形(&R)" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "圆(&C)" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "圆弧(&A)" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "三次贝塞尔样条(&B)" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "TrueType字体文本(&T)" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "图片(&m)" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "切换构造线(&G)" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "点处创建内切弧(&n)" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "交点处拆分曲线(&I)" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "约束(&C)" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "距离/直径(&D)" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "参考尺寸(&F)" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "角度(&N)" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "参考角度(&G)" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "补角(&U)" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "切换参考尺寸(&E)" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "æ°´å¹³(&H)" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "竖直(&V)" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "在点/线/面上(&O)" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "长度/半径/角度相等(&Q)" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "(å¼§)长比例(&T)" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "(å¼§)长之差(&E)" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "中点(&M)" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "对称(&Y)" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "平行/相切(&L)" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "垂直(&P)" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "同向(&A)" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "定位后锁定点(&D)" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "备注" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "分析(&A)" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "测量体积(&V)" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "测量面积(&R)" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "测量周长(&P)" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "显示干涉部件(&I)" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "显示裸露边(&N)" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "显示质心(&C)" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "显示欠约束的点(&U)" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "跟踪点(&T)" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "停止跟踪...(&S)" + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "尺寸步进...(&D)" + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "帮助(&H)" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "语言(&L)" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "网站/手册(&W)" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "转到Github commit(&G)" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "关于(&A)" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "(无最近文件)" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "不存在文件\"%s\"。" + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "没有活动工作面,因此无法显示格线。" + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel " +"projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the " +"configuration screen. A value around 0.3 is typical." +msgstr "" +"透视因数已设为零,因此视图将始终为平行投影。\n" +"\n" +"要使用透视投影,请在配置界面中修改透视因数。典型值大概是0.3。" + +#: graphicswin.cpp:884 +msgid "" +"Select a point; this point will become the center of the view on screen." +msgstr "选择一点; 此点将成为屏幕上视图的中心。" + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "所选物件不与其他物件有共同端点。" + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or " +"make a link group the active group." +msgstr "" +"使用此命令时,选择连接来的部件上一点或其他成分,或将一个连接组设为活动组。" + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) " +"to define the plane for the snap grid." +msgstr "" +"无活动工作面。激活一个工作面(用\"绘图 -> 在工作面内\")以定义吸附格线所在的" +"平面。" + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints " +"with a label. To snap a line, select its endpoints." +msgstr "" +"不能吸附这些项目到格线;选择点、文本备注、有尺寸的约束。要吸附线请选择其端" +"点。" + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "未选择工作面。将激活该组的默认工作面。" + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default " +"workplane. Try selecting a workplane, or activating a sketch-in-new-" +"workplane group." +msgstr "" +"未选择工作面,且活动组没有默认工作面。请选择一个工作面,或激活一个\"平面草图" +"\"组。" + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select " +"nothing to set up arc parameters." +msgstr "\"点处创建内切弧\"的选择错误。选择单个点,或什么都不选来设置参数。" + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "点击弧上的点(逆时针绘制)" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "点击放置基准点" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "点击线段的起点" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "点击构造线的起点" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "点击三次曲线段的起点" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "点击圆心" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "点击工作面原点" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "点击矩形的一个角" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "点击文本左上角" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "点击图片左上角" + +#: graphicswin.cpp:1402 +msgid "" +"No entities are selected. Select entities before trying to toggle their " +"construction state." +msgstr "未选中物件,切换构造状态前请先选中物件。" + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "三维草图" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the " +"lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" +"\"在新工作面绘制\"的选择错误。该组可创建以:\n" +"\n" +" * 一点(穿过该点,与坐标轴正交)\n" +" * 一点与两条线段(穿过点,平行于线)\n" +" * 一点和一条法线(穿过点,正交于法线)\n" +" * 工作面(副本)\n" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch " +"will be extruded normal to the workplane." +msgstr "挤出前先激活工作面(绘图 -> 在工作面内),草图将沿工作面法线挤出。" + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "挤出" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "转圈操作只能用于平面草图。" + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"新建转圈组的选择错误,该组可创建以:\n" +"\n" +" * 一点与一条线段或法线(围绕通过点且平行于线的轴)\n" +" * 一条线段(围绕线段)\n" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "转圈" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "扫略操作只能用于平面草图。" + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"新建扫略组的选择错误。该组可创建以:\n" +"\n" +" * 一点与线段/法线(围绕通过点且平行于线的轴旋转)\n" +" * 一条线段(围绕线段旋转)\n" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "扫略" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "螺旋操作只能用于平面草图。" + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel " +"to line / normal, through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" +"新建螺旋组的选择错误。该组可创建以:\n" +"\n" +" * 一点与一条线段或法线(围绕通过点且平行于线的轴旋转)\n" +" * 线段(围绕线段旋转)\n" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "螺旋" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that " +"point)\n" +" * a point and a line or a normal (rotate about an axis through the " +"point, and parallel to line / normal)\n" +msgstr "" +"新建旋转组的选择错误。该组可创建以:\n" +"\n" +" * 一点,在工作面内新建时(在平面内围绕该点旋转)\n" +" * 一点与一条线段或法线(围绕通过点且平行于线的轴旋转)\n" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "旋转" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "平移" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "(未命名)" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "轮廓未闭合,或样式不一致!" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "并非所有点都共面!" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "轮廓自相交!" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "边长度为零!" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "目前不支持文本格式的STL文件" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "必须在工作面内创建内切弧。" + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or " +"circles in this group and workplane join." +msgstr "要创建内切弧,请选择活动组和工作面中,两个非构造线或圆连接处。" + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the " +"desired geometry by hand with tangency constraints." +msgstr "无法倒圆这个角。尝试更小的半径,或用切线约束手动创建。" + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "不能拆分此物件;仅限直线、圆、三次曲线。" + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "必须在工作面内拆分。" + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs " +"or a line/circle/arc and a point)." +msgstr "选择两个相交的物件(例如两条线/圆/弧,或一条线/圆/弧与一点)。" + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "无法拆分;未发现交点。" + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "指定样式" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "无样式" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "新建自定义样式..." + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "组信息" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "样式信息" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "选择相连边" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "切换参考尺寸" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "补角" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "吸附至格线" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "删除样条点" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "增加样条点" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "无法增加样条点:超过点数限制。" + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "切换构造线" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "删除点点重合约束" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "剪切" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "复制" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "全选" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "粘贴" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "粘贴并变换..." + +#: mouse.cpp:766 +msgid "Delete" +msgstr "删除" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "全不选" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "光标下的不选" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "适合窗口" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "点击下一个点,或按Esc取消" + +#: mouse.cpp:993 +msgid "" +"Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "无法在三维空间绘制矩形;请先激活工作面(用\"绘图 -> 在工作面内\")。" + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "点击放置矩形的另一个角" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "点击设置半径" + +#: mouse.cpp:1053 +msgid "" +"Can't draw arc in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "无法在三维空间绘制弧线,请激活工作面(用\"绘图 -> 在工作面内\")" + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "点击放置点" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "点击下一个点,或按Esc取消" + +#: mouse.cpp:1093 +msgid "" +"Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "已在工作面内绘制;新建工作面之前先\"在三维空间绘制\"。" + +#: mouse.cpp:1109 +msgid "" +"Can't draw text in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "无法在三维空间绘制文本,请激活工作面(用\"绘图 -> 在工作面内\")" + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "点击放置文本的右下角" + +#: mouse.cpp:1132 +msgid "" +"Can't draw image in 3d; first, activate a workplane with Sketch -> In " +"Workplane." +msgstr "无法在三维空间绘制图片,请激活工作面(用\"绘图 -> 在工作面内\")" + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "SolveSpace模型" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "全部" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "IDF电路图" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "STL三角网格" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "PNG图片" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "STL网格" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "Wavefront obj网格" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "Three.js兼容网格,带视图" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "Three.js兼容网格,仅网格" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "VRML文本文件" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "STEP文件" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "PDF文件" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "封装的PostScript" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "SVG矢量图" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "DXF文件(AutoCAD 2007)" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "HPGL文件" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "G代码" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "AutoCAD DXF/DWG文件" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "逗号分隔数据" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "无标题" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "保存文件" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "打开文件" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "取消(_C)" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "保存(_S)" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "打开(_O)" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "自动保存可用" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "该草图有自动保存文件可用。" + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "是否加载自动保存文件?" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "加载(&L)" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "不加载(&N)" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "文件已修改" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "" +"是否保存您对草图\n" +"“%s”\n" +"的修改?" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "是否保存您对新草图的修改?" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "如果不保存,您的修改将会丢失。" + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "保存(&S)" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "不保存(&N)" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "(新草图)" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "属性浏览器" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This " +"is probably not what you want; hide them by clicking the link at the top of " +"the text window." +msgstr "" +"当前显示约束,并将导出至刀具路径。这可能不是你想要的;点击文本窗口顶部的按钮" +"来隐藏它们。" + +#: solvespace.cpp:834 +#, c-format +msgid "" +"Can't identify file type from file extension of filename '%s'; try .dxf or ." +"dwg." +msgstr "无法从'%s'的文件扩展名识别文件类型,请尝试.dxf或.dwg。" + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "约束必须有尺寸,且不能是参考尺寸。" + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "尺寸步进选择错误,请选择约束。" + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "装配无干涉,好。" + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" +"实心体模型的体积是:\n" +"\n" +" %s" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" +"\n" +"当前组的网格体积是:\n" +"\n" +" %s" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" +"\n" +"\n" +"曲面已近似为三角形。这会引入误差,通常约为1%。" + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"所选表面的表面积为:\n" +"\n" +" %s\n" +"\n" +"曲线已近似为线性分段。这会引入误差,通常约为1%%。" + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, " +"not coplanar, or self-intersecting." +msgstr "此组不包含正确形式的二维封闭区域。它可能是开放的,或不共面,或自相交。" + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"该组中所画区域的面积为:\n" +"\n" +" %s\n" +"\n" +"曲线已近似为线性分段。这会引入误差,通常约为1%%。" + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" +"所选物件的总长度为:\n" +"\n" +" %s\n" +"\n" +"曲线已近似为线性分段。这会引入误差,通常约为1%%。" + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "周长选择错误;请选择线段、弧线、曲线。" + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "跟踪选择不当;请选择单个点。" + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "无法写入'%s'" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "网格是自相交的(不行,无效)" + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "网格不是自相交的(行,有效)" + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "网格有裸露边(不行,无效)" + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "网格是水密的(行,有效)" + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" +"\n" +"\n" +"该模型包含%d个表面上的%d个三角形。" + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"没有问题边,好。%s" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d条边有问题,不好。%s" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" +"当前SolveSpace版本 %s\n" +"\n" +"更多信息请见 https://solvespace.com/\n" +"\n" +"SolveSpace是自由软件:您可以自由修改或\n" +"重新发行,但需遵循GNU通用公共许可协议\n" +"(GNU General Public License, GPL) 第3版\n" +"或后续版本。\n" +"\n" +"在法律允许范围内不包含质保,详见\n" +"https://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues等作者\n" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try " +"assigning a style to this entity's parent." +msgstr "无法将样式分配给派生自其他物件的物件;尝试将样式分配给此物件的父级。" + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "样式名称不能为空" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "不能重复 1 次以下。" + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "不能重复 999 次以上。" + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "组名不能为空" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "不透明度必须在 0 到 1 之间。" + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "半径偏移不能为负数。" + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "绘制线段" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "绘制矩形" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "绘制圆" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "绘制圆弧" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "绘制TrueType字体文本曲线" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "绘制图像文件" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "选定点处创建内切弧" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "绘制三次贝塞尔样条" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "绘制基准点" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "切换构造线" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "交点处拆分(曲)线" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "约束距离/直径/长度" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "约束角度" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "约束为水平" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "约束为竖直" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "约束为平行或相切" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "约束为垂直" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "约束点在直线/曲线/面/点上" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "约束为对称" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "约束长度/半径/角度相等" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "约束法线同向" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "补角" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "切换参考尺寸" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "新组:活动草图挤出" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "新组:活动草图旋转" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "新组:活动草图螺旋" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "新组:活动草图扫略" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "新组:步进旋转" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "新组:步进平移" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "新组:在新工作面绘制(由给定物件指定)" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "新组:在三维空间绘制" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "新组:连接/装配文件" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "最接近的等轴视图" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "视图对齐至工作面" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "错误" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "消息" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "好(&O)" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "缩放不能为零。" + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "格式错误:请指定 x,y,z" + +#~ msgid "" +#~ "Bad selection for on point / curve / plane constraint. This constraint " +#~ "can apply to:\n" +#~ "\n" +#~ " * two points (points coincident)\n" +#~ " * a point and a workplane (point in plane)\n" +#~ " * a point and a line segment (point on line)\n" +#~ " * a point and a circle or arc (point on curve)\n" +#~ " * a point and a plane face (point on face)\n" +#~ msgstr "" +#~ "点 / 曲线 / 平面约束的选定方法错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两点(点重合)\n" +#~ " * 一个点和一个工作面(平面中点)\n" +#~ " * 点和线段(点在线)\n" +#~ " * 一个点和一个圆或圆(曲线上的点)\n" +#~ " * 点和平面面(点在脸上)\n" + +#~ msgid "" +#~ "Bad selection for equal length / radius constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (equal length)\n" +#~ " * two line segments and two points (equal point-line distances)\n" +#~ " * a line segment and two points (equal point-line distances)\n" +#~ " * a line segment, and a point and line segment (point-line distance " +#~ "equals length)\n" +#~ " * four line segments or normals (equal angle between A,B and C,D)\n" +#~ " * three line segments or normals (equal angle between A,B and B,C)\n" +#~ " * two circles or arcs (equal radius)\n" +#~ " * a line segment and an arc (line segment length equals arc length)\n" +#~ msgstr "" +#~ "等长度/半径约束的选定方法错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两个线段(相等长度)\n" +#~ " * 两个线段和两个点(相等的点线距离)\n" +#~ " * 线段和两个点(相等的点线距离)\n" +#~ " * 线段和点段和线段(点线距离等于长度)\n" +#~ " * 四条线段或法线(A、B 和 C、D 之间的等角)\n" +#~ " * 三条线段或法线(A、B 和 B、C 之间的等角)\n" +#~ " * 两个圆或圆(相等半径)\n" +#~ " * 线段和圆弧(线段长度等于弧长)\n" + +#~ msgid "" +#~ "Bad selection for horizontal / vertical constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two points\n" +#~ " * a line segment\n" +#~ msgstr "" +#~ "æ°´å¹³/竖直约束的选择错误。此约束可应用于:\n" +#~ "\n" +#~ " * 两点\n" +#~ " * 线段\n" + +#~ msgid "" +#~ "Bad selection for angle constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "角度约束的选择错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两个线段\n" +#~ " * 线段和法线\n" +#~ " * 两个法线\n" + +#~ msgid "" +#~ "Bad selection for parallel / tangent constraint. This constraint can " +#~ "apply to:\n" +#~ "\n" +#~ " * two line segments (parallel)\n" +#~ " * a line segment and a normal (parallel)\n" +#~ " * two normals (parallel)\n" +#~ " * two line segments, arcs, or beziers, that share an endpoint " +#~ "(tangent)\n" +#~ msgstr "" +#~ "平行/切线约束的选择错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两条线段(平行)\n" +#~ " * 线段和法线(平行)\n" +#~ " * 两个法线(平行)\n" +#~ " * 有共同端点的两条线段、弧线或贝塞尔(切线)\n" + +#~ msgid "" +#~ "Bad selection for perpendicular constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ " * a line segment and a normal\n" +#~ " * two normals\n" +#~ msgstr "" +#~ "垂直约束的选择错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两个线段\n" +#~ " * 线段和法线\n" +#~ " * 两个法线\n" + +#~ msgid "A&ngle" +#~ msgstr "角度(&A)" + +#~ msgid "E&qual Length / Radius / Angle" +#~ msgstr "等于/长度/半径/角度(&Q)" + +#~ msgid "" +#~ "Bad selection for length ratio constraint. This constraint can apply to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "长度比例约束的选择错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两个线段\n" + +#~ msgid "" +#~ "Bad selection for length difference constraint. This constraint can apply " +#~ "to:\n" +#~ "\n" +#~ " * two line segments\n" +#~ msgstr "" +#~ "长度差异约束的选择错误。此约束可应用于:\n" +#~ "\n" +#~ "* 两个线段\n" + +#~ msgid "Length Ra&tio" +#~ msgstr "长度比例(&T)" + +#~ msgid "Length Diff&erence" +#~ msgstr "长度偏差(&E)" + +#~ msgid "" +#~ "Bad selection for new sketch in workplane. This group can be created " +#~ "with:\n" +#~ "\n" +#~ " * a point (through the point, orthogonal to coordinate axes)\n" +#~ " * a point and two line segments (through the point, parallel to the " +#~ "lines)\n" +#~ " * a workplane (copy of the workplane)\n" +#~ msgstr "" +#~ "在新工作面内绘图选择失败,该组可以使用:\n" +#~ "\n" +#~ " * 一个点(通过该点,正交至坐标轴)\n" +#~ " * 一个点和二个线段(通过点,绘制平行线至线段)\n" +#~ " * 一个工作面(复制工作面)\n" + +#~ msgctxt "file-type" +#~ msgid "Q3D Object file" +#~ msgstr "Q3D对象文件" diff --git a/res/messages.pot b/res/messages.pot new file mode 100644 index 0000000..4e51fda --- /dev/null +++ b/res/messages.pot @@ -0,0 +1,1980 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR the PACKAGE authors +# This file is distributed under the same license as the SolveSpace package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: SolveSpace 3.1\n" +"Report-Msgid-Bugs-To: phkahler@gmail.com\n" +"POT-Creation-Date: 2025-01-26 21:04+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: clipboard.cpp:314 +msgid "" +"Cut, paste, and copy work only in a workplane.\n" +"\n" +"Activate one with Sketch -> In Workplane." +msgstr "" + +#: clipboard.cpp:331 +msgid "Clipboard is empty; nothing to paste." +msgstr "" + +#: clipboard.cpp:378 +msgid "Number of copies to paste must be at least one." +msgstr "" + +#: clipboard.cpp:394 textscreens.cpp:879 +msgid "Scale cannot be zero." +msgstr "" + +#: clipboard.cpp:436 +msgid "Select one point to define origin of rotation." +msgstr "" + +#: clipboard.cpp:448 +msgid "Select two points to define translation vector." +msgstr "" + +#: clipboard.cpp:458 +msgid "Transformation is identity. So all copies will be exactly on top of each other." +msgstr "" + +#: clipboard.cpp:462 +msgid "Too many items to paste; split this into smaller pastes." +msgstr "" + +#: clipboard.cpp:467 +msgid "No workplane active." +msgstr "" + +#: confscreen.cpp:410 +msgid "Bad format: specify coordinates as x, y, z" +msgstr "" + +#: confscreen.cpp:420 style.cpp:729 textscreens.cpp:910 +msgid "Bad format: specify color as r, g, b" +msgstr "" + +#: confscreen.cpp:446 +msgid "" +"The perspective factor will have no effect until you enable View -> Use Perspective Projection." +msgstr "" + +#: confscreen.cpp:464 confscreen.cpp:474 +#, c-format +msgid "Specify between 0 and %d digits after the decimal." +msgstr "" + +#: confscreen.cpp:486 +msgid "Export scale must not be zero!" +msgstr "" + +#: confscreen.cpp:498 +msgid "Cutter radius offset must not be negative!" +msgstr "" + +#: confscreen.cpp:557 +msgid "Bad value: autosave interval should be positive" +msgstr "" + +#: confscreen.cpp:560 +msgid "Bad format: specify interval in integral minutes" +msgstr "" + +#: constraint.cpp:12 +msgctxt "constr-name" +msgid "pts-coincident" +msgstr "" + +#: constraint.cpp:13 +msgctxt "constr-name" +msgid "pt-pt-distance" +msgstr "" + +#: constraint.cpp:14 +msgctxt "constr-name" +msgid "pt-line-distance" +msgstr "" + +#: constraint.cpp:15 +msgctxt "constr-name" +msgid "pt-plane-distance" +msgstr "" + +#: constraint.cpp:16 +msgctxt "constr-name" +msgid "pt-face-distance" +msgstr "" + +#: constraint.cpp:17 +msgctxt "constr-name" +msgid "proj-pt-pt-distance" +msgstr "" + +#: constraint.cpp:18 +msgctxt "constr-name" +msgid "pt-in-plane" +msgstr "" + +#: constraint.cpp:19 +msgctxt "constr-name" +msgid "pt-on-line" +msgstr "" + +#: constraint.cpp:20 +msgctxt "constr-name" +msgid "pt-on-face" +msgstr "" + +#: constraint.cpp:21 +msgctxt "constr-name" +msgid "eq-length" +msgstr "" + +#: constraint.cpp:22 +msgctxt "constr-name" +msgid "eq-length-and-pt-ln-dist" +msgstr "" + +#: constraint.cpp:23 +msgctxt "constr-name" +msgid "eq-pt-line-distances" +msgstr "" + +#: constraint.cpp:24 +msgctxt "constr-name" +msgid "length-ratio" +msgstr "" + +#: constraint.cpp:25 +msgctxt "constr-name" +msgid "arc-arc-length-ratio" +msgstr "" + +#: constraint.cpp:26 +msgctxt "constr-name" +msgid "arc-line-length-ratio" +msgstr "" + +#: constraint.cpp:27 +msgctxt "constr-name" +msgid "length-difference" +msgstr "" + +#: constraint.cpp:28 +msgctxt "constr-name" +msgid "arc-arc-len-difference" +msgstr "" + +#: constraint.cpp:29 +msgctxt "constr-name" +msgid "arc-line-len-difference" +msgstr "" + +#: constraint.cpp:30 +msgctxt "constr-name" +msgid "symmetric" +msgstr "" + +#: constraint.cpp:31 +msgctxt "constr-name" +msgid "symmetric-h" +msgstr "" + +#: constraint.cpp:32 +msgctxt "constr-name" +msgid "symmetric-v" +msgstr "" + +#: constraint.cpp:33 +msgctxt "constr-name" +msgid "symmetric-line" +msgstr "" + +#: constraint.cpp:34 +msgctxt "constr-name" +msgid "at-midpoint" +msgstr "" + +#: constraint.cpp:35 +msgctxt "constr-name" +msgid "horizontal" +msgstr "" + +#: constraint.cpp:36 +msgctxt "constr-name" +msgid "vertical" +msgstr "" + +#: constraint.cpp:37 +msgctxt "constr-name" +msgid "diameter" +msgstr "" + +#: constraint.cpp:38 +msgctxt "constr-name" +msgid "pt-on-circle" +msgstr "" + +#: constraint.cpp:39 +msgctxt "constr-name" +msgid "same-orientation" +msgstr "" + +#: constraint.cpp:40 +msgctxt "constr-name" +msgid "angle" +msgstr "" + +#: constraint.cpp:41 +msgctxt "constr-name" +msgid "parallel" +msgstr "" + +#: constraint.cpp:42 +msgctxt "constr-name" +msgid "arc-line-tangent" +msgstr "" + +#: constraint.cpp:43 +msgctxt "constr-name" +msgid "cubic-line-tangent" +msgstr "" + +#: constraint.cpp:44 +msgctxt "constr-name" +msgid "curve-curve-tangent" +msgstr "" + +#: constraint.cpp:45 +msgctxt "constr-name" +msgid "perpendicular" +msgstr "" + +#: constraint.cpp:46 +msgctxt "constr-name" +msgid "eq-radius" +msgstr "" + +#: constraint.cpp:47 +msgctxt "constr-name" +msgid "eq-angle" +msgstr "" + +#: constraint.cpp:48 +msgctxt "constr-name" +msgid "eq-line-len-arc-len" +msgstr "" + +#: constraint.cpp:49 +msgctxt "constr-name" +msgid "lock-where-dragged" +msgstr "" + +#: constraint.cpp:50 +msgctxt "constr-name" +msgid "comment" +msgstr "" + +#: constraint.cpp:151 +msgid "" +"The point you selected does not belong to the arc. The arc and line segment do not share an end " +"point.\n" +"\n" +"Select the end point of the arc at which you want it to be tangent to the line." +msgstr "" + +#: constraint.cpp:158 +msgid "" +"The tangent arc and line segment must share an endpoint. Constrain them with Constrain -> On " +"Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the arc at which you want it to be tangent to the line." +msgstr "" + +#: constraint.cpp:186 +msgid "" +"The point you selected is not an end point of the cubic spline. The spline and line segment do " +"not share an end point.\n" +"\n" +"Select the end point of the spline at which you want it to be tangent to the line." +msgstr "" + +#: constraint.cpp:193 +msgid "" +"The tangent cubic spline and line segment must share an endpoint. Constrain them with Constrain -" +"> On Point before constraining tangent.\n" +"\n" +"Alternatively select the end point of the cubic spline at which you want it to be tangent to the " +"line." +msgstr "" + +#: constraint.cpp:237 +msgid "" +"The points you selected are not end points of the two curves. The curves do not share an end " +"point.\n" +"\n" +"Select the end points of both curves at which you want them to be tangent to each other." +msgstr "" + +#: constraint.cpp:244 +msgid "" +"The curves must share an endpoint. Constrain them with Constrain -> On Point before constraining " +"tangent.\n" +"\n" +"Alternatively select the end points of both curves at which you want the curves to be tangent." +msgstr "" + +#: constraint.cpp:303 +msgid "" +"Bad selection for distance / diameter constraint. This constraint can apply to:\n" +"\n" +" * two points (distance between points)\n" +" * a line segment (length)\n" +" * two points and a line segment or normal (projected distance)\n" +" * a workplane and a point (minimum distance)\n" +" * a line segment and a point (minimum distance)\n" +" * a plane face and a point (minimum distance)\n" +" * a circle or an arc (diameter)\n" +msgstr "" + +#: constraint.cpp:366 +msgid "" +"Bad selection for on point / curve / plane constraint. This constraint can apply to:\n" +"\n" +" * two or more points (points coincident)\n" +" * a point and a workplane (point in plane)\n" +" * a point and a line segment (point on line)\n" +" * a point and a circle or arc (point on curve)\n" +" * a point and one to three plane faces (point on face(s))\n" +msgstr "" + +#: constraint.cpp:427 +msgid "" +"Bad selection for equal length / radius constraint. This constraint can apply to:\n" +"\n" +" * two or more line segments (equal length)\n" +" * two line segments and two points (equal point-line distances)\n" +" * a line segment and two points (equal point-line distances)\n" +" * a line segment, and a point and line segment (point-line distance equals length)\n" +" * two or more circles or arcs (equal radius)\n" +" * a line segment and an arc (line segment length equals arc length)\n" +msgstr "" + +#: constraint.cpp:480 +msgid "" +"Bad selection for length ratio constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" + +#: constraint.cpp:515 +msgid "" +"Bad selection for length difference constraint. This constraint can apply to:\n" +"\n" +" * two line segments\n" +" * two arcs\n" +" * one arc and one line segment\n" +msgstr "" + +#: constraint.cpp:550 +msgid "" +"Bad selection for at midpoint constraint. This constraint can apply to:\n" +"\n" +" * a line segment and a point (point at midpoint)\n" +" * a line segment and a workplane (line's midpoint on plane)\n" +msgstr "" + +#: constraint.cpp:608 +msgid "" +"Bad selection for symmetric constraint. This constraint can apply to:\n" +"\n" +" * two points or a line segment (symmetric about workplane's coordinate axis)\n" +" * line segment, and two points or a line segment (symmetric about line segment)\n" +" * workplane, and two points or a line segment (symmetric about workplane)\n" +msgstr "" + +#: constraint.cpp:623 +msgid "A workplane must be active when constraining symmetric without an explicit symmetry plane." +msgstr "" + +#: constraint.cpp:663 +msgid "" +"Activate a workplane (with Sketch -> In Workplane) before applying a horizontal or vertical " +"constraint." +msgstr "" + +#: constraint.cpp:679 +msgid "" +"Bad selection for horizontal / vertical constraint. This constraint can apply to:\n" +"\n" +" * two or more points\n" +" * one or more line segments\n" +msgstr "" + +#: constraint.cpp:697 +msgid "" +"Bad selection for same orientation constraint. This constraint can apply to:\n" +"\n" +" * two normals\n" +msgstr "" + +#: constraint.cpp:748 +msgid "Must select an angle constraint." +msgstr "" + +#: constraint.cpp:761 +msgid "Must select a constraint with associated label." +msgstr "" + +#: constraint.cpp:784 +msgid "" +"Bad selection for angle constraint. This constraint can apply to:\n" +"\n" +"Angle between:\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +"\n" +"Equal angles:\n" +" * four line segments or normals (equal angle between A,B and C,D)\n" +" * three line segments or normals (equal angle between A,B and B,C)\n" +msgstr "" + +#: constraint.cpp:872 +msgid "Curve-curve tangency must apply in workplane." +msgstr "" + +#: constraint.cpp:887 +msgid "" +"Bad selection for parallel / tangent constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two or more line segments (parallel)\n" +" * one or more line segments and one or more normals (parallel)\n" +" * two or more normals (parallel)\n" +" * two line segments, arcs, or beziers, that share an endpoint (tangent)\n" +" * two line segments, arcs, or beziers, that do not share an endpoint and the end point(s) of " +"the curve(s) (tangent)\n" +msgstr "" + +#: constraint.cpp:914 +msgid "" +"Bad selection for perpendicular constraint. This constraint can apply to:\n" +"\n" +" * two faces\n" +" * two line segments\n" +" * a line segment and a normal\n" +" * two normals\n" +msgstr "" + +#: constraint.cpp:931 +msgid "" +"Bad selection for lock point where dragged constraint. This constraint can apply to:\n" +"\n" +" * a point\n" +msgstr "" + +#: constraint.cpp:946 mouse.cpp:1160 +msgid "NEW COMMENT -- DOUBLE-CLICK TO EDIT" +msgstr "" + +#: constraint.cpp:952 +msgid "click center of comment text" +msgstr "" + +#: export.cpp:19 +msgid "" +"No solid model present; draw one with extrudes and revolves, or use Export 2d View to export bare " +"lines and curves." +msgstr "" + +#: export.cpp:61 +msgid "" +"Bad selection for export section. Please select:\n" +"\n" +" * nothing, with an active workplane (workplane is section plane)\n" +" * a face (section plane through face)\n" +" * a point and two line segments (plane through point and parallel to lines)\n" +msgstr "" + +#: export.cpp:818 +msgid "Active group mesh is empty; nothing to export." +msgstr "" + +#: exportvector.cpp:336 +msgid "freehand lines were replaced with continuous lines" +msgstr "" + +#: exportvector.cpp:338 +msgid "zigzag lines were replaced with continuous lines" +msgstr "" + +#: exportvector.cpp:592 +msgid "Some aspects of the drawing have no DXF equivalent and were not exported:\n" +msgstr "" + +#: exportvector.cpp:838 +msgid "PDF page size exceeds 200 by 200 inches; many viewers may reject this file." +msgstr "" + +#: file.cpp:44 group.cpp:91 +msgctxt "group-name" +msgid "sketch-in-plane" +msgstr "" + +#: file.cpp:62 +msgctxt "group-name" +msgid "#references" +msgstr "" + +#: file.cpp:555 +msgid "The file is empty. It may be corrupt." +msgstr "" + +#: file.cpp:560 +msgid "Unrecognized data in file. This file may be corrupt, or from a newer version of the program." +msgstr "" + +#: file.cpp:876 +msgctxt "title" +msgid "Missing File" +msgstr "" + +#: file.cpp:877 +#, c-format +msgctxt "dialog" +msgid "The linked file “%s” is not present." +msgstr "" + +#: file.cpp:879 +msgctxt "dialog" +msgid "" +"Do you want to locate it manually?\n" +"\n" +"If you decline, any geometry that depends on the missing file will be permanently removed." +msgstr "" + +#: file.cpp:882 +msgctxt "button" +msgid "&Yes" +msgstr "" + +#: file.cpp:884 +msgctxt "button" +msgid "&No" +msgstr "" + +#: file.cpp:886 solvespace.cpp:652 +msgctxt "button" +msgid "&Cancel" +msgstr "" + +#: graphicswin.cpp:41 +msgid "&File" +msgstr "" + +#: graphicswin.cpp:42 +msgid "&New" +msgstr "" + +#: graphicswin.cpp:43 +msgid "&Open..." +msgstr "" + +#: graphicswin.cpp:44 +msgid "Open &Recent" +msgstr "" + +#: graphicswin.cpp:45 +msgid "&Save" +msgstr "" + +#: graphicswin.cpp:46 +msgid "Save &As..." +msgstr "" + +#: graphicswin.cpp:48 +msgid "Export &Image..." +msgstr "" + +#: graphicswin.cpp:49 +msgid "Export 2d &View..." +msgstr "" + +#: graphicswin.cpp:50 +msgid "Export 2d &Section..." +msgstr "" + +#: graphicswin.cpp:51 +msgid "Export 3d &Wireframe..." +msgstr "" + +#: graphicswin.cpp:52 +msgid "Export Triangle &Mesh..." +msgstr "" + +#: graphicswin.cpp:53 +msgid "Export &Surfaces..." +msgstr "" + +#: graphicswin.cpp:54 +msgid "Im&port..." +msgstr "" + +#: graphicswin.cpp:57 +msgid "E&xit" +msgstr "" + +#: graphicswin.cpp:60 +msgid "&Edit" +msgstr "" + +#: graphicswin.cpp:61 +msgid "&Undo" +msgstr "" + +#: graphicswin.cpp:62 +msgid "&Redo" +msgstr "" + +#: graphicswin.cpp:63 +msgid "Re&generate All" +msgstr "" + +#: graphicswin.cpp:65 +msgid "Snap Selection to &Grid" +msgstr "" + +#: graphicswin.cpp:66 +msgid "Rotate Imported &90°" +msgstr "" + +#: graphicswin.cpp:68 +msgid "Cu&t" +msgstr "" + +#: graphicswin.cpp:69 +msgid "&Copy" +msgstr "" + +#: graphicswin.cpp:70 +msgid "&Paste" +msgstr "" + +#: graphicswin.cpp:71 +msgid "Paste &Transformed..." +msgstr "" + +#: graphicswin.cpp:72 +msgid "&Delete" +msgstr "" + +#: graphicswin.cpp:74 +msgid "Select &Edge Chain" +msgstr "" + +#: graphicswin.cpp:75 +msgid "Select &All" +msgstr "" + +#: graphicswin.cpp:76 +msgid "&Unselect All" +msgstr "" + +#: graphicswin.cpp:78 +msgid "&Line Styles..." +msgstr "" + +#: graphicswin.cpp:79 +msgid "&View Projection..." +msgstr "" + +#: graphicswin.cpp:81 +msgid "Con&figuration..." +msgstr "" + +#: graphicswin.cpp:84 +msgid "&View" +msgstr "" + +#: graphicswin.cpp:85 +msgid "Zoom &In" +msgstr "" + +#: graphicswin.cpp:86 +msgid "Zoom &Out" +msgstr "" + +#: graphicswin.cpp:87 +msgid "Zoom To &Fit" +msgstr "" + +#: graphicswin.cpp:89 +msgid "Align View to &Workplane" +msgstr "" + +#: graphicswin.cpp:90 +msgid "Nearest &Ortho View" +msgstr "" + +#: graphicswin.cpp:91 +msgid "Nearest &Isometric View" +msgstr "" + +#: graphicswin.cpp:92 +msgid "&Center View At Point" +msgstr "" + +#: graphicswin.cpp:94 +msgid "Show Snap &Grid" +msgstr "" + +#: graphicswin.cpp:95 +msgid "Darken Inactive Solids" +msgstr "" + +#: graphicswin.cpp:96 +msgid "Use &Perspective Projection" +msgstr "" + +#: graphicswin.cpp:97 +msgid "Show E&xploded View" +msgstr "" + +#: graphicswin.cpp:98 +msgid "Dimension &Units" +msgstr "" + +#: graphicswin.cpp:99 +msgid "Dimensions in &Millimeters" +msgstr "" + +#: graphicswin.cpp:100 +msgid "Dimensions in M&eters" +msgstr "" + +#: graphicswin.cpp:101 +msgid "Dimensions in &Inches" +msgstr "" + +#: graphicswin.cpp:102 +msgid "Dimensions in &Feet and Inches" +msgstr "" + +#: graphicswin.cpp:104 +msgid "Show &Toolbar" +msgstr "" + +#: graphicswin.cpp:105 +msgid "Show Property Bro&wser" +msgstr "" + +#: graphicswin.cpp:107 +msgid "&Full Screen" +msgstr "" + +#: graphicswin.cpp:109 +msgid "&New Group" +msgstr "" + +#: graphicswin.cpp:110 +msgid "Sketch In &3d" +msgstr "" + +#: graphicswin.cpp:111 +msgid "Sketch In New &Workplane" +msgstr "" + +#: graphicswin.cpp:113 +msgid "Step &Translating" +msgstr "" + +#: graphicswin.cpp:114 +msgid "Step &Rotating" +msgstr "" + +#: graphicswin.cpp:116 +msgid "E&xtrude" +msgstr "" + +#: graphicswin.cpp:117 +msgid "&Helix" +msgstr "" + +#: graphicswin.cpp:118 +msgid "&Lathe" +msgstr "" + +#: graphicswin.cpp:119 +msgid "Re&volve" +msgstr "" + +#: graphicswin.cpp:121 +msgid "Link / Assemble..." +msgstr "" + +#: graphicswin.cpp:122 +msgid "Link Recent" +msgstr "" + +#: graphicswin.cpp:124 +msgid "&Sketch" +msgstr "" + +#: graphicswin.cpp:125 +msgid "In &Workplane" +msgstr "" + +#: graphicswin.cpp:126 +msgid "Anywhere In &3d" +msgstr "" + +#: graphicswin.cpp:128 +msgid "Datum &Point" +msgstr "" + +#: graphicswin.cpp:129 +msgid "Wor&kplane" +msgstr "" + +#: graphicswin.cpp:131 +msgid "Line &Segment" +msgstr "" + +#: graphicswin.cpp:132 +msgid "C&onstruction Line Segment" +msgstr "" + +#: graphicswin.cpp:133 +msgid "&Rectangle" +msgstr "" + +#: graphicswin.cpp:134 +msgid "&Circle" +msgstr "" + +#: graphicswin.cpp:135 +msgid "&Arc of a Circle" +msgstr "" + +#: graphicswin.cpp:136 +msgid "&Bezier Cubic Spline" +msgstr "" + +#: graphicswin.cpp:138 +msgid "&Text in TrueType Font" +msgstr "" + +#: graphicswin.cpp:139 +msgid "I&mage" +msgstr "" + +#: graphicswin.cpp:141 +msgid "To&ggle Construction" +msgstr "" + +#: graphicswin.cpp:142 +msgid "Ta&ngent Arc at Point" +msgstr "" + +#: graphicswin.cpp:143 +msgid "Split Curves at &Intersection" +msgstr "" + +#: graphicswin.cpp:145 +msgid "&Constrain" +msgstr "" + +#: graphicswin.cpp:146 +msgid "&Distance / Diameter" +msgstr "" + +#: graphicswin.cpp:147 +msgid "Re&ference Dimension" +msgstr "" + +#: graphicswin.cpp:148 +msgid "A&ngle / Equal Angle" +msgstr "" + +#: graphicswin.cpp:149 +msgid "Reference An&gle" +msgstr "" + +#: graphicswin.cpp:150 +msgid "Other S&upplementary Angle" +msgstr "" + +#: graphicswin.cpp:151 +msgid "Toggle R&eference Dim" +msgstr "" + +#: graphicswin.cpp:153 +msgid "&Horizontal" +msgstr "" + +#: graphicswin.cpp:154 +msgid "&Vertical" +msgstr "" + +#: graphicswin.cpp:156 +msgid "&On Point / Curve / Plane" +msgstr "" + +#: graphicswin.cpp:157 +msgid "E&qual Length / Radius" +msgstr "" + +#: graphicswin.cpp:158 +msgid "Length / Arc Ra&tio" +msgstr "" + +#: graphicswin.cpp:159 +msgid "Length / Arc Diff&erence" +msgstr "" + +#: graphicswin.cpp:160 +msgid "At &Midpoint" +msgstr "" + +#: graphicswin.cpp:161 +msgid "S&ymmetric" +msgstr "" + +#: graphicswin.cpp:162 +msgid "Para&llel / Tangent" +msgstr "" + +#: graphicswin.cpp:163 +msgid "&Perpendicular" +msgstr "" + +#: graphicswin.cpp:164 +msgid "Same Orient&ation" +msgstr "" + +#: graphicswin.cpp:165 +msgid "Lock Point Where &Dragged" +msgstr "" + +#: graphicswin.cpp:167 +msgid "Comment" +msgstr "" + +#: graphicswin.cpp:169 +msgid "&Analyze" +msgstr "" + +#: graphicswin.cpp:170 +msgid "Measure &Volume" +msgstr "" + +#: graphicswin.cpp:171 +msgid "Measure A&rea" +msgstr "" + +#: graphicswin.cpp:172 +msgid "Measure &Perimeter" +msgstr "" + +#: graphicswin.cpp:173 +msgid "Show &Interfering Parts" +msgstr "" + +#: graphicswin.cpp:174 +msgid "Show &Naked Edges" +msgstr "" + +#: graphicswin.cpp:175 +msgid "Show &Center of Mass" +msgstr "" + +#: graphicswin.cpp:177 +msgid "Show &Underconstrained Points" +msgstr "" + +#: graphicswin.cpp:179 +msgid "&Trace Point" +msgstr "" + +#: graphicswin.cpp:180 +msgid "&Stop Tracing..." +msgstr "" + +#: graphicswin.cpp:181 +msgid "Step &Dimension..." +msgstr "" + +#: graphicswin.cpp:183 +msgid "&Help" +msgstr "" + +#: graphicswin.cpp:184 +msgid "&Language" +msgstr "" + +#: graphicswin.cpp:185 +msgid "&Website / Manual" +msgstr "" + +#: graphicswin.cpp:186 +msgid "&Go to GitHub commit" +msgstr "" + +#: graphicswin.cpp:188 +msgid "&About" +msgstr "" + +#: graphicswin.cpp:362 +msgid "(no recent files)" +msgstr "" + +#: graphicswin.cpp:370 +#, c-format +msgid "File '%s' does not exist." +msgstr "" + +#: graphicswin.cpp:779 +msgid "No workplane is active, so the grid will not appear." +msgstr "" + +#: graphicswin.cpp:794 +msgid "" +"The perspective factor is set to zero, so the view will always be a parallel projection.\n" +"\n" +"For a perspective projection, modify the perspective factor in the configuration screen. A value " +"around 0.3 is typical." +msgstr "" + +#: graphicswin.cpp:884 +msgid "Select a point; this point will become the center of the view on screen." +msgstr "" + +#: graphicswin.cpp:1193 +msgid "No additional entities share endpoints with the selected entities." +msgstr "" + +#: graphicswin.cpp:1211 +msgid "" +"To use this command, select a point or other entity from an linked part, or make a link group the " +"active group." +msgstr "" + +#: graphicswin.cpp:1234 +msgid "" +"No workplane is active. Activate a workplane (with Sketch -> In Workplane) to define the plane " +"for the snap grid." +msgstr "" + +#: graphicswin.cpp:1241 +msgid "" +"Can't snap these items to grid; select points, text comments, or constraints with a label. To " +"snap a line, select its endpoints." +msgstr "" + +#: graphicswin.cpp:1326 +msgid "No workplane selected. Activating default workplane for this group." +msgstr "" + +#: graphicswin.cpp:1329 +msgid "" +"No workplane is selected, and the active group does not have a default workplane. Try selecting a " +"workplane, or activating a sketch-in-new-workplane group." +msgstr "" + +#: graphicswin.cpp:1350 +msgid "" +"Bad selection for tangent arc at point. Select a single point, or select nothing to set up arc " +"parameters." +msgstr "" + +#: graphicswin.cpp:1361 +msgid "click point on arc (draws anti-clockwise)" +msgstr "" + +#: graphicswin.cpp:1362 +msgid "click to place datum point" +msgstr "" + +#: graphicswin.cpp:1363 +msgid "click first point of line segment" +msgstr "" + +#: graphicswin.cpp:1365 +msgid "click first point of construction line segment" +msgstr "" + +#: graphicswin.cpp:1366 +msgid "click first point of cubic segment" +msgstr "" + +#: graphicswin.cpp:1367 +msgid "click center of circle" +msgstr "" + +#: graphicswin.cpp:1368 +msgid "click origin of workplane" +msgstr "" + +#: graphicswin.cpp:1369 +msgid "click one corner of rectangle" +msgstr "" + +#: graphicswin.cpp:1370 +msgid "click top left of text" +msgstr "" + +#: graphicswin.cpp:1376 +msgid "click top left of image" +msgstr "" + +#: graphicswin.cpp:1402 +msgid "No entities are selected. Select entities before trying to toggle their construction state." +msgstr "" + +#: group.cpp:86 +msgctxt "group-name" +msgid "sketch-in-3d" +msgstr "" + +#: group.cpp:154 +msgid "" +"Bad selection for new sketch in workplane. This group can be created with:\n" +"\n" +" * a point (through the point, orthogonal to coordinate axes)\n" +" * a point and two line segments (through the point, parallel to the lines)\n" +" * a point and a normal (through the point, orthogonal to the normal)\n" +" * a workplane (copy of the workplane)\n" +msgstr "" + +#: group.cpp:170 +msgid "" +"Activate a workplane (Sketch -> In Workplane) before extruding. The sketch will be extruded " +"normal to the workplane." +msgstr "" + +#: group.cpp:179 +msgctxt "group-name" +msgid "extrude" +msgstr "" + +#: group.cpp:184 +msgid "Lathe operation can only be applied to planar sketches." +msgstr "" + +#: group.cpp:195 +msgid "" +"Bad selection for new lathe group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel to line / normal, " +"through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" + +#: group.cpp:205 +msgctxt "group-name" +msgid "lathe" +msgstr "" + +#: group.cpp:210 +msgid "Revolve operation can only be applied to planar sketches." +msgstr "" + +#: group.cpp:221 +msgid "" +"Bad selection for new revolve group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel to line / normal, " +"through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" + +#: group.cpp:233 +msgctxt "group-name" +msgid "revolve" +msgstr "" + +#: group.cpp:238 +msgid "Helix operation can only be applied to planar sketches." +msgstr "" + +#: group.cpp:249 +msgid "" +"Bad selection for new helix group. This group can be created with:\n" +"\n" +" * a point and a line segment or normal (revolved about an axis parallel to line / normal, " +"through point)\n" +" * a line segment (revolved about line segment)\n" +msgstr "" + +#: group.cpp:261 +msgctxt "group-name" +msgid "helix" +msgstr "" + +#: group.cpp:274 +msgid "" +"Bad selection for new rotation. This group can be created with:\n" +"\n" +" * a point, while locked in workplane (rotate in plane, about that point)\n" +" * a point and a line or a normal (rotate about an axis through the point, and parallel to " +"line / normal)\n" +msgstr "" + +#: group.cpp:287 +msgctxt "group-name" +msgid "rotate" +msgstr "" + +#: group.cpp:298 +msgctxt "group-name" +msgid "translate" +msgstr "" + +#: group.cpp:422 +msgid "(unnamed)" +msgstr "" + +#: groupmesh.cpp:710 +msgid "not closed contour, or not all same style!" +msgstr "" + +#: groupmesh.cpp:723 +msgid "points not all coplanar!" +msgstr "" + +#: groupmesh.cpp:725 +msgid "contour is self-intersecting!" +msgstr "" + +#: groupmesh.cpp:727 +msgid "zero-length edge!" +msgstr "" + +#: importmesh.cpp:136 +msgid "Text-formated STL files are not currently supported" +msgstr "" + +#: modify.cpp:252 +msgid "Must be sketching in workplane to create tangent arc." +msgstr "" + +#: modify.cpp:299 +msgid "" +"To create a tangent arc, select a point where two non-construction lines or circles in this group " +"and workplane join." +msgstr "" + +#: modify.cpp:386 +msgid "" +"Couldn't round this corner. Try a smaller radius, or try creating the desired geometry by hand " +"with tangency constraints." +msgstr "" + +#: modify.cpp:595 +msgid "Couldn't split this entity; lines, circles, or cubics only." +msgstr "" + +#: modify.cpp:622 +msgid "Must be sketching in workplane to split." +msgstr "" + +#: modify.cpp:629 +msgid "" +"Select two entities that intersect each other (e.g. two lines/circles/arcs or a line/circle/arc " +"and a point)." +msgstr "" + +#: modify.cpp:734 +msgid "Can't split; no intersection found." +msgstr "" + +#: mouse.cpp:558 +msgid "Assign to Style" +msgstr "" + +#: mouse.cpp:574 +msgid "No Style" +msgstr "" + +#: mouse.cpp:577 +msgid "Newly Created Custom Style..." +msgstr "" + +#: mouse.cpp:584 +msgid "Group Info" +msgstr "" + +#: mouse.cpp:604 +msgid "Style Info" +msgstr "" + +#: mouse.cpp:624 +msgid "Select Edge Chain" +msgstr "" + +#: mouse.cpp:630 +msgid "Toggle Reference Dimension" +msgstr "" + +#: mouse.cpp:636 +msgid "Other Supplementary Angle" +msgstr "" + +#: mouse.cpp:641 +msgid "Snap to Grid" +msgstr "" + +#: mouse.cpp:650 +msgid "Remove Spline Point" +msgstr "" + +#: mouse.cpp:685 +msgid "Add Spline Point" +msgstr "" + +#: mouse.cpp:689 +msgid "Cannot add spline point: maximum number of points reached." +msgstr "" + +#: mouse.cpp:714 +msgid "Toggle Construction" +msgstr "" + +#: mouse.cpp:730 +msgid "Delete Point-Coincident Constraint" +msgstr "" + +#: mouse.cpp:748 +msgid "Cut" +msgstr "" + +#: mouse.cpp:750 +msgid "Copy" +msgstr "" + +#: mouse.cpp:754 +msgid "Select All" +msgstr "" + +#: mouse.cpp:759 +msgid "Paste" +msgstr "" + +#: mouse.cpp:761 +msgid "Paste Transformed..." +msgstr "" + +#: mouse.cpp:766 +msgid "Delete" +msgstr "" + +#: mouse.cpp:769 +msgid "Unselect All" +msgstr "" + +#: mouse.cpp:776 +msgid "Unselect Hovered" +msgstr "" + +#: mouse.cpp:785 +msgid "Zoom to Fit" +msgstr "" + +#: mouse.cpp:987 mouse.cpp:1276 +msgid "click next point of line, or press Esc" +msgstr "" + +#: mouse.cpp:993 +msgid "Can't draw rectangle in 3d; first, activate a workplane with Sketch -> In Workplane." +msgstr "" + +#: mouse.cpp:1027 +msgid "click to place other corner of rectangle" +msgstr "" + +#: mouse.cpp:1048 +msgid "click to set radius" +msgstr "" + +#: mouse.cpp:1053 +msgid "Can't draw arc in 3d; first, activate a workplane with Sketch -> In Workplane." +msgstr "" + +#: mouse.cpp:1072 +msgid "click to place point" +msgstr "" + +#: mouse.cpp:1088 +msgid "click next point of cubic, or press Esc" +msgstr "" + +#: mouse.cpp:1093 +msgid "Sketching in a workplane already; sketch in 3d before creating new workplane." +msgstr "" + +#: mouse.cpp:1109 +msgid "Can't draw text in 3d; first, activate a workplane with Sketch -> In Workplane." +msgstr "" + +#: mouse.cpp:1126 +msgid "click to place bottom right of text" +msgstr "" + +#: mouse.cpp:1132 +msgid "Can't draw image in 3d; first, activate a workplane with Sketch -> In Workplane." +msgstr "" + +#: platform/gui.cpp:85 platform/gui.cpp:90 solvespace.cpp:583 +msgctxt "file-type" +msgid "SolveSpace models" +msgstr "" + +#: platform/gui.cpp:89 +msgctxt "file-type" +msgid "ALL" +msgstr "" + +#: platform/gui.cpp:91 +msgctxt "file-type" +msgid "IDF circuit board" +msgstr "" + +#: platform/gui.cpp:92 +msgctxt "file-type" +msgid "STL triangle mesh" +msgstr "" + +#: platform/gui.cpp:96 +msgctxt "file-type" +msgid "PNG image" +msgstr "" + +#: platform/gui.cpp:100 +msgctxt "file-type" +msgid "STL mesh" +msgstr "" + +#: platform/gui.cpp:101 +msgctxt "file-type" +msgid "Wavefront OBJ mesh" +msgstr "" + +#: platform/gui.cpp:102 +msgctxt "file-type" +msgid "Three.js-compatible mesh, with viewer" +msgstr "" + +#: platform/gui.cpp:103 +msgctxt "file-type" +msgid "Three.js-compatible mesh, mesh only" +msgstr "" + +#: platform/gui.cpp:104 +msgctxt "file-type" +msgid "VRML text file" +msgstr "" + +#: platform/gui.cpp:108 platform/gui.cpp:115 platform/gui.cpp:122 +msgctxt "file-type" +msgid "STEP file" +msgstr "" + +#: platform/gui.cpp:112 +msgctxt "file-type" +msgid "PDF file" +msgstr "" + +#: platform/gui.cpp:113 +msgctxt "file-type" +msgid "Encapsulated PostScript" +msgstr "" + +#: platform/gui.cpp:114 +msgctxt "file-type" +msgid "Scalable Vector Graphics" +msgstr "" + +#: platform/gui.cpp:116 platform/gui.cpp:123 +msgctxt "file-type" +msgid "DXF file (AutoCAD 2007)" +msgstr "" + +#: platform/gui.cpp:117 +msgctxt "file-type" +msgid "HPGL file" +msgstr "" + +#: platform/gui.cpp:118 +msgctxt "file-type" +msgid "G Code" +msgstr "" + +#: platform/gui.cpp:127 +msgctxt "file-type" +msgid "AutoCAD DXF and DWG files" +msgstr "" + +#: platform/gui.cpp:131 +msgctxt "file-type" +msgid "Comma-separated values" +msgstr "" + +#: platform/guigtk.cpp:1434 platform/guimac.mm:1513 platform/guiwin.cpp:1641 +msgid "untitled" +msgstr "" + +#: platform/guigtk.cpp:1445 platform/guigtk.cpp:1481 platform/guimac.mm:1471 +#: platform/guiwin.cpp:1639 +msgctxt "title" +msgid "Save File" +msgstr "" + +#: platform/guigtk.cpp:1446 platform/guigtk.cpp:1482 platform/guimac.mm:1454 +#: platform/guiwin.cpp:1645 +msgctxt "title" +msgid "Open File" +msgstr "" + +#: platform/guigtk.cpp:1449 platform/guigtk.cpp:1488 +msgctxt "button" +msgid "_Cancel" +msgstr "" + +#: platform/guigtk.cpp:1450 platform/guigtk.cpp:1486 +msgctxt "button" +msgid "_Save" +msgstr "" + +#: platform/guigtk.cpp:1451 platform/guigtk.cpp:1487 +msgctxt "button" +msgid "_Open" +msgstr "" + +#: solvespace.cpp:175 +msgctxt "title" +msgid "Autosave Available" +msgstr "" + +#: solvespace.cpp:176 +msgctxt "dialog" +msgid "An autosave file is available for this sketch." +msgstr "" + +#: solvespace.cpp:177 +msgctxt "dialog" +msgid "Do you want to load the autosave file instead?" +msgstr "" + +#: solvespace.cpp:178 +msgctxt "button" +msgid "&Load autosave" +msgstr "" + +#: solvespace.cpp:180 +msgctxt "button" +msgid "Do&n't Load" +msgstr "" + +#: solvespace.cpp:640 +msgctxt "title" +msgid "Modified File" +msgstr "" + +#: solvespace.cpp:642 +#, c-format +msgctxt "dialog" +msgid "Do you want to save the changes you made to the sketch “%s”?" +msgstr "" + +#: solvespace.cpp:645 +msgctxt "dialog" +msgid "Do you want to save the changes you made to the new sketch?" +msgstr "" + +#: solvespace.cpp:648 +msgctxt "dialog" +msgid "Your changes will be lost if you don't save them." +msgstr "" + +#: solvespace.cpp:649 +msgctxt "button" +msgid "&Save" +msgstr "" + +#: solvespace.cpp:651 +msgctxt "button" +msgid "Do&n't Save" +msgstr "" + +#: solvespace.cpp:672 +msgctxt "title" +msgid "(new sketch)" +msgstr "" + +#: solvespace.cpp:683 +msgctxt "title" +msgid "Property Browser" +msgstr "" + +#: solvespace.cpp:746 +msgid "" +"Constraints are currently shown, and will be exported in the toolpath. This is probably not what " +"you want; hide them by clicking the link at the top of the text window." +msgstr "" + +#: solvespace.cpp:834 +#, c-format +msgid "Can't identify file type from file extension of filename '%s'; try .dxf or .dwg." +msgstr "" + +#: solvespace.cpp:886 +msgid "Constraint must have a label, and must not be a reference dimension." +msgstr "" + +#: solvespace.cpp:890 +msgid "Bad selection for step dimension; select a constraint." +msgstr "" + +#: solvespace.cpp:914 +msgid "The assembly does not interfere, good." +msgstr "" + +#: solvespace.cpp:930 +#, c-format +msgid "" +"The volume of the solid model is:\n" +"\n" +" %s" +msgstr "" + +#: solvespace.cpp:939 +#, c-format +msgid "" +"\n" +"The volume of current group mesh is:\n" +"\n" +" %s" +msgstr "" + +#: solvespace.cpp:944 +msgid "" +"\n" +"\n" +"Curved surfaces have been approximated as triangles.\n" +"This introduces error, typically of around 1%." +msgstr "" + +#: solvespace.cpp:959 +#, c-format +msgid "" +"The surface area of the selected faces is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" + +#: solvespace.cpp:968 +msgid "" +"This group does not contain a correctly-formed 2d closed area. It is open, not coplanar, or self-" +"intersecting." +msgstr "" + +#: solvespace.cpp:980 +#, c-format +msgid "" +"The area of the region sketched in this group is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" + +#: solvespace.cpp:1000 +#, c-format +msgid "" +"The total length of the selected entities is:\n" +"\n" +" %s\n" +"\n" +"Curves have been approximated as piecewise linear.\n" +"This introduces error, typically of around 1%%." +msgstr "" + +#: solvespace.cpp:1006 +msgid "Bad selection for perimeter; select line segments, arcs, and curves." +msgstr "" + +#: solvespace.cpp:1022 +msgid "Bad selection for trace; select a single point." +msgstr "" + +#: solvespace.cpp:1049 +#, c-format +msgid "Couldn't write to '%s'" +msgstr "" + +#: solvespace.cpp:1079 +msgid "The mesh is self-intersecting (NOT okay, invalid)." +msgstr "" + +#: solvespace.cpp:1080 +msgid "The mesh is not self-intersecting (okay, valid)." +msgstr "" + +#: solvespace.cpp:1082 +msgid "The mesh has naked edges (NOT okay, invalid)." +msgstr "" + +#: solvespace.cpp:1083 +msgid "The mesh is watertight (okay, valid)." +msgstr "" + +#: solvespace.cpp:1086 +#, c-format +msgid "" +"\n" +"\n" +"The model contains %d triangles, from %d surfaces." +msgstr "" + +#: solvespace.cpp:1090 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"Zero problematic edges, good.%s" +msgstr "" + +#: solvespace.cpp:1093 +#, c-format +msgid "" +"%s\n" +"\n" +"%s\n" +"\n" +"%d problematic edges, bad.%s" +msgstr "" + +#: solvespace.cpp:1106 +#, c-format +msgid "" +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n" +msgstr "" + +#: style.cpp:185 +msgid "" +"Can't assign style to an entity that's derived from another entity; try assigning a style to this " +"entity's parent." +msgstr "" + +#: style.cpp:735 +msgid "Style name cannot be empty" +msgstr "" + +#: textscreens.cpp:837 +msgid "Can't repeat fewer than 1 time." +msgstr "" + +#: textscreens.cpp:841 +msgid "Can't repeat more than 999 times." +msgstr "" + +#: textscreens.cpp:866 +msgid "Group name cannot be empty" +msgstr "" + +#: textscreens.cpp:918 +msgid "Opacity must be between zero and one." +msgstr "" + +#: textscreens.cpp:953 +msgid "Radius cannot be zero or negative." +msgstr "" + +#: toolbar.cpp:18 +msgid "Sketch line segment" +msgstr "" + +#: toolbar.cpp:20 +msgid "Sketch rectangle" +msgstr "" + +#: toolbar.cpp:22 +msgid "Sketch circle" +msgstr "" + +#: toolbar.cpp:24 +msgid "Sketch arc of a circle" +msgstr "" + +#: toolbar.cpp:26 +msgid "Sketch curves from text in a TrueType font" +msgstr "" + +#: toolbar.cpp:28 +msgid "Sketch image from a file" +msgstr "" + +#: toolbar.cpp:30 +msgid "Create tangent arc at selected point" +msgstr "" + +#: toolbar.cpp:32 +msgid "Sketch cubic Bezier spline" +msgstr "" + +#: toolbar.cpp:34 +msgid "Sketch datum point" +msgstr "" + +#: toolbar.cpp:36 +msgid "Toggle construction" +msgstr "" + +#: toolbar.cpp:38 +msgid "Split lines / curves where they intersect" +msgstr "" + +#: toolbar.cpp:42 +msgid "Constrain distance / diameter / length" +msgstr "" + +#: toolbar.cpp:44 +msgid "Constrain angle" +msgstr "" + +#: toolbar.cpp:46 +msgid "Constrain to be horizontal" +msgstr "" + +#: toolbar.cpp:48 +msgid "Constrain to be vertical" +msgstr "" + +#: toolbar.cpp:50 +msgid "Constrain to be parallel or tangent" +msgstr "" + +#: toolbar.cpp:52 +msgid "Constrain to be perpendicular" +msgstr "" + +#: toolbar.cpp:54 +msgid "Constrain point on line / curve / plane / point" +msgstr "" + +#: toolbar.cpp:56 +msgid "Constrain symmetric" +msgstr "" + +#: toolbar.cpp:58 +msgid "Constrain equal length / radius / angle" +msgstr "" + +#: toolbar.cpp:60 +msgid "Constrain normals in same orientation" +msgstr "" + +#: toolbar.cpp:62 +msgid "Other supplementary angle" +msgstr "" + +#: toolbar.cpp:64 +msgid "Toggle reference dimension" +msgstr "" + +#: toolbar.cpp:68 +msgid "New group extruding active sketch" +msgstr "" + +#: toolbar.cpp:70 +msgid "New group rotating active sketch" +msgstr "" + +#: toolbar.cpp:72 +msgid "New group helix from active sketch" +msgstr "" + +#: toolbar.cpp:74 +msgid "New group revolve active sketch" +msgstr "" + +#: toolbar.cpp:76 +msgid "New group step and repeat rotating" +msgstr "" + +#: toolbar.cpp:78 +msgid "New group step and repeat translating" +msgstr "" + +#: toolbar.cpp:80 +msgid "New group in new workplane (thru given entities)" +msgstr "" + +#: toolbar.cpp:82 +msgid "New group in 3d" +msgstr "" + +#: toolbar.cpp:84 +msgid "New group linking / assembling file" +msgstr "" + +#: toolbar.cpp:88 +msgid "Nearest isometric view" +msgstr "" + +#: toolbar.cpp:90 +msgid "Align view to active workplane" +msgstr "" + +#: util.cpp:165 +msgctxt "title" +msgid "Error" +msgstr "" + +#: util.cpp:165 +msgctxt "title" +msgid "Message" +msgstr "" + +#: util.cpp:170 +msgctxt "button" +msgid "&OK" +msgstr "" + +#: view.cpp:127 +msgid "Scale cannot be zero or negative." +msgstr "" + +#: view.cpp:139 view.cpp:148 +msgid "Bad format: specify x, y, z" +msgstr "" diff --git a/res/qt-resources.qrc b/res/qt-resources.qrc new file mode 100644 index 0000000..6c470db --- /dev/null +++ b/res/qt-resources.qrc @@ -0,0 +1,6 @@ + + + + freedesktop/solvespace-48x48.png + + \ No newline at end of file diff --git a/res/shaders/edge.frag b/res/shaders/edge.frag new file mode 100644 index 0000000..2d2e8ac --- /dev/null +++ b/res/shaders/edge.frag @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Edge rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +const float feather = 0.5; + +uniform vec4 color; +uniform float pixel; +uniform float width; +uniform float patternLen; +uniform float patternScale; +uniform sampler2D pattern; + +varying vec3 fragLoc; + +void main() { + // lookup distance texture + vec4 v = texture2D(pattern, vec2(fragLoc.z / patternScale, 0.0)); + + // decode distance value + float val = dot(v, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 160581375.0)); + + // calculate cap + float dist = length(vec2(val * patternScale / (patternLen * width) + abs(fragLoc.x), fragLoc.y)); + + // perform antialiasing + float k = smoothstep(1.0 - 2.0 * feather * pixel / (width + feather * pixel), 1.0, abs(dist)); + + // perform alpha-test + if(k == 1.0) discard; + + // write resulting color + gl_FragColor = vec4(color.rgb, color.a * (1.0 - k)); +} diff --git a/res/shaders/edge.vert b/res/shaders/edge.vert new file mode 100644 index 0000000..3c5af3b --- /dev/null +++ b/res/shaders/edge.vert @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------- +// Edge rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +const float feather = 0.5; + +attribute vec3 pos; +attribute vec3 loc; +attribute vec3 tgt; + +uniform mat4 modelview; +uniform mat4 projection; +uniform float width; +uniform float pixel; + +varying vec3 fragLoc; + +void main() { + // get camera direction from modelview matrix + vec3 dir = vec3(modelview[0].z, modelview[1].z, modelview[2].z); + + // calculate line contour extension basis for constant width and caps + vec3 norm = normalize(cross(tgt, dir)); + norm = normalize(norm - dir * dot(dir, norm)); + vec3 perp = normalize(cross(dir, norm)); + + // calculate line extension width considering antialiasing + float ext = width + feather * pixel; + + // extend line contour + vec3 vertex = pos; + vertex += ext * loc.x * normalize(perp); + vertex += ext * loc.y * normalize(norm); + + // write fragment location for calculating caps and antialiasing + fragLoc = loc; + + // transform resulting vertex with modelview and projection matrices + gl_Position = projection * modelview * vec4(vertex, 1.0); +} diff --git a/res/shaders/imesh.frag b/res/shaders/imesh.frag new file mode 100644 index 0000000..1e7a74b --- /dev/null +++ b/res/shaders/imesh.frag @@ -0,0 +1,12 @@ +//----------------------------------------------------------------------------- +// Indexed Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +uniform vec4 color; +uniform sampler2D texture_; + +void main() { + if(texture2D(texture_, gl_FragCoord.xy / 32.0).a < 0.5) discard; + gl_FragColor = color; +} diff --git a/res/shaders/imesh.vert b/res/shaders/imesh.vert new file mode 100644 index 0000000..5e3e59a --- /dev/null +++ b/res/shaders/imesh.vert @@ -0,0 +1,13 @@ +//----------------------------------------------------------------------------- +// Indexed Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +attribute vec3 pos; + +uniform mat4 modelview; +uniform mat4 projection; + +void main() { + gl_Position = projection * modelview * vec4(pos, 1.0); +} diff --git a/res/shaders/imesh_point.frag b/res/shaders/imesh_point.frag new file mode 100644 index 0000000..db165e1 --- /dev/null +++ b/res/shaders/imesh_point.frag @@ -0,0 +1,15 @@ +//----------------------------------------------------------------------------- +// Point rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +const float feather = 0.5; + +uniform vec4 color; +uniform float pixel; +uniform float width; + +void main() { + // Rectangular points + gl_FragColor = color; +} diff --git a/res/shaders/imesh_point.vert b/res/shaders/imesh_point.vert new file mode 100644 index 0000000..07aff1b --- /dev/null +++ b/res/shaders/imesh_point.vert @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------------- +// Point rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +const float feather = 0.5; + +attribute vec3 pos; +attribute vec2 loc; + +uniform mat4 modelview; +uniform mat4 projection; +uniform float width; +uniform float pixel; + +void main() { + // get camera vectors from modelview matrix + vec3 u = vec3(modelview[0].x, modelview[1].x, modelview[2].x); + vec3 v = vec3(modelview[0].y, modelview[1].y, modelview[2].y); + + // calculate point contour extension basis for constant width and caps + + // calculate point extension width considering antialiasing + float ext = width + feather * pixel; + + // extend point contour + vec3 vertex = pos; + vertex += ext * loc.x * normalize(u); + vertex += ext * loc.y * normalize(v); + + // transform resulting vertex with modelview and projection matrices + gl_Position = projection * modelview * vec4(vertex, 1.0); +} diff --git a/res/shaders/imesh_tex.frag b/res/shaders/imesh_tex.frag new file mode 100644 index 0000000..d3b3235 --- /dev/null +++ b/res/shaders/imesh_tex.frag @@ -0,0 +1,15 @@ +//----------------------------------------------------------------------------- +// Indexed Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +uniform vec4 color; +uniform sampler2D texture_; + +varying vec2 fragTex; + +void main() { + vec4 texColor = texture2D(texture_, fragTex); + if(texColor.a == 0.0) discard; + gl_FragColor = texColor * color; +} diff --git a/res/shaders/imesh_tex.vert b/res/shaders/imesh_tex.vert new file mode 100644 index 0000000..e048759 --- /dev/null +++ b/res/shaders/imesh_tex.vert @@ -0,0 +1,17 @@ +//----------------------------------------------------------------------------- +// Indexed Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +attribute vec3 pos; +attribute vec2 tex; + +uniform mat4 modelview; +uniform mat4 projection; + +varying vec2 fragTex; + +void main() { + fragTex = tex; + gl_Position = projection * modelview * vec4(pos, 1.0); +} diff --git a/res/shaders/imesh_texa.frag b/res/shaders/imesh_texa.frag new file mode 100644 index 0000000..89a124c --- /dev/null +++ b/res/shaders/imesh_texa.frag @@ -0,0 +1,13 @@ +//----------------------------------------------------------------------------- +// Indexed Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +uniform vec4 color; +uniform sampler2D texture_; + +varying vec2 fragTex; + +void main() { + gl_FragColor = vec4(color.rgb, color.a * texture2D(texture_, fragTex).TEX_ALPHA); +} diff --git a/res/shaders/mesh.frag b/res/shaders/mesh.frag new file mode 100644 index 0000000..8cb32c2 --- /dev/null +++ b/res/shaders/mesh.frag @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +uniform vec3 lightDir0; +uniform vec3 lightDir1; +uniform float lightInt0; +uniform float lightInt1; +uniform float ambient; + +varying vec3 fragNormal; +varying vec4 fragColor; + +void main() { + vec3 result = fragColor.xyz * ambient; + vec3 normal = normalize(fragNormal); + + float light0 = clamp(dot(lightDir0, normal), 0.0, 1.0) * lightInt0 * (1.0 - ambient); + result += fragColor.rgb * light0; + + float light1 = clamp(dot(lightDir1, normal), 0.0, 1.0) * lightInt1 * (1.0 - ambient); + result += fragColor.rgb * light1; + + gl_FragColor = vec4(result, fragColor.a); +} diff --git a/res/shaders/mesh.vert b/res/shaders/mesh.vert new file mode 100644 index 0000000..c310ffc --- /dev/null +++ b/res/shaders/mesh.vert @@ -0,0 +1,21 @@ +//----------------------------------------------------------------------------- +// Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +attribute vec3 pos; +attribute vec3 nor; +attribute vec4 col; + +uniform mat4 modelview; +uniform mat4 projection; + +varying vec3 fragNormal; +varying vec4 fragColor; + +void main() { + fragNormal = vec3(modelview * vec4(nor, 0.0)); + fragColor = col; + + gl_Position = projection * modelview * vec4(pos, 1.0); +} diff --git a/res/shaders/mesh_fill.frag b/res/shaders/mesh_fill.frag new file mode 100644 index 0000000..c8b3d37 --- /dev/null +++ b/res/shaders/mesh_fill.frag @@ -0,0 +1,12 @@ +//----------------------------------------------------------------------------- +// Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +uniform vec4 color; +uniform sampler2D texture_; + +void main() { + if(texture2D(texture_, gl_FragCoord.xy / 32.0).TEX_ALPHA < 0.5) discard; + gl_FragColor = color; +} diff --git a/res/shaders/mesh_fill.vert b/res/shaders/mesh_fill.vert new file mode 100644 index 0000000..935efa6 --- /dev/null +++ b/res/shaders/mesh_fill.vert @@ -0,0 +1,13 @@ +//----------------------------------------------------------------------------- +// Mesh rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +attribute vec3 pos; + +uniform mat4 modelview; +uniform mat4 projection; + +void main() { + gl_Position = projection * modelview * vec4(pos, 1.0); +} diff --git a/res/shaders/outline.vert b/res/shaders/outline.vert new file mode 100644 index 0000000..7683a14 --- /dev/null +++ b/res/shaders/outline.vert @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Outline rendering shader +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +const int EMPHASIZED_AND_CONTOUR = 0; +const int EMPHASIZED_WITHOUT_CONTOUR = 1; +const int CONTOUR_ONLY = 2; + +const float feather = 0.5; + +attribute vec3 pos; +attribute vec4 loc; +attribute vec3 tgt; +attribute vec3 nol; +attribute vec3 nor; + +uniform mat4 modelview; +uniform mat4 projection; +uniform float width; +uniform float pixel; +uniform int mode; + +varying vec3 fragLoc; + +void main() { + // get camera direction from modelview matrix + vec3 dir = vec3(modelview[0].z, modelview[1].z, modelview[2].z); + + // perform outline visibility test + float ldot = dot(nol, dir); + float rdot = dot(nor, dir); + + bool isOutline = (ldot > -1e-6) == (rdot < 1e-6) || + (rdot > -1e-6) == (ldot < 1e-6); + bool isTagged = loc.w > 0.5; + + float visible = float((mode == CONTOUR_ONLY && isOutline) || + (mode == EMPHASIZED_AND_CONTOUR && (isOutline || isTagged)) || + (mode == EMPHASIZED_WITHOUT_CONTOUR && isTagged && !isOutline)); + + // calculate line contour extension basis for constant width and caps + vec3 norm = normalize(cross(tgt, dir)); + norm = normalize(norm - dir * dot(dir, norm)); + vec3 perp = normalize(cross(dir, norm)); + + // calculate line extension width considering antialiasing + float ext = (width + feather * pixel) * visible; + + // extend line contour + vec3 vertex = pos; + vertex += ext * loc.x * normalize(perp); + vertex += ext * loc.y * normalize(norm); + + // write fragment location for calculating caps and antialiasing + fragLoc = vec3(loc); + + // transform resulting vertex with modelview and projection matrices + gl_Position = projection * modelview * vec4(vertex, 1.0); +} diff --git a/res/threejs/SolveSpaceControls.js b/res/threejs/SolveSpaceControls.js new file mode 100644 index 0000000..ca74fd5 --- /dev/null +++ b/res/threejs/SolveSpaceControls.js @@ -0,0 +1,536 @@ +window.devicePixelRatio = window.devicePixelRatio || 1; + +SolvespaceCamera = function(renderWidth, renderHeight, scale, up, right, offset) { + THREE.Camera.call(this); + + this.type = 'SolvespaceCamera'; + + this.renderWidth = renderWidth; + this.renderHeight = renderHeight; + this.zoomScale = scale; /* Avoid namespace collision w/ THREE.Object.scale */ + this.up = up; + this.right = right; + this.offset = offset; + this.depthBias = 0; + + this.updateProjectionMatrix(); +}; + +SolvespaceCamera.prototype = Object.create(THREE.Camera.prototype); +SolvespaceCamera.prototype.constructor = SolvespaceCamera; +SolvespaceCamera.prototype.updateProjectionMatrix = function() { + var temp = new THREE.Matrix4(); + var offset = new THREE.Matrix4().makeTranslation(this.offset.x, this.offset.y, this.offset.z); + // Convert to right handed- do up cross right instead. + var n = new THREE.Vector3().crossVectors(this.up, this.right); + var rotate = new THREE.Matrix4().makeBasis(this.right, this.up, n); + rotate.transpose(); + /* Transpose of rotation matrix == inverse. Rotating the camera by a + basis is equivalent to rotating an object by the inverse of the + basis. To mimic Solvespace's behavior, we pan relative to the camera. + So we need to be rotated to where the camera is pointing before panning. + See: https://en.wikipedia.org/wiki/Change_of_basis#Two_dimensions */ + + /* TODO: If we want perspective, we need an additional matrix + here which will modify w for perspective divide. */ + var scale = new THREE.Matrix4().makeScale(2 * this.zoomScale / this.renderWidth, + 2 * this.zoomScale / this.renderHeight, this.zoomScale / 30000.0); + + temp.multiply(scale); + temp.multiply(rotate); + temp.multiply(offset); + + this.projectionMatrix.copy(temp); +}; + +SolvespaceCamera.prototype.NormalizeProjectionVectors = function() { + /* After rotating, up and right may no longer be orthogonal. + However, their cross product will produce the correct + rotated plane, and we can recover an orthogonal basis. */ + var n = new THREE.Vector3().crossVectors(this.right, this.up); + this.up = new THREE.Vector3().crossVectors(n, this.right); + this.right.normalize(); + this.up.normalize(); +}; + +SolvespaceCamera.prototype.rotate = function(right, up) { + var oldRight = new THREE.Vector3().copy(this.right).normalize(); + var oldUp = new THREE.Vector3().copy(this.up).normalize(); + this.up.applyAxisAngle(oldRight, up); + this.right.applyAxisAngle(oldUp, right); + this.NormalizeProjectionVectors(); +}; + +SolvespaceCamera.prototype.offsetProj = function(right, up) { + var shift = new THREE.Vector3(right * this.right.x + up * this.up.x, + right * this.right.y + up * this.up.y, + right * this.right.z + up * this.up.z); + this.offset.add(shift); +}; + +/* Calculate the offset in terms of up and right projection vectors +that will preserve the world coordinates of the current mouse position after +the zoom. */ +SolvespaceCamera.prototype.zoomTo = function(x, y, delta) { + // Get offset components in world coordinates, in terms of up/right. + var projOffsetX = this.offset.dot(this.right); + var projOffsetY = this.offset.dot(this.up); + + /* Remove offset before scaling so, that mouse position changes + proportionally to the model and independent of current offset. */ + var centerRightI = x/this.zoomScale - projOffsetX; + var centerUpI = y/this.zoomScale - projOffsetY; + var zoomFactor; + + /* Zoom 20% every 100 delta. */ + if(delta < 0) { + zoomFactor = (-delta * 0.002 + 1); + } + else if(delta > 0) { + zoomFactor = (delta * (-1.0/600.0) + 1); + } + else { + return; + } + + this.zoomScale = this.zoomScale * zoomFactor; + var centerRightF = x/this.zoomScale - projOffsetX; + var centerUpF = y/this.zoomScale - projOffsetY; + + this.offset.addScaledVector(this.right, centerRightF - centerRightI); + this.offset.addScaledVector(this.up, centerUpF - centerUpI); +}; + +SolvespaceControls = function(object, domElement) { + var _this = this; + this.object = object; + this.domElement = ( domElement !== undefined ) ? domElement : document; + + var threePan = new Hammer.Pan({event : 'threepan', pointers : 3, enable : false}); + var panAfterTap = new Hammer.Pan({event : 'panaftertap', enable : false}); + + this.touchControls = new Hammer.Manager(domElement, { + recognizers: [ + [Hammer.Pinch, { enable: true }], + [Hammer.Pan], + [Hammer.Tap], + ] + }); + + this.touchControls.add(threePan); + this.touchControls.add(panAfterTap); + + var changeEvent = { + type: 'change' + }; + var startEvent = { + type: 'start' + }; + var endEvent = { + type: 'end' + }; + + var _changed = false; + var _offsetPrev = new THREE.Vector2(0, 0); + var _offsetCur = new THREE.Vector2(0, 0); + var _rotatePrev = new THREE.Vector2(0, 0); + var _rotateCur = new THREE.Vector2(0, 0); + + // Used during touch events. + var _rotateOrig = new THREE.Vector2(0, 0); + var _offsetOrig = new THREE.Vector2(0, 0); + var _prevScale = 1.0; + + this.handleEvent = function(event) { + if (typeof this[event.type] == 'function') { + this[event.type](event); + } + } + + function mousedown(event) { + event.preventDefault(); + event.stopPropagation(); + + switch (event.button) { + case 0: + _rotateCur.set(event.screenX, + event.screenY); + _rotatePrev.copy(_rotateCur); + document.addEventListener('mousemove', mousemove_rotate, false); + document.addEventListener('mouseup', mouseup, false); + break; + case 2: + _offsetCur.set(event.screenX / window.devicePixelRatio, + event.screenY / window.devicePixelRatio); + _offsetPrev.copy(_offsetCur); + document.addEventListener('mousemove', mousemove_pan, false); + document.addEventListener('mouseup', mouseup, false); + break; + default: + break; + } + } + + function wheel( event ) { + event.preventDefault(); + /* FIXME: Width and height might not be supported universally, but + can be calculated? */ + var box = _this.domElement.getBoundingClientRect(); + object.zoomTo(event.clientX - box.width/2 - box.left, + -(event.clientY - box.height/2 - box.top), event.deltaY); + _changed = true; + } + + function mousemove_rotate(event) { + _rotateCur.set(event.screenX, + event.screenY); + var diff = new THREE.Vector2().subVectors(_rotateCur, _rotatePrev) + .multiplyScalar(1 / object.zoomScale); + object.rotate(-0.3 * Math.PI / 180 * diff.x * object.zoomScale, + -0.3 * Math.PI / 180 * diff.y * object.zoomScale); + _changed = true; + _rotatePrev.copy(_rotateCur); + } + + function mousemove_pan(event) { + _offsetCur.set(event.screenX / window.devicePixelRatio, + event.screenY / window.devicePixelRatio); + var diff = new THREE.Vector2().subVectors(_offsetCur, _offsetPrev) + .multiplyScalar(window.devicePixelRatio / object.zoomScale); + object.offsetProj(diff.x, -diff.y); + _changed = true; + _offsetPrev.copy(_offsetCur); + } + + function mouseup(event) { + /* TODO: Opera mouse gestures will intercept this event, making it + possible to have multiple mousedown events consecutively without + a corresponding mouseup (so multiple viewports can be rotated/panned + simultaneously). Disable mouse gestures for now. */ + event.preventDefault(); + event.stopPropagation(); + + switch (event.button) { + case 0: + document.removeEventListener('mousemove', mousemove_rotate); + document.removeEventListener('mouseup', mouseup); + break; + case 2: + document.removeEventListener('mousemove', mousemove_pan); + document.removeEventListener('mouseup', mouseup); + break; + } + + _this.dispatchEvent(endEvent); + } + + function pan(event) { + /* neWcur - prev does not necessarily equal (cur + diff) - prev. + Floating point is not associative. */ + var touchDiff = new THREE.Vector2(event.deltaX, event.deltaY); + _rotateCur.addVectors(_rotateOrig, touchDiff); + var incDiff = new THREE.Vector2().subVectors(_rotateCur, _rotatePrev) + .multiplyScalar(1 / object.zoomScale); + object.rotate(-0.3 * Math.PI / 180 * incDiff.x * object.zoomScale, + -0.3 * Math.PI / 180 * incDiff.y * object.zoomScale); + _changed = true; + _rotatePrev.copy(_rotateCur); + } + + function panstart(event) { + /* TODO: Dynamically enable pan function? */ + _rotateOrig.copy(_rotateCur); + } + + function pinchstart(event) { + _prevScale = event.scale; + } + + function pinch(event) { + /* FIXME: Width and height might not be supported universally, but + can be calculated? */ + var box = _this.domElement.getBoundingClientRect(); + + /* 16.6... pixels chosen heuristically... matches my touchpad. */ + if (event.scale < _prevScale) { + object.zoomTo(event.center.x - box.width/2 - box.left, + -(event.center.y - box.height/2 - box.top), 100/6.0); + _changed = true; + } else if (event.scale > _prevScale) { + object.zoomTo(event.center.x - box.width/2 - box.left, + -(event.center.y - box.height/2 - box.top), -100/6.0); + _changed = true; + } + + _prevScale = event.scale; + } + + /* A tap will enable panning/disable rotate. */ + function tap(event) { + panAfterTap.set({enable : true}); + _this.touchControls.get('pan').set({enable : false}); + } + + function panaftertap(event) { + var touchDiff = new THREE.Vector2(event.deltaX, event.deltaY); + _offsetCur.addVectors(_offsetOrig, touchDiff); + var incDiff = new THREE.Vector2().subVectors(_offsetCur, _offsetPrev) + .multiplyScalar(1 / object.zoomScale); + object.offsetProj(incDiff.x, -incDiff.y); + _changed = true; + _offsetPrev.copy(_offsetCur); + } + + function panaftertapstart(event) { + _offsetOrig.copy(_offsetCur); + } + + function panaftertapend(event) { + panAfterTap.set({enable : false}); + _this.touchControls.get('pan').set({enable : true}); + } + + function contextmenu(event) { + event.preventDefault(); + } + + this.update = function() { + if (_changed) { + _this.dispatchEvent(changeEvent); + _changed = false; + } + }; + + this.domElement.addEventListener('mousedown', mousedown, false); + this.domElement.addEventListener('wheel', wheel, false); + this.domElement.addEventListener('contextmenu', contextmenu, false); + + /* Hammer.on wraps addEventListener */ + // Rotate + this.touchControls.on('pan', pan); + this.touchControls.on('panstart', panstart); + + // Zoom + this.touchControls.on('pinch', pinch); + this.touchControls.on('pinchstart', pinchstart); + + //Pan + this.touchControls.on('tap', tap); + this.touchControls.on('panaftertapstart', panaftertapstart); + this.touchControls.on('panaftertap', panaftertap); + this.touchControls.on('panaftertapend', panaftertapend); +}; + +SolvespaceControls.prototype = Object.create(THREE.EventDispatcher.prototype); +SolvespaceControls.prototype.constructor = SolvespaceControls; + + +solvespace = function(obj, params) { + var scene, edgeScene, camera, edgeCamera, renderer; + var geometry, controls, material, mesh, edges; + var width, height, scale, offset, projRight, projUp; + var directionalLightArray = []; + var inheritedWidth = false, inheritedHeight = false; + + if (typeof params === "undefined" || !("width" in params)) { + width = window.innerWidth; + inheritedWidth = true; + } else { + width = params.width; + } + + if (typeof params === "undefined" || !("height" in params)) { + height = window.innerHeight; + inheritedHeight = true; + } else { + height = params.height; + } + + if (typeof params === "undefined" || !("scale" in params)) { + scale = 5; + } else { + scale = params.scale; + } + + if (typeof params === "undefined" || !("offset" in params)) { + offset = new THREE.Vector3(0, 0, 0); + } else { + offset = params.offset; + } + + if (typeof params === "undefined" || !("projUp" in params)) { + projUp = new THREE.Vector3(0, 1, -1); + } else { + projUp = params.projUp; + } + + if (typeof params === "undefined" || !("projRight" in params)) { + projRight = new THREE.Vector3(1, 0, -1); + } else { + projRight = params.projRight; + } + + var domElement = init(); + lightUpdate(); + render(); + return domElement; + + function init() { + scene = new THREE.Scene(); + edgeScene = new THREE.Scene(); + + camera = new SolvespaceCamera(width, height, scale, projUp, projRight, offset); + camera.NormalizeProjectionVectors(); + + mesh = createMesh(obj); + scene.add(mesh); + edges = createEdges(obj); + edgeScene.add(edges); + + for (var i = 0; i < obj.lights.d.length; i++) { + var lightColor = new THREE.Color(obj.lights.d[i].intensity, + obj.lights.d[i].intensity, obj.lights.d[i].intensity); + var directionalLight = new THREE.DirectionalLight(lightColor, 1); + directionalLight.position.set(obj.lights.d[i].direction[0], + obj.lights.d[i].direction[1], obj.lights.d[i].direction[2]); + directionalLightArray.push(directionalLight); + scene.add(directionalLight); + } + + var lightColor = new THREE.Color(obj.lights.a, obj.lights.a, obj.lights.a); + var ambientLight = new THREE.AmbientLight(lightColor.getHex()); + scene.add(ambientLight); + + renderer = new THREE.WebGLRenderer({ antialias: true}); + renderer.setSize(width * window.devicePixelRatio, height * window.devicePixelRatio); + renderer.autoClear = false; + renderer.domElement.style = + "width: " + width + "px;" + + "height: " + height + "px;"; + + controls = new SolvespaceControls(camera, renderer.domElement); + controls.addEventListener("change", render); + controls.addEventListener("change", lightUpdate); + + if(inheritedWidth || inheritedHeight) { + window.addEventListener("resize", resize); + } + + animate(); + return renderer.domElement; + } + + function resize() { + scale = camera.zoomScale; + if(inheritedWidth) { + scale *= window.innerWidth / width; + width = window.innerWidth; + } + if(inheritedHeight) { + scale *= window.innerHeight / height; + height = window.innerHeight; + } + + camera.renderWidth = width; + camera.renderHeight = height; + camera.zoomScale = scale; + + renderer.setSize(width * window.devicePixelRatio, height * window.devicePixelRatio); + renderer.domElement.style = + "width: " + width + "px;" + + "height: " + height + "px;"; + + render(); + } + + function animate() { + requestAnimationFrame(animate); + controls.update(); + } + + function render() { + var context = renderer.getContext(); + camera.updateProjectionMatrix(); + renderer.clear(); + + context.depthRange(0.1, 1); + renderer.render(scene, camera); + + context.depthRange(0.1-(2/60000.0), 1-(2/60000.0)); + renderer.render(edgeScene, camera); + } + + function lightUpdate() { + var changeBasis = new THREE.Matrix4(); + + // The original light positions were in camera space. + // Project them into standard space using camera's basis + // vectors (up, target, and their cross product). + var n = new THREE.Vector3().crossVectors(camera.up, camera.right); + changeBasis.makeBasis(camera.right, camera.up, n); + + for (var i = 0; i < 2; i++) { + var newLightPos = new THREE.Vector3(obj.lights.d[i].direction[0], + obj.lights.d[i].direction[1], + obj.lights.d[i].direction[2]).applyMatrix4(changeBasis); + directionalLightArray[i].position.set(newLightPos[0], + newLightPos[1], newLightPos[2]); + } + } + + function createMesh(meshObj) { + var geometry = new THREE.Geometry(); + var materialIndex = 0; + var materialList = []; + var opacitiesSeen = {}; + + for (var i = 0; i < meshObj.points.length; i++) { + geometry.vertices.push(new THREE.Vector3(meshObj.points[i][0], + meshObj.points[i][1], meshObj.points[i][2])); + } + + for (var i = 0; i < meshObj.faces.length; i++) { + var currOpacity = ((meshObj.colors[i] & 0xFF000000) >>> 24) / 255.0; + if (opacitiesSeen[currOpacity] === undefined) { + opacitiesSeen[currOpacity] = materialIndex; + materialIndex++; + materialList.push(new THREE.MeshLambertMaterial({ + vertexColors: THREE.FaceColors, + opacity: currOpacity, + transparent: true, + side: THREE.DoubleSide + })); + } + + geometry.faces.push(new THREE.Face3(meshObj.faces[i][0], + meshObj.faces[i][1], meshObj.faces[i][2], + [new THREE.Vector3(meshObj.normals[i][0][0], + meshObj.normals[i][0][1], meshObj.normals[i][0][2]), + new THREE.Vector3(meshObj.normals[i][1][0], + meshObj.normals[i][1][1], meshObj.normals[i][1][2]), + new THREE.Vector3(meshObj.normals[i][2][0], + meshObj.normals[i][2][1], meshObj.normals[i][2][2])], + new THREE.Color(meshObj.colors[i] & 0x00FFFFFF), + opacitiesSeen[currOpacity])); + } + + geometry.computeBoundingSphere(); + return new THREE.Mesh(geometry, materialList); + } + + function createEdges(meshObj) { + var geometry = new THREE.Geometry(); + var material = new THREE.LineBasicMaterial(); + + for (var i = 0; i < meshObj.edges.length; i++) { + geometry.vertices.push(new THREE.Vector3(meshObj.edges[i][0][0], + meshObj.edges[i][0][1], meshObj.edges[i][0][2]), + new THREE.Vector3(meshObj.edges[i][1][0], + meshObj.edges[i][1][1], meshObj.edges[i][1][2])); + } + + geometry.computeBoundingSphere(); + return new THREE.LineSegments(geometry, material); + } +}; + diff --git a/res/threejs/hammer-2.0.8.js.gz b/res/threejs/hammer-2.0.8.js.gz new file mode 100644 index 0000000..764a580 Binary files /dev/null and b/res/threejs/hammer-2.0.8.js.gz differ diff --git a/res/win32/icon.ico b/res/win32/icon.ico new file mode 100644 index 0000000..e545e2f Binary files /dev/null and b/res/win32/icon.ico differ diff --git a/res/win32/manifest.xml b/res/win32/manifest.xml new file mode 100644 index 0000000..7c49a2e --- /dev/null +++ b/res/win32/manifest.xml @@ -0,0 +1,28 @@ + + + +Parametric 3d CAD tool. + + + PerMonitorV2, PerMonitor + true + + + + + + + + diff --git a/res/win32/versioninfo.rc.in b/res/win32/versioninfo.rc.in new file mode 100644 index 0000000..1a3179f --- /dev/null +++ b/res/win32/versioninfo.rc.in @@ -0,0 +1,29 @@ +1 VERSIONINFO +FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,0 +PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,0 +FILEFLAGSMASK 0 +FILEFLAGS 0 +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE 0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" + BEGIN + VALUE "CompanyName", "The SolveSpace authors" + VALUE "ProductName", "SolveSpace" + VALUE "ProductVersion", "${PROJECT_VERSION}~${solvespace_GIT_HASH}" + VALUE "FileDescription", "SolveSpace, a parametric 2d/3d CAD" + VALUE "FileVersion", "${PROJECT_VERSION}~${solvespace_GIT_HASH}" + VALUE "OriginalFilename", "solvespace.exe" + VALUE "InternalName", "solvespace" + VALUE "LegalCopyright", "(c) 2008-2026 Jonathan Westhues and other authors" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 0 + END +END diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..3af2075 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,526 @@ +include(GNUInstallDirs) + +# configuration + +set(HAVE_SPACEWARE ${SPACEWARE_FOUND}) + +if(NOT WIN32 OR APPLE) + if(GTKMM_gtkmm-3.0_VERSION VERSION_LESS "3.24.0") + set(HAVE_GTK_FILECHOOSERNATIVE 0) + else() + set(HAVE_GTK_FILECHOOSERNATIVE 1) + endif() +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +if(USE_QT_GUI) + set(CMAKE_AUTOMOC ON) + find_package(Qt6 COMPONENTS Core Gui OpenGLWidgets Widgets REQUIRED) + # find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) + qt_add_resources(RESOURCE_FILES ../res/qt-resources.qrc) +endif() + +# solvespace dependencies +add_library(slvs_deps INTERFACE) +target_include_directories(slvs_deps SYSTEM INTERFACE + ${OPENGL_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIR} + ${PNG_PNG_INCLUDE_DIR} + ${FREETYPE_INCLUDE_DIRS} + ${MIMALLOC_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIRS}) +target_link_libraries(slvs_deps INTERFACE + dxfrw + ${ZLIB_LIBRARY} + ${PNG_LIBRARY} + ${FREETYPE_LIBRARY} + mimalloc-static) + +if(NOT USE_QT_GUI OR ENABLE_CLI) + target_include_directories(slvs_deps SYSTEM INTERFACE ${CAIRO_INCLUDE_DIRS}) + target_link_libraries(slvs_deps INTERFACE ${CAIRO_LIBRARIES}) +endif() + +if(Backtrace_FOUND) + target_include_directories(slvs_deps SYSTEM INTERFACE + ${Backtrace_INCLUDE_DIRS}) + target_link_libraries(slvs_deps INTERFACE + ${Backtrace_LIBRARY}) +endif() + +if(SPACEWARE_FOUND) + target_include_directories(slvs_deps SYSTEM INTERFACE + ${SPACEWARE_INCLUDE_DIR}) + target_link_libraries(slvs_deps INTERFACE + ${SPACEWARE_LIBRARIES}) +endif() + +if(ENABLE_OPENMP) + target_link_libraries(slvs_deps INTERFACE slvs_openmp) +endif() + +target_compile_options(slvs_deps + INTERFACE ${COVERAGE_FLAGS}) + +# platform utilities +if(APPLE) + target_link_libraries(slvs_deps INTERFACE + ${APPKIT_LIBRARY}) +endif() + +# Solver +add_library(slvs-solver INTERFACE) +target_sources(slvs-solver INTERFACE + dsc.h + expr.h + handle.h + param.h + platform/platform.h + solvespace.h + + constrainteq.cpp + entity.cpp + expr.cpp + platform/platformbase.cpp + system.cpp + util.cpp +) +target_include_directories(slvs-solver SYSTEM INTERFACE + ${MIMALLOC_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIRS}) +target_include_directories(slvs-solver INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}) + +# Needed for CI +file(WRITE ${CMAKE_BINARY_DIR}/version.env "\ +VERSION_MAJOR=${PROJECT_VERSION_MAJOR}\n\ +VERSION_MINOR=${PROJECT_VERSION_MINOR}\n\ +VERSION_PATCH=0\n\ +VERSION_GIT_HASH=${solvespace_GIT_HASH}\n\ +") + +if(ENABLE_GUI OR ENABLE_CLI) + set(every_platform_SOURCES + platform/guiwin.cpp + platform/guigtk.cpp + platform/guimac.mm + platform/guihtml.cpp) + + # solvespace library + + set(solvespace_core_gl_SOURCES + solvespace.cpp) + + add_library(solvespace-core STATIC + polygon.h + sketch.h + ui.h + render/render.h + srf/surface.h + + bsp.cpp + clipboard.cpp + confscreen.cpp + constraint.cpp + describescreen.cpp + draw.cpp + drawconstraint.cpp + drawentity.cpp + export.cpp + exportstep.cpp + exportvector.cpp + file.cpp + generate.cpp + graphicswin.cpp + group.cpp + groupmesh.cpp + importdxf.cpp + importidf.cpp + importmesh.cpp + mesh.cpp + modify.cpp + mouse.cpp + polyline.cpp + polygon.cpp + resource.cpp + request.cpp + style.cpp + textscreens.cpp + textwin.cpp + toolbar.cpp + ttf.cpp + undoredo.cpp + view.cpp + platform/platform.cpp + platform/gui.cpp + render/render.cpp + render/render2d.cpp + srf/boolean.cpp + srf/curve.cpp + srf/merge.cpp + srf/ratpoly.cpp + srf/raycast.cpp + srf/shell.cpp + srf/surface.cpp + srf/surfinter.cpp + srf/triangulate.cpp) + + target_include_directories(solvespace-core PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(solvespace-core PRIVATE slvs-solver) + target_link_libraries(solvespace-core PUBLIC slvs_deps) + + # solvespace translations + + if(HAVE_GETTEXT) + get_target_property(solvespace_core_SOURCES solvespace-core SOURCES) + set(inputs + ${solvespace_core_SOURCES} + ${every_platform_SOURCES} + ${solvespace_core_gl_SOURCES}) + + set(templ_po ${CMAKE_CURRENT_BINARY_DIR}/../res/messages.po) + + set(output_pot ${CMAKE_CURRENT_SOURCE_DIR}/../res/messages.pot) + set(output_po ${CMAKE_CURRENT_SOURCE_DIR}/../res/locales/en_US.po) + file(GLOB locale_pos ${CMAKE_CURRENT_SOURCE_DIR}/../res/locales/*.po) + + string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + gen_output_pot ${output_pot}.gen) + string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + gen_output_po ${output_po}.gen) + foreach(locale_po ${locale_pos}) + string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + gen_locale_po ${locale_po}.gen) + list(APPEND gen_locale_pos ${gen_locale_po}) + endforeach() + + add_custom_command( + OUTPUT ${gen_output_pot} + COMMAND ${XGETTEXT} + --language=C++ + --keyword --keyword=_ --keyword=N_ --keyword=C_:2,1c --keyword=CN_:2,1c + --force-po --width=100 --sort-by-file + --package-name=SolveSpace + --package-version=${PROJECT_VERSION} + "--copyright-holder=the PACKAGE authors" + --msgid-bugs-address=phkahler@gmail.com + --from-code=utf-8 --output=${gen_output_pot} ${inputs} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${gen_output_pot} ${output_pot} + DEPENDS ${inputs} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Extracting translations" + VERBATIM) + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../res/locales) + + # en_US is a bit special; we pre-fill the msgstrs from msgids, instead of (as would normally + # happen) leaving them empty. + add_custom_command( + OUTPUT ${gen_output_po} + COMMAND ${MSGINIT} + --locale=en_US --no-translator + --output=${templ_po} --input=${gen_output_pot} + COMMAND ${MSGMERGE} + --force-po --no-fuzzy-matching + --output=${gen_output_po} ${output_po} ${templ_po} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${gen_output_po} ${output_po} + DEPENDS ${gen_output_pot} + COMMENT "Updating en_US translations" + VERBATIM) + + foreach(locale_po ${locale_pos}) + string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + gen_locale_po ${locale_po}.gen) + + get_filename_component(locale_name ${locale_po} NAME_WE) + if(locale_name STREQUAL "en_US") + continue() + endif() + + add_custom_command( + OUTPUT ${gen_locale_po} + COMMAND ${MSGMERGE} + --no-fuzzy-matching + --output=${gen_locale_po} ${locale_po} ${gen_output_pot} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${gen_locale_po} ${locale_po} + DEPENDS ${gen_output_pot} + COMMENT "Updating ${locale_name} translations" + VERBATIM) + endforeach() + + add_custom_target(translate_solvespace + DEPENDS ${gen_output_pot} ${gen_output_po} ${gen_locale_pos}) + endif() +endif() + +# solvespace graphical executable + +if(ENABLE_GUI) + add_executable(solvespace WIN32 MACOSX_BUNDLE + ${solvespace_core_gl_SOURCES} + $) + + if(NOT USE_QT_GUI) + target_sources(solvespace PRIVATE platform/entrygui.cpp) + endif() + + add_dependencies(solvespace + resources) + + target_link_libraries(solvespace + PRIVATE + solvespace-core + ${OPENGL_LIBRARIES}) + + # OpenGL version + if(OPENGL STREQUAL 3) + target_sources(solvespace PRIVATE + render/gl3shader.cpp + render/rendergl3.cpp) + elseif(OPENGL STREQUAL 1) + target_sources(solvespace PRIVATE + render/rendergl1.cpp) + else() + message(FATAL_ERROR "Unsupported OpenGL version ${OPENGL}") + endif() + + # Platform-specific + if(WIN32 AND NOT USE_QT_GUI) + target_sources(solvespace PRIVATE + platform/guiwin.cpp) + + target_link_libraries(solvespace PRIVATE comctl32) + elseif(APPLE) + target_compile_options(solvespace PRIVATE -fobjc-arc) + target_compile_definitions(solvespace PRIVATE GL_SILENCE_DEPRECATION) + + target_sources(solvespace PRIVATE + platform/guimac.mm) + set_target_properties(solvespace PROPERTIES + OUTPUT_NAME SolveSpace + XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.solvespace" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + elseif(EMSCRIPTEN) + # Due to the response file hack below, we need a version of Emscripten that + # passes arguments via a response file to the `file_packager` utility, but + # this was not the case prior to version 4.0.8 of Emscripten. + # See https://github.com/emscripten-core/emscripten/pull/24107 + if(NOT EMSCRIPTEN_VERSION OR EMSCRIPTEN_VERSION VERSION_LESS "4.0.8") + message(FATAL_ERROR "The Emscripten build requires at least version 4.0.8") + endif() + + target_compile_features(solvespace PRIVATE cxx_std_17) + + set(SHELL "${CMAKE_CURRENT_SOURCE_DIR}/platform/html/emshell.html") + # Add internal quotes to paths used in the response file to ensure that paths + # that contain spaces are handled correctly + set(RESP_LINK_FLAGS + --bind --shell-file "\"${SHELL}\"" --no-heap-copy + "-s ALLOW_MEMORY_GROWTH=1" "-s WASM=1" + "-s ASYNCIFY=1" "-s DYNCALLS=1" "-s ASSERTIONS=1" + "-s TOTAL_STACK=33554432" "-s TOTAL_MEMORY=134217728") + + get_target_property(resource_list resources SOURCES) + foreach(resource ${resource_list}) + # Strip everything before `res/...`, and map the source path to the stripped + # path in the virtual Emscripten fileystem + file(RELATIVE_PATH target_path "${CMAKE_SOURCE_DIR}" "${resource}") + list(APPEND RESP_LINK_FLAGS "--preload-file \"${resource}\"@\"${target_path}\"") + endforeach() + + if(CMAKE_BUILD_TYPE STREQUAL Debug) + list(APPEND RESP_LINK_FLAGS + --emrun --emit-symbol-map + "-s DEMANGLE_SUPPORT=1" + "-s SAFE_HEAP=1") + endif() + + target_sources(solvespace PRIVATE + platform/guihtml.cpp) + + # Pass arguments through a response file in order to avoid exceeding the maximum + # command line length (the Emscripten tools on Windows are all wrapped by batch + # scripts, and as such are subject to the CMD length limit of 8KiB). + set(resp_file_path "${CMAKE_CURRENT_BINARY_DIR}/emscripten_flags.rsp") + file(GENERATE OUTPUT "${resp_file_path}" CONTENT "$") + + # NOTE: it would be ideal if we could portably specify that linking depends on the + # response file (and the files that are specified in it), but unfortunately there + # is no way to reliably trigger a relink like that without using LINK_DEPENDS, + # which only works with the Ninja and Makefile generators. + # This means that using e.g. the Visual Studio of Xcode generators will not work + # correctly when any of the link time dependencies changes, so the output artefact + # needs to be explicitly deleted in order to trigger a relink. + set_target_properties(solvespace PROPERTIES + SUFFIX ".html" + LINK_FLAGS "@${resp_file_path}" + LINK_DEPENDS "${SHELL};${resp_file_path};${resource_list}") + + add_custom_command( + TARGET solvespace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/platform/html/solvespaceui.css + ${EXECUTABLE_OUTPUT_PATH}/solvespaceui.css + COMMENT "Copying UI stylesheet" + VERBATIM) + add_custom_command( + TARGET solvespace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/platform/html/solvespaceui.js + ${EXECUTABLE_OUTPUT_PATH}/solvespaceui.js + COMMENT "Copying UI script solvespaceui.js" + VERBATIM) + add_custom_command( + TARGET solvespace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/platform/html/filemanagerui.js + ${EXECUTABLE_OUTPUT_PATH}/filemanagerui.js + COMMENT "Copying UI script filemanagerui.sj" + VERBATIM) + elseif(USE_QT_GUI) + set_target_properties(solvespace PROPERTIES + OUTPUT_NAME solvespace-qt) + + target_sources(solvespace PRIVATE + platform/guiqt.cpp + platform/guiqt.h + ${RESOURCE_FILES}) + + target_include_directories(solvespace SYSTEM PRIVATE + ${FONTCONFIG_INCLUDE_DIRS}) + target_link_directories(solvespace PRIVATE + ${FONTCONFIG_LIBRARY_DIRS}) + target_link_libraries(solvespace PRIVATE + ${FONTCONFIG_LIBRARIES} + Qt6::Core Qt6::Gui Qt6::OpenGLWidgets Qt6::Widgets + # Qt5::Core Qt5::Gui Qt5::Widgets + ) + else() + target_sources(solvespace PRIVATE + platform/guigtk.cpp) + + target_include_directories(solvespace SYSTEM PRIVATE + ${GTKMM_INCLUDE_DIRS} + ${JSONC_INCLUDE_DIRS} + ${FONTCONFIG_INCLUDE_DIRS}) + target_link_directories(solvespace PRIVATE + ${GTKMM_LIBRARY_DIRS} + ${JSONC_LIBRARY_DIRS} + ${FONTCONFIG_LIBRARY_DIRS}) + target_link_libraries(solvespace PRIVATE + ${GTKMM_LIBRARIES} + ${JSONC_LIBRARIES} + ${FONTCONFIG_LIBRARIES}) + endif() + + if(WIN32) + if(MSVC) + set_target_properties(solvespace PROPERTIES + LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /INCREMENTAL:NO /OPT:REF") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC_VERSION) + # Hack to fix broken build with clang (not clang-cl) on Windows with CMake >= 3.22 + # which unconditionally adds "-Xlinker /MANIFEST:EMBED" to the command line + # for non-MSVC and non-MINGW compilers, and breaks the clang build where + # manifest are specified through resource files. + # See: + # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6929 + # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6534 + # https://gitlab.kitware.com/cmake/cmake/-/issues/22611 + string(REPLACE " -Xlinker /MANIFEST:EMBED" "" + CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}") + target_link_options(solvespace PRIVATE + "SHELL:-Xlinker /MANIFEST:NO") + endif() + endif() +endif() + +if(ENABLE_CLI) +# solvespace headless library + +add_library(solvespace-headless STATIC EXCLUDE_FROM_ALL + ${solvespace_core_gl_SOURCES} + platform/guinone.cpp + render/rendercairo.cpp) + +target_compile_definitions(solvespace-headless + PRIVATE HEADLESS) + +target_include_directories(solvespace-headless + INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${EIGEN3_INCLUDE_DIRS}) + +target_link_libraries(solvespace-headless + PRIVATE + solvespace-core) + +# solvespace command-line executable + + add_executable(solvespace-cli + platform/entrycli.cpp + $) + + target_link_libraries(solvespace-cli + solvespace-core + solvespace-headless) + + add_dependencies(solvespace-cli + resources) + + if(MSVC) + set_target_properties(solvespace-cli PROPERTIES + LINK_FLAGS "/INCREMENTAL:NO /OPT:REF") + endif() +endif() + +# solvespace unix package + +if(NOT (WIN32 OR APPLE OR EMSCRIPTEN)) + if(ENABLE_GUI) + install(TARGETS solvespace + COMPONENT solvespace + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() + if(ENABLE_CLI) + install(TARGETS solvespace-cli + COMPONENT solvespace + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() +endif() + +# solvespace macOS package + +if(APPLE) + set(LIBOMP_LIB_PATH ${OpenMP_CXX_INCLUDE_DIRS}/../lib/libomp.dylib) + set(LIBOMP_LINK_PATH "@executable_path/../Resources/libomp.dylib") + set(LIBOMP_LINK_PATH_UTILS "@executable_path/SolveSpace.app/Contents/Resources/libomp.dylib") + if(ENABLE_GUI) + add_custom_command(TARGET solvespace POST_BUILD + COMMAND cp -r ${CMAKE_BINARY_DIR}/Resources $ + ) + if(ENABLE_OPENMP) + execute_process(COMMAND install_name_tool -id ${LIBOMP_LINK_PATH} ${LIBOMP_LIB_PATH}) + message("FROM " ${${LIBOMP_LIB_PATH}} "TO" $/Resources/libomp.dylib) + add_custom_command(TARGET solvespace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMP_LIB_PATH} $/Resources/libomp.dylib + COMMAND install_name_tool -change ${LIBOMP_LINK_PATH} ${LIBOMP_LINK_PATH_UTILS} $ + ) + endif() + endif() + if(ENABLE_TESTS AND ENABLE_OPENMP) + add_custom_command(TARGET solvespace POST_BUILD + COMMAND install_name_tool -change ${LIBOMP_LINK_PATH} ${LIBOMP_LINK_PATH_UTILS} $) + endif() + if(ENABLE_CLI) + add_custom_command(TARGET solvespace POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMENT "Bundling executable solvespace-cli" + VERBATIM) + endif() +endif() + +add_subdirectory(slvs) diff --git a/src/bsp.cpp b/src/bsp.cpp new file mode 100644 index 0000000..50a3bb2 --- /dev/null +++ b/src/bsp.cpp @@ -0,0 +1,733 @@ +//----------------------------------------------------------------------------- +// Binary space partitioning tree, used to represent a volume in 3-space +// bounded by a triangle mesh. These are used to compute Boolean operations +// on meshes. These aren't used for anything relating to an SShell of +// ratpoly surfaces. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +SBsp2 *SBsp2::Alloc() { return (SBsp2 *)Platform::AllocTemporary(sizeof(SBsp2)); } +SBsp3 *SBsp3::Alloc() { return (SBsp3 *)Platform::AllocTemporary(sizeof(SBsp3)); } + +SBsp3 *SBsp3::FromMesh(const SMesh *m) { + SMesh mc = {}; + for(auto const &elt : m->l) { mc.AddTriangle(&elt); } + + srand(0); // Let's be deterministic, at least! + int n = mc.l.n; + while(n > 1) { + int k = rand() % n; + n--; + swap(mc.l[k], mc.l[n]); + } + + SBsp3 *bsp3 = NULL; + for(auto &elt : mc.l) { bsp3 = InsertOrCreate(bsp3, &elt, NULL); } + mc.Clear(); + return bsp3; +} + +Vector SBsp3::IntersectionWith(Vector a, Vector b) const { + double da = a.Dot(n) - d; + double db = b.Dot(n) - d; + ssassert(da*db < 0, "Expected segment to intersect BSP node"); + + double dab = (db - da); + return (a.ScaledBy(db/dab)).Plus(b.ScaledBy(-da/dab)); +} + +void SBsp3::InsertInPlane(bool pos2, STriangle *tr, SMesh *m) { + Vector tc = ((tr->a).Plus(tr->b).Plus(tr->c)).ScaledBy(1.0/3); + + bool onFace = false; + bool sameNormal = false; + double maxNormalMag = -1; + + Vector lln, trn = tr->Normal(); + + SBsp3 *ll = this; + while(ll) { + if((ll->tri).ContainsPoint(tc)) { + onFace = true; + // If the mesh contains almost-zero-area triangles, and we're + // just on the edge of one of those, then don't trust its normal. + lln = (ll->tri).Normal(); + if(lln.Magnitude() > maxNormalMag) { + sameNormal = trn.Dot(lln) > 0; + maxNormalMag = lln.Magnitude(); + } + } + ll = ll->more; + } + + if((!onFace && ((m->keepInsideOtherShell && !pos2) || + (!m->keepInsideOtherShell && pos2))) || + (onFace && ((m->keepCoplanar && m->flipNormal && !sameNormal) || + (m->keepCoplanar && !m->flipNormal && sameNormal)))) { + // We have decided that we need to keep a triangle either inside, + // outside or on the other shell. So add it and flip it if requested. + if(!(m->flipNormal)) { + m->AddTriangle(tr->meta, tr->a, tr->b, tr->c); + } else { + m->AddTriangle(tr->meta, tr->c, tr->b, tr->a); + } + } else { + m->atLeastOneDiscarded = true; + } +} + +void SBsp3::InsertHow(BspClass how, STriangle *tr, SMesh *instead) { + switch(how) { + case BspClass::POS: + if(instead && !pos) goto alt; + pos = InsertOrCreate(pos, tr, instead); + break; + + case BspClass::NEG: + if(instead && !neg) goto alt; + neg = InsertOrCreate(neg, tr, instead); + break; + + case BspClass::COPLANAR: { + if(instead) goto alt; + SBsp3 *m = Alloc(); + m->n = n; + m->d = d; + m->tri = *tr; + m->more = more; + more = m; + break; + } + } + return; + +alt: + if(((BspClass::POS == how) && !instead->keepInsideOtherShell) || + ((BspClass::NEG == how) && instead->keepInsideOtherShell)) { + // We have decided that we need to keep a triangle (either inside or + // outside the other shell. So add it and flip it if requested. + if(!(instead->flipNormal)) { + instead->AddTriangle(tr->meta, tr->a, tr->b, tr->c); + } else { + instead->AddTriangle(tr->meta, tr->c, tr->b, tr->a); + } + } else if(how == BspClass::COPLANAR) { + if(edges) { + edges->InsertTriangle(tr, instead, this); + } else { + // I suppose this actually is allowed to happen, if the coplanar + // face is the leaf, and all of its neighbors are earlier in tree? + InsertInPlane(/*pos2=*/false, tr, instead); + } + } else { + instead->atLeastOneDiscarded = true; + } +} + +class BspUtil { +public: + SBsp3 *bsp; + + size_t onc; + size_t posc; + size_t negc; + bool *isPos; + bool *isNeg; + bool *isOn; + + // triangle operations + STriangle *tr; + STriangle *btri; // also as alone + STriangle *ctri; + + // convex operations + Vector *on; + size_t npos; + size_t nneg; + Vector *vpos; // also as quad + Vector *vneg; + + static BspUtil *Alloc() { + return (BspUtil *)Platform::AllocTemporary(sizeof(BspUtil)); + } + + void AllocOn() { + on = (Vector *)Platform::AllocTemporary(sizeof(Vector) * 2); + } + + void AllocTriangle() { + btri = (STriangle *)Platform::AllocTemporary(sizeof(STriangle)); + } + + void AllocTriangles() { + btri = (STriangle *)Platform::AllocTemporary(sizeof(STriangle) * 2); + ctri = &btri[1]; + } + + void AllocQuad() { + vpos = (Vector *)Platform::AllocTemporary(sizeof(Vector) * 4); + } + + void AllocClassify(size_t size) { + // Allocate a one big piece is faster than a small ones. + isPos = (bool *)Platform::AllocTemporary(sizeof(bool) * size * 3); + isNeg = &isPos[size]; + isOn = &isNeg[size]; + } + + void AllocVertices(size_t size) { + vpos = (Vector *)Platform::AllocTemporary(sizeof(Vector) * size * 2); + vneg = &vpos[size]; + } + + void ClassifyTriangle(STriangle *tri, SBsp3 *node) { + tr = tri; + bsp = node; + onc = 0; + posc = 0; + negc = 0; + + AllocClassify(3); + + double dt[3] = { (tr->a).Dot(bsp->n), (tr->b).Dot(bsp->n), (tr->c).Dot(bsp->n) }; + double d = bsp->d; + // Count vertices in the plane + for(int i = 0; i < 3; i++) { + if(dt[i] > d + LENGTH_EPS) { + posc++; + isPos[i] = true; + } else if(dt[i] < d - LENGTH_EPS) { + negc++; + isNeg[i] = true; + } else { + onc++; + isOn[i] = true; + } + } + } + + bool ClassifyConvex(Vector *vertex, size_t cnt, SBsp3 *node, bool insertEdge) { + bsp = node; + onc = 0; + posc = 0; + negc = 0; + + AllocClassify(cnt); + AllocOn(); + + for(size_t i = 0; i < cnt; i++) { + double dt = bsp->n.Dot(vertex[i]); + isPos[i] = isNeg[i] = isOn[i] = false; + if(fabs(dt - bsp->d) < LENGTH_EPS) { + isOn[i] = true; + if(onc < 2) { + on[onc] = vertex[i]; + } + onc++; + } else if(dt > bsp->d) { + isPos[i] = true; + posc++; + } else { + isNeg[i] = true; + negc++; + } + } + + if(onc != 2 && onc != 1 && onc != 0) return false; + if(onc == 2) { + if(insertEdge) { + Vector e01 = (vertex[1]).Minus(vertex[0]); + Vector e12 = (vertex[2]).Minus(vertex[1]); + Vector out = e01.Cross(e12); + SEdge se = SEdge::From(on[0], on[1]); + bsp->edges = SBsp2::InsertOrCreateEdge(bsp->edges, &se, bsp->n, out); + } + } + return true; + } + + bool ClassifyConvexVertices(Vector *vertex, size_t cnt, bool insertEdges) { + Vector inter[2]; + int inters = 0; + + npos = 0; + nneg = 0; + + // Enlarge vertices list to consider two intersections + AllocVertices(cnt + 4); + + for(size_t i = 0; i < cnt; i++) { + size_t ip = WRAP((i + 1), cnt); + + if(isPos[i]) { + vpos[npos++] = vertex[i]; + } + if(isNeg[i]) { + vneg[nneg++] = vertex[i]; + } + if(isOn[i]) { + vneg[nneg++] = vertex[i]; + vpos[npos++] = vertex[i]; + } + if((isPos[i] && isNeg[ip]) || (isNeg[i] && isPos[ip])) { + Vector vi = bsp->IntersectionWith(vertex[i], vertex[ip]); + vpos[npos++] = vi; + vneg[nneg++] = vi; + + if(inters >= 2) return false; // triangulate: XXX shouldn't happen but does + inter[inters++] = vi; + } + } + ssassert(npos <= cnt + 1 && nneg <= cnt + 1, "Impossible"); + + if(insertEdges) { + Vector e01 = (vertex[1]).Minus(vertex[0]); + Vector e12 = (vertex[2]).Minus(vertex[1]); + Vector out = e01.Cross(e12); + if(inters == 2) { + SEdge se = SEdge::From(inter[0], inter[1]); + bsp->edges = SBsp2::InsertOrCreateEdge(bsp->edges, &se, bsp->n, out); + } else if(inters == 1 && onc == 1) { + SEdge se = SEdge::From(inter[0], on[0]); + bsp->edges = SBsp2::InsertOrCreateEdge(bsp->edges, &se, bsp->n, out); + } else if(inters == 0 && onc == 2) { + // We already handled this on-plane existing edge + } else { + return false; //triangulate; + } + } + if(nneg < 3 || npos < 3) return false; // triangulate; // XXX + + return true; + } + + void ProcessEdgeInsert() { + ssassert(onc == 2, "Impossible"); + + Vector a, b; + if (!isOn[0]) { a = tr->b; b = tr->c; } + else if(!isOn[1]) { a = tr->c; b = tr->a; } + else if(!isOn[2]) { a = tr->a; b = tr->b; } + else ssassert(false, "Impossible"); + + SEdge se = SEdge::From(a, b); + bsp->edges = SBsp2::InsertOrCreateEdge(bsp->edges, &se, bsp->n, tr->Normal()); + } + + bool SplitIntoTwoTriangles(bool insertEdge) { + ssassert(posc == 1 && negc == 1 && onc == 1, "Impossible"); + + bool bpos; + Vector a, b, c; + + // Standardize so that a is on the plane + if (isOn[0]) { a = tr->a; b = tr->b; c = tr->c; bpos = isPos[1]; + } else if(isOn[1]) { a = tr->b; b = tr->c; c = tr->a; bpos = isPos[2]; + } else if(isOn[2]) { a = tr->c; b = tr->a; c = tr->b; bpos = isPos[0]; + } else ssassert(false, "Impossible"); + + AllocTriangles(); + Vector bPc = bsp->IntersectionWith(b, c); + *btri = STriangle::From(tr->meta, a, b, bPc); + *ctri = STriangle::From(tr->meta, c, a, bPc); + + if(insertEdge) { + SEdge se = SEdge::From(a, bPc); + bsp->edges = SBsp2::InsertOrCreateEdge(bsp->edges, &se, bsp->n, tr->Normal()); + } + + return bpos; + } + + bool SplitIntoTwoPieces(bool insertEdge) { + Vector a, b, c; + if(posc == 2 && negc == 1) { + // Standardize so that a is on one side, and b and c are on the other. + if (isNeg[0]) { a = tr->a; b = tr->b; c = tr->c; + } else if(isNeg[1]) { a = tr->b; b = tr->c; c = tr->a; + } else if(isNeg[2]) { a = tr->c; b = tr->a; c = tr->b; + } else ssassert(false, "Impossible"); + } else if(posc == 1 && negc == 2) { + if (isPos[0]) { a = tr->a; b = tr->b; c = tr->c; + } else if(isPos[1]) { a = tr->b; b = tr->c; c = tr->a; + } else if(isPos[2]) { a = tr->c; b = tr->a; c = tr->b; + } else ssassert(false, "Impossible"); + } else ssassert(false, "Impossible"); + + Vector aPb = bsp->IntersectionWith(a, b); + Vector cPa = bsp->IntersectionWith(c, a); + AllocTriangle(); + AllocQuad(); + + *btri = STriangle::From(tr->meta, a, aPb, cPa); + + vpos[0] = aPb; + vpos[1] = b; + vpos[2] = c; + vpos[3] = cPa; + + if(insertEdge) { + SEdge se = SEdge::From(aPb, cPa); + bsp->edges = SBsp2::InsertOrCreateEdge(bsp->edges, &se, bsp->n, btri->Normal()); + } + + return posc == 2 && negc == 1; + } + + static SBsp3 *Triangulate(SBsp3 *bsp, const STriMeta &meta, Vector *vertex, + size_t cnt, SMesh *instead) { + for(size_t i = 0; i < cnt - 2; i++) { + STriangle tr = STriangle::From(meta, vertex[0], vertex[i + 1], vertex[i + 2]); + bsp = SBsp3::InsertOrCreate(bsp, &tr, instead); + } + return bsp; + } +}; + +void SBsp3::InsertConvexHow(BspClass how, STriMeta meta, Vector *vertex, size_t n, + SMesh *instead) { + switch(how) { + case BspClass::POS: + if(pos) { + pos = pos->InsertConvex(meta, vertex, n, instead); + return; + } + break; + + case BspClass::NEG: + if(neg) { + neg = neg->InsertConvex(meta, vertex, n, instead); + return; + } + break; + + default: ssassert(false, "Unexpected BSP insert type"); + } + + for(size_t i = 0; i < n - 2; i++) { + STriangle tr = STriangle::From(meta, + vertex[0], vertex[i+1], vertex[i+2]); + InsertHow(how, &tr, instead); + } +} + +SBsp3 *SBsp3::InsertConvex(STriMeta meta, Vector *vertex, size_t cnt, SMesh *instead) { + BspUtil *u = BspUtil::Alloc(); + if(u->ClassifyConvex(vertex, cnt, this, !instead)) { + if(u->posc == 0) { + InsertConvexHow(BspClass::NEG, meta, vertex, cnt, instead); + return this; + } + if(u->negc == 0) { + InsertConvexHow(BspClass::POS, meta, vertex, cnt, instead); + return this; + } + + if(u->ClassifyConvexVertices(vertex, cnt, !instead)) { + InsertConvexHow(BspClass::NEG, meta, u->vneg, u->nneg, instead); + InsertConvexHow(BspClass::POS, meta, u->vpos, u->npos, instead); + return this; + } + } + + // We don't handle the special case for this; do it as triangles + return BspUtil::Triangulate(this, meta, vertex, cnt, instead); +} + +SBsp3 *SBsp3::InsertOrCreate(SBsp3 *where, STriangle *tr, SMesh *instead) { + if(where == NULL) { + if(instead) { + // ruevs: I do not think this code is reachable, but in + // principle should we use instead->keepInsideOtherShell + // in place of instead->flipNormal ? + if(instead->flipNormal) { + instead->atLeastOneDiscarded = true; + } else { + instead->AddTriangle(tr->meta, tr->a, tr->b, tr->c); + } + return NULL; + } + + // Brand new node; so allocate for it, and fill us in. + SBsp3 *r = Alloc(); + r->n = (tr->Normal()).WithMagnitude(1); + r->d = (tr->a).Dot(r->n); + r->tri = *tr; + return r; + } + where->Insert(tr, instead); + return where; +} + +void SBsp3::Insert(STriangle *tr, SMesh *instead) { + BspUtil *u = BspUtil::Alloc(); + u->ClassifyTriangle(tr, this); + + // All vertices in-plane + if(u->onc == 3) { + InsertHow(BspClass::COPLANAR, tr, instead); + return; + } + + // No split required + if(u->posc == 0 || u->negc == 0) { + if(!instead && u->onc == 2) { + u->ProcessEdgeInsert(); + } + + if(u->posc > 0) { + InsertHow(BspClass::POS, tr, instead); + } else { + InsertHow(BspClass::NEG, tr, instead); + } + return; + } + + // The polygon must be split into two triangles, one above, one below. + if(u->posc == 1 && u->negc == 1 && u->onc == 1) { + if(u->SplitIntoTwoTriangles(!instead)) { + InsertHow(BspClass::POS, u->btri, instead); + InsertHow(BspClass::NEG, u->ctri, instead); + } else { + InsertHow(BspClass::POS, u->ctri, instead); + InsertHow(BspClass::NEG, u->btri, instead); + } + return; + } + + // The polygon must be split into two pieces: a triangle and a quad. + if(u->SplitIntoTwoPieces(!instead)) { + InsertConvexHow(BspClass::POS, tr->meta, u->vpos, 4, instead); + InsertHow(BspClass::NEG, u->btri, instead); + } else { + InsertConvexHow(BspClass::NEG, tr->meta, u->vpos, 4, instead); + InsertHow(BspClass::POS, u->btri, instead); + } +} + +void SBsp3::GenerateInPaintOrder(SMesh *m) const { + // Doesn't matter which branch we take if the normal has zero z + // component, so don't need a separate case for that. + if(n.z < 0) { + if(pos) pos->GenerateInPaintOrder(m); + } else { + if(neg) neg->GenerateInPaintOrder(m); + } + + const SBsp3 *flip = this; + while(flip) { + m->AddTriangle(&(flip->tri)); + flip = flip->more; + } + + if(n.z < 0) { + if(neg) neg->GenerateInPaintOrder(m); + } else { + if(pos) pos->GenerateInPaintOrder(m); + } +} + +///////////////////////////////// + +Vector SBsp2::IntersectionWith(Vector a, Vector b) const { + double da = a.Dot(no) - d; + double db = b.Dot(no) - d; + ssassert(da*db < 0, "Expected segment to intersect BSP node"); + + double dab = (db - da); + return (a.ScaledBy(db/dab)).Plus(b.ScaledBy(-da/dab)); +} + +SBsp2 *SBsp2::InsertOrCreateEdge(SBsp2 *where, SEdge *nedge, Vector nnp, Vector out) { + if(where == NULL) { + // Brand new node; so allocate for it, and fill us in. + SBsp2 *r = Alloc(); + r->np = nnp; + r->no = ((r->np).Cross((nedge->b).Minus(nedge->a))).WithMagnitude(1); + if(out.Dot(r->no) < 0) { + r->no = (r->no).ScaledBy(-1); + } + r->d = (nedge->a).Dot(r->no); + r->edge = *nedge; + return r; + } + where->InsertEdge(nedge, nnp, out); + return where; +} + +void SBsp2::InsertEdge(SEdge *nedge, Vector nnp, Vector out) { + + double dt[2] = { (nedge->a).Dot(no), (nedge->b).Dot(no) }; + + bool isPos[2] = {}, isNeg[2] = {}, isOn[2] = {}; + for(int i = 0; i < 2; i++) { + if(fabs(dt[i] - d) < LENGTH_EPS) { + isOn[i] = true; + } else if(dt[i] > d) { + isPos[i] = true; + } else { + isNeg[i] = true; + } + } + + if((isPos[0] && isPos[1])||(isPos[0] && isOn[1])||(isOn[0] && isPos[1])) { + pos = InsertOrCreateEdge(pos, nedge, nnp, out); + return; + } + if((isNeg[0] && isNeg[1])||(isNeg[0] && isOn[1])||(isOn[0] && isNeg[1])) { + neg = InsertOrCreateEdge(neg, nedge, nnp, out); + return; + } + if(isOn[0] && isOn[1]) { + SBsp2 *m = Alloc(); + + m->np = nnp; + m->no = ((m->np).Cross((nedge->b).Minus(nedge->a))).WithMagnitude(1); + if(out.Dot(m->no) < 0) { + m->no = (m->no).ScaledBy(-1); + } + m->d = (nedge->a).Dot(m->no); + m->edge = *nedge; + + m->more = more; + more = m; + return; + } + if((isPos[0] && isNeg[1]) || (isNeg[0] && isPos[1])) { + Vector aPb = IntersectionWith(nedge->a, nedge->b); + + SEdge ea = SEdge::From(nedge->a, aPb); + SEdge eb = SEdge::From(aPb, nedge->b); + + if(isPos[0]) { + pos = InsertOrCreateEdge(pos, &ea, nnp, out); + neg = InsertOrCreateEdge(neg, &eb, nnp, out); + } else { + neg = InsertOrCreateEdge(neg, &ea, nnp, out); + pos = InsertOrCreateEdge(pos, &eb, nnp, out); + } + return; + } + ssassert(false, "Impossible"); +} + +void SBsp2::InsertTriangleHow(BspClass how, STriangle *tr, SMesh *m, SBsp3 *bsp3) { + switch(how) { + case BspClass::POS: + if(pos) { + pos->InsertTriangle(tr, m, bsp3); + } else { + bsp3->InsertInPlane(/*pos2=*/true, tr, m); + } + break; + + case BspClass::NEG: + if(neg) { + neg->InsertTriangle(tr, m, bsp3); + } else { + bsp3->InsertInPlane(/*pos2=*/false, tr, m); + } + break; + + default: ssassert(false, "Unexpected BSP insert type"); + } +} + +void SBsp2::InsertTriangle(STriangle *tr, SMesh *m, SBsp3 *bsp3) { + double dt[3] = { (tr->a).Dot(no), (tr->b).Dot(no), (tr->c).Dot(no) }; + + bool isPos[3] = {}, isNeg[3] = {}, isOn[3] = {}; + int inc = 0, posc = 0, negc = 0; + for(int i = 0; i < 3; i++) { + if(fabs(dt[i] - d) < LENGTH_EPS) { + isOn[i] = true; + inc++; + } else if(dt[i] > d) { + isPos[i] = true; + posc++; + } else { + isNeg[i] = true; + negc++; + } + } + + if(inc == 3) { + // All vertices on-line; so it's a degenerate triangle, to ignore. + return; + } + + // No split required + if(posc == 0 || negc == 0) { + if(posc > 0) { + InsertTriangleHow(BspClass::POS, tr, m, bsp3); + } else { + InsertTriangleHow(BspClass::NEG, tr, m, bsp3); + } + return; + } + + // The polygon must be split into two pieces, one above, one below. + Vector a, b, c; + + if(posc == 1 && negc == 1 && inc == 1) { + bool bpos; + // Standardize so that a is on the plane + if (isOn[0]) { a = tr->a; b = tr->b; c = tr->c; bpos = isPos[1]; + } else if(isOn[1]) { a = tr->b; b = tr->c; c = tr->a; bpos = isPos[2]; + } else if(isOn[2]) { a = tr->c; b = tr->a; c = tr->b; bpos = isPos[0]; + } else ssassert(false, "Impossible"); + + Vector bPc = IntersectionWith(b, c); + STriangle btri = STriangle::From(tr->meta, a, b, bPc); + STriangle ctri = STriangle::From(tr->meta, c, a, bPc); + + if(bpos) { + InsertTriangleHow(BspClass::POS, &btri, m, bsp3); + InsertTriangleHow(BspClass::NEG, &ctri, m, bsp3); + } else { + InsertTriangleHow(BspClass::POS, &ctri, m, bsp3); + InsertTriangleHow(BspClass::NEG, &btri, m, bsp3); + } + + return; + } + + if(posc == 2 && negc == 1) { + // Standardize so that a is on one side, and b and c are on the other. + if (isNeg[0]) { a = tr->a; b = tr->b; c = tr->c; + } else if(isNeg[1]) { a = tr->b; b = tr->c; c = tr->a; + } else if(isNeg[2]) { a = tr->c; b = tr->a; c = tr->b; + } else ssassert(false, "Impossible"); + + } else if(posc == 1 && negc == 2) { + if (isPos[0]) { a = tr->a; b = tr->b; c = tr->c; + } else if(isPos[1]) { a = tr->b; b = tr->c; c = tr->a; + } else if(isPos[2]) { a = tr->c; b = tr->a; c = tr->b; + } else ssassert(false, "Impossible"); + } else ssassert(false, "Impossible"); + + Vector aPb = IntersectionWith(a, b); + Vector cPa = IntersectionWith(c, a); + + STriangle alone = STriangle::From(tr->meta, a, aPb, cPa); + STriangle quad1 = STriangle::From(tr->meta, aPb, b, c ); + STriangle quad2 = STriangle::From(tr->meta, aPb, c, cPa); + + if(posc == 2 && negc == 1) { + InsertTriangleHow(BspClass::POS, &quad1, m, bsp3); + InsertTriangleHow(BspClass::POS, &quad2, m, bsp3); + InsertTriangleHow(BspClass::NEG, &alone, m, bsp3); + } else { + InsertTriangleHow(BspClass::NEG, &quad1, m, bsp3); + InsertTriangleHow(BspClass::NEG, &quad2, m, bsp3); + InsertTriangleHow(BspClass::POS, &alone, m, bsp3); + } + + return; +} + +} // namespace SolveSpace diff --git a/src/clipboard.cpp b/src/clipboard.cpp new file mode 100644 index 0000000..8eea1a8 --- /dev/null +++ b/src/clipboard.cpp @@ -0,0 +1,527 @@ +//----------------------------------------------------------------------------- +// The clipboard that gets manipulated when the user selects Edit -> Cut, +// Copy, Paste, etc.; may contain entities only, not constraints. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void SolveSpaceUI::Clipboard::Clear() { + c.Clear(); + r.Clear(); +} + +bool SolveSpaceUI::Clipboard::ContainsEntity(hEntity he) { + if(he == Entity::NO_ENTITY) + return true; + + ClipboardRequest *cr; + for(cr = r.First(); cr; cr = r.NextAfter(cr)) { + if(cr->oldEnt == he) + return true; + + for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) { + if(cr->oldPointEnt[i] == he) + return true; + } + } + return false; +} + +hEntity SolveSpaceUI::Clipboard::NewEntityFor(hEntity he) { + if(he == Entity::NO_ENTITY) + return Entity::NO_ENTITY; + + ClipboardRequest *cr; + for(cr = r.First(); cr; cr = r.NextAfter(cr)) { + if(cr->oldEnt == he) + return cr->newReq.entity(0); + + for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) { + if(cr->oldPointEnt[i] == he) + return cr->newReq.entity(1+i); + } + } + + ssassert(false, "Expected to find entity in some clipboard request"); +} + +void GraphicsWindow::DeleteSelection() { + SK.request.ClearTags(); + SK.constraint.ClearTags(); + List *ls = &(selection); + for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) { + hRequest r = { 0 }; + if(s->entity.v && s->entity.isFromRequest()) { + r = s->entity.request(); + } + if(r.v && !r.IsFromReferences()) { + SK.request.Tag(r, 1); + } + if(s->constraint.v) { + SK.constraint.Tag(s->constraint, 1); + } + } + + SK.constraint.RemoveTagged(); + // Note that this regenerates and clears the selection, to avoid + // lingering references to the just-deleted items. + DeleteTaggedRequests(); +} + +void GraphicsWindow::CopySelection() { + SS.clipboard.Clear(); + + Entity *wrkpl = SK.GetEntity(ActiveWorkplane()); + Entity *wrkpln = SK.GetEntity(wrkpl->normal); + Vector u = wrkpln->NormalU(), + v = wrkpln->NormalV(), + n = wrkpln->NormalN(), + p = SK.GetEntity(wrkpl->point[0])->PointGetNum(); + + List *ls = &(selection); + for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) { + if(!s->entity.v) continue; + // Work only on entities that have requests that will generate them. + Entity *e = SK.GetEntity(s->entity); + bool hasDistance; + Request::Type req; + int pts; + if(!EntReqTable::GetEntityInfo(e->type, e->extraPoints, + &req, &pts, NULL, &hasDistance)) + { + if(!e->h.isFromRequest()) continue; + Request *r = SK.GetRequest(e->h.request()); + if(r->type != Request::Type::DATUM_POINT) continue; + ssassert(EntReqTable::GetEntityInfo((Entity::Type)0, e->extraPoints, + &req, &pts, NULL, &hasDistance), "No entity info"); + } + if(req == Request::Type::WORKPLANE) continue; + + ClipboardRequest cr = {}; + cr.type = req; + cr.extraPoints = e->extraPoints; + cr.style = e->style; + cr.str = e->str; + cr.font = e->font; + cr.file = e->file; + cr.construction = e->construction; + {for(int i = 0; i < pts; i++) { + Vector pt; + if(req == Request::Type::DATUM_POINT) { + pt = e->PointGetNum(); + } else { + pt = SK.GetEntity(e->point[i])->PointGetNum(); + } + pt = pt.Minus(p); + pt = pt.DotInToCsys(u, v, n); + cr.point[i] = pt; + }} + if(hasDistance) { + cr.distance = SK.GetEntity(e->distance)->DistanceGetNum(); + } + + cr.oldEnt = e->h; + for(int i = 0; i < pts; i++) { + cr.oldPointEnt[i] = e->point[i]; + } + + SS.clipboard.r.Add(&cr); + } + + for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) { + if(!s->constraint.v) continue; + + Constraint *c = SK.GetConstraint(s->constraint); + if(c->type == Constraint::Type::COMMENT) { + SS.clipboard.c.Add(c); + } + } + + for(Constraint &c : SK.constraint) { + if(!SS.clipboard.ContainsEntity(c.ptA) || + !SS.clipboard.ContainsEntity(c.ptB) || + !SS.clipboard.ContainsEntity(c.entityA) || + !SS.clipboard.ContainsEntity(c.entityB) || + !SS.clipboard.ContainsEntity(c.entityC) || + !SS.clipboard.ContainsEntity(c.entityD) || + c.type == Constraint::Type::COMMENT) { + continue; + } + SS.clipboard.c.Add(&c); + } +} + +void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { + Entity *wrkpl = SK.GetEntity(ActiveWorkplane()); + Entity *wrkpln = SK.GetEntity(wrkpl->normal); + Vector u = wrkpln->NormalU(), + v = wrkpln->NormalV(), + n = wrkpln->NormalN(), + p = SK.GetEntity(wrkpl->point[0])->PointGetNum(); + + // For arcs, reflection involves swapping the endpoints, or otherwise + // the arc gets inverted. + auto mapPoint = [scale](hEntity he) { + if(he.v == 0) return he; + + if(scale < 0) { + hRequest hr = he.request(); + Request *r = SK.GetRequest(hr); + if(r->type == Request::Type::ARC_OF_CIRCLE) { + if(he == hr.entity(2)) { + return hr.entity(3); + } else if(he == hr.entity(3)) { + return hr.entity(2); + } + } + } + return he; + }; + + ClipboardRequest *cr; + for(cr = SS.clipboard.r.First(); cr; cr = SS.clipboard.r.NextAfter(cr)) { + hRequest hr = AddRequest(cr->type, /*rememberForUndo=*/false); + Request *r = SK.GetRequest(hr); + r->extraPoints = cr->extraPoints; + r->style = cr->style; + r->str = cr->str; + r->font = cr->font; + r->file = cr->file; + r->construction = cr->construction; + // Need to regen to get the right number of points, if extraPoints + // changed. + SS.GenerateAll(SolveSpaceUI::Generate::REGEN); + SS.MarkGroupDirty(r->group); + bool hasDistance; + int i, pts; + EntReqTable::GetRequestInfo(r->type, r->extraPoints, + NULL, &pts, NULL, &hasDistance); + for(i = 0; i < pts; i++) { + Vector pt = cr->point[i]; + // We need the reflection to occur within the workplane; it may + // otherwise correspond to just a rotation as projected. + if(scale < 0) { + pt.x *= -1; + } + // Likewise the scale, which could otherwise take us out of the + // workplane. + pt = pt.ScaledBy(fabs(scale)); + pt = pt.ScaleOutOfCsys(u, v, Vector::From(0, 0, 0)); + pt = pt.Plus(p); + pt = pt.RotatedAbout(n, theta); + pt = pt.Plus(trans); + int j = (r->type == Request::Type::DATUM_POINT) ? i : i + 1; + SK.GetEntity(mapPoint(hr.entity(j)))->PointForceTo(pt); + } + if(hasDistance) { + SK.GetEntity(hr.entity(64))->DistanceForceTo( + cr->distance*fabs(scale)); + } + + cr->newReq = hr; + MakeSelected(hr.entity(0)); + for(i = 0; i < pts; i++) { + int j = (r->type == Request::Type::DATUM_POINT) ? i : i + 1; + MakeSelected(hr.entity(j)); + } + } + Constraint *cc; + for(cc = SS.clipboard.c.First(); cc; cc = SS.clipboard.c.NextAfter(cc)) { + Constraint c = {}; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + c.type = cc->type; + c.valA = cc->valA; + c.ptA = SS.clipboard.NewEntityFor(mapPoint(cc->ptA)); + c.ptB = SS.clipboard.NewEntityFor(mapPoint(cc->ptB)); + c.entityA = SS.clipboard.NewEntityFor(cc->entityA); + c.entityB = SS.clipboard.NewEntityFor(cc->entityB); + c.entityC = SS.clipboard.NewEntityFor(cc->entityC); + c.entityD = SS.clipboard.NewEntityFor(cc->entityD); + c.other = cc->other; + c.other2 = cc->other2; + c.reference = cc->reference; + c.disp = cc->disp; + c.comment = cc->comment; + bool dontAddConstraint = false; + switch(c.type) { + case Constraint::Type::COMMENT: + c.disp.offset = c.disp.offset.Plus(trans); + break; + case Constraint::Type::PT_LINE_DISTANCE: + c.valA *= scale; + break; + case Constraint::Type::PT_PT_DISTANCE: + case Constraint::Type::PROJ_PT_DISTANCE: + case Constraint::Type::DIAMETER: + c.valA *= fabs(scale); + break; + case Constraint::Type::ARC_LINE_TANGENT: { + if(scale < 0) { + // When mirroring swap the end point of the arc. The reason is that arcs are + // defined as counter-clockwise from the start point to the end point. And we + // swapped its points in mapPoint above to avoid inverting it. + c.other = !c.other; + } + break; + } + case Constraint::Type::CUBIC_LINE_TANGENT: { + // Nothing to do for CUBIC unlike the ARC_OF_CIRCLE above and below. + break; + } + case Constraint::Type::CURVE_CURVE_TANGENT: { + if(scale < 0) { + // When mirroring swap the end points of arcs. The reason is that arcs are + // defined as counter-clockwise from the start point to the end point. And we + // swapped their points in mapPoint above to avoid inverting them. + // CUBIC splines do not need this. + if(EntityBase::Type::ARC_OF_CIRCLE == SK.GetEntity(c.entityA)->type) { + c.other = !c.other; + } + if(EntityBase::Type::ARC_OF_CIRCLE == SK.GetEntity(c.entityB)->type) { + c.other2 = !c.other2; + } + } + break; + } + case Constraint::Type::HORIZONTAL: + case Constraint::Type::VERTICAL: + // When rotating 90 or 270 degrees, swap the vertical / horizontal constraints + if (EXACT(fmod(theta + (PI/2), PI) == 0)) { + if(c.type == Constraint::Type::HORIZONTAL) { + c.type = Constraint::Type::VERTICAL; + } else { + c.type = Constraint::Type::HORIZONTAL; + } + } else if (fmod(theta, PI/2) != 0) { + dontAddConstraint = true; + } + break; + default: + break; + } + if (!dontAddConstraint) { + hConstraint hc = Constraint::AddConstraint(&c, /*rememberForUndo=*/false); + if(c.type == Constraint::Type::COMMENT) { + MakeSelected(hc); + } + } + } +} + +void GraphicsWindow::MenuClipboard(Command id) { + if(id != Command::DELETE && !SS.GW.LockedInWorkplane()) { + Error(_("Cut, paste, and copy work only in a workplane.\n\n" + "Activate one with Sketch -> In Workplane.")); + return; + } + + switch(id) { + case Command::PASTE: { + SS.UndoRemember(); + Vector trans = SS.GW.projRight.ScaledBy(80/SS.GW.scale).Plus( + SS.GW.projUp .ScaledBy(40/SS.GW.scale)); + SS.GW.ClearSelection(); + SS.GW.PasteClipboard(trans, 0, 1); + break; + } + + case Command::PASTE_TRANSFORM: { + if(SS.clipboard.r.IsEmpty()) { + Error(_("Clipboard is empty; nothing to paste.")); + break; + } + + Entity *wrkpl = SK.GetEntity(SS.GW.ActiveWorkplane()); + Vector p = SK.GetEntity(wrkpl->point[0])->PointGetNum(); + SS.TW.shown.paste.times = 1; + SS.TW.shown.paste.trans = Vector::From(0, 0, 0); + SS.TW.shown.paste.theta = 0; + SS.TW.shown.paste.origin = p; + SS.TW.shown.paste.scale = 1; + SS.TW.GoToScreen(TextWindow::Screen::PASTE_TRANSFORMED); + SS.GW.ForceTextWindowShown(); + SS.ScheduleShowTW(); + break; + } + + case Command::COPY: + SS.GW.CopySelection(); + SS.GW.ClearSelection(); + break; + + case Command::CUT: + SS.UndoRemember(); + SS.GW.CopySelection(); + SS.GW.DeleteSelection(); + break; + + case Command::DELETE: + SS.UndoRemember(); + SS.GW.DeleteSelection(); + break; + + default: ssassert(false, "Unexpected menu ID"); + } +} + +bool TextWindow::EditControlDoneForPaste(const std::string &s) { + Expr *e; + switch(edit.meaning) { + case Edit::PASTE_TIMES_REPEATED: { + e = Expr::From(s, /*popUpError=*/true); + if(!e) break; + int v = (int)e->Eval(); + if(v > 0) { + shown.paste.times = v; + } else { + Error(_("Number of copies to paste must be at least one.")); + } + break; + } + case Edit::PASTE_ANGLE: + e = Expr::From(s, /*popUpError=*/true); + if(!e) break; + shown.paste.theta = WRAP_SYMMETRIC((e->Eval())*PI/180, 2*PI); + break; + + case Edit::PASTE_SCALE: { + e = Expr::From(s, /*popUpError=*/true); + double v = e->Eval(); + if(fabs(v) > 1e-6) { + shown.paste.scale = shown.paste.scale < 0 ? -v : v; + } else { + Error(_("Scale cannot be zero.")); + } + break; + } + + default: + return false; + } + return true; +} + +void TextWindow::ScreenChangePasteTransformed(int link, uint32_t v) { + switch(link) { + case 't': + SS.TW.ShowEditControl(13, ssprintf("%d", SS.TW.shown.paste.times)); + SS.TW.edit.meaning = Edit::PASTE_TIMES_REPEATED; + break; + + case 'r': + SS.TW.ShowEditControl(13, ssprintf("%.3f", SS.TW.shown.paste.theta*180/PI)); + SS.TW.edit.meaning = Edit::PASTE_ANGLE; + break; + + case 's': + SS.TW.ShowEditControl(13, ssprintf("%.3f", fabs(SS.TW.shown.paste.scale))); + SS.TW.edit.meaning = Edit::PASTE_SCALE; + break; + + case 'f': + SS.TW.shown.paste.scale *= -1; + break; + } +} + +void TextWindow::ScreenPasteTransformed(int link, uint32_t v) { + SS.GW.GroupSelection(); + switch(link) { + case 'o': + if(SS.GW.gs.points == 1 && SS.GW.gs.n == 1) { + Entity *e = SK.GetEntity(SS.GW.gs.point[0]); + SS.TW.shown.paste.origin = e->PointGetNum(); + } else { + Error(_("Select one point to define origin of rotation.")); + } + SS.GW.ClearSelection(); + break; + + case 't': + if(SS.GW.gs.points == 2 && SS.GW.gs.n == 2) { + Entity *pa = SK.GetEntity(SS.GW.gs.point[0]), + *pb = SK.GetEntity(SS.GW.gs.point[1]); + SS.TW.shown.paste.trans = + (pb->PointGetNum()).Minus(pa->PointGetNum()); + } else { + Error(_("Select two points to define translation vector.")); + } + SS.GW.ClearSelection(); + break; + + case 'g': { + if(fabs(SS.TW.shown.paste.theta) < LENGTH_EPS && + SS.TW.shown.paste.trans.Magnitude() < LENGTH_EPS && + SS.TW.shown.paste.times != 1) + { + Message(_("Transformation is identity. So all copies will be " + "exactly on top of each other.")); + } + if(SS.TW.shown.paste.times*SS.clipboard.r.n > 100) { + Error(_("Too many items to paste; split this into smaller " + "pastes.")); + break; + } + if(!SS.GW.LockedInWorkplane()) { + Error(_("No workplane active.")); + break; + } + Entity *wrkpl = SK.GetEntity(SS.GW.ActiveWorkplane()); + Entity *wrkpln = SK.GetEntity(wrkpl->normal); + Vector wn = wrkpln->NormalN(); + SS.UndoRemember(); + SS.GW.ClearSelection(); + for(int i = 0; i < SS.TW.shown.paste.times; i++) { + Vector trans = SS.TW.shown.paste.trans.ScaledBy(i+1), + origin = SS.TW.shown.paste.origin; + double theta = SS.TW.shown.paste.theta*(i+1); + // desired transformation is Q*(p - o) + o + t = + // Q*p - Q*o + o + t = Q*p + (t + o - Q*o) + Vector t = trans.Plus( + origin).Minus( + origin.RotatedAbout(wn, theta)); + + SS.GW.PasteClipboard(t, theta, SS.TW.shown.paste.scale); + } + SS.TW.GoToScreen(Screen::LIST_OF_GROUPS); + SS.ScheduleShowTW(); + break; + } + } +} + +void TextWindow::ShowPasteTransformed() { + Printf(true, "%FtPASTE TRANSFORMED%E"); + Printf(true, "%Ba %Ftrepeat%E %d time%s %Fl%Lt%f[change]%E", + shown.paste.times, (shown.paste.times == 1) ? "" : "s", + &ScreenChangePasteTransformed); + Printf(false, "%Bd %Ftrotate%E %@ degrees %Fl%Lr%f[change]%E", + shown.paste.theta*180/PI, + &ScreenChangePasteTransformed); + Printf(false, "%Ba %Ftabout pt%E (%s, %s, %s) %Fl%Lo%f[use selected]%E", + SS.MmToString(shown.paste.origin.x).c_str(), + SS.MmToString(shown.paste.origin.y).c_str(), + SS.MmToString(shown.paste.origin.z).c_str(), + &ScreenPasteTransformed); + Printf(false, "%Bd %Fttranslate%E (%s, %s, %s) %Fl%Lt%f[use selected]%E", + SS.MmToString(shown.paste.trans.x).c_str(), + SS.MmToString(shown.paste.trans.y).c_str(), + SS.MmToString(shown.paste.trans.z).c_str(), + &ScreenPasteTransformed); + Printf(false, "%Ba %Ftscale%E %@ %Fl%Ls%f[change]%E", + fabs(shown.paste.scale), + &ScreenChangePasteTransformed); + Printf(false, "%Ba %Ftmirror%E %Fd%Lf%f%s flip%E", + &ScreenChangePasteTransformed, + shown.paste.scale < 0 ? CHECK_TRUE : CHECK_FALSE); + + Printf(true, " %Fl%Lg%fpaste transformed now%E", &ScreenPasteTransformed); + + Printf(true, "(or %Fl%Ll%fcancel operation%E)", &ScreenHome); +} + +} // namespace SolveSpace diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..187b9cb --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,19 @@ +#ifndef SOLVESPACE_CONFIG_H +#define SOLVESPACE_CONFIG_H + +#define PACKAGE_VERSION "@PROJECT_VERSION@~@solvespace_GIT_HASH@" +#define GIT_HASH_URL "https://github.com/solvespace/solvespace/commit/@solvespace_GIT_HASH@" + +/* Non-OS X *nix only */ +#define UNIX_DATADIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/solvespace" + +/* Do we have the si library on win32, or libspnav on *nix? */ +#cmakedefine HAVE_SPACEWARE + +/* What OpenGL version do we use? */ +#define HAVE_OPENGL @OPENGL@ + +/* If we use GTK, can we use the native file chooser? */ +#cmakedefine HAVE_GTK_FILECHOOSERNATIVE + +#endif diff --git a/src/confscreen.cpp b/src/confscreen.cpp new file mode 100644 index 0000000..7cd86fd --- /dev/null +++ b/src/confscreen.cpp @@ -0,0 +1,592 @@ +//----------------------------------------------------------------------------- +// For the configuration screen, setup items that are not specific to the +// file being edited right now. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" +#if defined(_OPENMP) +#include +#endif + +namespace SolveSpace { + +void TextWindow::ScreenChangeColor(int link, uint32_t v) { + SS.TW.ShowEditControlWithColorPicker(13, SS.modelColor[v]); + + SS.TW.edit.meaning = Edit::COLOR; + SS.TW.edit.i = v; +} + +void TextWindow::ScreenChangeChordTolerance(int link, uint32_t v) { + SS.TW.ShowEditControl(3, ssprintf("%lg", SS.chordTol)); + SS.TW.edit.meaning = Edit::CHORD_TOLERANCE; + SS.TW.edit.i = 0; +} + +void TextWindow::ScreenChangeMaxSegments(int link, uint32_t v) { + SS.TW.ShowEditControl(3, ssprintf("%d", SS.maxSegments)); + SS.TW.edit.meaning = Edit::MAX_SEGMENTS; + SS.TW.edit.i = 0; +} + +void TextWindow::ScreenChangeExportChordTolerance(int link, uint32_t v) { + SS.TW.ShowEditControl(3, ssprintf("%lg", SS.exportChordTol)); + SS.TW.edit.meaning = Edit::CHORD_TOLERANCE; + SS.TW.edit.i = 1; +} + +void TextWindow::ScreenChangeExportMaxSegments(int link, uint32_t v) { + SS.TW.ShowEditControl(3, ssprintf("%d", SS.exportMaxSegments)); + SS.TW.edit.meaning = Edit::MAX_SEGMENTS; + SS.TW.edit.i = 1; +} + +void TextWindow::ScreenChangeGridSpacing(int link, uint32_t v) { + SS.TW.ShowEditControl(3, SS.MmToString(SS.gridSpacing, true)); + SS.TW.edit.meaning = Edit::GRID_SPACING; +} + +void TextWindow::ScreenChangeDigitsAfterDecimal(int link, uint32_t v) { + SS.TW.ShowEditControl(14, ssprintf("%d", SS.UnitDigitsAfterDecimal())); + SS.TW.edit.meaning = Edit::DIGITS_AFTER_DECIMAL; +} + +void TextWindow::ScreenChangeDigitsAfterDecimalDegree(int link, uint32_t v) { + SS.TW.ShowEditControl(14, ssprintf("%d", SS.afterDecimalDegree)); + SS.TW.edit.meaning = Edit::DIGITS_AFTER_DECIMAL_DEGREE; +} + +void TextWindow::ScreenChangeUseSIPrefixes(int link, uint32_t v) { + SS.useSIPrefixes = !SS.useSIPrefixes; + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeExportScale(int link, uint32_t v) { + SS.TW.ShowEditControl(5, ssprintf("%.3f", (double)SS.exportScale)); + SS.TW.edit.meaning = Edit::EXPORT_SCALE; +} + +void TextWindow::ScreenChangeExportOffset(int link, uint32_t v) { + SS.TW.ShowEditControl(3, SS.MmToString(SS.exportOffset, true)); + SS.TW.edit.meaning = Edit::EXPORT_OFFSET; +} + +void TextWindow::ScreenChangeArcDimDefault(int link, uint32_t v) { + SS.arcDimDefaultDiameter = !SS.arcDimDefaultDiameter; +} + +void TextWindow::ScreenChangeShowFullFilePath(int link, uint32_t v) { + SS.showFullFilePath = !SS.showFullFilePath; + SS.UpdateWindowTitles(); +} + +void TextWindow::ScreenChangeFixExportColors(int link, uint32_t v) { + SS.fixExportColors = !SS.fixExportColors; +} + +void TextWindow::ScreenChangeExportBackgroundColor(int link, uint32_t v) { + SS.exportBackgroundColor = !SS.exportBackgroundColor; +} + +void TextWindow::ScreenChangeBackFaces(int link, uint32_t v) { + SS.drawBackFaces = !SS.drawBackFaces; + SS.GW.Invalidate(/*clearPersistent=*/true); +} + +void TextWindow::ScreenChangeTurntableNav(int link, uint32_t v) { + SS.turntableNav = !SS.turntableNav; + if(SS.turntableNav) { + // If turntable nav is being turned on, align view so Z is vertical + SS.GW.AnimateOnto(Quaternion::From(Vector::From(-1, 0, 0), Vector::From(0, 0, 1)), + SS.GW.offset); + } +} + +void TextWindow::ScreenChangeCameraNav(int link, uint32_t v) { + SS.cameraNav = !SS.cameraNav; +} + +void TextWindow::ScreenChangeImmediatelyEditDimension(int link, uint32_t v) { + SS.immediatelyEditDimension = !SS.immediatelyEditDimension; + SS.GW.Invalidate(/*clearPersistent=*/true); +} + +void TextWindow::ScreenChangeShowContourAreas(int link, uint32_t v) { + SS.showContourAreas = !SS.showContourAreas; + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeCheckClosedContour(int link, uint32_t v) { + SS.checkClosedContour = !SS.checkClosedContour; + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeAutomaticLineConstraints(int link, uint32_t v) { + SS.automaticLineConstraints = !SS.automaticLineConstraints; + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeShadedTriangles(int link, uint32_t v) { + SS.exportShadedTriangles = !SS.exportShadedTriangles; + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangePwlCurves(int link, uint32_t v) { + SS.exportPwlCurves = !SS.exportPwlCurves; + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeCanvasSizeAuto(int link, uint32_t v) { + if(link == 't') { + SS.exportCanvasSizeAuto = true; + } else { + SS.exportCanvasSizeAuto = false; + } + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeCanvasSize(int link, uint32_t v) { + double d; + switch(v) { + case 0: d = SS.exportMargin.left; break; + case 1: d = SS.exportMargin.right; break; + case 2: d = SS.exportMargin.bottom; break; + case 3: d = SS.exportMargin.top; break; + + case 10: d = SS.exportCanvas.width; break; + case 11: d = SS.exportCanvas.height; break; + case 12: d = SS.exportCanvas.dx; break; + case 13: d = SS.exportCanvas.dy; break; + + default: return; + } + int col = 13; + if(v < 10) col = 11; + SS.TW.ShowEditControl(col, SS.MmToString(d, true)); + SS.TW.edit.meaning = Edit::CANVAS_SIZE; + SS.TW.edit.i = v; +} + +void TextWindow::ScreenChangeGCodeParameter(int link, uint32_t v) { + std::string buf; + switch(link) { + case 'd': + SS.TW.edit.meaning = Edit::G_CODE_DEPTH; + buf += SS.MmToString(SS.gCode.depth, true); + break; + + case 'h': + SS.TW.edit.meaning = Edit::G_CODE_SAFE_HEIGHT; + buf += SS.MmToString(SS.gCode.safeHeight, true); + break; + + case 's': + SS.TW.edit.meaning = Edit::G_CODE_PASSES; + buf += std::to_string(SS.gCode.passes); + break; + + case 'F': + SS.TW.edit.meaning = Edit::G_CODE_FEED; + buf += SS.MmToString(SS.gCode.feed, true); + break; + + case 'P': + SS.TW.edit.meaning = Edit::G_CODE_PLUNGE_FEED; + buf += SS.MmToString(SS.gCode.plungeFeed, true); + break; + } + SS.TW.ShowEditControl(14, buf); +} + +void TextWindow::ScreenChangeAutosaveInterval(int link, uint32_t v) { + SS.TW.ShowEditControl(3, std::to_string(SS.autosaveInterval)); + SS.TW.edit.meaning = Edit::AUTOSAVE_INTERVAL; +} + +void TextWindow::ScreenChangeFindConstraintTimeout(int link, uint32_t v) { + SS.TW.ShowEditControl(3, std::to_string(SS.timeoutRedundantConstr)); + SS.TW.edit.meaning = Edit::FIND_CONSTRAINT_TIMEOUT; +} + +void TextWindow::ScreenChangeAnimationSpeed(int link, uint32_t v) { + SS.TW.ShowEditControl(3, std::to_string(SS.animationSpeed)); + SS.TW.edit.meaning = Edit::ANIMATION_SPEED; +} + +void TextWindow::ShowConfiguration() { + int i; + Printf(true, "%Ft user color (r, g, b)"); + + for(i = 0; i < SS.MODEL_COLORS; i++) { + Printf(false, "%Bp #%d: %Bz %Bp (%@, %@, %@) %f%D%Ll%Fl[change]%E", + (i & 1) ? 'd' : 'a', + i, &SS.modelColor[i], + (i & 1) ? 'd' : 'a', + SS.modelColor[i].redF(), + SS.modelColor[i].greenF(), + SS.modelColor[i].blueF(), + &ScreenChangeColor, i); + } + + Printf(false, ""); + Printf(false, "%Ft chord tolerance (in percents)%E"); + Printf(false, "%Ba %@ %% %Fl%Ll%f%D[change]%E; %@ mm, %d triangles", + SS.chordTol, + &ScreenChangeChordTolerance, 0, SS.chordTolCalculated, + SK.GetGroup(SS.GW.activeGroup)->displayMesh.l.n); + Printf(false, "%Ft max piecewise linear segments%E"); + Printf(false, "%Ba %d %Fl%Ll%f[change]%E", + SS.maxSegments, + &ScreenChangeMaxSegments); + + Printf(false, ""); + Printf(false, "%Ft export chord tolerance (in mm)%E"); + Printf(false, "%Ba %@ %Fl%Ll%f%D[change]%E", + SS.exportChordTol, + &ScreenChangeExportChordTolerance, 0); + Printf(false, "%Ft export max piecewise linear segments%E"); + Printf(false, "%Ba %d %Fl%Ll%f[change]%E", + SS.exportMaxSegments, + &ScreenChangeExportMaxSegments); + + Printf(false, "%Ft snap grid spacing%E"); + Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.gridSpacing).c_str(), + &ScreenChangeGridSpacing, 0); + + Printf(false, ""); + Printf(false, "%Ft digits after decimal point to show%E"); + Printf(false, "%Ba%Ft distances: %Fd%d %Fl%Ll%f%D[change]%E (e.g. '%s')", + SS.UnitDigitsAfterDecimal(), + &ScreenChangeDigitsAfterDecimal, 0, + SS.MmToString(SS.StringToMm("1.23456789")).c_str()); + Printf(false, "%Bd%Ft angles: %Fd%d %Fl%Ll%f%D[change]%E (e.g. '%s')", + SS.afterDecimalDegree, + &ScreenChangeDigitsAfterDecimalDegree, 0, + SS.DegreeToString(1.23456789).c_str()); + Printf(false, " %Fd%f%Ll%s use SI prefixes for distances%E", + &ScreenChangeUseSIPrefixes, + SS.useSIPrefixes ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, ""); + Printf(false, "%Ft export scale factor (1:1=mm, 1:25.4=inch)"); + Printf(false, "%Ba 1:%# %Fl%Ll%f%D[change]%E", + (double)SS.exportScale, + &ScreenChangeExportScale, 0); + Printf(false, "%Ft cutter radius offset (0=no offset) "); + Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportOffset).c_str(), + &ScreenChangeExportOffset, 0); + + Printf(false, ""); + Printf(false, " %Fd%f%Ll%s export shaded 2d triangles%E", + &ScreenChangeShadedTriangles, + SS.exportShadedTriangles ? CHECK_TRUE : CHECK_FALSE); + if(fabs(SS.exportOffset) > LENGTH_EPS) { + Printf(false, " %Fd%s curves as piecewise linear%E " + "(since cutter radius is not zero)", CHECK_TRUE); + } else { + Printf(false, " %Fd%f%Ll%s export curves as piecewise linear%E", + &ScreenChangePwlCurves, + SS.exportPwlCurves ? CHECK_TRUE : CHECK_FALSE); + } + Printf(false, " %Fd%f%Ll%s fix white exported lines%E", + &ScreenChangeFixExportColors, + SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s export background color%E", + &ScreenChangeExportBackgroundColor, + SS.exportBackgroundColor ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, ""); + Printf(false, "%Ft export canvas size: " + "%f%Fd%Lf%s fixed%E " + "%f%Fd%Lt%s auto%E", + &ScreenChangeCanvasSizeAuto, + !SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE, + &ScreenChangeCanvasSizeAuto, + SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE); + + if(SS.exportCanvasSizeAuto) { + Printf(false, "%Ft (by margins around exported geometry)"); + Printf(false, "%Ba%Ft left: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportMargin.left).c_str(), &ScreenChangeCanvasSize, 0); + Printf(false, "%Bd%Ft right: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportMargin.right).c_str(), &ScreenChangeCanvasSize, 1); + Printf(false, "%Ba%Ft bottom: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportMargin.bottom).c_str(), &ScreenChangeCanvasSize, 2); + Printf(false, "%Bd%Ft top: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportMargin.top).c_str(), &ScreenChangeCanvasSize, 3); + } else { + Printf(false, "%Ft (by absolute dimensions and offsets)"); + Printf(false, "%Ba%Ft width: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportCanvas.width).c_str(), &ScreenChangeCanvasSize, 10); + Printf(false, "%Bd%Ft height: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportCanvas.height).c_str(), &ScreenChangeCanvasSize, 11); + Printf(false, "%Ba%Ft offset x: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportCanvas.dx).c_str(), &ScreenChangeCanvasSize, 12); + Printf(false, "%Bd%Ft offset y: %Fd%s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.exportCanvas.dy).c_str(), &ScreenChangeCanvasSize, 13); + } + + Printf(false, ""); + Printf(false, "%Ft exported g code parameters"); + Printf(false, "%Ba%Ft depth: %Fd%s %Fl%Ld%f[change]%E", + SS.MmToString(SS.gCode.depth).c_str(), &ScreenChangeGCodeParameter); + Printf(false, "%Bd%Ft passes: %Fd%d %Fl%Ls%f[change]%E", + SS.gCode.passes, &ScreenChangeGCodeParameter); + Printf(false, "%Ba%Ft feed: %Fd%s %Fl%LF%f[change]%E", + SS.MmToString(SS.gCode.feed).c_str(), &ScreenChangeGCodeParameter); + Printf(false, "%Bd%Ft plunge fd: %Fd%s %Fl%LP%f[change]%E", + SS.MmToString(SS.gCode.plungeFeed).c_str(), &ScreenChangeGCodeParameter); + + Printf(false, ""); + Printf(false, " %Fd%f%Ll%s draw triangle back faces in red%E", + &ScreenChangeBackFaces, + SS.drawBackFaces ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s check sketch for closed contour%E", + &ScreenChangeCheckClosedContour, + SS.checkClosedContour ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s show areas of closed contours%E", + &ScreenChangeShowContourAreas, + SS.showContourAreas ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s enable automatic line constraints%E", + &ScreenChangeAutomaticLineConstraints, + SS.automaticLineConstraints ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s use camera mouse navigation%E", &ScreenChangeCameraNav, + SS.cameraNav ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s use turntable mouse navigation%E", &ScreenChangeTurntableNav, + SS.turntableNav ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s edit newly added dimensions%E", + &ScreenChangeImmediatelyEditDimension, + SS.immediatelyEditDimension ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s arc default is diameter%E", + &ScreenChangeArcDimDefault, + SS.arcDimDefaultDiameter ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Ll%s display the full path in the title bar%E", + &ScreenChangeShowFullFilePath, SS.showFullFilePath ? CHECK_TRUE : CHECK_FALSE); + Printf(false, ""); + Printf(false, "%Ft autosave interval (in minutes)%E"); + Printf(false, "%Ba %d %Fl%Ll%f[change]%E", + SS.autosaveInterval, &ScreenChangeAutosaveInterval); + Printf(false, ""); + Printf(false, "%Ft redundant constraint timeout (in ms)%E"); + Printf(false, "%Ba %d %Fl%Ll%f[change]%E", + SS.timeoutRedundantConstr, &ScreenChangeFindConstraintTimeout); + Printf(false, ""); + Printf(false, "%Ft animation speed (in ms; 0 to disable)%E"); + Printf(false, "%Ba %d %Fl%Ll%f[change]%E", + SS.animationSpeed, &ScreenChangeAnimationSpeed); + + if(canvas) { + const char *gl_vendor, *gl_renderer, *gl_version; + canvas->GetIdent(&gl_vendor, &gl_renderer, &gl_version); + Printf(false, ""); + Printf(false, " %Ftgl vendor %E%s", gl_vendor); + Printf(false, " %Ft renderer %E%s", gl_renderer); + Printf(false, " %Ft version %E%s", gl_version); + } + + #if defined(_OPENMP) + Printf(false, " %FtOpenMP enabled"); + Printf(false, " %Ft threads %E%d", omp_get_max_threads()); + #endif +} + +bool TextWindow::EditControlDoneForConfiguration(const std::string &s) { + switch(edit.meaning) { + case Edit::LIGHT_INTENSITY: + SS.lightIntensity[edit.i] = min(1.0, max(0.0, atof(s.c_str()))); + SS.GW.Invalidate(); + break; + case Edit::LIGHT_AMBIENT: + SS.ambientIntensity = min(1.0, max(0.0, atof(s.c_str()))); + SS.GW.Invalidate(); + break; + case Edit::LIGHT_DIRECTION: { + double x, y, z; + if(sscanf(s.c_str(), "%lf, %lf, %lf", &x, &y, &z)==3) { + SS.lightDir[edit.i] = Vector::From(x, y, z); + SS.GW.Invalidate(); + } else { + Error(_("Bad format: specify coordinates as x, y, z")); + } + break; + } + case Edit::COLOR: { + Vector rgb; + if(sscanf(s.c_str(), "%lf, %lf, %lf", &rgb.x, &rgb.y, &rgb.z)==3) { + rgb = rgb.ClampWithin(0, 1); + SS.modelColor[edit.i] = RGBf(rgb.x, rgb.y, rgb.z); + } else { + Error(_("Bad format: specify color as r, g, b")); + } + break; + } + case Edit::CHORD_TOLERANCE: { + if(edit.i == 0) { + SS.chordTol = max(0.0, atof(s.c_str())); + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + } else { + SS.exportChordTol = max(0.0, atof(s.c_str())); + } + break; + } + case Edit::MAX_SEGMENTS: { + if(edit.i == 0) { + SS.maxSegments = min(1000, max(7, atoi(s.c_str()))); + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + } else { + SS.exportMaxSegments = min(1000, max(7, atoi(s.c_str()))); + } + break; + } + case Edit::CAMERA_TANGENT: { + SS.cameraTangent = (min(2.0, max(0.0, atof(s.c_str()))))/1000.0; + SS.GW.Invalidate(); + if(!SS.usePerspectiveProj) { + Message(_("The perspective factor will have no effect until you " + "enable View -> Use Perspective Projection.")); + } + break; + } + case Edit::GRID_SPACING: { + SS.gridSpacing = (float)min(1e4, max(1e-3, SS.StringToMm(s))); + SS.GW.Invalidate(); + break; + } + case Edit::EXPLODE_DISTANCE: { + SS.explodeDistance = min(1e4, max(-1e4, SS.StringToMm(s))); + SS.MarkGroupDirty(SS.GW.activeGroup, true); + break; + } + case Edit::DIGITS_AFTER_DECIMAL: { + int v = atoi(s.c_str()); + if(v < 0 || v > 8) { + Error(_("Specify between 0 and %d digits after the decimal."), 8); + } else { + SS.SetUnitDigitsAfterDecimal(v); + SS.GW.Invalidate(); + } + break; + } + case Edit::DIGITS_AFTER_DECIMAL_DEGREE: { + int v = atoi(s.c_str()); + if(v < 0 || v > 4) { + Error(_("Specify between 0 and %d digits after the decimal."), 4); + } else { + SS.afterDecimalDegree = v; + SS.GW.Invalidate(); + } + break; + } + case Edit::EXPORT_SCALE: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) { + double ev = e->Eval(); + if(fabs(ev) < 0.001 || IsReasonable(ev)) { + Error(_("Export scale must not be zero!")); + } else { + SS.exportScale = (float)ev; + } + } + break; + } + case Edit::EXPORT_OFFSET: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) { + double ev = SS.ExprToMm(e); + if(IsReasonable(ev) || ev < 0) { + Error(_("Cutter radius offset must not be negative!")); + } else { + SS.exportOffset = (float)ev; + } + } + break; + } + case Edit::CANVAS_SIZE: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(!e) { + break; + } + float d = (float)SS.ExprToMm(e); + switch(edit.i) { + case 0: SS.exportMargin.left = d; break; + case 1: SS.exportMargin.right = d; break; + case 2: SS.exportMargin.bottom = d; break; + case 3: SS.exportMargin.top = d; break; + + case 10: SS.exportCanvas.width = d; break; + case 11: SS.exportCanvas.height = d; break; + case 12: SS.exportCanvas.dx = d; break; + case 13: SS.exportCanvas.dy = d; break; + } + break; + } + case Edit::G_CODE_DEPTH: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) SS.gCode.depth = (float)SS.ExprToMm(e); + break; + } + case Edit::G_CODE_SAFE_HEIGHT: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) SS.gCode.safeHeight = (float)SS.ExprToMm(e); + break; + } + case Edit::G_CODE_PASSES: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) SS.gCode.passes = (int)(e->Eval()); + SS.gCode.passes = max(1, min(1000, SS.gCode.passes)); + break; + } + case Edit::G_CODE_FEED: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) SS.gCode.feed = (float)SS.ExprToMm(e); + break; + } + case Edit::G_CODE_PLUNGE_FEED: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) SS.gCode.plungeFeed = (float)SS.ExprToMm(e); + break; + } + case Edit::AUTOSAVE_INTERVAL: { + int interval = atoi(s.c_str()); + if(interval) { + if(interval >= 1) { + SS.autosaveInterval = interval; + SS.ScheduleAutosave(); + } else { + Error(_("Bad value: autosave interval should be positive")); + } + } else { + Error(_("Bad format: specify interval in integral minutes")); + } + break; + } + case Edit::FIND_CONSTRAINT_TIMEOUT: { + int timeout = atoi(s.c_str()); + if(timeout) { + if(timeout >= 1) { + SS.timeoutRedundantConstr = timeout; + } else { + SS.timeoutRedundantConstr = 1000; + } + } + break; + } + case Edit::ANIMATION_SPEED: { + int speed = atoi(s.c_str()); + if(speed >= 0) { + SS.animationSpeed = speed; + } else { + SS.animationSpeed = 800; + } + break; + } + + default: return false; + } + return true; +} + +} // namespace SolveSpace diff --git a/src/constraint.cpp b/src/constraint.cpp new file mode 100644 index 0000000..3075d31 --- /dev/null +++ b/src/constraint.cpp @@ -0,0 +1,994 @@ +//----------------------------------------------------------------------------- +// Implementation of the Constraint menu, to create new constraints in +// the sketch. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +std::string Constraint::DescriptionString() const { + std::string s; + switch(type) { + case Type::POINTS_COINCIDENT: s = C_("constr-name", "pts-coincident"); break; + case Type::PT_PT_DISTANCE: s = C_("constr-name", "pt-pt-distance"); break; + case Type::PT_LINE_DISTANCE: s = C_("constr-name", "pt-line-distance"); break; + case Type::PT_PLANE_DISTANCE: s = C_("constr-name", "pt-plane-distance"); break; + case Type::PT_FACE_DISTANCE: s = C_("constr-name", "pt-face-distance"); break; + case Type::PROJ_PT_DISTANCE: s = C_("constr-name", "proj-pt-pt-distance"); break; + case Type::PT_IN_PLANE: s = C_("constr-name", "pt-in-plane"); break; + case Type::PT_ON_LINE: s = C_("constr-name", "pt-on-line"); break; + case Type::PT_ON_FACE: s = C_("constr-name", "pt-on-face"); break; + case Type::EQUAL_LENGTH_LINES: s = C_("constr-name", "eq-length"); break; + case Type::EQ_LEN_PT_LINE_D: s = C_("constr-name", "eq-length-and-pt-ln-dist"); break; + case Type::EQ_PT_LN_DISTANCES: s = C_("constr-name", "eq-pt-line-distances"); break; + case Type::LENGTH_RATIO: s = C_("constr-name", "length-ratio"); break; + case Type::ARC_ARC_LEN_RATIO: s = C_("constr-name", "arc-arc-length-ratio"); break; + case Type::ARC_LINE_LEN_RATIO: s = C_("constr-name", "arc-line-length-ratio"); break; + case Type::LENGTH_DIFFERENCE: s = C_("constr-name", "length-difference"); break; + case Type::ARC_ARC_DIFFERENCE: s = C_("constr-name", "arc-arc-len-difference"); break; + case Type::ARC_LINE_DIFFERENCE: s = C_("constr-name", "arc-line-len-difference"); break; + case Type::SYMMETRIC: s = C_("constr-name", "symmetric"); break; + case Type::SYMMETRIC_HORIZ: s = C_("constr-name", "symmetric-h"); break; + case Type::SYMMETRIC_VERT: s = C_("constr-name", "symmetric-v"); break; + case Type::SYMMETRIC_LINE: s = C_("constr-name", "symmetric-line"); break; + case Type::AT_MIDPOINT: s = C_("constr-name", "at-midpoint"); break; + case Type::HORIZONTAL: s = C_("constr-name", "horizontal"); break; + case Type::VERTICAL: s = C_("constr-name", "vertical"); break; + case Type::DIAMETER: s = C_("constr-name", "diameter"); break; + case Type::PT_ON_CIRCLE: s = C_("constr-name", "pt-on-circle"); break; + case Type::SAME_ORIENTATION: s = C_("constr-name", "same-orientation"); break; + case Type::ANGLE: s = C_("constr-name", "angle"); break; + case Type::PARALLEL: s = C_("constr-name", "parallel"); break; + case Type::ARC_LINE_TANGENT: s = C_("constr-name", "arc-line-tangent"); break; + case Type::CUBIC_LINE_TANGENT: s = C_("constr-name", "cubic-line-tangent"); break; + case Type::CURVE_CURVE_TANGENT: s = C_("constr-name", "curve-curve-tangent"); break; + case Type::PERPENDICULAR: s = C_("constr-name", "perpendicular"); break; + case Type::EQUAL_RADIUS: s = C_("constr-name", "eq-radius"); break; + case Type::EQUAL_ANGLE: s = C_("constr-name", "eq-angle"); break; + case Type::EQUAL_LINE_ARC_LEN: s = C_("constr-name", "eq-line-len-arc-len"); break; + case Type::WHERE_DRAGGED: s = C_("constr-name", "lock-where-dragged"); break; + case Type::COMMENT: s = C_("constr-name", "comment"); break; + default: s = "???"; break; + } + + return ssprintf("c%03x-%s", h.v, s.c_str()); +} + +#ifndef LIBRARY + +//----------------------------------------------------------------------------- +// Delete all constraints with the specified type, entityA, ptA. We use this +// when auto-removing constraints that would become redundant. +//----------------------------------------------------------------------------- +void Constraint::DeleteAllConstraintsFor(Constraint::Type type, hEntity entityA, hEntity ptA) +{ + SK.constraint.ClearTags(); + for(auto &constraint : SK.constraint) { + ConstraintBase *ct = &constraint; + if(ct->type != type) continue; + + if(ct->entityA != entityA) continue; + if(ct->ptA != ptA) continue; + ct->tag = 1; + } + SK.constraint.RemoveTagged(); + // And no need to do anything special, since nothing + // ever depends on a constraint. But do clear the + // hover, in case the just-deleted constraint was + // hovered. + SS.GW.hover.Clear(); +} + +hConstraint Constraint::AddConstraint(Constraint *c, bool rememberForUndo) { + if(rememberForUndo) SS.UndoRemember(); + + hConstraint hc = SK.constraint.AddAndAssignId(c); + SK.GetConstraint(hc)->Generate(&SK.param); + + SS.MarkGroupDirty(c->group); + SK.GetGroup(c->group)->dofCheckOk = false; + return c->h; +} + +hConstraint Constraint::Constrain(Constraint::Type type, hEntity ptA, hEntity ptB, + hEntity entityA, hEntity entityB, + bool other, bool other2) +{ + Constraint c = {}; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + c.type = type; + c.ptA = ptA; + c.ptB = ptB; + c.entityA = entityA; + c.entityB = entityB; + c.other = other; + c.other2 = other2; + return AddConstraint(&c, /*rememberForUndo=*/false); +} + +hConstraint Constraint::TryConstrain(Constraint::Type type, hEntity ptA, hEntity ptB, + hEntity entityA, hEntity entityB, + bool other, bool other2) { + int rankBefore, rankAfter; + SolveResult howBefore = SS.TestRankForGroup(SS.GW.activeGroup, &rankBefore); + hConstraint hc = Constrain(type, ptA, ptB, entityA, entityB, other, other2); + SolveResult howAfter = SS.TestRankForGroup(SS.GW.activeGroup, &rankAfter); + // There are two cases where the constraint is clearly redundant: + // * If the group wasn't overconstrained and now it is; + // * If the group was overconstrained, and adding the constraint doesn't change rank at all. + if((howBefore == SolveResult::OKAY && howAfter == SolveResult::REDUNDANT_OKAY) || + (howBefore == SolveResult::REDUNDANT_OKAY && howAfter == SolveResult::REDUNDANT_OKAY && + rankBefore == rankAfter)) { + SK.constraint.RemoveById(hc); + hc = {}; + } + return hc; +} + +hConstraint Constraint::ConstrainCoincident(hEntity ptA, hEntity ptB) { + return Constrain(Type::POINTS_COINCIDENT, ptA, ptB, + Entity::NO_ENTITY, Entity::NO_ENTITY, /*other=*/false, /*other2=*/false); +} + +bool Constraint::ConstrainArcLineTangent(Constraint *c, Entity *line, Entity *arc, + Entity *arcendpoint) { + Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(), + l1 = SK.GetEntity(line->point[1])->PointGetNum(); + Vector a1 = SK.GetEntity(arc->point[1])->PointGetNum(), + a2 = SK.GetEntity(arc->point[2])->PointGetNum(); + if(l0.Equals(a1) || l1.Equals(a1)) { + c->other = false; + } else if(l0.Equals(a2) || l1.Equals(a2)) { + c->other = true; + } else if(nullptr != arcendpoint) { + Vector p = arcendpoint->PointGetNum(); + if(a1.Equals(p)) { + c->other = false; + } else if(a2.Equals(p)) { + c->other = true; + } else { + Error(_("The point you selected does not belong to the arc. " + "The arc and line segment do not share an end point.\n\n" + "Select the end point of the arc at which you want " + "it to be tangent to the line.")); + return false; + } + } else { + Error(_("The tangent arc and line segment must share an " + "endpoint. Constrain them with Constrain -> " + "On Point before constraining tangent.\n\n" + "Alternatively select the end point of the arc " + "at which you want it to be tangent to the line.")); + return false; + } + return true; +} + +bool Constraint::ConstrainCubicLineTangent(Constraint *c, Entity *line, Entity *cubic, + Entity *curveendpoint) { + Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(), + l1 = SK.GetEntity(line->point[1])->PointGetNum(); + Vector as = cubic->CubicGetStartNum(), + af = cubic->CubicGetFinishNum(); + + if(l0.Equals(as) || l1.Equals(as)) { + c->other = false; + } else if(l0.Equals(af) || l1.Equals(af)) { + c->other = true; + } else if(nullptr != curveendpoint) { + Vector p = curveendpoint->PointGetNum(); + if(as.Equals(p)) { + c->other = false; + } else if(af.Equals(p)) { + c->other = true; + } else { + Error(_("The point you selected is not an end point of the cubic spline. " + "The spline and line segment do not share an end point.\n\n" + "Select the end point of the spline at which you want " + "it to be tangent to the line.")); + return false; + } + } else { + Error(_("The tangent cubic spline and line segment must share an " + "endpoint. Constrain them with Constrain -> " + "On Point before constraining tangent.\n\n" + "Alternatively select the end point of the cubic spline " + "at which you want it to be tangent to the line.")); + return false; + } + return true; +} + +bool Constraint::ConstrainCurveCurveTangent(Constraint *c, Entity *eA, Entity *eB, Entity *epA, + Entity *epB) { + Vector as = eA->EndpointStart(), + af = eA->EndpointFinish(), + bs = eB->EndpointStart(), + bf = eB->EndpointFinish(); + if(as.Equals(bs)) { + c->other = false; + c->other2 = false; + } else if(as.Equals(bf)) { + c->other = false; + c->other2 = true; + } else if(af.Equals(bs)) { + c->other = true; + c->other2 = false; + } else if(af.Equals(bf)) { + c->other = true; + c->other2 = true; + } else if((nullptr != epA) && (nullptr != epB)) { + Vector pa = epA->PointGetNum(), + pb = epB->PointGetNum(); + if((as.Equals(pa) && bs.Equals(pb)) || (as.Equals(pb) && bs.Equals(pa))) { + c->other = false; + c->other2 = false; + } else if((as.Equals(pa) && bf.Equals(pb)) || (as.Equals(pb) && bf.Equals(pa))) { + c->other = false; + c->other2 = true; + } else if((af.Equals(pa) && bs.Equals(pb)) || (af.Equals(pb) && bs.Equals(pa))) { + c->other = true; + c->other2 = false; + } else if((af.Equals(pa) && bf.Equals(pb)) || (af.Equals(pb) && bf.Equals(pa))) { + c->other = true; + c->other2 = true; + } else { + Error(_("The points you selected are not end points of the two curves. " + "The curves do not share an end point.\n\n" + "Select the end points of both curves at which you want " + "them to be tangent to each other.")); + return false; + } + } else { + Error(_("The curves must share an endpoint. Constrain them " + "with Constrain -> On Point before constraining " + "tangent.\n\n" + "Alternatively select the end points of both " + "curves at which you want the curves to be tangent.")); + return false; + } + return true; +} + +void Constraint::MenuConstrain(Command id) { + std::vector newcons; + + Constraint c = {}; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + + switch(id) { + case Command::DISTANCE_DIA: + case Command::REF_DISTANCE: { + if(gs.points == 2 && gs.n == 2) { + c.type = Type::PT_PT_DISTANCE; + c.ptA = gs.point[0]; + c.ptB = gs.point[1]; + } else if(gs.lineSegments == 1 && gs.n == 1) { + c.type = Type::PT_PT_DISTANCE; + Entity *e = SK.GetEntity(gs.entity[0]); + c.ptA = e->point[0]; + c.ptB = e->point[1]; + } else if(gs.vectors == 1 && gs.points == 2 && gs.n == 3) { + c.type = Type::PROJ_PT_DISTANCE; + c.ptA = gs.point[0]; + c.ptB = gs.point[1]; + c.entityA = gs.vector[0]; + } else if(gs.workplanes == 1 && gs.points == 1 && gs.n == 2) { + c.type = Type::PT_PLANE_DISTANCE; + c.ptA = gs.point[0]; + c.entityA = gs.entity[0]; + } else if(gs.lineSegments == 1 && gs.points == 1 && gs.n == 2) { + c.type = Type::PT_LINE_DISTANCE; + c.ptA = gs.point[0]; + c.entityA = gs.entity[0]; + } else if(gs.faces == 1 && gs.points == 1 && gs.n == 2) { + c.type = Type::PT_FACE_DISTANCE; + c.ptA = gs.point[0]; + c.entityA = gs.face[0]; + } else if(gs.circlesOrArcs == 1 && gs.n == 1) { + c.type = Type::DIAMETER; + c.entityA = gs.entity[0]; + Entity* arc = SK.GetEntity(gs.entity[0]); + if ((arc->type == EntityBase::Type::ARC_OF_CIRCLE) + && (!SS.arcDimDefaultDiameter)) + { + c.other = true; + } + } else { + Error(_("Bad selection for distance / diameter constraint. This " + "constraint can apply to:\n\n" + " * two points (distance between points)\n" + " * a line segment (length)\n" + " * two points and a line segment or normal (projected distance)\n" + " * a workplane and a point (minimum distance)\n" + " * a line segment and a point (minimum distance)\n" + " * a plane face and a point (minimum distance)\n" + " * a circle or an arc (diameter)\n")); + return; + } + if(c.type == Type::PT_PT_DISTANCE || c.type == Type::PROJ_PT_DISTANCE) { + Vector n = SS.GW.projRight.Cross(SS.GW.projUp); + Vector a = SK.GetEntity(c.ptA)->PointGetNum(); + Vector b = SK.GetEntity(c.ptB)->PointGetNum(); + c.disp.offset = n.Cross(a.Minus(b)); + c.disp.offset = (c.disp.offset).WithMagnitude(50/SS.GW.scale); + } else { + c.disp.offset = Vector::From(0, 0, 0); + } + + if(id == Command::REF_DISTANCE) { + c.reference = true; + } + + c.valA = 0; + c.ModifyToSatisfy(); + AddConstraint(&c); + newcons.push_back(c); + break; + } + + case Command::ON_ENTITY: + if(gs.points >= 2 && gs.points == gs.n) { + c.type = Type::POINTS_COINCIDENT; + c.ptA = gs.point[0]; + for(int k = 1; k < gs.points; k++) { + c.ptB = gs.point[k]; + newcons.push_back(c); + } + } else if(gs.points == 1 && gs.workplanes == 1 && gs.n == 2) { + c.type = Type::PT_IN_PLANE; + c.ptA = gs.point[0]; + c.entityA = gs.entity[0]; + newcons.push_back(c); + } else if(gs.points == 1 && gs.lineSegments == 1 && gs.n == 2) { + c.type = Type::PT_ON_LINE; + c.ptA = gs.point[0]; + c.entityA = gs.entity[0]; + newcons.push_back(c); + } else if(gs.points == 1 && gs.circlesOrArcs == 1 && gs.n == 2) { + c.type = Type::PT_ON_CIRCLE; + c.ptA = gs.point[0]; + c.entityA = gs.entity[0]; + newcons.push_back(c); + } else if(gs.points == 1 && gs.faces >= 1 && gs.n == gs.points+gs.faces) { + c.type = Type::PT_ON_FACE; + c.ptA = gs.point[0]; + for (int k=0; k= 2 && gs.lineSegments == gs.n) { + c.type = Type::EQUAL_LENGTH_LINES; + c.entityA = gs.entity[0]; + for (std::vector::size_type k = 1;k < gs.entity.size(); ++k){ + c.entityB = gs.entity[k]; + newcons.push_back(c); + } + } else if(gs.lineSegments == 2 && gs.points == 2 && gs.n == 4) { + c.type = Type::EQ_PT_LN_DISTANCES; + c.entityA = gs.entity[0]; + c.ptA = gs.point[0]; + c.entityB = gs.entity[1]; + c.ptB = gs.point[1]; + newcons.push_back(c); + } else if(gs.lineSegments == 1 && gs.points == 2 && gs.n == 3) { + // The same line segment for the distances, but different + // points. + c.type = Type::EQ_PT_LN_DISTANCES; + c.entityA = gs.entity[0]; + c.ptA = gs.point[0]; + c.entityB = gs.entity[0]; + c.ptB = gs.point[1]; + newcons.push_back(c); + } else if(gs.lineSegments == 2 && gs.points == 1 && gs.n == 3) { + c.type = Type::EQ_LEN_PT_LINE_D; + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + c.ptA = gs.point[0]; + newcons.push_back(c); + } else if(gs.circlesOrArcs >= 2 && gs.circlesOrArcs == gs.n) { + c.type = Type::EQUAL_RADIUS; + c.entityA = gs.entity[0]; + for (std::vector::size_type k = 1;k < gs.entity.size(); ++k){ + c.entityB = gs.entity[k]; + newcons.push_back(c); + } + } else if(gs.arcs == 1 && gs.lineSegments == 1 && gs.n == 2) { + c.type = Type::EQUAL_LINE_ARC_LEN; + if(SK.GetEntity(gs.entity[0])->type == Entity::Type::ARC_OF_CIRCLE) { + c.entityA = gs.entity[1]; + c.entityB = gs.entity[0]; + } else { + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + newcons.push_back(c); + } else { + Error(_("Bad selection for equal length / radius constraint. " + "This constraint can apply to:\n\n" + " * two or more line segments (equal length)\n" + " * two line segments and two points " + "(equal point-line distances)\n" + " * a line segment and two points " + "(equal point-line distances)\n" + " * a line segment, and a point and line segment " + "(point-line distance equals length)\n" + " * two or more circles or arcs (equal radius)\n" + " * a line segment and an arc " + "(line segment length equals arc length)\n")); + return; + } + SS.UndoRemember(); + for (auto&& nc : newcons){ + if(nc.type == Type::EQUAL_ANGLE) { + // Infer the nearest supplementary angle from the sketch. + Vector a1 = SK.GetEntity(c.entityA)->VectorGetNum(), + b1 = SK.GetEntity(c.entityB)->VectorGetNum(), + a2 = SK.GetEntity(c.entityC)->VectorGetNum(), + b2 = SK.GetEntity(c.entityD)->VectorGetNum(); + double d1 = a1.Dot(b1), d2 = a2.Dot(b2); + + if(d1*d2 < 0) { + nc.other = true; + } + } + AddConstraint(&nc, /*rememberForUndo=*/false); + } + break; + + case Command::RATIO: + if(gs.lineSegments == 2 && gs.n == 2) { + c.type = Type::LENGTH_RATIO; + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + else if(gs.arcs == 2 && gs.n == 2) { + c.type = Type::ARC_ARC_LEN_RATIO; + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + else if(gs.lineSegments == 1 && gs.arcs == 1 && gs.n == 2) { + c.type = Type::ARC_LINE_LEN_RATIO; + if(SK.GetEntity(gs.entity[0])->type == Entity::Type::ARC_OF_CIRCLE) { + c.entityA = gs.entity[1]; + c.entityB = gs.entity[0]; + } else { + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + } else { + Error(_("Bad selection for length ratio constraint. This " + "constraint can apply to:\n\n" + " * two line segments\n" + " * two arcs\n" + " * one arc and one line segment\n")); + return; + } + + c.valA = 0; + c.ModifyToSatisfy(); + AddConstraint(&c); + newcons.push_back(c); + break; + + case Command::DIFFERENCE: + if(gs.lineSegments == 2 && gs.n == 2) { + c.type = Type::LENGTH_DIFFERENCE; + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + else if(gs.arcs == 2 && gs.n == 2) { + c.type = Type::ARC_ARC_DIFFERENCE; + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + else if(gs.lineSegments == 1 && gs.arcs == 1 && gs.n == 2) { + c.type = Type::ARC_LINE_DIFFERENCE; + if(SK.GetEntity(gs.entity[0])->type == Entity::Type::ARC_OF_CIRCLE) { + c.entityA = gs.entity[1]; + c.entityB = gs.entity[0]; + } else { + c.entityA = gs.entity[0]; + c.entityB = gs.entity[1]; + } + } else { + Error(_("Bad selection for length difference constraint. This " + "constraint can apply to:\n\n" + " * two line segments\n" + " * two arcs\n" + " * one arc and one line segment\n")); + return; + } + + c.valA = 0; + c.ModifyToSatisfy(); + AddConstraint(&c); + newcons.push_back(c); + break; + + case Command::AT_MIDPOINT: + if(gs.lineSegments == 1 && gs.points == 1 && gs.n == 2) { + c.type = Type::AT_MIDPOINT; + c.entityA = gs.entity[0]; + c.ptA = gs.point[0]; + + // If a point is at-midpoint, then no reason to also constrain + // it on-line; so auto-remove that. Handle as one undo group. + SS.UndoRemember(); + DeleteAllConstraintsFor(Type::PT_ON_LINE, c.entityA, c.ptA); + AddConstraint(&c, /*rememberForUndo=*/false); + newcons.push_back(c); + break; + } else if(gs.lineSegments == 1 && gs.workplanes == 1 && gs.n == 2) { + c.type = Type::AT_MIDPOINT; + int i = SK.GetEntity(gs.entity[0])->IsWorkplane() ? 1 : 0; + c.entityA = gs.entity[i]; + c.entityB = gs.entity[1-i]; + AddConstraint(&c); + newcons.push_back(c); + } else { + Error(_("Bad selection for at midpoint constraint. This " + "constraint can apply to:\n\n" + " * a line segment and a point " + "(point at midpoint)\n" + " * a line segment and a workplane " + "(line's midpoint on plane)\n")); + return; + } + + break; + + case Command::SYMMETRIC: + if(gs.points == 2 && + ((gs.workplanes == 1 && gs.n == 3) || + (gs.n == 2))) + { + if(gs.entities > 0) + c.entityA = gs.entity[0]; + c.ptA = gs.point[0]; + c.ptB = gs.point[1]; + c.type = Type::SYMMETRIC; + } else if(gs.lineSegments == 1 && + ((gs.workplanes == 1 && gs.n == 2) || + (gs.n == 1))) + { + Entity *line; + if(SK.GetEntity(gs.entity[0])->IsWorkplane()) { + line = SK.GetEntity(gs.entity[1]); + c.entityA = gs.entity[0]; + } else { + line = SK.GetEntity(gs.entity[0]); + } + c.ptA = line->point[0]; + c.ptB = line->point[1]; + c.type = Type::SYMMETRIC; + } else if(SS.GW.LockedInWorkplane() + && gs.lineSegments == 2 && gs.n == 2) + { + Entity *l0 = SK.GetEntity(gs.entity[0]), + *l1 = SK.GetEntity(gs.entity[1]); + + if((l1->group != SS.GW.activeGroup) || + (l1->construction && !(l0->construction))) + { + swap(l0, l1); + } + c.ptA = l1->point[0]; + c.ptB = l1->point[1]; + c.entityA = l0->h; + c.type = Type::SYMMETRIC_LINE; + } else if(SS.GW.LockedInWorkplane() + && gs.lineSegments == 1 && gs.points == 2 && gs.n == 3) + { + c.ptA = gs.point[0]; + c.ptB = gs.point[1]; + c.entityA = gs.entity[0]; + c.type = Type::SYMMETRIC_LINE; + } else { + Error(_("Bad selection for symmetric constraint. This constraint " + "can apply to:\n\n" + " * two points or a line segment " + "(symmetric about workplane's coordinate axis)\n" + " * line segment, and two points or a line segment " + "(symmetric about line segment)\n" + " * workplane, and two points or a line segment " + "(symmetric about workplane)\n")); + return; + } + // We may remove constraints so remember manually + if(c.entityA == Entity::NO_ENTITY) { + // Horizontal / vertical symmetry, implicit symmetry plane + // normal to the workplane + if(c.workplane == Entity::FREE_IN_3D) { + Error(_("A workplane must be active when constraining " + "symmetric without an explicit symmetry plane.")); + return; + } + Vector pa = SK.GetEntity(c.ptA)->PointGetNum(); + Vector pb = SK.GetEntity(c.ptB)->PointGetNum(); + Vector dp = pa.Minus(pb); + EntityBase *norm = SK.GetEntity(c.workplane)->Normal();; + Vector u = norm->NormalU(), v = norm->NormalV(); + if(fabs(dp.Dot(u)) > fabs(dp.Dot(v))) { + c.type = Type::SYMMETRIC_HORIZ; + } else { + c.type = Type::SYMMETRIC_VERT; + } + if(gs.lineSegments == 1) { + // If this line segment is already constrained horiz or + // vert, then auto-remove that redundant constraint. + // Handle as one undo group. + SS.UndoRemember(); + DeleteAllConstraintsFor(Type::HORIZONTAL, (gs.entity[0]), + Entity::NO_ENTITY); + DeleteAllConstraintsFor(Type::VERTICAL, (gs.entity[0]), + Entity::NO_ENTITY); + AddConstraint(&c, /*rememberForUndo=*/false); + newcons.push_back(c); + break; + } + } + AddConstraint(&c); + newcons.push_back(c); + break; + + case Command::VERTICAL: + case Command::HORIZONTAL: { + if(id == Command::HORIZONTAL) { + c.type = Type::HORIZONTAL; + } else { + c.type = Type::VERTICAL; + } + if(c.workplane == Entity::FREE_IN_3D) { + Error(_("Activate a workplane (with Sketch -> In Workplane) before " + "applying a horizontal or vertical constraint.")); + return; + } + if(gs.lineSegments > 0 && gs.lineSegments == gs.n) { + for (auto enti : gs.entity){ + c.entityA = enti; + newcons.push_back(c); + } + } else if(gs.points >= 2 && gs.n == gs.points) { + c.ptA = gs.point[0]; + for (int k = 1; kgroup == SS.GW.activeGroup) { + swap(nref, nfree); + } + if(nfree->group == SS.GW.activeGroup && nref->group != SS.GW.activeGroup) { + // nfree is free, and nref is locked (since it came from a + // previous group); so let's force nfree aligned to nref, + // and make convergence easy + Vector ru = nref ->NormalU(), rv = nref ->NormalV(); + Vector fu = nfree->NormalU(), fv = nfree->NormalV(); + + if(fabs(fu.Dot(ru)) < fabs(fu.Dot(rv))) { + // There might be an odd*90 degree rotation about the + // normal vector; allow that, since the numerical + // constraint does + swap(ru, rv); + } + fu = fu.Dot(ru) > 0 ? ru : ru.ScaledBy(-1); + fv = fv.Dot(rv) > 0 ? rv : rv.ScaledBy(-1); + + nfree->NormalForceTo(Quaternion::From(fu, fv)); + } + AddConstraint(&c, /*rememberForUndo=*/false); + newcons.push_back(c); + break; + } + + case Command::OTHER_ANGLE: + if(gs.constraints == 1 && gs.n == 0) { + Constraint *c = SK.GetConstraint(gs.constraint[0]); + if(c->type == Type::ANGLE) { + SS.UndoRemember(); + c->other = !(c->other); + c->ModifyToSatisfy(); + break; + } + if(c->type == Type::EQUAL_ANGLE) { + SS.UndoRemember(); + c->other = !(c->other); + SS.MarkGroupDirty(c->group); + break; + } + } + Error(_("Must select an angle constraint.")); + return; + + case Command::REFERENCE: + if(gs.constraints == 1 && gs.n == 0) { + Constraint *c = SK.GetConstraint(gs.constraint[0]); + if(c->HasLabel() && c->type != Type::COMMENT) { + SS.UndoRemember(); + (c->reference) = !(c->reference); + SS.MarkGroupDirty(c->group, /*onlyThis=*/true); + break; + } + } + Error(_("Must select a constraint with associated label.")); + return; + + case Command::ANGLE: + case Command::REF_ANGLE: { + if(gs.vectors == 3 && gs.n == 3) { + c.type = Type::EQUAL_ANGLE; + c.entityA = gs.vector[0]; + c.entityB = gs.vector[1]; + c.entityC = gs.vector[1]; + c.entityD = gs.vector[2]; + } else if(gs.vectors == 4 && gs.n == 4) { + c.type = Type::EQUAL_ANGLE; + c.entityA = gs.vector[0]; + c.entityB = gs.vector[1]; + c.entityC = gs.vector[2]; + c.entityD = gs.vector[3]; + } else if(gs.vectors == 2 && gs.n == 2) { + c.type = Type::ANGLE; + c.entityA = gs.vector[0]; + c.entityB = gs.vector[1]; + c.valA = 0; + } else { + Error(_("Bad selection for angle constraint. This constraint " + "can apply to:\n\n" + "Angle between:\n" + " * two line segments\n" + " * a line segment and a normal\n" + " * two normals\n" + "\nEqual angles:\n" + " * four line segments or normals " + "(equal angle between A,B and C,D)\n" + " * three line segments or normals " + "(equal angle between A,B and B,C)\n")); + return; + } + + Entity *ea = SK.GetEntity(c.entityA), + *eb = SK.GetEntity(c.entityB); + if(ea->type == Entity::Type::LINE_SEGMENT && + eb->type == Entity::Type::LINE_SEGMENT) + { + Vector a0 = SK.GetEntity(ea->point[0])->PointGetNum(), + a1 = SK.GetEntity(ea->point[1])->PointGetNum(), + b0 = SK.GetEntity(eb->point[0])->PointGetNum(), + b1 = SK.GetEntity(eb->point[1])->PointGetNum(); + if(a0.Equals(b0) || a1.Equals(b1)) { + // okay, vectors should be drawn in same sense + } else if(a0.Equals(b1) || a1.Equals(b0)) { + // vectors are in opposite sense + c.other = true; + } else { + // no shared point; not clear which intersection to draw + } + } + + if(id == Command::REF_ANGLE) { + c.reference = true; + } + + c.ModifyToSatisfy(); + AddConstraint(&c); + newcons.push_back(c); + break; + } + + case Command::PARALLEL: + if(gs.faces == 2 && gs.n == 2) { + c.type = Type::PARALLEL; + c.entityA = gs.face[0]; + c.entityB = gs.face[1]; + newcons.push_back(c); + } else if(gs.vectors > 1 && gs.vectors == gs.n) { + c.type = Type::PARALLEL; + c.entityA = gs.vector[0]; + for (std::vector::size_type k = 1; k < gs.vector.size();++k ){ + c.entityB = gs.vector[k]; + newcons.push_back(c); + } + } else if(gs.lineSegments == 1 && gs.arcs == 1 && + (gs.n == 2 || (gs.points == 1 && gs.n == 3))) { + Entity *line = SK.GetEntity(gs.entity[0]), + *arc = SK.GetEntity(gs.entity[1]); + if(line->type == Entity::Type::ARC_OF_CIRCLE) { + swap(line, arc); + } + if(!ConstrainArcLineTangent( + &c, line, arc, (1 == gs.points) ? SK.GetEntity(gs.point[0]) : nullptr)) { + return; + } + c.type = Type::ARC_LINE_TANGENT; + c.entityA = arc->h; + c.entityB = line->h; + newcons.push_back(c); + } else if(gs.lineSegments == 1 && gs.cubics == 1 && + (gs.n == 2 || (gs.points == 1 && gs.n == 3))) { + Entity *line = SK.GetEntity(gs.entity[0]), + *cubic = SK.GetEntity(gs.entity[1]); + if(line->type == Entity::Type::CUBIC) { + swap(line, cubic); + } + if(!ConstrainCubicLineTangent( + &c, line, cubic, (1 == gs.points) ? SK.GetEntity(gs.point[0]) : nullptr)) { + return; + } + c.type = Type::CUBIC_LINE_TANGENT; + c.entityA = cubic->h; + c.entityB = line->h; + newcons.push_back(c); + } else if(gs.cubics + gs.arcs == 2 && (gs.n == 2 || (gs.points == 2 && gs.n == 4))) { + if(!SS.GW.LockedInWorkplane()) { + Error(_("Curve-curve tangency must apply in workplane.")); + return; + } + Entity *eA = SK.GetEntity(gs.entity[0]), + *eB = SK.GetEntity(gs.entity[1]); + if(!ConstrainCurveCurveTangent( + &c, eA, eB, (2 == gs.points) ? SK.GetEntity(gs.point[0]) : nullptr, + (2 == gs.points) ? SK.GetEntity(gs.point[1]) : nullptr)) { + return; + } + c.type = Type::CURVE_CURVE_TANGENT; + c.entityA = eA->h; + c.entityB = eB->h; + newcons.push_back(c); + } else { + Error(_("Bad selection for parallel / tangent constraint. This " + "constraint can apply to:\n\n" + " * two faces\n" + " * two or more line segments (parallel)\n" + " * one or more line segments and one or more normals (parallel)\n" + " * two or more normals (parallel)\n" + " * two line segments, arcs, or beziers, that share " + "an endpoint (tangent)\n" + " * two line segments, arcs, or beziers, that do not share " + "an endpoint and the end point(s) of the curve(s) (tangent)\n")); + return; + } + SS.UndoRemember(); + for (auto&& nc:newcons) + AddConstraint(&nc, /*rememberForUndo=*/false); + break; + + case Command::PERPENDICULAR: + if(gs.faces == 2 && gs.n == 2) { + c.type = Type::PERPENDICULAR; + c.entityA = gs.face[0]; + c.entityB = gs.face[1]; + } else if(gs.vectors == 2 && gs.n == 2) { + c.type = Type::PERPENDICULAR; + c.entityA = gs.vector[0]; + c.entityB = gs.vector[1]; + } else { + Error(_("Bad selection for perpendicular constraint. This " + "constraint can apply to:\n\n" + " * two faces\n" + " * two line segments\n" + " * a line segment and a normal\n" + " * two normals\n")); + return; + } + AddConstraint(&c); + newcons.push_back(c); + break; + + case Command::WHERE_DRAGGED: + if(gs.points == 1 && gs.n == 1) { + c.type = Type::WHERE_DRAGGED; + c.ptA = gs.point[0]; + } else { + Error(_("Bad selection for lock point where dragged constraint. " + "This constraint can apply to:\n\n" + " * a point\n")); + return; + } + AddConstraint(&c); + newcons.push_back(c); + break; + + case Command::COMMENT: + if(gs.points == 1 && gs.n == 1) { + c.type = Type::COMMENT; + c.ptA = gs.point[0]; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + c.comment = _("NEW COMMENT -- DOUBLE-CLICK TO EDIT"); + AddConstraint(&c); + newcons.push_back(c); + } else { + SS.GW.pending.operation = GraphicsWindow::Pending::COMMAND; + SS.GW.pending.command = Command::COMMENT; + SS.GW.pending.description = _("click center of comment text"); + SS.ScheduleShowTW(); + } + break; + + default: ssassert(false, "Unexpected menu ID"); + } + for (auto nc:newcons){ + for(const Constraint &cc : SK.constraint) { + if(nc.h != cc.h && nc.Equals(cc)) { + // Oops, we already have this exact constraint. Remove the one we just added. + SK.constraint.RemoveById(nc.h); + SS.GW.ClearSelection(); + // And now select the old one, to give feedback. + SS.GW.MakeSelected(cc.h); + return; + } + } + + if(SK.constraint.FindByIdNoOops(nc.h)) { + Constraint *constraint = SK.GetConstraint(nc.h); + if(SS.TestRankForGroup(nc.group) == SolveResult::REDUNDANT_OKAY && + !SK.GetGroup(SS.GW.activeGroup)->allowRedundant && + constraint->HasLabel()) { + constraint->reference = true; + } + } + + if((id == Command::DISTANCE_DIA || id == Command::ANGLE || + id == Command::RATIO || id == Command::DIFFERENCE) && + SS.immediatelyEditDimension) { + SS.GW.EditConstraint(nc.h); + } + } + + SS.GW.ClearSelection(); +} + +#endif /* ! LIBRARY */ + +} // namespace SolveSpace diff --git a/src/constrainteq.cpp b/src/constrainteq.cpp new file mode 100644 index 0000000..644e480 --- /dev/null +++ b/src/constrainteq.cpp @@ -0,0 +1,1062 @@ +//----------------------------------------------------------------------------- +// Given a constraint, generate one or more equations in our symbolic algebra +// system to represent that constraint; also various geometric helper +// functions for that. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +const hConstraint ConstraintBase::NO_CONSTRAINT = { 0 }; + +bool ConstraintBase::HasLabel() const { + switch(type) { + case Type::PT_LINE_DISTANCE: + case Type::PT_PLANE_DISTANCE: + case Type::PT_FACE_DISTANCE: + case Type::PT_PT_DISTANCE: + case Type::PROJ_PT_DISTANCE: + case Type::DIAMETER: + case Type::LENGTH_RATIO: + case Type::ARC_ARC_LEN_RATIO: + case Type::ARC_LINE_LEN_RATIO: + case Type::LENGTH_DIFFERENCE: + case Type::ARC_ARC_DIFFERENCE: + case Type::ARC_LINE_DIFFERENCE: + case Type::ANGLE: + case Type::COMMENT: + return true; + + default: + return false; + } +} + +bool ConstraintBase::IsProjectible() const { + switch(type) { + case Type::POINTS_COINCIDENT: + case Type::PT_PT_DISTANCE: + case Type::PT_LINE_DISTANCE: + case Type::PT_ON_LINE: + case Type::EQUAL_LENGTH_LINES: + case Type::EQ_LEN_PT_LINE_D: + case Type::EQ_PT_LN_DISTANCES: + case Type::EQUAL_ANGLE: + case Type::LENGTH_RATIO: + case Type::ARC_ARC_LEN_RATIO: + case Type::ARC_LINE_LEN_RATIO: + case Type::LENGTH_DIFFERENCE: + case Type::ARC_ARC_DIFFERENCE: + case Type::ARC_LINE_DIFFERENCE: + case Type::SYMMETRIC: + case Type::SYMMETRIC_HORIZ: + case Type::SYMMETRIC_VERT: + case Type::SYMMETRIC_LINE: + case Type::AT_MIDPOINT: + case Type::HORIZONTAL: + case Type::VERTICAL: + case Type::ANGLE: + case Type::PARALLEL: + case Type::PERPENDICULAR: + case Type::WHERE_DRAGGED: + case Type::COMMENT: + return true; + + case Type::PT_PLANE_DISTANCE: + case Type::PT_FACE_DISTANCE: + case Type::PROJ_PT_DISTANCE: + case Type::PT_IN_PLANE: + case Type::PT_ON_FACE: + case Type::EQUAL_LINE_ARC_LEN: + case Type::DIAMETER: + case Type::PT_ON_CIRCLE: + case Type::SAME_ORIENTATION: + case Type::CUBIC_LINE_TANGENT: + case Type::CURVE_CURVE_TANGENT: + case Type::ARC_LINE_TANGENT: + case Type::EQUAL_RADIUS: + return false; + } + ssassert(false, "Impossible"); +} + +ExprVector ConstraintBase::VectorsParallel3d(ExprVector a, ExprVector b, hParam p) { + return a.Minus(b.ScaledBy(Expr::From(p))); +} + +Expr *ConstraintBase::PointLineDistance(hEntity wrkpl, hEntity hpt, hEntity hln) +{ + EntityBase *ln = SK.GetEntity(hln); + EntityBase *a = SK.GetEntity(ln->point[0]); + EntityBase *b = SK.GetEntity(ln->point[1]); + + EntityBase *p = SK.GetEntity(hpt); + + if(wrkpl == EntityBase::FREE_IN_3D) { + ExprVector ep = p->PointGetExprs(); + + ExprVector ea = a->PointGetExprs(); + ExprVector eb = b->PointGetExprs(); + ExprVector eab = ea.Minus(eb); + Expr *m = eab.Magnitude(); + + return ((eab.Cross(ea.Minus(ep))).Magnitude())->Div(m); + } else { + Expr *ua, *va, *ub, *vb; + a->PointGetExprsInWorkplane(wrkpl, &ua, &va); + b->PointGetExprsInWorkplane(wrkpl, &ub, &vb); + + Expr *du = ua->Minus(ub); + Expr *dv = va->Minus(vb); + + Expr *u, *v; + p->PointGetExprsInWorkplane(wrkpl, &u, &v); + + Expr *m = ((du->Square())->Plus(dv->Square()))->Sqrt(); + + Expr *proj = (dv->Times(ua->Minus(u)))->Minus( + (du->Times(va->Minus(v)))); + + return proj->Div(m); + } +} + +Expr *ConstraintBase::PointPlaneDistance(ExprVector p, hEntity hpl) { + ExprVector n; + Expr *d; + SK.GetEntity(hpl)->WorkplaneGetPlaneExprs(&n, &d); + return (p.Dot(n))->Minus(d); +} + +Expr *ConstraintBase::Distance(hEntity wrkpl, hEntity hpa, hEntity hpb) { + EntityBase *pa = SK.GetEntity(hpa); + EntityBase *pb = SK.GetEntity(hpb); + ssassert(pa->IsPoint() && pb->IsPoint(), + "Expected two points to measure projected distance between"); + + if(wrkpl == EntityBase::FREE_IN_3D) { + // This is true distance + ExprVector ea, eb, eab; + ea = pa->PointGetExprs(); + eb = pb->PointGetExprs(); + eab = ea.Minus(eb); + + return eab.Magnitude(); + } else { + // This is projected distance, in the given workplane. + Expr *au, *av, *bu, *bv; + + pa->PointGetExprsInWorkplane(wrkpl, &au, &av); + pb->PointGetExprsInWorkplane(wrkpl, &bu, &bv); + + Expr *du = au->Minus(bu); + Expr *dv = av->Minus(bv); + + return ((du->Square())->Plus(dv->Square()))->Sqrt(); + } +} + +//----------------------------------------------------------------------------- +// Return the cosine of the angle between two vectors. If a workplane is +// specified, then it's the cosine of their projections into that workplane. +//----------------------------------------------------------------------------- +Expr *ConstraintBase::DirectionCosine(hEntity wrkpl, + ExprVector ae, ExprVector be) +{ + if(wrkpl == EntityBase::FREE_IN_3D) { + Expr *mags = (ae.Magnitude())->Times(be.Magnitude()); + return (ae.Dot(be))->Div(mags); + } else { + EntityBase *w = SK.GetEntity(wrkpl); + ExprVector u = w->Normal()->NormalExprsU(); + ExprVector v = w->Normal()->NormalExprsV(); + Expr *ua = u.Dot(ae); + Expr *va = v.Dot(ae); + Expr *ub = u.Dot(be); + Expr *vb = v.Dot(be); + Expr *maga = (ua->Square()->Plus(va->Square()))->Sqrt(); + Expr *magb = (ub->Square()->Plus(vb->Square()))->Sqrt(); + Expr *dot = (ua->Times(ub))->Plus(va->Times(vb)); + return dot->Div(maga->Times(magb)); + } +} + +ExprVector ConstraintBase::PointInThreeSpace(hEntity workplane, + Expr *u, Expr *v) +{ + EntityBase *w = SK.GetEntity(workplane); + + ExprVector ub = w->Normal()->NormalExprsU(); + ExprVector vb = w->Normal()->NormalExprsV(); + ExprVector ob = w->WorkplaneGetOffsetExprs(); + + return (ub.ScaledBy(u)).Plus(vb.ScaledBy(v)).Plus(ob); +} + +void ConstraintBase::ModifyToSatisfy() { + if(type == Type::ANGLE) { + Vector a = SK.GetEntity(entityA)->VectorGetNum(); + Vector b = SK.GetEntity(entityB)->VectorGetNum(); + if(other) a = a.ScaledBy(-1); + if(workplane != EntityBase::FREE_IN_3D) { + a = a.ProjectVectorInto(workplane); + b = b.ProjectVectorInto(workplane); + } + double c = (a.Dot(b))/(a.Magnitude() * b.Magnitude()); + valA = acos(c)*180/PI; + } else if(type == Type::PT_ON_LINE) { + EntityBase *eln = SK.GetEntity(entityA); + EntityBase *ea = SK.GetEntity(eln->point[0]); + EntityBase *eb = SK.GetEntity(eln->point[1]); + EntityBase *ep = SK.GetEntity(ptA); + ExprVector exp = ep->PointGetExprsInWorkplane(workplane); + ExprVector exa = ea->PointGetExprsInWorkplane(workplane); + ExprVector exb = eb->PointGetExprsInWorkplane(workplane); + ExprVector exba = exb.Minus(exa); + SK.GetParam(valP)->val = exba.Dot(exp.Minus(exa))->Eval() / exba.Dot(exba)->Eval(); + } else { + // We'll fix these ones up by looking at their symbolic equation; + // that means no extra work. + IdList l = {}; + // Generate the equations even if this is a reference dimension + GenerateEquations(&l, /*forReference=*/true); + ssassert(l.n == 1, "Expected constraint to generate a single equation"); + + // These equations are written in the form f(...) - d = 0, where + // d is the value of the valA. + valA += (l[0].e)->Eval(); + + l.Clear(); + } +} + +void ConstraintBase::AddEq(IdList *l, Expr *expr, int index) const +{ + Equation eq; + eq.e = expr; + eq.h = h.equation(index); + l->Add(&eq); +} + +void ConstraintBase::AddEq(IdList *l, const ExprVector &v, + int baseIndex) const { + AddEq(l, v.x, baseIndex); + AddEq(l, v.y, baseIndex + 1); + if(workplane == EntityBase::FREE_IN_3D) { + AddEq(l, v.z, baseIndex + 2); + } +} + +void ConstraintBase::Generate(ParamList *l) { + switch(type) { + case Type::PARALLEL: + case Type::CUBIC_LINE_TANGENT: + // Add new parameter only when we operate in 3d space + if(workplane != EntityBase::FREE_IN_3D) break; + // fallthrough + case Type::SAME_ORIENTATION: + case Type::PT_ON_LINE: { + Param p = {}; + valP = h.param(0); + p.h = valP; + l->Add(&p); + break; + } + + default: + break; + } +} + +void ConstraintBase::GenerateEquations(IdList *l, + bool forReference) const { + if(reference && !forReference) return; + + Expr *exA = Expr::From(valA); + switch(type) { + case Type::PT_PT_DISTANCE: + AddEq(l, Distance(workplane, ptA, ptB)->Minus(exA), 0); + return; + + case Type::PROJ_PT_DISTANCE: { + ExprVector pA = SK.GetEntity(ptA)->PointGetExprs(), + pB = SK.GetEntity(ptB)->PointGetExprs(), + dp = pB.Minus(pA); + + ExprVector pp = SK.GetEntity(entityA)->VectorGetExprs(); + pp = pp.WithMagnitude(Expr::From(1.0)); + + AddEq(l, (dp.Dot(pp))->Minus(exA), 0); + return; + } + + case Type::PT_LINE_DISTANCE: + AddEq(l, + PointLineDistance(workplane, ptA, entityA)->Minus(exA), 0); + return; + + case Type::PT_PLANE_DISTANCE: { + ExprVector pt = SK.GetEntity(ptA)->PointGetExprs(); + AddEq(l, (PointPlaneDistance(pt, entityA))->Minus(exA), 0); + return; + } + + case Type::PT_FACE_DISTANCE: { + ExprVector pt = SK.GetEntity(ptA)->PointGetExprs(); + EntityBase *f = SK.GetEntity(entityA); + ExprVector p0 = f->FaceGetPointExprs(); + ExprVector n = f->FaceGetNormalExprs(); + AddEq(l, (pt.Minus(p0)).Dot(n)->Minus(exA), 0); + return; + } + + case Type::EQUAL_LENGTH_LINES: { + EntityBase *a = SK.GetEntity(entityA); + EntityBase *b = SK.GetEntity(entityB); + AddEq(l, Distance(workplane, a->point[0], a->point[1])->Minus( + Distance(workplane, b->point[0], b->point[1])), 0); + return; + } + + // These work on distance squared, since the pt-line distances are + // signed, and we want the absolute value. + case Type::EQ_LEN_PT_LINE_D: { + EntityBase *forLen = SK.GetEntity(entityA); + Expr *d1 = Distance(workplane, forLen->point[0], forLen->point[1]); + Expr *d2 = PointLineDistance(workplane, ptA, entityB); + AddEq(l, (d1->Square())->Minus(d2->Square()), 0); + return; + } + case Type::EQ_PT_LN_DISTANCES: { + Expr *d1 = PointLineDistance(workplane, ptA, entityA); + Expr *d2 = PointLineDistance(workplane, ptB, entityB); + AddEq(l, (d1->Square())->Minus(d2->Square()), 0); + return; + } + + case Type::LENGTH_RATIO: { + EntityBase *a = SK.GetEntity(entityA); + EntityBase *b = SK.GetEntity(entityB); + Expr *la = Distance(workplane, a->point[0], a->point[1]); + Expr *lb = Distance(workplane, b->point[0], b->point[1]); + AddEq(l, (la->Div(lb))->Minus(exA), 0); + return; + } + + case Type::ARC_ARC_LEN_RATIO: { + EntityBase *arc1 = SK.GetEntity(entityA), + *arc2 = SK.GetEntity(entityB); + + // And get the arc1 radius, and the cosine of its angle + EntityBase *ao1 = SK.GetEntity(arc1->point[0]), + *as1 = SK.GetEntity(arc1->point[1]), + *af1 = SK.GetEntity(arc1->point[2]); + + ExprVector aos1 = (as1->PointGetExprs()).Minus(ao1->PointGetExprs()), + aof1 = (af1->PointGetExprs()).Minus(ao1->PointGetExprs()); + Expr *r1 = aof1.Magnitude(); + + ExprVector n1 = arc1->Normal()->NormalExprsN(); + ExprVector u1 = aos1.WithMagnitude(Expr::From(1.0)); + ExprVector v1 = n1.Cross(u1); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta1 = aof1.Dot(u1)->Div(r1); + Expr *sintheta1 = aof1.Dot(v1)->Div(r1); + + double thetas1, thetaf1, dtheta1; + arc1->ArcGetAngles(&thetas1, &thetaf1, &dtheta1); + Expr *theta1; + if(dtheta1 < 3*PI/4) { + theta1 = costheta1->ACos(); + } else if(dtheta1 < 5*PI/4) { + // As the angle crosses pi, cos theta1 is not invertible; + // so use the sine to stop blowing up + theta1 = Expr::From(PI)->Minus(sintheta1->ASin()); + } else { + theta1 = (Expr::From(2*PI))->Minus(costheta1->ACos()); + } + + // And get the arc2 radius, and the cosine of its angle + EntityBase *ao2 = SK.GetEntity(arc2->point[0]), + *as2 = SK.GetEntity(arc2->point[1]), + *af2 = SK.GetEntity(arc2->point[2]); + + ExprVector aos2 = (as2->PointGetExprs()).Minus(ao2->PointGetExprs()), + aof2 = (af2->PointGetExprs()).Minus(ao2->PointGetExprs()); + Expr *r2 = aof2.Magnitude(); + + ExprVector n2 = arc2->Normal()->NormalExprsN(); + ExprVector u2 = aos2.WithMagnitude(Expr::From(1.0)); + ExprVector v2 = n2.Cross(u2); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta2 = aof2.Dot(u2)->Div(r2); + Expr *sintheta2 = aof2.Dot(v2)->Div(r2); + + double thetas2, thetaf2, dtheta2; + arc2->ArcGetAngles(&thetas2, &thetaf2, &dtheta2); + Expr *theta2; + if(dtheta2 < 3*PI/4) { + theta2 = costheta2->ACos(); + } else if(dtheta2 < 5*PI/4) { + // As the angle crosses pi, cos theta2 is not invertible; + // so use the sine to stop blowing up + theta2 = Expr::From(PI)->Minus(sintheta2->ASin()); + } else { + theta2 = (Expr::From(2*PI))->Minus(costheta2->ACos()); + } + // And write the equation; (r1*theta1) / ( r2*theta2) = some ratio + AddEq(l, (r1->Times(theta1))->Div(r2->Times(theta2))->Minus(exA), 0); + return; + } + + case Type::ARC_LINE_LEN_RATIO: { + EntityBase *line = SK.GetEntity(entityA), + *arc1 = SK.GetEntity(entityB); + + Expr *ll = Distance(workplane, line->point[0], line->point[1]); + + // And get the arc1 radius, and the cosine of its angle + EntityBase *ao1 = SK.GetEntity(arc1->point[0]), + *as1 = SK.GetEntity(arc1->point[1]), + *af1 = SK.GetEntity(arc1->point[2]); + + ExprVector aos1 = (as1->PointGetExprs()).Minus(ao1->PointGetExprs()), + aof1 = (af1->PointGetExprs()).Minus(ao1->PointGetExprs()); + Expr *r1 = aof1.Magnitude(); + ExprVector n1 = arc1->Normal()->NormalExprsN(); + ExprVector u1 = aos1.WithMagnitude(Expr::From(1.0)); + ExprVector v1 = n1.Cross(u1); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta1 = aof1.Dot(u1)->Div(r1); + Expr *sintheta1 = aof1.Dot(v1)->Div(r1); + + double thetas1, thetaf1, dtheta1; + arc1->ArcGetAngles(&thetas1, &thetaf1, &dtheta1); + Expr *theta1; + if(dtheta1 < 3*PI/4) { + theta1 = costheta1->ACos(); + } else if(dtheta1 < 5*PI/4) { + // As the angle crosses pi, cos theta1 is not invertible; + // so use the sine to stop blowing up + theta1 = Expr::From(PI)->Minus(sintheta1->ASin()); + } else { + theta1 = (Expr::From(2*PI))->Minus(costheta1->ACos()); + } + // And write the equation; (r1*theta1) / ( length) = some ratio + AddEq(l, (r1->Times(theta1))->Div(ll)->Minus(exA), 0); + return; + } + + case Type::LENGTH_DIFFERENCE: { + EntityBase *a = SK.GetEntity(entityA); + EntityBase *b = SK.GetEntity(entityB); + Expr *la = Distance(workplane, a->point[0], a->point[1]); + Expr *lb = Distance(workplane, b->point[0], b->point[1]); + AddEq(l, (la->Minus(lb))->Minus(exA), 0); + return; + } + + case Type::ARC_ARC_DIFFERENCE: { + EntityBase *arc1 = SK.GetEntity(entityA), + *arc2 = SK.GetEntity(entityB); + + // And get the arc1 radius, and the cosine of its angle + EntityBase *ao1 = SK.GetEntity(arc1->point[0]), + *as1 = SK.GetEntity(arc1->point[1]), + *af1 = SK.GetEntity(arc1->point[2]); + + ExprVector aos1 = (as1->PointGetExprs()).Minus(ao1->PointGetExprs()), + aof1 = (af1->PointGetExprs()).Minus(ao1->PointGetExprs()); + Expr *r1 = aof1.Magnitude(); + + ExprVector n1 = arc1->Normal()->NormalExprsN(); + ExprVector u1 = aos1.WithMagnitude(Expr::From(1.0)); + ExprVector v1 = n1.Cross(u1); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta1 = aof1.Dot(u1)->Div(r1); + Expr *sintheta1 = aof1.Dot(v1)->Div(r1); + + double thetas1, thetaf1, dtheta1; + arc1->ArcGetAngles(&thetas1, &thetaf1, &dtheta1); + Expr *theta1; + if(dtheta1 < 3*PI/4) { + theta1 = costheta1->ACos(); + } else if(dtheta1 < 5*PI/4) { + // As the angle crosses pi, cos theta1 is not invertible; + // so use the sine to stop blowing up + theta1 = Expr::From(PI)->Minus(sintheta1->ASin()); + } else { + theta1 = (Expr::From(2*PI))->Minus(costheta1->ACos()); + } + + // And get the arc2 radius, and the cosine of its angle + EntityBase *ao2 = SK.GetEntity(arc2->point[0]), + *as2 = SK.GetEntity(arc2->point[1]), + *af2 = SK.GetEntity(arc2->point[2]); + + ExprVector aos2 = (as2->PointGetExprs()).Minus(ao2->PointGetExprs()), + aof2 = (af2->PointGetExprs()).Minus(ao2->PointGetExprs()); + Expr *r2 = aof2.Magnitude(); + + ExprVector n2 = arc2->Normal()->NormalExprsN(); + ExprVector u2 = aos2.WithMagnitude(Expr::From(1.0)); + ExprVector v2 = n2.Cross(u2); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta2 = aof2.Dot(u2)->Div(r2); + Expr *sintheta2 = aof2.Dot(v2)->Div(r2); + + double thetas2, thetaf2, dtheta2; + arc2->ArcGetAngles(&thetas2, &thetaf2, &dtheta2); + Expr *theta2; + if(dtheta2 < 3*PI/4) { + theta2 = costheta2->ACos(); + } else if(dtheta2 < 5*PI/4) { + // As the angle crosses pi, cos theta2 is not invertible; + // so use the sine to stop blowing up + theta2 = Expr::From(PI)->Minus(sintheta2->ASin()); + } else { + theta2 = (Expr::From(2*PI))->Minus(costheta2->ACos()); + } + // And write the equation; (r1*theta1) - ( r2*theta2) = some difference + AddEq(l, (r1->Times(theta1))->Minus(r2->Times(theta2))->Minus(exA), 0); + return; + } + + case Type::ARC_LINE_DIFFERENCE: { + EntityBase *line = SK.GetEntity(entityA), + *arc1 = SK.GetEntity(entityB); + + Expr *ll = Distance(workplane, line->point[0], line->point[1]); + + // And get the arc1 radius, and the cosine of its angle + EntityBase *ao1 = SK.GetEntity(arc1->point[0]), + *as1 = SK.GetEntity(arc1->point[1]), + *af1 = SK.GetEntity(arc1->point[2]); + + ExprVector aos1 = (as1->PointGetExprs()).Minus(ao1->PointGetExprs()), + aof1 = (af1->PointGetExprs()).Minus(ao1->PointGetExprs()); + Expr *r1 = aof1.Magnitude(); + ExprVector n1 = arc1->Normal()->NormalExprsN(); + ExprVector u1 = aos1.WithMagnitude(Expr::From(1.0)); + ExprVector v1 = n1.Cross(u1); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta1 = aof1.Dot(u1)->Div(r1); + Expr *sintheta1 = aof1.Dot(v1)->Div(r1); + + double thetas1, thetaf1, dtheta1; + arc1->ArcGetAngles(&thetas1, &thetaf1, &dtheta1); + Expr *theta1; + if(dtheta1 < 3*PI/4) { + theta1 = costheta1->ACos(); + } else if(dtheta1 < 5*PI/4) { + // As the angle crosses pi, cos theta1 is not invertible; + // so use the sine to stop blowing up + theta1 = Expr::From(PI)->Minus(sintheta1->ASin()); + } else { + theta1 = (Expr::From(2*PI))->Minus(costheta1->ACos()); + } + // And write the equation; (r1*theta1) - ( length) = some difference + AddEq(l, (r1->Times(theta1))->Minus(ll)->Minus(exA), 0); + return; + } + + case Type::DIAMETER: { + EntityBase *circle = SK.GetEntity(entityA); + Expr *r = circle->CircleGetRadiusExpr(); + AddEq(l, (r->Times(Expr::From(2)))->Minus(exA), 0); + return; + } + + case Type::EQUAL_RADIUS: { + EntityBase *c1 = SK.GetEntity(entityA); + EntityBase *c2 = SK.GetEntity(entityB); + AddEq(l, (c1->CircleGetRadiusExpr())->Minus( + c2->CircleGetRadiusExpr()), 0); + return; + } + + case Type::EQUAL_LINE_ARC_LEN: { + EntityBase *line = SK.GetEntity(entityA), + *arc = SK.GetEntity(entityB); + + // Get the line length + ExprVector l0 = SK.GetEntity(line->point[0])->PointGetExprs(), + l1 = SK.GetEntity(line->point[1])->PointGetExprs(); + Expr *ll = (l1.Minus(l0)).Magnitude(); + + // And get the arc radius, and the cosine of its angle + EntityBase *ao = SK.GetEntity(arc->point[0]), + *as = SK.GetEntity(arc->point[1]), + *af = SK.GetEntity(arc->point[2]); + + ExprVector aos = (as->PointGetExprs()).Minus(ao->PointGetExprs()), + aof = (af->PointGetExprs()).Minus(ao->PointGetExprs()); + Expr *r = aof.Magnitude(); + + ExprVector n = arc->Normal()->NormalExprsN(); + ExprVector u = aos.WithMagnitude(Expr::From(1.0)); + ExprVector v = n.Cross(u); + // so in our new csys, we start at (1, 0, 0) + Expr *costheta = aof.Dot(u)->Div(r); + Expr *sintheta = aof.Dot(v)->Div(r); + + double thetas, thetaf, dtheta; + arc->ArcGetAngles(&thetas, &thetaf, &dtheta); + Expr *theta; + if(dtheta < 3*PI/4) { + theta = costheta->ACos(); + } else if(dtheta < 5*PI/4) { + // As the angle crosses pi, cos theta is not invertible; + // so use the sine to stop blowing up + theta = Expr::From(PI)->Minus(sintheta->ASin()); + } else { + theta = (Expr::From(2*PI))->Minus(costheta->ACos()); + } + + // And write the equation; r*theta = L + AddEq(l, (r->Times(theta))->Minus(ll), 0); + return; + } + + case Type::POINTS_COINCIDENT: { + EntityBase *a = SK.GetEntity(ptA); + EntityBase *b = SK.GetEntity(ptB); + if(workplane == EntityBase::FREE_IN_3D) { + ExprVector pa = a->PointGetExprs(); + ExprVector pb = b->PointGetExprs(); + AddEq(l, pa.x->Minus(pb.x), 0); + AddEq(l, pa.y->Minus(pb.y), 1); + AddEq(l, pa.z->Minus(pb.z), 2); + } else { + Expr *au, *av; + Expr *bu, *bv; + a->PointGetExprsInWorkplane(workplane, &au, &av); + b->PointGetExprsInWorkplane(workplane, &bu, &bv); + AddEq(l, au->Minus(bu), 0); + AddEq(l, av->Minus(bv), 1); + } + return; + } + + case Type::PT_IN_PLANE: + // This one works the same, whether projected or not. + AddEq(l, PointPlaneDistance( + SK.GetEntity(ptA)->PointGetExprs(), entityA), 0); + return; + + case Type::PT_ON_FACE: { + // a plane, n dot (p - p0) = 0 + ExprVector p = SK.GetEntity(ptA)->PointGetExprs(); + EntityBase *f = SK.GetEntity(entityA); + ExprVector p0 = f->FaceGetPointExprs(); + ExprVector n = f->FaceGetNormalExprs(); + AddEq(l, (p.Minus(p0)).Dot(n), 0); + return; + } + + case Type::PT_ON_LINE: { + EntityBase *ln = SK.GetEntity(entityA); + EntityBase *a = SK.GetEntity(ln->point[0]); + EntityBase *b = SK.GetEntity(ln->point[1]); + EntityBase *p = SK.GetEntity(ptA); + + ExprVector ep = p->PointGetExprsInWorkplane(workplane); + ExprVector ea = a->PointGetExprsInWorkplane(workplane); + ExprVector eb = b->PointGetExprsInWorkplane(workplane); + + ExprVector ptOnLine = ea.Plus(eb.Minus(ea).ScaledBy(Expr::From(valP))); + ExprVector eq = ptOnLine.Minus(ep); + + AddEq(l, eq); + return; + } + + case Type::PT_ON_CIRCLE: { + // This actually constrains the point to lie on the cylinder. + EntityBase *circle = SK.GetEntity(entityA); + ExprVector center = SK.GetEntity(circle->point[0])->PointGetExprs(); + ExprVector pt = SK.GetEntity(ptA)->PointGetExprs(); + EntityBase *normal = SK.GetEntity(circle->normal); + ExprVector u = normal->NormalExprsU(), + v = normal->NormalExprsV(); + + Expr *du = (center.Minus(pt)).Dot(u), + *dv = (center.Minus(pt)).Dot(v); + + Expr *r = circle->CircleGetRadiusExpr(); + + AddEq(l, du->Square()->Plus(dv->Square())->Sqrt()->Minus(r), 0); + return; + } + + case Type::AT_MIDPOINT: + if(workplane == EntityBase::FREE_IN_3D) { + EntityBase *ln = SK.GetEntity(entityA); + ExprVector a = SK.GetEntity(ln->point[0])->PointGetExprs(); + ExprVector b = SK.GetEntity(ln->point[1])->PointGetExprs(); + ExprVector m = (a.Plus(b)).ScaledBy(Expr::From(0.5)); + + if(ptA.v) { + ExprVector p = SK.GetEntity(ptA)->PointGetExprs(); + AddEq(l, (m.x)->Minus(p.x), 0); + AddEq(l, (m.y)->Minus(p.y), 1); + AddEq(l, (m.z)->Minus(p.z), 2); + } else { + AddEq(l, PointPlaneDistance(m, entityB), 0); + } + } else { + EntityBase *ln = SK.GetEntity(entityA); + EntityBase *a = SK.GetEntity(ln->point[0]); + EntityBase *b = SK.GetEntity(ln->point[1]); + + Expr *au, *av, *bu, *bv; + a->PointGetExprsInWorkplane(workplane, &au, &av); + b->PointGetExprsInWorkplane(workplane, &bu, &bv); + Expr *mu = Expr::From(0.5)->Times(au->Plus(bu)); + Expr *mv = Expr::From(0.5)->Times(av->Plus(bv)); + + if(ptA.v) { + EntityBase *p = SK.GetEntity(ptA); + Expr *pu, *pv; + p->PointGetExprsInWorkplane(workplane, &pu, &pv); + AddEq(l, pu->Minus(mu), 0); + AddEq(l, pv->Minus(mv), 1); + } else { + ExprVector m = PointInThreeSpace(workplane, mu, mv); + AddEq(l, PointPlaneDistance(m, entityB), 0); + } + } + return; + + case Type::SYMMETRIC: + if(workplane == EntityBase::FREE_IN_3D) { + EntityBase *plane = SK.GetEntity(entityA); + EntityBase *ea = SK.GetEntity(ptA); + EntityBase *eb = SK.GetEntity(ptB); + ExprVector a = ea->PointGetExprs(); + ExprVector b = eb->PointGetExprs(); + + // The midpoint of the line connecting the symmetric points + // lies on the plane of the symmetry. + ExprVector m = (a.Plus(b)).ScaledBy(Expr::From(0.5)); + AddEq(l, PointPlaneDistance(m, plane->h), 0); + + // And projected into the plane of symmetry, the points are + // coincident. + Expr *au, *av, *bu, *bv; + ea->PointGetExprsInWorkplane(plane->h, &au, &av); + eb->PointGetExprsInWorkplane(plane->h, &bu, &bv); + AddEq(l, au->Minus(bu), 1); + AddEq(l, av->Minus(bv), 2); + } else { + EntityBase *plane = SK.GetEntity(entityA); + EntityBase *a = SK.GetEntity(ptA); + EntityBase *b = SK.GetEntity(ptB); + + Expr *au, *av, *bu, *bv; + a->PointGetExprsInWorkplane(workplane, &au, &av); + b->PointGetExprsInWorkplane(workplane, &bu, &bv); + Expr *mu = Expr::From(0.5)->Times(au->Plus(bu)); + Expr *mv = Expr::From(0.5)->Times(av->Plus(bv)); + + ExprVector m = PointInThreeSpace(workplane, mu, mv); + AddEq(l, PointPlaneDistance(m, plane->h), 0); + + // Construct a vector within the workplane that is normal + // to the symmetry pane's normal (i.e., that lies in the + // plane of symmetry). The line connecting the points is + // perpendicular to that constructed vector. + EntityBase *w = SK.GetEntity(workplane); + ExprVector u = w->Normal()->NormalExprsU(); + ExprVector v = w->Normal()->NormalExprsV(); + + ExprVector pa = a->PointGetExprs(); + ExprVector pb = b->PointGetExprs(); + ExprVector n; + Expr *d; + plane->WorkplaneGetPlaneExprs(&n, &d); + AddEq(l, (n.Cross(u.Cross(v))).Dot(pa.Minus(pb)), 1); + } + return; + + case Type::SYMMETRIC_HORIZ: + case Type::SYMMETRIC_VERT: { + ssassert(workplane != Entity::FREE_IN_3D, + "Unexpected horizontal/vertical symmetric constraint in 3d"); + + EntityBase *a = SK.GetEntity(ptA); + EntityBase *b = SK.GetEntity(ptB); + + Expr *au, *av, *bu, *bv; + a->PointGetExprsInWorkplane(workplane, &au, &av); + b->PointGetExprsInWorkplane(workplane, &bu, &bv); + + if(type == Type::SYMMETRIC_HORIZ) { + AddEq(l, av->Minus(bv), 0); + AddEq(l, au->Plus(bu), 1); + } else { + AddEq(l, au->Minus(bu), 0); + AddEq(l, av->Plus(bv), 1); + } + return; + } + + case Type::SYMMETRIC_LINE: { + EntityBase *pa = SK.GetEntity(ptA); + EntityBase *pb = SK.GetEntity(ptB); + + Expr *pau, *pav, *pbu, *pbv; + pa->PointGetExprsInWorkplane(workplane, &pau, &pav); + pb->PointGetExprsInWorkplane(workplane, &pbu, &pbv); + + EntityBase *ln = SK.GetEntity(entityA); + EntityBase *la = SK.GetEntity(ln->point[0]); + EntityBase *lb = SK.GetEntity(ln->point[1]); + Expr *lau, *lav, *lbu, *lbv; + la->PointGetExprsInWorkplane(workplane, &lau, &lav); + lb->PointGetExprsInWorkplane(workplane, &lbu, &lbv); + + Expr *dpu = pbu->Minus(pau), *dpv = pbv->Minus(pav); + Expr *dlu = lbu->Minus(lau), *dlv = lbv->Minus(lav); + + // The line through the points is perpendicular to the line + // of symmetry. + AddEq(l, (dlu->Times(dpu))->Plus(dlv->Times(dpv)), 0); + + // And the signed distances of the points to the line are + // equal in magnitude and opposite in sign, so sum to zero + Expr *dista = (dlv->Times(lau->Minus(pau)))->Minus( + (dlu->Times(lav->Minus(pav)))); + Expr *distb = (dlv->Times(lau->Minus(pbu)))->Minus( + (dlu->Times(lav->Minus(pbv)))); + AddEq(l, dista->Plus(distb), 1); + + return; + } + + case Type::HORIZONTAL: + case Type::VERTICAL: { + ssassert(workplane != Entity::FREE_IN_3D, + "Unexpected horizontal/vertical constraint in 3d"); + + hEntity ha, hb; + if(entityA.v) { + EntityBase *e = SK.GetEntity(entityA); + ha = e->point[0]; + hb = e->point[1]; + } else { + ha = ptA; + hb = ptB; + } + EntityBase *a = SK.GetEntity(ha); + EntityBase *b = SK.GetEntity(hb); + + Expr *au, *av, *bu, *bv; + a->PointGetExprsInWorkplane(workplane, &au, &av); + b->PointGetExprsInWorkplane(workplane, &bu, &bv); + + AddEq(l, (type == Type::HORIZONTAL) ? av->Minus(bv) : au->Minus(bu), 0); + return; + } + + case Type::SAME_ORIENTATION: { + EntityBase *a = SK.GetEntity(entityA); + EntityBase *b = SK.GetEntity(entityB); + + ExprVector au = a->NormalExprsU(), + an = a->NormalExprsN(); + ExprVector bu = b->NormalExprsU(), + bv = b->NormalExprsV(), + bn = b->NormalExprsN(); + + ExprVector eq = VectorsParallel3d(an, bn, valP); + AddEq(l, eq.x, 0); + AddEq(l, eq.y, 1); + AddEq(l, eq.z, 2); + Expr *d1 = au.Dot(bv); + Expr *d2 = au.Dot(bu); + // Allow either orientation for the coordinate system, depending + // on how it was drawn. + if(fabs(d1->Eval()) < fabs(d2->Eval())) { + AddEq(l, d1, 3); + } else { + AddEq(l, d2, 3); + } + return; + } + + case Type::PERPENDICULAR: + case Type::ANGLE: { + EntityBase *a = SK.GetEntity(entityA); + EntityBase *b = SK.GetEntity(entityB); + ExprVector ae = a->VectorGetExprs(); + ExprVector be = b->VectorGetExprs(); + if(other) ae = ae.ScaledBy(Expr::From(-1)); + Expr *c = DirectionCosine(workplane, ae, be); + + if(type == Type::ANGLE) { + // The direction cosine is equal to the cosine of the + // specified angle + Expr *rads = exA->Times(Expr::From(PI/180)), + *rc = rads->Cos(); + double arc = fabs(rc->Eval()); + // avoid false detection of inconsistent systems by gaining + // up as the difference in dot products gets small at small + // angles; doubles still have plenty of precision, only + // problem is that rank test + Expr *mult = Expr::From(arc > 0.99 ? 0.01/(1.00001 - arc) : 1); + AddEq(l, (c->Minus(rc))->Times(mult), 0); + } else { + // The dot product (and therefore the direction cosine) + // is equal to zero, perpendicular. + AddEq(l, c, 0); + } + return; + } + + case Type::EQUAL_ANGLE: { + EntityBase *a = SK.GetEntity(entityA); + EntityBase *b = SK.GetEntity(entityB); + EntityBase *c = SK.GetEntity(entityC); + EntityBase *d = SK.GetEntity(entityD); + ExprVector ae = a->VectorGetExprs(); + ExprVector be = b->VectorGetExprs(); + ExprVector ce = c->VectorGetExprs(); + ExprVector de = d->VectorGetExprs(); + + if(other) ae = ae.ScaledBy(Expr::From(-1)); + + Expr *cab = DirectionCosine(workplane, ae, be); + Expr *ccd = DirectionCosine(workplane, ce, de); + + AddEq(l, cab->Minus(ccd), 0); + return; + } + + case Type::ARC_LINE_TANGENT: { + EntityBase *arc = SK.GetEntity(entityA); + EntityBase *line = SK.GetEntity(entityB); + + ExprVector ac = SK.GetEntity(arc->point[0])->PointGetExprs(); + ExprVector ap = + SK.GetEntity(arc->point[other ? 2 : 1])->PointGetExprs(); + + ExprVector ld = line->VectorGetExprs(); + + // The line is perpendicular to the radius + AddEq(l, ld.Dot(ac.Minus(ap)), 0); + return; + } + + case Type::CUBIC_LINE_TANGENT: { + EntityBase *cubic = SK.GetEntity(entityA); + EntityBase *line = SK.GetEntity(entityB); + + ExprVector a; + if(other) { + a = cubic->CubicGetFinishTangentExprs(); + } else { + a = cubic->CubicGetStartTangentExprs(); + } + + ExprVector b = line->VectorGetExprs(); + + if(workplane == EntityBase::FREE_IN_3D) { + ExprVector eq = VectorsParallel3d(a, b, valP); + AddEq(l, eq); + } else { + EntityBase *w = SK.GetEntity(workplane); + ExprVector wn = w->Normal()->NormalExprsN(); + AddEq(l, (a.Cross(b)).Dot(wn), 0); + } + return; + } + + case Type::CURVE_CURVE_TANGENT: { + bool parallel = true; + int i; + ExprVector dir[2]; + for(i = 0; i < 2; i++) { + EntityBase *e = SK.GetEntity((i == 0) ? entityA : entityB); + bool oth = (i == 0) ? other : other2; + + if(e->type == Entity::Type::ARC_OF_CIRCLE) { + ExprVector center, endpoint; + center = SK.GetEntity(e->point[0])->PointGetExprs(); + endpoint = + SK.GetEntity(e->point[oth ? 2 : 1])->PointGetExprs(); + dir[i] = endpoint.Minus(center); + // We're using the vector from the center of the arc to + // an endpoint; so that's normal to the tangent, not + // parallel. + parallel = !parallel; + } else if(e->type == Entity::Type::CUBIC) { // BRANCH_ALWAYS_TAKEN + if(oth) { + dir[i] = e->CubicGetFinishTangentExprs(); + } else { + dir[i] = e->CubicGetStartTangentExprs(); + } + } else { + ssassert(false, "Unexpected entity types for CURVE_CURVE_TANGENT"); + } + } + if(parallel) { + EntityBase *w = SK.GetEntity(workplane); + ExprVector wn = w->Normal()->NormalExprsN(); + AddEq(l, ((dir[0]).Cross(dir[1])).Dot(wn), 0); + } else { + AddEq(l, (dir[0]).Dot(dir[1]), 0); + } + return; + } + + case Type::PARALLEL: { + EntityBase *ea = SK.GetEntity(entityA), *eb = SK.GetEntity(entityB); + ExprVector a = ea->VectorGetExprsInWorkplane(workplane); + ExprVector b = eb->VectorGetExprsInWorkplane(workplane); + + if(workplane == EntityBase::FREE_IN_3D) { + ExprVector eq = VectorsParallel3d(a, b, valP); + AddEq(l, eq); + } else { + // We use expressions written in workplane csys, so we can assume the workplane + // normal is (0, 0, 1). We can write the equation as: + // Expr *eq = a.Cross(b).Dot(ExprVector::From(0.0, 0.0, 1.0)); + // but this will just result in elimination of x and y terms after dot product. + // We can only use the z expression: + // Expr *eq = a.Cross(b).z; + // but it's more efficient to write it in the terms of pseudo-scalar product: + Expr *eq = (a.x->Times(b.y))->Minus(a.y->Times(b.x)); + AddEq(l, eq, 0); + } + + return; + } + + case Type::WHERE_DRAGGED: { + EntityBase *ep = SK.GetEntity(ptA); + if(workplane == EntityBase::FREE_IN_3D) { + ExprVector ev = ep->PointGetExprs(); + Vector v = ep->PointGetNum(); + + AddEq(l, ev.x->Minus(Expr::From(v.x)), 0); + AddEq(l, ev.y->Minus(Expr::From(v.y)), 1); + AddEq(l, ev.z->Minus(Expr::From(v.z)), 2); + } else { + Expr *u, *v; + ep->PointGetExprsInWorkplane(workplane, &u, &v); + AddEq(l, u->Minus(Expr::From(u->Eval())), 0); + AddEq(l, v->Minus(Expr::From(v->Eval())), 1); + } + return; + } + + case Type::COMMENT: + return; + } + ssassert(false, "Unexpected constraint ID"); +} + +} // namespace SolveSpace diff --git a/src/defs.h b/src/defs.h new file mode 100644 index 0000000..94105f9 --- /dev/null +++ b/src/defs.h @@ -0,0 +1,15 @@ +#ifndef SOLVESPACE_DEFS_H +#define SOLVESPACE_DEFS_H + +namespace SolveSpace { + +static constexpr double ANGLE_COS_EPS = 1e-6; +static constexpr double LENGTH_EPS = 1e-6; +static constexpr double VERY_POSITIVE = 1e10; +static constexpr double VERY_NEGATIVE = -1e10; + +static constexpr double PI = 3.1415926535897931; + +} // namespace SolveSpace + +#endif // !SOLVESPACE_DEFS_H diff --git a/src/describescreen.cpp b/src/describescreen.cpp new file mode 100644 index 0000000..02a308a --- /dev/null +++ b/src/describescreen.cpp @@ -0,0 +1,589 @@ +//----------------------------------------------------------------------------- +// The screens when an entity is selected, that show some description of it-- +// endpoints of the lines, diameter of the circle, etc. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void TextWindow::ScreenUnselectAll(int link, uint32_t v) { + GraphicsWindow::MenuEdit(Command::UNSELECT_ALL); +} + +void TextWindow::ScreenEditTtfText(int link, uint32_t v) { + hRequest hr = { v }; + Request *r = SK.GetRequest(hr); + + SS.TW.ShowEditControl(10, r->str); + SS.TW.edit.meaning = Edit::TTF_TEXT; + SS.TW.edit.request = hr; +} + +void TextWindow::ScreenToggleTtfKerning(int link, uint32_t v) { + hRequest hr = { v }; + Request *r = SK.GetRequest(hr); + + SS.UndoRemember(); + r->extraPoints = !r->extraPoints; + + SS.MarkGroupDirty(r->group); + SS.ScheduleShowTW(); +} + +void TextWindow::ScreenSetTtfFont(int link, uint32_t v) { + int i = (int)v; + if(i < 0) return; + if(i >= SS.fonts.l.n) return; + + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + if(gs.entities != 1 || gs.n != 1) return; + + Entity *e = SK.entity.FindByIdNoOops(gs.entity[0]); + if(!e || e->type != Entity::Type::TTF_TEXT || !e->h.isFromRequest()) return; + + Request *r = SK.request.FindByIdNoOops(e->h.request()); + if(!r) return; + + SS.UndoRemember(); + r->font = SS.fonts.l[i].FontFileBaseName(); + SS.MarkGroupDirty(r->group); + SS.ScheduleShowTW(); +} + +void TextWindow::ScreenConstraintToggleReference(int link, uint32_t v) { + hConstraint hc = { v }; + Constraint *c = SK.GetConstraint(hc); + + SS.UndoRemember(); + c->reference = !c->reference; + + SS.MarkGroupDirty(c->group); + SS.ScheduleShowTW(); +} + +void TextWindow::ScreenConstraintShowAsRadius(int link, uint32_t v) { + hConstraint hc = { v }; + Constraint *c = SK.GetConstraint(hc); + + SS.UndoRemember(); + c->other = !c->other; + + SS.ScheduleShowTW(); +} + +void TextWindow::DescribeSelection() { + Printf(false, ""); + +#define COSTR_NO_LINK(p) \ + SS.MmToString((p).x).c_str(), \ + SS.MmToString((p).y).c_str(), \ + SS.MmToString((p).z).c_str() +#define PT_AS_STR_NO_LINK "(%Fi%s%Fd, %Fi%s%Fd, %Fi%s%Fd)" +#define PT_AS_NUM "(%Fi%3%Fd, %Fi%3%Fd, %Fi%3%Fd)" +#define COSTR(e, p) \ + e->h, (&TextWindow::ScreenSelectEntity), (&TextWindow::ScreenHoverEntity), \ + COSTR_NO_LINK(p) +#define PT_AS_STR "%Ll%D%f%h" PT_AS_STR_NO_LINK "%E" +#define CO_LINK(e, p) e->h, (&TextWindow::ScreenSelectEntity), (&TextWindow::ScreenHoverEntity), CO(p) +#define PT_AS_NUM_LINK "%Ll%D%f%h" PT_AS_NUM "%E" + + auto const &gs = SS.GW.gs; + + auto ListFaces = [&]() { + char abc = 'A'; + for(auto &fc : gs.face) { + Vector n = SK.GetEntity(fc)->FaceGetNormalNum(); + Printf(true, " plane%c normal = " PT_AS_NUM, abc, CO(n)); + Vector p = SK.GetEntity(fc)->FaceGetPointNum(); + Printf(false, " plane%c thru = " PT_AS_STR, abc, COSTR(SK.GetEntity(fc), p)); + ++abc; + } + }; + + if(gs.n == 1 && (gs.points == 1 || gs.entities == 1)) { + Entity *e = SK.GetEntity(gs.points == 1 ? gs.point[0] : gs.entity[0]); + Vector p; + + switch(e->type) { + case Entity::Type::POINT_IN_3D: + case Entity::Type::POINT_IN_2D: + case Entity::Type::POINT_N_TRANS: + case Entity::Type::POINT_N_ROT_TRANS: + case Entity::Type::POINT_N_COPY: + case Entity::Type::POINT_N_ROT_AA: + case Entity::Type::POINT_N_ROT_AXIS_TRANS: + p = e->PointGetNum(); + Printf(false, "%FtPOINT%E at " PT_AS_STR, COSTR(e, p)); + break; + + case Entity::Type::NORMAL_IN_3D: + case Entity::Type::NORMAL_IN_2D: + case Entity::Type::NORMAL_N_COPY: + case Entity::Type::NORMAL_N_ROT: + case Entity::Type::NORMAL_N_ROT_AA: { + Quaternion q = e->NormalGetNum(); + p = q.RotationN(); + Printf(false, "%FtNORMAL / COORDINATE SYSTEM%E"); + Printf(true, " basis n = " PT_AS_NUM, CO(p)); + p = q.RotationU(); + Printf(false, " u = " PT_AS_NUM, CO(p)); + p = q.RotationV(); + Printf(false, " v = " PT_AS_NUM, CO(p)); + break; + } + case Entity::Type::WORKPLANE: { + p = SK.GetEntity(e->point[0])->PointGetNum(); + Printf(false, "%FtWORKPLANE%E"); + Printf(true, " origin = " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p)); + Quaternion q = e->Normal()->NormalGetNum(); + p = q.RotationN(); + Printf(true, " normal = " PT_AS_NUM_LINK, CO_LINK(e->Normal(), p)); + break; + } + case Entity::Type::LINE_SEGMENT: { + Vector p0 = SK.GetEntity(e->point[0])->PointGetNum(); + p = p0; + Printf(false, "%FtLINE SEGMENT%E"); + Printf(true, " thru " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p)); + Vector p1 = SK.GetEntity(e->point[1])->PointGetNum(); + p = p1; + Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(e->point[1]), p)); + Printf(true, " len = %Fi%s%E", + SS.MmToString((p1.Minus(p0).Magnitude())).c_str()); + break; + } + case Entity::Type::CUBIC_PERIODIC: + case Entity::Type::CUBIC: + int pts; + if(e->type == Entity::Type::CUBIC_PERIODIC) { + Printf(false, "%FtPERIODIC C2 CUBIC SPLINE%E"); + pts = (3 + e->extraPoints); + } else if(e->extraPoints > 0) { + Printf(false, "%FtINTERPOLATING C2 CUBIC SPLINE%E"); + pts = (4 + e->extraPoints); + } else { + Printf(false, "%FtCUBIC BEZIER CURVE%E"); + pts = 4; + } + for(int i = 0; i < pts; i++) { + p = SK.GetEntity(e->point[i])->PointGetNum(); + Printf((i==0), " p%d = " PT_AS_STR, i, COSTR(SK.GetEntity(e->point[i]), p)); + } + break; + + case Entity::Type::ARC_OF_CIRCLE: { + Printf(false, "%FtARC OF A CIRCLE%E"); + p = SK.GetEntity(e->point[0])->PointGetNum(); + Printf(true, " center = " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p)); + p = SK.GetEntity(e->point[1])->PointGetNum(); + Printf(true, " endpoints = " PT_AS_STR, COSTR(SK.GetEntity(e->point[1]), p)); + p = SK.GetEntity(e->point[2])->PointGetNum(); + Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(e->point[2]), p)); + double r = e->CircleGetRadiusNum(); + Printf(true, " diameter = %Fi%s", SS.MmToString(r*2).c_str()); + Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str()); + double thetas, thetaf, dtheta; + e->ArcGetAngles(&thetas, &thetaf, &dtheta); + Printf(false, " arc len = %Fi%s", SS.MmToString(dtheta*r).c_str()); + break; + } + case Entity::Type::CIRCLE: { + Printf(false, "%FtCIRCLE%E"); + p = SK.GetEntity(e->point[0])->PointGetNum(); + Printf(true, " center = " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p)); + double r = e->CircleGetRadiusNum(); + Printf(true, " diameter = %Fi%s", SS.MmToString(r*2).c_str()); + Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str()); + Printf(false, " circumference = %Fi%s", SS.MmToString(2*M_PI*r).c_str()); + break; + } + case Entity::Type::FACE_NORMAL_PT: + case Entity::Type::FACE_XPROD: + case Entity::Type::FACE_N_ROT_TRANS: + case Entity::Type::FACE_N_ROT_AA: + case Entity::Type::FACE_N_TRANS: + case Entity::Type::FACE_ROT_NORMAL_PT: + case Entity::Type::FACE_N_ROT_AXIS_TRANS: + Printf(false, "%FtPLANE FACE%E"); + p = e->FaceGetNormalNum(); + Printf(true, " normal = " PT_AS_NUM, CO(p)); + p = e->FaceGetPointNum(); + Printf(false, " thru = " PT_AS_STR, COSTR(e, p)); + break; + + case Entity::Type::TTF_TEXT: { + Printf(false, "%FtTRUETYPE FONT TEXT%E"); + Printf(true, " font = '%Fi%s%E'", e->font.c_str()); + if(e->h.isFromRequest()) { + Printf(true, " text = '%Fi%s%E' %Fl%Ll%f%D[change]%E", + e->str.c_str(), &ScreenEditTtfText, e->h.request().v); + Printf(true, " %Fd%f%D%Ll%s apply kerning", + &ScreenToggleTtfKerning, e->h.request().v, + e->extraPoints ? CHECK_TRUE : CHECK_FALSE); + Printf(true, " select new font"); + SS.fonts.LoadAll(); + // Not using range-for here because we use i inside the output. + for(int i = 0; i < SS.fonts.l.n; i++) { + TtfFont *tf = &(SS.fonts.l[i]); + if(e->font == tf->FontFileBaseName()) { + Printf(false, "%Bp %s", + (i & 1) ? 'd' : 'a', + tf->name.c_str()); + } else { + Printf(false, "%Bp %f%D%Fl%Ll%s%E%Bp", + (i & 1) ? 'd' : 'a', + &ScreenSetTtfFont, i, + tf->name.c_str(), + (i & 1) ? 'd' : 'a'); + } + } + } else { + Printf(false, " text = '%Fi%s%E'", e->str.c_str()); + } + break; + } + case Entity::Type::IMAGE: { + Printf(false, "%FtIMAGE%E"); + Platform::Path relativePath = e->file.RelativeTo(SS.saveFile.Parent()); + if(relativePath.IsEmpty()) { + Printf(true, " file = '%Fi%s%E'", e->file.raw.c_str()); + } else { + Printf(true, " file = '%Fi%s%E'", relativePath.raw.c_str()); + } + break; + } + + default: + Printf(true, "%Ft?? ENTITY%E"); + break; + } + + Printf(false, ""); + if(e->h.isFromRequest()) { + Request *r = SK.GetRequest(e->h.request()); + if(e->h == r->h.entity(0)) { + Printf(false, "%FtFROM REQUEST%E %s", + r->DescriptionString().c_str()); + } else { + Printf(false, "%FtFROM REQUEST%E %Fl%Ll%D%f%h%s%E", + r->h.v, (&TextWindow::ScreenSelectRequest), &(TextWindow::ScreenHoverRequest), + r->DescriptionString().c_str()); + } + } + Group *g = SK.GetGroup(e->group); + Printf(false, "%FtIN GROUP%E %Fl%Ll%D%f%s%E", + g->h.v, (&TextWindow::ScreenSelectGroup), + g->DescriptionString().c_str()); + if(e->workplane == Entity::FREE_IN_3D) { + Printf(false, "%FtNOT LOCKED IN WORKPLANE%E"); + } else { + Entity *w = SK.GetEntity(e->workplane); + if(w->h.isFromRequest()) { + Printf(false, "%FtIN WORKPLANE%E %Fl%Ll%D%f%h%s%E", + w->h.request().v, + (&TextWindow::ScreenSelectRequest), &(TextWindow::ScreenHoverRequest), + w->DescriptionString().c_str()); + } else { + Printf(false, "%FtIN WORKPLANE%E %Fl%Ll%D%f%h%s%E", + w->h.group().v, + (&TextWindow::ScreenSelectGroup), (&TextWindow::ScreenHoverGroupWorkplane), + w->DescriptionString().c_str()); + } + } + if(e->IsStylable()) { + if(e->style.v) { + Style *s = Style::Get(e->style); + Printf(false, "%FtIN STYLE%E %Fl%Ll%D%f%s%E", + s->h.v, (&TextWindow::ScreenShowStyleInfo), + s->DescriptionString().c_str()); + } else { + Printf(false, "%FtIN STYLE%E none"); + } + } + if(e->construction) { + Printf(false, "%FtCONSTRUCTION"); + } + + std::vector lhc = {}; + auto FindConstraints = [&](hEntity he) { + for(const Constraint &c : SK.constraint) { + if(!(c.ptA == he || c.ptB == he || + c.entityA == he || c.entityB == he || c.entityC == he || c.entityD == he)) + continue; + lhc.push_back(c.h); + } + }; + FindConstraints(e->h); + if(!e->IsPoint()) { + for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) { + if(e->point[i].v == 0) break; + FindConstraints(e->point[i]); + } + } + + std::sort(lhc.begin(), lhc.end()); + lhc.erase(std::unique(lhc.begin(), lhc.end()), lhc.end()); + + auto ListConstraints = [&](bool reference) { + bool first = true; + int a = 0; + for(hConstraint hc : lhc) { + Constraint *c = SK.GetConstraint(hc); + if(c->reference != reference) continue; + if(first) { + first = false; + if(reference) { + Printf(true, "%FtMEASURED BY:%E"); + } else { + Printf(true, "%FtCONSTRAINED BY:%E"); + } + } + Printf(false, "%Bp %Fl%Ll%D%f%h%s%E", + (a & 1) ? 'd' : 'a', + c->h.v, (&TextWindow::ScreenSelectConstraint), + (&TextWindow::ScreenHoverConstraint), + c->DescriptionString().c_str()); + a++; + } + }; + ListConstraints(/*reference=*/false); + ListConstraints(/*reference=*/true); + } else if(gs.n == 2 && gs.points == 2) { + Printf(false, "%FtTWO POINTS"); + Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum(); + Printf(true, " at " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), p0)); + Vector p1 = SK.GetEntity(gs.point[1])->PointGetNum(); + Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(gs.point[1]), p1)); + Vector dv = p1.Minus(p0); + Printf(true, " d = %Fi%s", SS.MmToString(dv.Magnitude()).c_str()); + Printf(false, " d(x, y, z) = " PT_AS_STR_NO_LINK, COSTR_NO_LINK(dv)); + } else if(gs.n == 2 && gs.points == 1 && gs.circlesOrArcs == 1) { + Entity *ec = SK.GetEntity(gs.entity[0]); + if(ec->type == Entity::Type::CIRCLE) { + Printf(false, "%FtPOINT AND A CIRCLE"); + } else if(ec->type == Entity::Type::ARC_OF_CIRCLE) { + Printf(false, "%FtPOINT AND AN ARC"); + } else ssassert(false, "Unexpected entity type"); + Vector p = SK.GetEntity(gs.point[0])->PointGetNum(); + Printf(true, " pt at " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), p)); + Vector c = SK.GetEntity(ec->point[0])->PointGetNum(); + Printf(true, " center = " PT_AS_STR, COSTR(SK.GetEntity(ec->point[0]), c)); + double r = ec->CircleGetRadiusNum(); + Printf(false, " diameter = %Fi%s", SS.MmToString(r*2).c_str()); + Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str()); + double d = (p.Minus(c)).Magnitude() - r; + Printf(true, " distance = %Fi%s", SS.MmToString(d).c_str()); + } else if(gs.n == 2 && gs.faces == 1 && gs.points == 1) { + Printf(false, "%FtA POINT AND A PLANE FACE"); + Vector pt = SK.GetEntity(gs.point[0])->PointGetNum(); + Printf(true, " point = " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), pt)); + Vector n = SK.GetEntity(gs.face[0])->FaceGetNormalNum(); + Printf(true, " plane normal = " PT_AS_NUM, CO(n)); + Vector pl = SK.GetEntity(gs.face[0])->FaceGetPointNum(); + Printf(false, " plane thru = " PT_AS_STR, COSTR(SK.GetEntity(gs.face[0]), pl)); + double dd = n.Dot(pl) - n.Dot(pt); + Printf(true, " distance = %Fi%s", SS.MmToString(dd).c_str()); + } else if(gs.n == 3 && gs.points == 2 && gs.vectors == 1) { + Printf(false, "%FtTWO POINTS AND A VECTOR"); + Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum(); + Printf(true, " pointA = " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), p0)); + Vector p1 = SK.GetEntity(gs.point[1])->PointGetNum(); + Printf(false, " pointB = " PT_AS_STR, COSTR(SK.GetEntity(gs.point[1]), p1)); + Vector v = SK.GetEntity(gs.vector[0])->VectorGetNum(); + v = v.WithMagnitude(1); + Printf(true, " vector = " PT_AS_NUM_LINK, CO_LINK(SK.GetEntity(gs.vector[0]), v)); + double d = (p1.Minus(p0)).Dot(v); + Printf(true, " proj_d = %Fi%s", SS.MmToString(d).c_str()); + } else if(gs.n == 2 && gs.lineSegments == 1 && gs.points == 1) { + Entity *ln = SK.GetEntity(gs.entity[0]); + Vector lp0 = SK.GetEntity(ln->point[0])->PointGetNum(), + lp1 = SK.GetEntity(ln->point[1])->PointGetNum(); + Printf(false, "%FtLINE SEGMENT AND POINT%E"); + Printf(true, " ln thru " PT_AS_STR, COSTR(SK.GetEntity(ln->point[0]), lp0)); + Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(ln->point[1]), lp1)); + Entity *p = SK.GetEntity(gs.point[0]); + Vector pp = p->PointGetNum(); + Printf(true, " point " PT_AS_STR, COSTR(p, pp)); + Printf(true, " pt-ln distance = %Fi%s%E", + SS.MmToString(pp.DistanceToLine(lp0, lp1.Minus(lp0))).c_str()); + hEntity wrkpl = SS.GW.ActiveWorkplane(); + if(wrkpl != Entity::FREE_IN_3D && !(p->workplane == wrkpl && ln->workplane == wrkpl)) { + Vector ppw = pp.ProjectInto(wrkpl); + Vector lp0w = lp0.ProjectInto(wrkpl); + Vector lp1w = lp1.ProjectInto(wrkpl); + Printf(false, " or distance = %Fi%s%E (in workplane)", + SS.MmToString(ppw.DistanceToLine(lp0w, lp1w.Minus(lp0w))).c_str()); + } + } else if(gs.n == 2 && gs.vectors == 2) { + Printf(false, "%FtTWO VECTORS"); + + Vector v0 = SK.GetEntity(gs.entity[0])->VectorGetNum(), + v1 = SK.GetEntity(gs.entity[1])->VectorGetNum(); + v0 = v0.WithMagnitude(1); + v1 = v1.WithMagnitude(1); + + Printf(true, " vectorA = " PT_AS_NUM_LINK, CO_LINK(SK.GetEntity(gs.entity[0]), v0)); + Printf(false, " vectorB = " PT_AS_NUM_LINK, CO_LINK(SK.GetEntity(gs.entity[1]), v1)); + + double theta = acos(v0.Dot(v1)); + Printf(true, " angle = %Fi%2%E degrees", theta*180/PI); + while(theta < PI/2) theta += PI; + while(theta > PI/2) theta -= PI; + Printf(false, " or angle = %Fi%2%E (mod 180)", theta*180/PI); + } else if(gs.n == 2 && gs.faces == 2) { + Printf(false, "%FtTWO PLANE FACES"); + + ListFaces(); + + Vector n0 = SK.GetEntity(gs.face[0])->FaceGetNormalNum(); + Vector n1 = SK.GetEntity(gs.face[1])->FaceGetNormalNum(); + + double theta = acos(n0.Dot(n1)); + Printf(true, " angle = %Fi%2%E degrees", theta*180/PI); + while(theta < PI/2) theta += PI; + while(theta > PI/2) theta -= PI; + Printf(false, " or angle = %Fi%2%E (mod 180)", theta*180/PI); + + if(fabs(theta) < 0.01) { + Vector p0 = SK.GetEntity(gs.face[0])->FaceGetPointNum(); + Vector p1 = SK.GetEntity(gs.face[1])->FaceGetPointNum(); + + double d = (p1.Minus(p0)).Dot(n0); + Printf(true, " distance = %Fi%s", SS.MmToString(d).c_str()); + } + } else if(gs.n == 3 && gs.faces == 3) { + Printf(false, "%FtTHREE PLANE FACES"); + + ListFaces(); + + // We should probably compute and show the intersection point if there is one. + + } else if(gs.n == 0 && gs.constraints == 1) { + Constraint *c = SK.GetConstraint(gs.constraint[0]); + const std::string &desc = c->DescriptionString().c_str(); + + if(c->type == Constraint::Type::COMMENT) { + Printf(false, "%FtCOMMENT%E %s", desc.c_str()); + if(c->ptA != Entity::NO_ENTITY) { + Vector p = SK.GetEntity(c->ptA)->PointGetNum(); + Printf(true, " attached to point at: " PT_AS_STR, COSTR(SK.GetEntity(c->ptA), p)); + Vector dv = c->disp.offset; + Printf(false, " distance = %Fi%s", SS.MmToString(dv.Magnitude()).c_str()); + Printf(false, " d(x, y, z) = " PT_AS_STR_NO_LINK, COSTR_NO_LINK(dv)); + } + } else if(c->HasLabel()) { + if(c->reference) { + Printf(false, "%FtREFERENCE%E %s", desc.c_str()); + } else { + Printf(false, "%FtDIMENSION%E %s", desc.c_str()); + } + Printf(true, " %Fd%f%D%Ll%s reference", + &ScreenConstraintToggleReference, gs.constraint[0].v, + c->reference ? CHECK_TRUE : CHECK_FALSE); + if(c->type == Constraint::Type::DIAMETER) { + Printf(false, " %Fd%f%D%Ll%s use radius", + &ScreenConstraintShowAsRadius, gs.constraint[0].v, + c->other ? CHECK_TRUE : CHECK_FALSE); + } + } else { + Printf(false, "%FtCONSTRAINT%E %s", desc.c_str()); + } + + if(c->IsProjectible()) { + if(c->workplane == Entity::FREE_IN_3D) { + Printf(true, "%FtNOT PROJECTED TO WORKPLANE%E"); + } else { + Entity *w = SK.GetEntity(c->workplane); + if(w->h.isFromRequest()) { + Printf(true, "%FtIN WORKPLANE%E %Fl%Ll%D%f%h%s%E", + w->h.request().v, + (&TextWindow::ScreenSelectRequest), &(TextWindow::ScreenHoverRequest), + w->DescriptionString().c_str()); + } else { + Printf(true, "%FtIN WORKPLANE%E %Fl%Ll%D%f%h%s%E", + w->h.group().v, + (&TextWindow::ScreenSelectGroup), (&TextWindow::ScreenHoverGroupWorkplane), + w->DescriptionString().c_str()); + } + } + } + + std::vector lhe = {}; + lhe.push_back(c->ptA); + lhe.push_back(c->ptB); + lhe.push_back(c->entityA); + lhe.push_back(c->entityB); + lhe.push_back(c->entityC); + lhe.push_back(c->entityD); + + auto it = std::remove_if(lhe.begin(), lhe.end(), [](hEntity he) { + return he == Entity::NO_ENTITY || !he.isFromRequest(); + }); + lhe.erase(it, lhe.end()); + + if(!lhe.empty()) { + if(c->reference) { + Printf(true, "%FtMEASURES:%E"); + } else { + Printf(true, "%FtCONSTRAINS:%E"); + } + + int a = 0; + for(hEntity he : lhe) { + Entity *e = SK.GetEntity(he); + Printf(false, "%Bp %Fl%Ll%D%f%h%s%E", + (a & 1) ? 'd' : 'a', + e->h.v, (&TextWindow::ScreenSelectEntity), + &(TextWindow::ScreenHoverEntity), + e->DescriptionString().c_str()); + a++; + } + } + } else { + int n = SS.GW.selection.n; + Printf(false, "%FtSELECTED:%E %d item%s", n, n == 1 ? "" : "s"); + } + + if(shown.screen == Screen::STYLE_INFO && + shown.style.v >= Style::FIRST_CUSTOM && gs.stylables > 0) + { + // If we are showing a screen for a particular style, then offer the + // option to assign our selected entities to that style. + Style *s = Style::Get(shown.style); + Printf(true, "%Fl%D%f%Ll(assign to style %s)%E", + shown.style.v, + &ScreenAssignSelectionToStyle, + s->DescriptionString().c_str()); + } + // If any of the selected entities have an assigned style, then offer + // the option to remove that style. + bool styleAssigned = false; + for(int i = 0; i < gs.entities; i++) { + Entity *e = SK.GetEntity(gs.entity[i]); + if(e->style.v != 0) { + styleAssigned = true; + } + } + for(int i = 0; i < gs.constraints; i++) { + Constraint *c = SK.GetConstraint(gs.constraint[i]); + if(c->type == Constraint::Type::COMMENT && c->disp.style.v != 0) { + styleAssigned = true; + } + } + if(styleAssigned) { + Printf(true, "%Fl%D%f%Ll(remove assigned style)%E", + 0, + &ScreenAssignSelectionToStyle); + } + + Printf(true, "%Fl%f%Ll(unselect all)%E", &TextWindow::ScreenUnselectAll); +} + +void TextWindow::GoToScreen(Screen screen) { + shown.screen = screen; +} + +} // namespace SolveSpace diff --git a/src/draw.cpp b/src/draw.cpp new file mode 100644 index 0000000..65603dd --- /dev/null +++ b/src/draw.cpp @@ -0,0 +1,961 @@ +//----------------------------------------------------------------------------- +// The root function to paint our graphics window, after setting up all the +// views and such appropriately. Also contains all the stuff to manage the +// selection. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +bool GraphicsWindow::Selection::Equals(Selection *b) { + if(entity != b->entity) return false; + if(constraint != b->constraint) return false; + return true; +} + +bool GraphicsWindow::Selection::IsEmpty() { + if(entity.v) return false; + if(constraint.v) return false; + return true; +} + +bool GraphicsWindow::Selection::HasEndpoints() { + if(!entity.v) return false; + Entity *e = SK.GetEntity(entity); + return e->HasEndpoints(); +} + +void GraphicsWindow::Selection::Clear() { + entity.v = constraint.v = 0; + emphasized = false; +} + +void GraphicsWindow::Selection::Draw(bool isHovered, Canvas *canvas) { + const Camera &camera = canvas->GetCamera(); + + std::vector refs; + if(entity.v) { + Entity *e = SK.GetEntity(entity); + e->Draw(isHovered ? Entity::DrawAs::HOVERED : + Entity::DrawAs::SELECTED, + canvas); + if(emphasized) { + e->GetReferencePoints(&refs); + } + } + if(constraint.v) { + Constraint *c = SK.GetConstraint(constraint); + c->Draw(isHovered ? Constraint::DrawAs::HOVERED : + Constraint::DrawAs::SELECTED, + canvas); + if(emphasized) { + c->GetReferencePoints(camera, &refs); + } + } + if(emphasized && (constraint.v || entity.v)) { + // We want to emphasize this constraint or entity, by drawing a thick + // line from the top left corner of the screen to the reference point(s) + // of that entity or constraint. + Canvas::Stroke strokeEmphasis = {}; + strokeEmphasis.layer = Canvas::Layer::FRONT; + strokeEmphasis.color = Style::Color(Style::HOVERED).WithAlpha(50); + strokeEmphasis.width = 40; + strokeEmphasis.unit = Canvas::Unit::PX; + Canvas::hStroke hcsEmphasis = canvas->GetStroke(strokeEmphasis); + + Point2d topLeftScreen; + topLeftScreen.x = -(double)camera.width / 2; + topLeftScreen.y = (double)camera.height / 2; + Vector topLeft = camera.UnProjectPoint(topLeftScreen); + + auto it = std::unique(refs.begin(), refs.end(), + [](const Vector &a, const Vector &b) { return a.Equals(b); }); + refs.erase(it, refs.end()); + for(const Vector &p : refs) { + canvas->DrawLine(topLeft, p, hcsEmphasis); + } + } +} + +void GraphicsWindow::ClearSelection() { + selection.Clear(); + SS.ScheduleShowTW(); + Invalidate(); +} + +void GraphicsWindow::ClearNonexistentSelectionItems() { + bool change = false; + Selection *s; + selection.ClearTags(); + for(s = selection.First(); s; s = selection.NextAfter(s)) { + if(s->constraint.v && !(SK.constraint.FindByIdNoOops(s->constraint))) { + s->tag = 1; + change = true; + } + if(s->entity.v && !(SK.entity.FindByIdNoOops(s->entity))) { + s->tag = 1; + change = true; + } + } + selection.RemoveTagged(); + if(change) Invalidate(); +} + +//----------------------------------------------------------------------------- +// Is this entity/constraint selected? +//----------------------------------------------------------------------------- +bool GraphicsWindow::IsSelected(hEntity he) { + Selection s = {}; + s.entity = he; + return IsSelected(&s); +} +bool GraphicsWindow::IsSelected(Selection *st) { + Selection *s; + for(s = selection.First(); s; s = selection.NextAfter(s)) { + if(s->Equals(st)) { + return true; + } + } + return false; +} + +//----------------------------------------------------------------------------- +// Unselect an item, if it is selected. We can either unselect just that item, +// or also unselect any coincident points. The latter is useful if the user +// somehow selects two coincident points (like with select all), because it +// would otherwise be impossible to de-select the lower of the two. +//----------------------------------------------------------------------------- +void GraphicsWindow::MakeUnselected(hEntity he, bool coincidentPointTrick) { + Selection stog = {}; + stog.entity = he; + MakeUnselected(&stog, coincidentPointTrick); +} +void GraphicsWindow::MakeUnselected(Selection *stog, bool coincidentPointTrick){ + if(stog->IsEmpty()) return; + + Selection *s; + + // If an item was selected, then we just un-select it. + selection.ClearTags(); + for(s = selection.First(); s; s = selection.NextAfter(s)) { + if(s->Equals(stog)) { + s->tag = 1; + } + } + // If two points are coincident, then it's impossible to hover one of + // them. But make sure to deselect both, to avoid mysterious seeming + // inability to deselect if the bottom one did somehow get selected. + if(stog->entity.v && coincidentPointTrick) { + Entity *e = SK.GetEntity(stog->entity); + if(e->IsPoint()) { + Vector ep = e->PointGetNum(); + for(s = selection.First(); s; s = selection.NextAfter(s)) { + if(!s->entity.v) continue; + if(s->entity == stog->entity) + continue; + Entity *se = SK.GetEntity(s->entity); + if(!se->IsPoint()) continue; + if(ep.Equals(se->PointGetNum())) { + s->tag = 1; + } + } + } + } + selection.RemoveTagged(); +} + +//----------------------------------------------------------------------------- +// Select an item, if it isn't selected already. +//----------------------------------------------------------------------------- +void GraphicsWindow::MakeSelected(hEntity he) { + Selection stog = {}; + stog.entity = he; + MakeSelected(&stog); +} + +void GraphicsWindow::MakeSelected(hConstraint hc) { + Selection stog = {}; + stog.constraint = hc; + MakeSelected(&stog); +} + +void GraphicsWindow::MakeSelected(Selection *stog) { + if(stog->IsEmpty()) return; + if(IsSelected(stog)) return; + + if(stog->entity.v != 0 && SK.GetEntity(stog->entity)->IsFace()) { + // In the interest of speed for the triangle drawing code, + // only MAX_SELECTABLE_FACES faces may be selected at a time. + unsigned int c = 0; + Selection *s; + selection.ClearTags(); + for(s = selection.First(); s; s = selection.NextAfter(s)) { + hEntity he = s->entity; + if(he.v != 0 && SK.GetEntity(he)->IsFace()) { + c++; + // See also GraphicsWindow::GroupSelection "if(e->IsFace())" + // and Group::DrawMesh "case DrawMeshAs::SELECTED:" + if(c >= MAX_SELECTABLE_FACES) s->tag = 1; + } + } + selection.RemoveTagged(); + } + + selection.Add(stog); +} + +//----------------------------------------------------------------------------- +// Select everything that lies within the marquee view-aligned rectangle. +//----------------------------------------------------------------------------- +void GraphicsWindow::SelectByMarquee() { + Point2d marqueePoint = ProjectPoint(orig.marqueePoint); + BBox marqueeBBox = BBox::From(Vector::From(marqueePoint.x, marqueePoint.y, VERY_NEGATIVE), + Vector::From(orig.mouse.x, orig.mouse.y, VERY_POSITIVE)); + + for(Entity &e : SK.entity) { + if(e.group != SS.GW.activeGroup) continue; + if(e.IsFace() || e.IsDistance()) continue; + if(!e.IsVisible()) continue; + + bool entityHasBBox; + BBox entityBBox = e.GetOrGenerateScreenBBox(&entityHasBBox); + if(entityHasBBox && entityBBox.Overlaps(marqueeBBox)) { + if(e.type == Entity::Type::LINE_SEGMENT) { + Vector p0 = SS.GW.ProjectPoint3(e.EndpointStart()); + Vector p1 = SS.GW.ProjectPoint3(e.EndpointFinish()); + if((!marqueeBBox.Contains({p0.x, p0.y}, 0)) && + (!marqueeBBox.Contains({p1.x, p1.y}, 0))) { + // The selection marquee does not contain either of the line segment end points. + // This means that either the segment is entirely outside the marquee or that + // it intersects it. Check if it does... + if(!Vector::BoundingBoxIntersectsLine(marqueeBBox.maxp, marqueeBBox.minp, p0, + p1, true)) { + // ... it does not so it is outside. + continue; + } + } + } + MakeSelected(e.h); + } + } +} + +//----------------------------------------------------------------------------- +// Sort the selection according to various criteria: the entities and +// constraints separately, counts of certain types of entities (circles, +// lines, etc.), and so on. +//----------------------------------------------------------------------------- +void GraphicsWindow::GroupSelection() { + gs = {}; + int i; + for(i = 0; i < selection.n; i++) { + Selection *s = &(selection[i]); + if(s->entity.v) { + (gs.n)++; + + Entity *e = SK.entity.FindById(s->entity); + + if(e->IsStylable()) gs.stylables++; + + // A list of points, and a list of all entities that aren't points. + if(e->IsPoint()) { + gs.points++; + gs.point.push_back(s->entity); + } else { + gs.entities++; + gs.entity.push_back(s->entity); + } + + // And an auxiliary list of normals, including normals from + // workplanes. + if(e->IsNormal()) { + gs.anyNormals++; + gs.anyNormal.push_back(s->entity); + } else if(e->IsWorkplane()) { + gs.anyNormals++; + gs.anyNormal.push_back(e->Normal()->h); + } + + // And of vectors (i.e., stuff with a direction to constrain) + if(e->HasVector()) { + gs.vectors++; + gs.vector.push_back(s->entity); + } + + // Faces (which are special, associated/drawn with triangles) + if(e->IsFace()) { + gs.faces++; + gs.face.push_back(s->entity); + } + + if(e->HasEndpoints()) { + (gs.withEndpoints)++; + } + + // And some aux counts too + switch(e->type) { + case Entity::Type::WORKPLANE: (gs.workplanes)++; break; + case Entity::Type::LINE_SEGMENT: (gs.lineSegments)++; break; + case Entity::Type::CUBIC: (gs.cubics)++; break; + case Entity::Type::CUBIC_PERIODIC: (gs.periodicCubics)++; break; + + case Entity::Type::ARC_OF_CIRCLE: + (gs.circlesOrArcs)++; + (gs.arcs)++; + break; + + case Entity::Type::CIRCLE: (gs.circlesOrArcs)++; break; + + default: break; + } + } + if(s->constraint.v) { + gs.constraints++; + gs.constraint.push_back(s->constraint); + Constraint *c = SK.GetConstraint(s->constraint); + if(c->IsStylable()) gs.stylables++; + if(c->HasLabel()) gs.constraintLabels++; + } + } +} + +Camera GraphicsWindow::GetCamera() const { + Camera camera = {}; + if(window) { + window->GetContentSize(&camera.width, &camera.height); + camera.pixelRatio = window->GetDevicePixelRatio(); + camera.gridFit = (window->GetDevicePixelRatio() == 1); + } else { // solvespace-cli + camera.width = 297.0; // A4? Whatever... + camera.height = 210.0; + camera.pixelRatio = 1.0; + camera.gridFit = camera.pixelRatio == 1.0; + } + camera.offset = offset; + camera.projUp = projUp; + camera.projRight = projRight; + camera.scale = scale; + camera.tangent = SS.CameraTangent(); + return camera; +} + +Lighting GraphicsWindow::GetLighting() const { + Lighting lighting = {}; + lighting.backgroundColor = SS.backgroundColor; + lighting.ambientIntensity = SS.ambientIntensity; + lighting.lightIntensity[0] = SS.lightIntensity[0]; + lighting.lightIntensity[1] = SS.lightIntensity[1]; + lighting.lightDirection[0] = SS.lightDir[0]; + lighting.lightDirection[1] = SS.lightDir[1]; + return lighting; +} + +GraphicsWindow::Selection GraphicsWindow::ChooseFromHoverToSelect() { + Selection sel = {}; + if(hoverList.IsEmpty()) + return sel; + + Group *activeGroup = SK.GetGroup(SS.GW.activeGroup); + int bestOrder = -1; + int bestZIndex = 0; + double bestDepth = VERY_POSITIVE; + + for(const Hover &hov : hoverList) { + hGroup hg = {}; + if(hov.selection.entity.v != 0) { + hg = SK.GetEntity(hov.selection.entity)->group; + } else if(hov.selection.constraint.v != 0) { + hg = SK.GetConstraint(hov.selection.constraint)->group; + } + + Group *g = SK.GetGroup(hg); + if(g->order > activeGroup->order) continue; + if(bestOrder != -1 && (bestOrder > g->order || bestZIndex > hov.zIndex)) continue; + // we have hov.zIndex is >= best and hov.group is >= best (but not > active group) + if(hov.depth > bestDepth && bestOrder == g->order && bestZIndex == hov.zIndex) continue; + bestOrder = g->order; + bestZIndex = hov.zIndex; + bestDepth = hov.depth; + sel = hov.selection; + } + return sel; +} + +// This uses the same logic as hovering and static entity selection +// but ignores points known not to be draggable +GraphicsWindow::Selection GraphicsWindow::ChooseFromHoverToDrag() { + Selection sel = {}; + if(hoverList.IsEmpty()) + return sel; + + Group *activeGroup = SK.GetGroup(SS.GW.activeGroup); + int bestOrder = -1; + int bestZIndex = 0; + double bestDepth = VERY_POSITIVE; + + for(const Hover &hov : hoverList) { + hGroup hg = {}; + if(hov.selection.entity.v != 0) { + Entity *e = SK.GetEntity(hov.selection.entity); + if (!e->CanBeDragged()) continue; + hg = e->group; + } else if(hov.selection.constraint.v != 0) { + hg = SK.GetConstraint(hov.selection.constraint)->group; + } + + Group *g = SK.GetGroup(hg); + if(g->order > activeGroup->order) continue; + if(bestOrder != -1 && (bestOrder > g->order || bestZIndex > hov.zIndex)) continue; + // we have hov.zIndex is >= best and hov.group is >= best (but not > active group) + if(hov.depth > bestDepth && bestOrder == g->order && bestZIndex == hov.zIndex) continue; + bestOrder = g->order; + bestZIndex = hov.zIndex; + sel = hov.selection; + } + return sel; +} + +void GraphicsWindow::HitTestMakeSelection(Point2d mp) { + hoverList = {}; + Selection sel = {}; + + // Did the view projection change? If so, invalidate bounding boxes. + if(!offset.EqualsExactly(cached.offset) || + !projRight.EqualsExactly(cached.projRight) || + !projUp.EqualsExactly(cached.projUp) || + EXACT(scale != cached.scale)) { + cached.offset = offset; + cached.projRight = projRight; + cached.projUp = projUp; + cached.scale = scale; + for(Entity &e : SK.entity) { + e.screenBBoxValid = false; + } + } + + ObjectPicker canvas = {}; + canvas.camera = GetCamera(); + canvas.selRadius = 10.0; + canvas.point = mp; + canvas.maxZIndex = -1; + + // Always do the entities; we might be dragging something that should + // be auto-constrained, and we need the hover for that. + for(Entity &e : SK.entity) { + if(!e.IsVisible()) continue; + + // If faces aren't selectable, image entities aren't either. + if(e.type == Entity::Type::IMAGE && !showFaces) continue; + + // Don't hover whatever's being dragged. + if(IsFromPending(e.h.request())) { + // The one exception is when we're creating a new cubic; we + // want to be able to hover the first point, because that's + // how we turn it into a periodic spline. + if(!e.IsPoint()) continue; + if(!e.h.isFromRequest()) continue; + Request *r = SK.GetRequest(e.h.request()); + if(r->type != Request::Type::CUBIC) continue; + if(r->extraPoints < 2) continue; + if(e.h.v != r->h.entity(1).v) continue; + } + + if(canvas.Pick([&]{ e.Draw(Entity::DrawAs::DEFAULT, &canvas); })) { + Hover hov = {}; + hov.distance = canvas.minDistance; + hov.zIndex = canvas.maxZIndex; + hov.depth = canvas.minDepth; + hov.selection.entity = e.h; + hoverList.Add(&hov); + } + } + + // The constraints and faces happen only when nothing's in progress. + if(pending.operation == Pending::NONE) { + // Constraints + for(Constraint &c : SK.constraint) { + if(canvas.Pick([&]{ c.Draw(Constraint::DrawAs::DEFAULT, &canvas); })) { + Hover hov = {}; + hov.distance = canvas.minDistance; + hov.zIndex = canvas.maxZIndex; + hov.selection.constraint = c.h; + hoverList.Add(&hov); + } + } + } + + std::sort(hoverList.begin(), hoverList.end(), + [](const Hover &a, const Hover &b) { + if(a.zIndex == b.zIndex) return a.distance < b.distance; + return a.zIndex > b.zIndex; + }); + sel = ChooseFromHoverToSelect(); + + if(pending.operation == Pending::NONE) { + // Faces, from the triangle mesh; these are lowest priority + if(sel.constraint.v == 0 && sel.entity.v == 0 && showShaded && showFaces) { + Group *g = SK.GetGroup(activeGroup); + SMesh *m = &(g->displayMesh); + + uint32_t v = m->FirstIntersectionWith(mp); + if(v) { + sel.entity.v = v; + Hover hov = {}; + hov.selection = sel; + hoverList.Add(&hov); + } + } + } + + canvas.Clear(); + + if(!sel.Equals(&hover)) { + hover = sel; + Invalidate(); + } +} + +//----------------------------------------------------------------------------- +// Project a point in model space to screen space, exactly as gl would; return +// units are pixels. +//----------------------------------------------------------------------------- +Point2d GraphicsWindow::ProjectPoint(Vector p) { + Vector p3 = ProjectPoint3(p); + Point2d p2 = { p3.x, p3.y }; + return p2; +} +//----------------------------------------------------------------------------- +// Project a point in model space to screen space, exactly as gl would; return +// units are pixels. The z coordinate is also returned, also in pixels. +//----------------------------------------------------------------------------- +Vector GraphicsWindow::ProjectPoint3(Vector p) { + double w; + Vector r = ProjectPoint4(p, &w); + return r.ScaledBy(scale/w); +} +//----------------------------------------------------------------------------- +// Project a point in model space halfway into screen space. The scale is +// not applied, and the perspective divide isn't applied; instead the w +// coordinate is returned separately. +//----------------------------------------------------------------------------- +Vector GraphicsWindow::ProjectPoint4(Vector p, double *w) { + p = p.Plus(offset); + + Vector r; + r.x = p.Dot(projRight); + r.y = p.Dot(projUp); + r.z = p.Dot(projUp.Cross(projRight)); + + *w = 1 + r.z*SS.CameraTangent()*scale; + return r; +} + +//----------------------------------------------------------------------------- +// Return a point in the plane parallel to the screen and through the offset, +// that projects onto the specified (x, y) coordinates. +//----------------------------------------------------------------------------- +Vector GraphicsWindow::UnProjectPoint(Point2d p) { + Vector orig = offset.ScaledBy(-1); + + // Note that we ignoring the effects of perspective. Since our returned + // point has the same component normal to the screen as the offset, it + // will have z = 0 after the rotation is applied, thus w = 1. So this is + // correct. + orig = orig.Plus(projRight.ScaledBy(p.x / scale)).Plus( + projUp. ScaledBy(p.y / scale)); + return orig; +} + +Vector GraphicsWindow::UnProjectPoint3(Vector p) { + p.z = p.z / (scale - p.z * SS.CameraTangent() * scale); + double w = 1 + p.z * SS.CameraTangent() * scale; + p.x *= w / scale; + p.y *= w / scale; + + Vector orig = offset.ScaledBy(-1); + orig = orig.Plus(projRight.ScaledBy(p.x)).Plus( + projUp. ScaledBy(p.y).Plus( + projRight.Cross(projUp). ScaledBy(p.z))); + return orig; +} + +void GraphicsWindow::NormalizeProjectionVectors() { + if(projRight.Magnitude() < LENGTH_EPS) { + projRight = Vector::From(1, 0, 0); + } + + Vector norm = projRight.Cross(projUp); + // If projRight and projUp somehow ended up parallel, then pick an + // arbitrary projUp normal to projRight. + if(norm.Magnitude() < LENGTH_EPS) { + norm = projRight.Normal(0); + } + projUp = norm.Cross(projRight); + + projUp = projUp.WithMagnitude(1); + projRight = projRight.WithMagnitude(1); +} + +void GraphicsWindow::DrawSnapGrid(Canvas *canvas) { + if(!LockedInWorkplane()) return; + + const Camera &camera = canvas->GetCamera(); + double width = camera.width, + height = camera.height; + + hEntity he = ActiveWorkplane(); + EntityBase *wrkpl = SK.GetEntity(he), + *norm = wrkpl->Normal(); + Vector n = projUp.Cross(projRight); + Vector wu, wv, wn, wp; + wp = SK.GetEntity(wrkpl->point[0])->PointGetNum(); + wu = norm->NormalU(); + wv = norm->NormalV(); + wn = norm->NormalN(); + + double g = SS.gridSpacing; + + double umin = VERY_POSITIVE, umax = VERY_NEGATIVE, + vmin = VERY_POSITIVE, vmax = VERY_NEGATIVE; + int a; + for(a = 0; a < 4; a++) { + // Ideally, we would just do +/- half the width and height; but + // allow some extra slop for rounding. + Vector horiz = projRight.ScaledBy((0.6*width)/scale + 2*g), + vert = projUp. ScaledBy((0.6*height)/scale + 2*g); + if(a == 2 || a == 3) horiz = horiz.ScaledBy(-1); + if(a == 1 || a == 3) vert = vert. ScaledBy(-1); + Vector tp = horiz.Plus(vert).Minus(offset); + + // Project the point into our grid plane, normal to the screen + // (not to the grid plane). If the plane is on edge then this is + // impossible so don't try to draw the grid. + bool parallel; + Vector tpp = Vector::AtIntersectionOfPlaneAndLine( + wn, wn.Dot(wp), + tp, tp.Plus(n), + ¶llel); + if(parallel) return; + + tpp = tpp.Minus(wp); + double uu = tpp.Dot(wu), + vv = tpp.Dot(wv); + + umin = min(uu, umin); + umax = max(uu, umax); + vmin = min(vv, vmin); + vmax = max(vv, vmax); + } + + int i, j, i0, i1, j0, j1; + + i0 = (int)(umin / g); + i1 = (int)(umax / g); + j0 = (int)(vmin / g); + j1 = (int)(vmax / g); + + if(i0 > i1 || i1 - i0 > 400) return; + if(j0 > j1 || j1 - j0 > 400) return; + + Canvas::Stroke stroke = {}; + stroke.layer = Canvas::Layer::BACK; + stroke.color = Style::Color(Style::DATUM).WithAlpha(75); + stroke.unit = Canvas::Unit::PX; + stroke.width = 1.0f; + Canvas::hStroke hcs = canvas->GetStroke(stroke); + + for(i = i0 + 1; i < i1; i++) { + canvas->DrawLine(wp.Plus(wu.ScaledBy(i*g)).Plus(wv.ScaledBy(j0*g)), + wp.Plus(wu.ScaledBy(i*g)).Plus(wv.ScaledBy(j1*g)), + hcs); + } + for(j = j0 + 1; j < j1; j++) { + canvas->DrawLine(wp.Plus(wu.ScaledBy(i0*g)).Plus(wv.ScaledBy(j*g)), + wp.Plus(wu.ScaledBy(i1*g)).Plus(wv.ScaledBy(j*g)), + hcs); + } +} + +void GraphicsWindow::DrawEntities(Canvas *canvas, bool persistent) { + for(Entity &e : SK.entity) { + if(persistent == (e.IsNormal() || e.IsWorkplane())) continue; + switch(SS.GW.drawOccludedAs) { + case DrawOccludedAs::VISIBLE: + e.Draw(Entity::DrawAs::OVERLAY, canvas); + break; + + case DrawOccludedAs::STIPPLED: + e.Draw(Entity::DrawAs::HIDDEN, canvas); + /* fallthrough */ + case DrawOccludedAs::INVISIBLE: + e.Draw(Entity::DrawAs::DEFAULT, canvas); + break; + } + } +} + +void GraphicsWindow::DrawPersistent(Canvas *canvas) { + // Draw the active group; this does stuff like the mesh and edges. + SK.GetGroup(activeGroup)->Draw(canvas); + + // Now draw the entities that don't change with viewport. + DrawEntities(canvas, /*persistent=*/true); + + // Draw filled paths in all groups, when those filled paths were requested + // specially by assigning a style with a fill color, or when the filled + // paths are just being filled by default. This should go last, to make + // the transparency work. + for(hGroup hg : SK.groupOrder) { + Group *g = SK.GetGroup(hg); + if(!(g->IsVisible())) continue; + g->DrawFilledPaths(canvas); + } +} + +void GraphicsWindow::Draw(Canvas *canvas) { + const Camera &camera = canvas->GetCamera(); + + // Nasty case when we're reloading the linked files; could be that + // we get an error, so a dialog pops up, and a message loop starts, and + // we have to get called to paint ourselves. If the sketch is screwed + // up, then we could trigger an oops trying to draw. + if(!SS.allConsistent) return; + + if(showSnapGrid) DrawSnapGrid(canvas); + + // Draw all the things that don't change when we rotate. + if(persistentCanvas != NULL) { + if(persistentDirty) { + persistentDirty = false; + + persistentCanvas->Clear(); + DrawPersistent(&*persistentCanvas); + persistentCanvas->Finalize(); + } + + persistentCanvas->Draw(); + } else { + DrawPersistent(canvas); + } + + // Draw the entities that do change with viewport. + DrawEntities(canvas, /*persistent=*/false); + + // Draw the polygon errors. + if(SS.checkClosedContour) { + SK.GetGroup(activeGroup)->DrawPolyError(canvas); + } + + // Draw the constraints + for(Constraint &c : SK.constraint) { + c.Draw(Constraint::DrawAs::DEFAULT, canvas); + } + + // Draw areas + if(SS.showContourAreas) { + for(hGroup hg : SK.groupOrder) { + Group *g = SK.GetGroup(hg); + if(g->h != activeGroup) continue; + if(!(g->IsVisible())) continue; + g->DrawContourAreaLabels(canvas); + } + } + + // Draw the "pending" constraint, i.e. a constraint that would be + // placed on a line that is almost horizontal or vertical. + if(SS.GW.pending.operation == Pending::DRAGGING_NEW_LINE_POINT && + SS.GW.pending.hasSuggestion) { + Constraint c = {}; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + c.type = SS.GW.pending.suggestion; + c.entityA = SS.GW.pending.request.entity(0); + c.Draw(Constraint::DrawAs::DEFAULT, canvas); + } + + Canvas::Stroke strokeAnalyze = Style::Stroke(Style::ANALYZE); + strokeAnalyze.layer = Canvas::Layer::FRONT; + Canvas::hStroke hcsAnalyze = canvas->GetStroke(strokeAnalyze); + + // Draw the traced path, if one exists + SEdgeList tracedEdges = {}; + SS.traced.path.MakeEdgesInto(&tracedEdges); + canvas->DrawEdges(tracedEdges, hcsAnalyze); + tracedEdges.Clear(); + + Canvas::Stroke strokeError = Style::Stroke(Style::DRAW_ERROR); + strokeError.layer = Canvas::Layer::FRONT; + strokeError.width = 12; + Canvas::hStroke hcsError = canvas->GetStroke(strokeError); + + // And the naked edges, if the user did Analyze -> Show Naked Edges. + canvas->DrawEdges(SS.nakedEdges, hcsError); + + // Then redraw whatever the mouse is hovering over, highlighted. + hover.Draw(/*isHovered=*/true, canvas); + SK.GetGroup(activeGroup)->DrawMesh(Group::DrawMeshAs::HOVERED, canvas); + + // And finally draw the selection, same mechanism. + for(Selection *s = selection.First(); s; s = selection.NextAfter(s)) { + s->Draw(/*isHovered=*/false, canvas); + } + SK.GetGroup(activeGroup)->DrawMesh(Group::DrawMeshAs::SELECTED, canvas); + + Canvas::Stroke strokeDatum = Style::Stroke(Style::DATUM); + strokeDatum.unit = Canvas::Unit::PX; + strokeDatum.layer = Canvas::Layer::FRONT; + strokeDatum.width = 1; + Canvas::hStroke hcsDatum = canvas->GetStroke(strokeDatum); + + // An extra line, used to indicate the origin when rotating within the + // plane of the monitor. + if(SS.extraLine.draw) { + canvas->DrawLine(SS.extraLine.ptA, SS.extraLine.ptB, hcsDatum); + } + + if(SS.centerOfMass.draw && !SS.centerOfMass.dirty) { + Vector p = SS.centerOfMass.position; + Vector u = camera.projRight; + Vector v = camera.projUp; + + const double size = 10.0; + const int subdiv = 16; + double h = Style::DefaultTextHeight() / camera.scale; + std::string s = + SS.MmToStringSI(p.x) + ", " + + SS.MmToStringSI(p.y) + ", " + + SS.MmToStringSI(p.z); + canvas->DrawVectorText(s.c_str(), h, + p.Plus(u.ScaledBy((size + 5.0)/scale)).Minus(v.ScaledBy(h / 2.0)), + u, v, hcsDatum); + u = u.WithMagnitude(size / scale); + v = v.WithMagnitude(size / scale); + + canvas->DrawLine(p.Minus(u), p.Plus(u), hcsDatum); + canvas->DrawLine(p.Minus(v), p.Plus(v), hcsDatum); + Vector prev; + for(int i = 0; i <= subdiv; i++) { + double a = (double)i / subdiv * 2.0 * PI; + Vector point = p.Plus(u.ScaledBy(cos(a))).Plus(v.ScaledBy(sin(a))); + if(i > 0) { + canvas->DrawLine(point, prev, hcsDatum); + } + prev = point; + } + } + + // A note to indicate the origin in the just-exported file. + if(SS.justExportedInfo.draw) { + Vector p, u, v; + if(SS.justExportedInfo.showOrigin) { + p = SS.justExportedInfo.pt, + u = SS.justExportedInfo.u, + v = SS.justExportedInfo.v; + } else { + p = camera.offset.ScaledBy(-1); + u = camera.projRight; + v = camera.projUp; + } + canvas->DrawVectorText("previewing exported geometry; press Esc to return", + Style::DefaultTextHeight() / camera.scale, + p.Plus(u.ScaledBy(10/scale)).Plus(v.ScaledBy(10/scale)), u, v, + hcsDatum); + + if(SS.justExportedInfo.showOrigin) { + Vector um = p.Plus(u.WithMagnitude(-15/scale)), + up = p.Plus(u.WithMagnitude(30/scale)), + vm = p.Plus(v.WithMagnitude(-15/scale)), + vp = p.Plus(v.WithMagnitude(30/scale)); + canvas->DrawLine(um, up, hcsDatum); + canvas->DrawLine(vm, vp, hcsDatum); + canvas->DrawVectorText("(x, y) = (0, 0) for file just exported", + Style::DefaultTextHeight() / camera.scale, + p.Plus(u.ScaledBy(40/scale)).Plus( + v.ScaledBy(-(Style::DefaultTextHeight())/scale)), u, v, + hcsDatum); + } + } +} + +void GraphicsWindow::Paint() { + ssassert(window != NULL && canvas != NULL, + "Cannot paint without window and canvas"); + + havePainted = true; + + Camera camera = GetCamera(); + Lighting lighting = GetLighting(); + + if(!SS.ActiveGroupsOkay()) { + // Draw a different background whenever we're having solve problems. + RgbaColor bgColor = Style::Color(Style::DRAW_ERROR); + bgColor = RgbaColor::FromFloat(0.4f*bgColor.redF(), + 0.4f*bgColor.greenF(), + 0.4f*bgColor.blueF()); + lighting.backgroundColor = bgColor; + // And show the text window, which has info to debug it + ForceTextWindowShown(); + } + + canvas->SetLighting(lighting); + canvas->SetCamera(camera); + canvas->StartFrame(); + + // Draw the 3d objects. + Draw(canvas.get()); + canvas->FlushFrame(); + + // Draw the 2d UI overlay. + camera.LoadIdentity(); + camera.offset.x = -(double)camera.width / 2.0; + camera.offset.y = -(double)camera.height / 2.0; + canvas->SetCamera(camera); + + UiCanvas uiCanvas = {}; + uiCanvas.canvas = canvas; + + // If a marquee selection is in progress, then draw the selection + // rectangle, as an outline and a transparent fill. + if(pending.operation == Pending::DRAGGING_MARQUEE) { + Point2d begin = ProjectPoint(orig.marqueePoint); + uiCanvas.DrawRect((int)orig.mouse.x + (int)camera.width / 2, + (int)begin.x + (int)camera.width / 2, + (int)orig.mouse.y + (int)camera.height / 2, + (int)begin.y + (int)camera.height / 2, + /*fillColor=*/Style::Color(Style::HOVERED).WithAlpha(25), + /*outlineColor=*/Style::Color(Style::HOVERED)); + } + + // If we've had a screenshot requested, take it now, before the UI is overlaid. + if(!SS.screenshotFile.IsEmpty()) { + FILE *f = OpenFile(SS.screenshotFile, "wb"); + if(!f || !canvas->ReadFrame()->WritePng(f, /*flip=*/true)) { + Error("Couldn't write to '%s'", SS.screenshotFile.raw.c_str()); + } + if(f) fclose(f); + SS.screenshotFile.Clear(); + } + + // And finally the toolbar. + if(SS.showToolbar) { + canvas->SetCamera(camera); + ToolbarDraw(&uiCanvas); + } + + canvas->FlushFrame(); + canvas->FinishFrame(); + canvas->Clear(); +} + +void GraphicsWindow::Invalidate(bool clearPersistent) { + if(window) { + if(clearPersistent) { + persistentDirty = true; + } + window->Invalidate(); + } +} + +} // namespace SolveSpace diff --git a/src/drawconstraint.cpp b/src/drawconstraint.cpp new file mode 100644 index 0000000..bf7d389 --- /dev/null +++ b/src/drawconstraint.cpp @@ -0,0 +1,1384 @@ +//----------------------------------------------------------------------------- +// Given a constraint, draw a graphical and user-selectable representation +// of that constraint on-screen. We can either draw with gl, or compute the +// distance from a point (the location of the mouse pointer) to the lines +// that we would have drawn, for selection. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +std::string Constraint::Label() const { + std::string result; + if(type == Type::ANGLE) { + result = SS.DegreeToString(valA) + "°"; + } else if(type == Type::LENGTH_RATIO || type == Type::ARC_ARC_LEN_RATIO || type == Type::ARC_LINE_LEN_RATIO) { + result = ssprintf("%.3f:1", valA); + } else if(type == Type::COMMENT) { + result = comment; + } else if(type == Type::DIAMETER) { + if(!other) { + result = "⌀" + SS.MmToStringSI(valA); + } else { + result = "R" + SS.MmToStringSI(valA / 2); + } + } else { + // valA has units of distance + result = SS.MmToStringSI(fabs(valA)); + } + if(reference) { + result += " REF"; + } + return result; +} + +void Constraint::DoLine(Canvas *canvas, Canvas::hStroke hcs, Vector a, Vector b) { + const Camera &camera = canvas->GetCamera(); + + a = camera.AlignToPixelGrid(a); + b = camera.AlignToPixelGrid(b); + canvas->DrawLine(a, b, hcs); +} + +void Constraint::DoStippledLine(Canvas *canvas, Canvas::hStroke hcs, Vector a, Vector b) { + Canvas::Stroke strokeStippled = *canvas->strokes.FindById(hcs); + strokeStippled.stipplePattern = StipplePattern::SHORT_DASH; + strokeStippled.stippleScale = 4.0; + Canvas::hStroke hcsStippled = canvas->GetStroke(strokeStippled); + DoLine(canvas, hcsStippled, a, b); +} + +void Constraint::DoLabel(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector *labelPos, Vector gr, Vector gu) { + const Camera &camera = canvas->GetCamera(); + + std::string s = Label(); + double textHeight = Style::TextHeight(GetStyle()) / camera.scale; + double swidth = VectorFont::Builtin()->GetWidth(textHeight, s), + sheight = VectorFont::Builtin()->GetCapHeight(textHeight); + + // By default, the reference is from the center; but the style could + // specify otherwise if one is present, and it could also specify a + // rotation. + if(type == Type::COMMENT && disp.style.v) { + Style *st = Style::Get(disp.style); + // rotation first + double rads = st->textAngle*PI/180; + double c = cos(rads), s = sin(rads); + Vector pr = gr, pu = gu; + gr = pr.ScaledBy( c).Plus(pu.ScaledBy(s)); + gu = pr.ScaledBy(-s).Plus(pu.ScaledBy(c)); + // then origin + uint32_t o = (uint32_t)st->textOrigin; + if(o & (uint32_t)Style::TextOrigin::LEFT) ref = ref.Plus(gr.WithMagnitude(swidth/2)); + if(o & (uint32_t)Style::TextOrigin::RIGHT) ref = ref.Minus(gr.WithMagnitude(swidth/2)); + if(o & (uint32_t)Style::TextOrigin::BOT) ref = ref.Plus(gu.WithMagnitude(sheight/2)); + if(o & (uint32_t)Style::TextOrigin::TOP) ref = ref.Minus(gu.WithMagnitude(sheight/2)); + } + + Vector o = ref.Minus(gr.WithMagnitude(swidth/2)).Minus( + gu.WithMagnitude(sheight/2)); + canvas->DrawVectorText(s, textHeight, o, gr.WithMagnitude(1), gu.WithMagnitude(1), hcs); + if(labelPos) *labelPos = o; +} + +void Constraint::DoProjectedPoint(Canvas *canvas, Canvas::hStroke hcs, + Vector *r, Vector n, Vector o) { + double d = r->DistanceToPlane(n, o); + Vector p = r->Minus(n.ScaledBy(d)); + DoStippledLine(canvas, hcs, p, *r); + *r = p; +} + +void Constraint::DoProjectedPoint(Canvas *canvas, Canvas::hStroke hcs, Vector *r) { + Vector p = r->ProjectInto(workplane); + DoStippledLine(canvas, hcs, p, *r); + *r = p; +} + +//----------------------------------------------------------------------------- +// There is a rectangular box, aligned to our display axes (projRight, projUp) +// centered at ref. This is where a dimension label will be drawn. We want to +// draw a line from A to B. If that line would intersect the label box, then +// trim the line to leave a gap for it, and return zero. If not, then extend +// the line to almost meet the box, and return either positive or negative, +// depending whether that extension was from A or from B. +//----------------------------------------------------------------------------- +int Constraint::DoLineTrimmedAgainstBox(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector a, Vector b, bool extend) { + const Camera &camera = canvas->GetCamera(); + double th = Style::TextHeight(GetStyle()) / camera.scale; + double pixels = 1.0 / camera.scale; + double swidth = VectorFont::Builtin()->GetWidth(th, Label()) + 8 * pixels, + sheight = VectorFont::Builtin()->GetCapHeight(th) + 8 * pixels; + Vector gu = camera.projUp.WithMagnitude(1), + gr = camera.projRight.WithMagnitude(1); + return DoLineTrimmedAgainstBox(canvas, hcs, ref, a, b, extend, gr, gu, swidth, sheight); +} + +int Constraint::DoLineTrimmedAgainstBox(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector a, Vector b, bool extend, + Vector gr, Vector gu, double swidth, double sheight) { + struct { + Vector n; + double d; + } planes[4]; + // reference pos is the center of box occupied by text; build a rectangle + // around that, aligned to axes gr and gu, from four planes will all four + // normals pointing inward + planes[0].n = gu.ScaledBy(-1); planes[0].d = -(gu.Dot(ref) + sheight/2); + planes[1].n = gu; planes[1].d = gu.Dot(ref) - sheight/2; + planes[2].n = gr; planes[2].d = gr.Dot(ref) - swidth/2; + planes[3].n = gr.ScaledBy(-1); planes[3].d = -(gr.Dot(ref) + swidth/2); + + double tmin = VERY_POSITIVE, tmax = VERY_NEGATIVE; + Vector dl = b.Minus(a); + + for(int i = 0; i < 4; i++) { + bool parallel; + Vector p = Vector::AtIntersectionOfPlaneAndLine( + planes[i].n, planes[i].d, + a, b, ¶llel); + if(parallel) continue; + + int j; + for(j = 0; j < 4; j++) { + double d = (planes[j].n).Dot(p) - planes[j].d; + if(d < -LENGTH_EPS) break; + } + if(j < 4) continue; + + double t = (p.Minus(a)).DivProjected(dl); + tmin = min(t, tmin); + tmax = max(t, tmax); + } + + // Both in range; so there's pieces of the line on both sides of the label box. + if(tmin >= 0.0 && tmin <= 1.0 && tmax >= 0.0 && tmax <= 1.0) { + DoLine(canvas, hcs, a, a.Plus(dl.ScaledBy(tmin))); + DoLine(canvas, hcs, a.Plus(dl.ScaledBy(tmax)), b); + return 0; + } + + // Only one intersection in range; so the box is right on top of the endpoint + if(tmin >= 0.0 && tmin <= 1.0) { + DoLine(canvas, hcs, a, a.Plus(dl.ScaledBy(tmin))); + return 0; + } + + // Likewise. + if(tmax >= 0.0 && tmax <= 1.0) { + DoLine(canvas, hcs, a.Plus(dl.ScaledBy(tmax)), b); + return 0; + } + + // The line does not intersect the label; so the line should get + // extended to just barely meet the label. + // 0 means the label lies within the line, negative means it's outside + // and closer to b, positive means outside and closer to a. + if(tmax < 0.0) { + if(extend) a = a.Plus(dl.ScaledBy(tmax)); + DoLine(canvas, hcs, a, b); + return 1; + } + + if(tmin > 1.0) { + if(extend) b = a.Plus(dl.ScaledBy(tmin)); + DoLine(canvas, hcs, a, b); + return -1; + } + + // This will happen if the entire line lies within the box. + return 0; +} + +void Constraint::DoArrow(Canvas *canvas, Canvas::hStroke hcs, + Vector p, Vector dir, Vector n, double width, double angle, double da) { + dir = dir.WithMagnitude(width / cos(angle)); + dir = dir.RotatedAbout(n, da); + DoLine(canvas, hcs, p, p.Plus(dir.RotatedAbout(n, angle))); + DoLine(canvas, hcs, p, p.Plus(dir.RotatedAbout(n, -angle))); +} + +//----------------------------------------------------------------------------- +// Draw a line with arrows on both ends, and possibly a gap in the middle for +// the dimension. We will use these for most length dimensions. The length +// being dimensioned is from A to B; but those points get extended perpendicular +// to the line AB, until the line between the extensions crosses ref (the +// center of the label). +//----------------------------------------------------------------------------- +void Constraint::DoLineWithArrows(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector a, Vector b, + bool onlyOneExt) +{ + const Camera &camera = canvas->GetCamera(); + double pixels = 1.0 / camera.scale; + + Vector ab = a.Minus(b); + Vector ar = a.Minus(ref); + // Normal to a plane containing the line and the label origin. + Vector n = ab.Cross(ar); + // Within that plane, and normal to the line AB; so that's our extension + // line. + Vector out = ab.Cross(n).WithMagnitude(1); + out = out.ScaledBy(-out.Dot(ar)); + + Vector ae = a.Plus(out), be = b.Plus(out); + + // Extension lines extend 10 pixels beyond where the arrows get + // drawn (which is at the same offset perpendicular from AB as the + // label). + DoLine(canvas, hcs, a, ae.Plus(out.WithMagnitude(10*pixels))); + if(!onlyOneExt) { + DoLine(canvas, hcs, b, be.Plus(out.WithMagnitude(10*pixels))); + } + + int within = DoLineTrimmedAgainstBox(canvas, hcs, ref, ae, be); + + // Arrow heads are 13 pixels long, with an 18 degree half-angle. + double theta = 18*PI/180; + Vector arrow = (be.Minus(ae)).WithMagnitude(13*pixels); + + if(within != 0) { + arrow = arrow.ScaledBy(-1); + Vector seg = (be.Minus(ae)).WithMagnitude(18*pixels); + if(within < 0) DoLine(canvas, hcs, ae, ae.Minus(seg)); + if(within > 0) DoLine(canvas, hcs, be, be.Plus(seg)); + } + + DoArrow(canvas, hcs, ae, arrow, n, 13.0 * pixels, theta, 0.0); + DoArrow(canvas, hcs, be, arrow.Negated(), n, 13.0 * pixels, theta, 0.0); +} + +void Constraint::DoEqualLenTicks(Canvas *canvas, Canvas::hStroke hcs, + Vector a, Vector b, Vector gn, Vector *refp) { + const Camera &camera = canvas->GetCamera(); + + Vector m = (a.ScaledBy(1.0/3)).Plus(b.ScaledBy(2.0/3)); + if(refp) *refp = m; + Vector ab = a.Minus(b); + Vector n = (gn.Cross(ab)).WithMagnitude(10/camera.scale); + + DoLine(canvas, hcs, m.Minus(n), m.Plus(n)); +} + +void Constraint::DoEqualRadiusTicks(Canvas *canvas, Canvas::hStroke hcs, + hEntity he, Vector *refp) { + const Camera &camera = canvas->GetCamera(); + Entity *circ = SK.GetEntity(he); + + Vector center = SK.GetEntity(circ->point[0])->PointGetDrawNum(); + double r = circ->CircleGetRadiusNum(); + Quaternion q = circ->Normal()->NormalGetNum(); + Vector u = q.RotationU(), v = q.RotationV(); + + double theta; + if(circ->type == Entity::Type::CIRCLE) { + theta = PI/2; + } else if(circ->type == Entity::Type::ARC_OF_CIRCLE) { + double thetaa, thetab, dtheta; + circ->ArcGetAngles(&thetaa, &thetab, &dtheta); + theta = thetaa + dtheta/2; + } else ssassert(false, "Unexpected entity type"); + + Vector d = u.ScaledBy(cos(theta)).Plus(v.ScaledBy(sin(theta))); + d = d.ScaledBy(r); + Vector p = center.Plus(d); + if(refp) *refp = p; + Vector tick = d.WithMagnitude(10/camera.scale); + DoLine(canvas, hcs, p.Plus(tick), p.Minus(tick)); +} + +void Constraint::DoArcForAngle(Canvas *canvas, Canvas::hStroke hcs, + Vector a0, Vector da, Vector b0, Vector db, + Vector offset, Vector *ref, bool trim, + Vector explodeOffset) +{ + const Camera &camera = canvas->GetCamera(); + double pixels = 1.0 / camera.scale; + Vector gr = camera.projRight.ScaledBy(1.0); + Vector gu = camera.projUp.ScaledBy(1.0); + + if(workplane != Entity::FREE_IN_3D) { + a0 = a0.ProjectInto(workplane); + b0 = b0.ProjectInto(workplane); + da = da.ProjectVectorInto(workplane); + db = db.ProjectVectorInto(workplane); + } + + a0 = a0.Plus(explodeOffset); + b0 = b0.Plus(explodeOffset); + + Vector a1 = a0.Plus(da); + Vector b1 = b0.Plus(db); + + bool skew; + Vector pi = Vector::AtIntersectionOfLines(a0, a0.Plus(da), + b0, b0.Plus(db), &skew); + + if(!skew) { + *ref = pi.Plus(offset); + // We draw in a coordinate system centered at the intersection point. + // One basis vector is da, and the other is normal to da and in + // the plane that contains our lines (so normal to its normal). + da = da.WithMagnitude(1); + db = db.WithMagnitude(1); + + Vector norm = da.Cross(db); + + Vector dna = norm.Cross(da).WithMagnitude(1.0); + Vector dnb = norm.Cross(db).WithMagnitude(1.0); + + // da and db magnitudes are 1.0 + double thetaf = acos(da.Dot(db)); + + // Calculate median + Vector m = da.ScaledBy(cos(thetaf/2)).Plus( + dna.ScaledBy(sin(thetaf/2))); + Vector rm = (*ref).Minus(pi); + + // Test which side we have to place an arc + if(m.Dot(rm) < 0) { + da = da.ScaledBy(-1); dna = dna.ScaledBy(-1); + db = db.ScaledBy(-1); dnb = dnb.ScaledBy(-1); + } + + double rda = rm.Dot(da), rdna = rm.Dot(dna); + + // Introduce minimal arc radius in pixels + double r = max(sqrt(rda*rda + rdna*rdna), 15.0 * pixels); + + double th = Style::TextHeight(GetStyle()) / camera.scale; + double swidth = VectorFont::Builtin()->GetWidth(th, Label()) + 8*pixels, + sheight = VectorFont::Builtin()->GetCapHeight(th) + 6*pixels; + double textR = sqrt(swidth * swidth + sheight * sheight) / 2.0; + *ref = pi.Plus(rm.WithMagnitude(std::max(rm.Magnitude(), 15 * pixels + textR))); + + // Arrow points + Vector apa = da. ScaledBy(r).Plus(pi); + Vector apb = da. ScaledBy(r*cos(thetaf)).Plus( + dna.ScaledBy(r*sin(thetaf))).Plus(pi); + + double arrowW = 13 * pixels; + double arrowA = 18.0 * PI / 180.0; + bool arrowVisible = apb.Minus(apa).Magnitude() > 2.5 * arrowW; + // Arrow reversing indicator + bool arrowRev = false; + + // The minimal extension length in angular representation + double extAngle = 18 * pixels / r; + + // Arc additional angle + double addAngle = 0.0; + // Arc start angle + double startAngle = 0.0; + + // Arc extension to db. + // We have just enlarge angle value. + if(HasLabel() && rm.Dot(dnb) > 0.0) { + // rm direction projected to plane with u = da, v = dna + Vector rmp = da.ScaledBy(rda).Plus(dna.ScaledBy(rdna)).WithMagnitude(1.0); + // rmp and db magnitudes are 1.0 + addAngle = std::max(acos(rmp.Dot(db)), extAngle); + + if(arrowVisible) { + startAngle = -extAngle; + addAngle += extAngle; + arrowRev = true; + } + } + + // Arc extension to da. + // We are enlarge angle value and rewrite basis to align along rm projection. + if(HasLabel() && rm.Dot(dna) < 0.0) { + // rm direction projected to plane with u = da, v = dna + Vector rmp = da.ScaledBy(rda).Plus(dna.ScaledBy(rdna)).WithMagnitude(1.0); + // rmp and da magnitudes are 1.0 + startAngle = -std::max(acos(rmp.Dot(da)), extAngle); + addAngle = -startAngle; + + if(arrowVisible) { + addAngle += extAngle; + arrowRev = true; + } + } + + Vector prev; + int n = 30; + for(int i = 0; i <= n; i++) { + double theta = startAngle + (i*(thetaf + addAngle))/n; + Vector p = da.ScaledBy(r*cos(theta)).Plus( + dna.ScaledBy(r*sin(theta))).Plus(pi); + if(i > 0) { + if(trim) { + DoLineTrimmedAgainstBox(canvas, hcs, *ref, prev, p, + /*extend=*/false, gr, gu, swidth, sheight + 2*pixels); + } else { + DoLine(canvas, hcs, prev, p); + } + } + prev = p; + } + + DoLineExtend(canvas, hcs, a0, a1, apa, 5.0 * pixels); + DoLineExtend(canvas, hcs, b0, b1, apb, 5.0 * pixels); + + // Draw arrows only when we have enough space. + if(arrowVisible) { + double angleCorr = arrowW / (2.0 * r); + if(arrowRev) { + dna = dna.ScaledBy(-1.0); + angleCorr = -angleCorr; + } + DoArrow(canvas, hcs, apa, dna, norm, arrowW, arrowA, angleCorr); + DoArrow(canvas, hcs, apb, dna, norm, arrowW, arrowA, thetaf + PI - angleCorr); + } + } else { + // The lines are skew; no wonderful way to illustrate that. + + *ref = a0.Plus(b0); + *ref = (*ref).ScaledBy(0.5).Plus(disp.offset); + gu = gu.WithMagnitude(1); + double textHeight = Style::TextHeight(GetStyle()) / camera.scale; + Vector trans = + (*ref).Plus(gu.ScaledBy(-1.5*VectorFont::Builtin()->GetCapHeight(textHeight))); + canvas->DrawVectorText("angle between skew lines", textHeight, + trans, gr.WithMagnitude(1), gu.WithMagnitude(1), + hcs); + } +} + +bool Constraint::IsVisible() const { + if(SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_NOSHOW) + return false; + bool isDim = false; + + if(SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_SHOW_DIM) + switch(type) { + case ConstraintBase::Type::ANGLE: + case ConstraintBase::Type::DIAMETER: + case ConstraintBase::Type::PT_PT_DISTANCE: + case ConstraintBase::Type::PT_FACE_DISTANCE: + case ConstraintBase::Type::PT_LINE_DISTANCE: + case ConstraintBase::Type::PT_PLANE_DISTANCE: isDim = true; break; + default:; + } + + if(SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_SHOW_ALL || isDim ) { + Group *g = SK.GetGroup(group); + // If the group is hidden, then the constraints are hidden and not + // able to be selected. + if(!(g->visible)) return false; + // And likewise if the group is not the active group; except for comments + // with an assigned style. + if(g->h != SS.GW.activeGroup && !(type == Type::COMMENT && disp.style.v)) { + return false; + } + if(disp.style.v) { + Style *s = Style::Get(disp.style); + if(!s->visible) return false; + } + return true; + } + return false; +} + +bool Constraint::DoLineExtend(Canvas *canvas, Canvas::hStroke hcs, + Vector p0, Vector p1, Vector pt, double salient) { + Vector dir = p1.Minus(p0); + double k = dir.Dot(pt.Minus(p0)) / dir.Dot(dir); + Vector ptOnLine = p0.Plus(dir.ScaledBy(k)); + + // Draw projection line. + DoLine(canvas, hcs, pt, ptOnLine); + + // Calculate salient direction. + Vector sd = dir.WithMagnitude(1.0).ScaledBy(salient); + + Vector from; + Vector to; + + if(k < 0.0) { + from = p0; + to = ptOnLine.Minus(sd); + } else if(k > 1.0) { + from = p1; + to = ptOnLine.Plus(sd); + } else { + return false; + } + + // Draw extension line. + DoLine(canvas, hcs, from, to); + return true; +} + +void Constraint::DoLayout(DrawAs how, Canvas *canvas, + Vector *labelPos, std::vector *refs) { + if(!(how == DrawAs::HOVERED || how == DrawAs::SELECTED) && + !IsVisible()) return; + + // Unit vectors that describe our current view of the scene. One pixel + // long, not one actual unit. + const Camera &camera = canvas->GetCamera(); + Vector gr = camera.projRight.ScaledBy(1/camera.scale); + Vector gu = camera.projUp.ScaledBy(1/camera.scale); + Vector gn = (gr.Cross(gu)).WithMagnitude(1/camera.scale); + + double textHeight = Style::TextHeight(GetStyle()) / camera.scale; + + RgbaColor color = {}; + switch(how) { + case DrawAs::DEFAULT: color = Style::Color(GetStyle()); break; + case DrawAs::HOVERED: color = Style::Color(Style::HOVERED); break; + case DrawAs::SELECTED: color = Style::Color(Style::SELECTED); break; + } + Canvas::Stroke stroke = Style::Stroke(GetStyle()); + stroke.layer = Canvas::Layer::FRONT; + stroke.color = color; + stroke.zIndex = 4; + Canvas::hStroke hcs = canvas->GetStroke(stroke); + + Canvas::Fill fill = {}; + fill.layer = Canvas::Layer::FRONT; + fill.color = color; + fill.zIndex = stroke.zIndex; + Canvas::hFill hcf = canvas->GetFill(fill); + + switch(type) { + case Type::PT_PT_DISTANCE: { + Vector ap = SK.GetEntity(ptA)->PointGetNum(); + Vector bp = SK.GetEntity(ptB)->PointGetNum(); + + if(workplane != Entity::FREE_IN_3D) { + DoProjectedPoint(canvas, hcs, &ap); + DoProjectedPoint(canvas, hcs, &bp); + } + + if(ShouldDrawExploded()) { + // Offset A and B by the same offset so the constraint is drawn + // in the plane of one of the exploded points (rather than at an + // angle) + Vector offset = SK.GetEntity(ptA)->ExplodeOffset(); + ap = ap.Plus(offset); + bp = bp.Plus(offset); + } + + Vector ref = ((ap.Plus(bp)).ScaledBy(0.5)).Plus(disp.offset); + if(refs) refs->push_back(ref); + + DoLineWithArrows(canvas, hcs, ref, ap, bp, /*onlyOneExt=*/false); + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + return; + } + + case Type::PROJ_PT_DISTANCE: { + Vector ap = SK.GetEntity(ptA)->PointGetNum(), + bp = SK.GetEntity(ptB)->PointGetNum(), + dp = (bp.Minus(ap)), + pp = SK.GetEntity(entityA)->VectorGetNum(); + + if(ShouldDrawExploded()) { + // explode for whichever point is in the workplane (or the first if both are) + Entity *pt = SK.GetEntity(ptA); + if(pt->group != group) { + pt = SK.GetEntity(ptB); + } + if(pt->group == group) { + Vector offset = pt->ExplodeOffset(); + ap = ap.Plus(offset); + bp = bp.Plus(offset); + } + } + + Vector ref = ((ap.Plus(bp)).ScaledBy(0.5)).Plus(disp.offset); + if(refs) refs->push_back(ref); + + pp = pp.WithMagnitude(1); + double d = dp.Dot(pp); + Vector bpp = ap.Plus(pp.ScaledBy(d)); + DoStippledLine(canvas, hcs, ap, bpp); + DoStippledLine(canvas, hcs, bp, bpp); + + DoLineWithArrows(canvas, hcs, ref, ap, bpp, /*onlyOneExt=*/false); + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + return; + } + + case Type::PT_FACE_DISTANCE: + case Type::PT_PLANE_DISTANCE: { + Vector pt = SK.GetEntity(ptA)->PointGetDrawNum(); + Entity *enta = SK.GetEntity(entityA); + Vector n, p; + if(type == Type::PT_PLANE_DISTANCE) { + n = enta->Normal()->NormalN(); + p = enta->WorkplaneGetOffset(); + } else { + n = enta->FaceGetNormalNum(); + p = enta->FaceGetPointNum(); + } + + double d = (p.Minus(pt)).Dot(n); + Vector closest = pt.Plus(n.WithMagnitude(d)); + + Vector ref = ((closest.Plus(pt)).ScaledBy(0.5)).Plus(disp.offset); + if(refs) refs->push_back(ref); + + if(!pt.Equals(closest)) { + DoLineWithArrows(canvas, hcs, ref, pt, closest, /*onlyOneExt=*/true); + } + + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + return; + } + + case Type::PT_LINE_DISTANCE: { + Entity *ptEntity = SK.GetEntity(ptA); + Vector pt = ptEntity->PointGetNum(); + Entity *line = SK.GetEntity(entityA); + Vector lA = SK.GetEntity(line->point[0])->PointGetNum(); + Vector lB = SK.GetEntity(line->point[1])->PointGetNum(); + Vector dl = lB.Minus(lA); + + if(workplane != Entity::FREE_IN_3D) { + lA = lA.ProjectInto(workplane); + lB = lB.ProjectInto(workplane); + DoProjectedPoint(canvas, hcs, &pt); + } + + // Only explode if the point and line are in the same group (and that group is a sketch + // with explode enabled) otherwise it's too visually confusing to figure out what the + // correct projections should be. + bool shouldExplode = ShouldDrawExploded() + && ptEntity->group == group + && line->group == group; + if(shouldExplode) { + Vector explodeOffset = ptEntity->ExplodeOffset(); + pt = pt.Plus(explodeOffset); + lA = lA.Plus(explodeOffset); + lB = lB.Plus(explodeOffset); + } + + // Find the closest point on the line + Vector closest = pt.ClosestPointOnLine(lA, dl); + + Vector ref = ((closest.Plus(pt)).ScaledBy(0.5)).Plus(disp.offset); + if(refs) refs->push_back(ref); + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + + if(!pt.Equals(closest)) { + DoLineWithArrows(canvas, hcs, ref, pt, closest, /*onlyOneExt=*/true); + + // Draw projected point + Vector a = pt; + Vector b = closest; + Vector ab = a.Minus(b); + Vector ar = a.Minus(ref); + Vector n = ab.Cross(ar); + Vector out = ab.Cross(n).WithMagnitude(1); + out = out.ScaledBy(-out.Dot(ar)); + Vector be = b.Plus(out); + Vector np = lA.Minus(pt).Cross(lB.Minus(pt)).WithMagnitude(1.0); + DoProjectedPoint(canvas, hcs, &be, np, pt); + + // Extensions to line + double pixels = 1.0 / camera.scale; + Vector refClosest = ref.ClosestPointOnLine(lA, dl); + double ddl = dl.Dot(dl); + if(fabs(ddl) > LENGTH_EPS * LENGTH_EPS) { + double t = refClosest.Minus(lA).Dot(dl) / ddl; + if(t < 0.0) { + DoLine(canvas, hcs, refClosest.Minus(dl.WithMagnitude(10.0 * pixels)), lA); + } else if(t > 1.0) { + DoLine(canvas, hcs, refClosest.Plus(dl.WithMagnitude(10.0 * pixels)), lB); + } + } + } + + if(workplane != Entity::FREE_IN_3D) { + // Draw the projection marker from the closest point on the + // projected line to the projected point on the real line. + Vector lAB = (lA.Minus(lB)); + double t = (lA.Minus(closest)).DivProjected(lAB); + + Vector lA = SK.GetEntity(line->point[0])->PointGetNum(); + Vector lB = SK.GetEntity(line->point[1])->PointGetNum(); + + Vector c2 = (lA.ScaledBy(1-t)).Plus(lB.ScaledBy(t)); + DoProjectedPoint(canvas, hcs, &c2); + } + return; + } + + case Type::DIAMETER: { + Entity *circle = SK.GetEntity(entityA); + Vector center = SK.GetEntity(circle->point[0])->PointGetDrawNum(); + Quaternion q = SK.GetEntity(circle->normal)->NormalGetNum(); + Vector n = q.RotationN().WithMagnitude(1); + double r = circle->CircleGetRadiusNum(); + + Vector ref = center.Plus(disp.offset); + // Force the label into the same plane as the circle. + ref = ref.Minus(n.ScaledBy(n.Dot(ref) - n.Dot(center))); + if(refs) refs->push_back(ref); + + Vector mark = ref.Minus(center); + mark = mark.WithMagnitude(mark.Magnitude()-r); + DoLineTrimmedAgainstBox(canvas, hcs, ref, ref, ref.Minus(mark)); + + Vector topLeft; + DoLabel(canvas, hcs, ref, &topLeft, gr, gu); + if(labelPos) *labelPos = topLeft; + return; + } + + case Type::POINTS_COINCIDENT: { + if(how == DrawAs::DEFAULT) { + // Let's adjust the color of this constraint to have the same + // rough luma as the point color, so that the constraint does not + // stand out in an ugly way. + RgbaColor cd = Style::Color(Style::DATUM), + cc = Style::Color(Style::CONSTRAINT); + // convert from 8-bit color to a vector + Vector vd = Vector::From(cd.redF(), cd.greenF(), cd.blueF()), + vc = Vector::From(cc.redF(), cc.greenF(), cc.blueF()); + // and scale the constraint color to have the same magnitude as + // the datum color, maybe a bit dimmer + vc = vc.WithMagnitude(vd.Magnitude()*0.9); + // and set the color to that. + fill.color = RGBf(vc.x, vc.y, vc.z); + hcf = canvas->GetFill(fill); + } + + for(int a = 0; a < 2; a++) { + Vector r = camera.projRight.ScaledBy((a+1)/camera.scale); + Vector d = camera.projUp.ScaledBy((2-a)/camera.scale); + for(int i = 0; i < 2; i++) { + Vector p = SK.GetEntity(i == 0 ? ptA : ptB)->PointGetDrawNum(); + if(refs) refs->push_back(p); + canvas->DrawQuad(p.Plus (r).Plus (d), + p.Plus (r).Minus(d), + p.Minus(r).Minus(d), + p.Minus(r).Plus (d), + hcf); + } + + } + return; + } + + case Type::PT_ON_CIRCLE: + case Type::PT_ON_LINE: + case Type::PT_ON_FACE: + case Type::PT_IN_PLANE: { + double s = 8/camera.scale; + Vector p = SK.GetEntity(ptA)->PointGetDrawNum(); + if(refs) refs->push_back(p); + Vector r, d; + if(type == Type::PT_ON_FACE) { + Vector n = SK.GetEntity(entityA)->FaceGetNormalNum(); + r = n.Normal(0); + d = n.Normal(1); + } else if(type == Type::PT_IN_PLANE) { + EntityBase *n = SK.GetEntity(entityA)->Normal(); + r = n->NormalU(); + d = n->NormalV(); + } else { + r = gr; + d = gu; + s *= (6.0/8); // draw these a little smaller + } + r = r.WithMagnitude(s); d = d.WithMagnitude(s); + DoLine(canvas, hcs, p.Plus (r).Plus (d), p.Plus (r).Minus(d)); + DoLine(canvas, hcs, p.Plus (r).Minus(d), p.Minus(r).Minus(d)); + DoLine(canvas, hcs, p.Minus(r).Minus(d), p.Minus(r).Plus (d)); + DoLine(canvas, hcs, p.Minus(r).Plus (d), p.Plus (r).Plus (d)); + return; + } + + case Type::WHERE_DRAGGED: { + Vector p = SK.GetEntity(ptA)->PointGetDrawNum(); + if(refs) refs->push_back(p); + Vector u = p.Plus(gu.WithMagnitude(8/camera.scale)).Plus( + gr.WithMagnitude(8/camera.scale)), + uu = u.Minus(gu.WithMagnitude(5/camera.scale)), + ur = u.Minus(gr.WithMagnitude(5/camera.scale)); + // Draw four little crop marks, uniformly spaced (by ninety + // degree rotations) around the point. + int i; + for(i = 0; i < 4; i++) { + DoLine(canvas, hcs, u, uu); + DoLine(canvas, hcs, u, ur); + u = u.RotatedAbout(p, gn, PI/2); + ur = ur.RotatedAbout(p, gn, PI/2); + uu = uu.RotatedAbout(p, gn, PI/2); + } + return; + } + + case Type::SAME_ORIENTATION: { + for(int i = 0; i < 2; i++) { + Entity *e = SK.GetEntity(i == 0 ? entityA : entityB); + Quaternion q = e->NormalGetNum(); + Vector n = q.RotationN().WithMagnitude(25/camera.scale); + Vector u = q.RotationU().WithMagnitude(6/camera.scale); + Vector p = SK.GetEntity(e->point[0])->PointGetNum(); + p = p.Plus(n.WithMagnitude(10/camera.scale)); + if(refs) refs->push_back(p); + + DoLine(canvas, hcs, p.Plus(u), p.Minus(u).Plus(n)); + DoLine(canvas, hcs, p.Minus(u), p.Plus(u).Plus(n)); + } + return; + } + + case Type::EQUAL_ANGLE: { + Vector ref; + Entity *a = SK.GetEntity(entityA); + Entity *b = SK.GetEntity(entityB); + Entity *c = SK.GetEntity(entityC); + Entity *d = SK.GetEntity(entityD); + + Vector a0 = a->VectorGetStartPoint(); + Vector b0 = b->VectorGetStartPoint(); + Vector c0 = c->VectorGetStartPoint(); + Vector d0 = d->VectorGetStartPoint(); + Vector da = a->VectorGetNum(); + Vector db = b->VectorGetNum(); + Vector dc = c->VectorGetNum(); + Vector dd = d->VectorGetNum(); + + if(other) { + a0 = a0.Plus(da); + da = da.ScaledBy(-1); + } + + DoArcForAngle(canvas, hcs, a0, da, b0, db, + da.WithMagnitude(40/camera.scale), &ref, /*trim=*/false, a->ExplodeOffset()); + if(refs) refs->push_back(ref); + DoArcForAngle(canvas, hcs, c0, dc, d0, dd, + dc.WithMagnitude(40/camera.scale), &ref, /*trim=*/false, c->ExplodeOffset()); + if(refs) refs->push_back(ref); + + return; + } + + case Type::ANGLE: { + Entity *a = SK.GetEntity(entityA); + Entity *b = SK.GetEntity(entityB); + + Vector a0 = a->VectorGetStartPoint(); + Vector b0 = b->VectorGetStartPoint(); + Vector da = a->VectorGetNum(); + Vector db = b->VectorGetNum(); + if(other) { + a0 = a0.Plus(da); + da = da.ScaledBy(-1); + } + + Vector ref; + DoArcForAngle(canvas, hcs, a0, da, b0, db, disp.offset, &ref, /*trim=*/true, a->ExplodeOffset()); + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + if(refs) refs->push_back(ref); + return; + } + + case Type::PERPENDICULAR: { + Vector u = Vector::From(0, 0, 0), v = Vector::From(0, 0, 0); + Vector rn, ru; + if(workplane == Entity::FREE_IN_3D) { + rn = gn; + ru = gu; + } else { + EntityBase *normal = SK.GetEntity(workplane)->Normal(); + rn = normal->NormalN(); + ru = normal->NormalV(); // ru meaning r_up, not u/v + } + + for(int i = 0; i < 2; i++) { + Entity *e = SK.GetEntity(i == 0 ? entityA : entityB); + + if(i == 0) { + // Calculate orientation of perpendicular sign only + // once, so that it's the same both times it's drawn + u = e->VectorGetNum(); + u = u.WithMagnitude(16/camera.scale); + v = (rn.Cross(u)).WithMagnitude(16/camera.scale); + // a bit of bias to stop it from flickering between the + // two possibilities + if(fabs(u.Dot(ru)) < fabs(v.Dot(ru)) + LENGTH_EPS) { + swap(u, v); + } + if(u.Dot(ru) < 0) u = u.ScaledBy(-1); + } + + Vector p = e->VectorGetRefPoint().Plus(e->ExplodeOffset()); + Vector s = p.Plus(u).Plus(v); + DoLine(canvas, hcs, s, s.Plus(v)); + Vector m = s.Plus(v.ScaledBy(0.5)); + DoLine(canvas, hcs, m, m.Plus(u)); + if(refs) refs->push_back(m); + } + return; + } + + case Type::CURVE_CURVE_TANGENT: + case Type::CUBIC_LINE_TANGENT: + case Type::ARC_LINE_TANGENT: { + Vector textAt, u, v; + + if(type == Type::ARC_LINE_TANGENT) { + Entity *arc = SK.GetEntity(entityA); + Entity *norm = SK.GetEntity(arc->normal); + Vector c = SK.GetEntity(arc->point[0])->PointGetDrawNum(); + Vector p = + SK.GetEntity(arc->point[other ? 2 : 1])->PointGetDrawNum(); + Vector r = p.Minus(c); + textAt = p.Plus(r.WithMagnitude(14/camera.scale)); + u = norm->NormalU(); + v = norm->NormalV(); + } else if(type == Type::CUBIC_LINE_TANGENT) { + Vector n; + if(workplane == Entity::FREE_IN_3D) { + u = gr; + v = gu; + n = gn; + } else { + EntityBase *wn = SK.GetEntity(workplane)->Normal(); + u = wn->NormalU(); + v = wn->NormalV(); + n = wn->NormalN(); + } + + Entity *cubic = SK.GetEntity(entityA); + Vector p = other ? cubic->CubicGetFinishNum() : + cubic->CubicGetStartNum(); + p = p.Plus(cubic->ExplodeOffset()); + Vector dir = SK.GetEntity(entityB)->VectorGetNum(); + Vector out = n.Cross(dir); + textAt = p.Plus(out.WithMagnitude(14/camera.scale)); + } else { + Vector n, dir; + EntityBase *wn = SK.GetEntity(workplane)->Normal(); + u = wn->NormalU(); + v = wn->NormalV(); + n = wn->NormalN(); + Entity *eA = SK.GetEntity(entityA); + // Big pain; we have to get a vector tangent to the curve + // at the shared point, which could be from either a cubic + // or an arc. + if(other) { + textAt = eA->EndpointFinish().Plus(eA->ExplodeOffset()); + if(eA->type == Entity::Type::CUBIC) { + dir = eA->CubicGetFinishTangentNum(); + } else { + dir = SK.GetEntity(eA->point[0])->PointGetNum().Minus( + SK.GetEntity(eA->point[2])->PointGetNum()); + dir = n.Cross(dir); + } + } else { + textAt = eA->EndpointStart().Plus(eA->ExplodeOffset()); + if(eA->type == Entity::Type::CUBIC) { + dir = eA->CubicGetStartTangentNum(); + } else { + dir = SK.GetEntity(eA->point[0])->PointGetNum().Minus( + SK.GetEntity(eA->point[1])->PointGetNum()); + dir = n.Cross(dir); + } + } + dir = n.Cross(dir); + textAt = textAt.Plus(dir.WithMagnitude(14/camera.scale)); + } + + Vector ex = VectorFont::Builtin()->GetExtents(textHeight, "T"); + canvas->DrawVectorText("T", textHeight, textAt.Minus(ex.ScaledBy(0.5)), + u.WithMagnitude(1), v.WithMagnitude(1), hcs); + if(refs) refs->push_back(textAt); + return; + } + + case Type::PARALLEL: { + for(int i = 0; i < 2; i++) { + Entity *e = SK.GetEntity(i == 0 ? entityA : entityB); + Vector n = e->VectorGetNum(); + n = n.WithMagnitude(25/camera.scale); + Vector u = (gn.Cross(n)).WithMagnitude(4/camera.scale); + Vector p = e->VectorGetRefPoint(); + + if(ShouldDrawExploded()) { + p = p.Plus(e->ExplodeOffset()); + } + + DoLine(canvas, hcs, p.Plus(u), p.Plus(u).Plus(n)); + DoLine(canvas, hcs, p.Minus(u), p.Minus(u).Plus(n)); + if(refs) refs->push_back(p.Plus(n.ScaledBy(0.5))); + } + return; + } + + case Type::EQUAL_RADIUS: { + for(int i = 0; i < 2; i++) { + Vector ref; + DoEqualRadiusTicks(canvas, hcs, i == 0 ? entityA : entityB, &ref); + if(refs) refs->push_back(ref); + } + return; + } + + case Type::EQUAL_LINE_ARC_LEN: { + Entity *line = SK.GetEntity(entityA); + Vector ref; + DoEqualLenTicks(canvas, hcs, + SK.GetEntity(line->point[0])->PointGetDrawNum(), + SK.GetEntity(line->point[1])->PointGetDrawNum(), + gn, &ref); + if(refs) refs->push_back(ref); + DoEqualRadiusTicks(canvas, hcs, entityB, &ref); + if(refs) refs->push_back(ref); + return; + } + + case Type::LENGTH_RATIO: + case Type::LENGTH_DIFFERENCE: + case Type::EQUAL_LENGTH_LINES: { + Vector a, b = Vector::From(0, 0, 0); + for(int i = 0; i < 2; i++) { + Entity *e = SK.GetEntity(i == 0 ? entityA : entityB); + a = SK.GetEntity(e->point[0])->PointGetNum(); + b = SK.GetEntity(e->point[1])->PointGetNum(); + + if(workplane != Entity::FREE_IN_3D) { + DoProjectedPoint(canvas, hcs, &a); + DoProjectedPoint(canvas, hcs, &b); + } + + if(ShouldDrawExploded()) { + Vector offset = e->ExplodeOffset(); + a = a.Plus(offset); + b = b.Plus(offset); + } + + Vector ref; + DoEqualLenTicks(canvas, hcs, a, b, gn, &ref); + if(refs) refs->push_back(ref); + } + if((type == Type::LENGTH_RATIO) || (type == Type::LENGTH_DIFFERENCE)) { + Vector ref = ((a.Plus(b)).ScaledBy(0.5)).Plus(disp.offset); + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + } + return; + } + case Type::ARC_ARC_LEN_RATIO: + case Type::ARC_ARC_DIFFERENCE: { + Entity *circle = SK.GetEntity(entityA); + Vector center = SK.GetEntity(circle->point[0])->PointGetNum(); + Quaternion q = SK.GetEntity(circle->normal)->NormalGetNum(); + Vector n = q.RotationN().WithMagnitude(1); + + Vector ref2; + DoEqualRadiusTicks(canvas, hcs, entityA, &ref2); + DoEqualRadiusTicks(canvas, hcs, entityB, &ref2); + + Vector ref = center.Plus(disp.offset); + // Force the label into the same plane as the circle. + ref = ref.Minus(n.ScaledBy(n.Dot(ref) - n.Dot(center))); + if(refs) refs->push_back(ref); + Vector topLeft; + DoLabel(canvas, hcs, ref, &topLeft, gr, gu); + if(labelPos) *labelPos = topLeft; + return; + } + case Type::ARC_LINE_LEN_RATIO: + case Type::ARC_LINE_DIFFERENCE: { + Vector a, b = Vector::From(0, 0, 0); + Vector ref; + Entity *e = SK.GetEntity(entityA); + a = SK.GetEntity(e->point[0])->PointGetNum(); + b = SK.GetEntity(e->point[1])->PointGetNum(); + DoEqualLenTicks(canvas, hcs, a, b, gn, &ref); + if(refs) refs->push_back(ref); + DoEqualRadiusTicks(canvas, hcs, entityB, &ref); + if(refs) refs->push_back(ref); + ref = ((a.Plus(b)).ScaledBy(0.5)).Plus(disp.offset); + DoLabel(canvas, hcs, ref, labelPos, gr, gu); + return; + } + + case Type::EQ_LEN_PT_LINE_D: { + Entity *forLen = SK.GetEntity(entityA); + Vector a = SK.GetEntity(forLen->point[0])->PointGetNum(), + b = SK.GetEntity(forLen->point[1])->PointGetNum(); + if(workplane != Entity::FREE_IN_3D) { + DoProjectedPoint(canvas, hcs, &a); + DoProjectedPoint(canvas, hcs, &b); + } + if(ShouldDrawExploded()) { + Vector offset = forLen->ExplodeOffset(); + a = a.Plus(offset); + b = b.Plus(offset); + } + Vector refa; + DoEqualLenTicks(canvas, hcs, a, b, gn, &refa); + if(refs) refs->push_back(refa); + + Entity *ln = SK.GetEntity(entityB); + Vector la = SK.GetEntity(ln->point[0])->PointGetNum(), + lb = SK.GetEntity(ln->point[1])->PointGetNum(); + Vector pt = SK.GetEntity(ptA)->PointGetNum(); + if(workplane != Entity::FREE_IN_3D) { + DoProjectedPoint(canvas, hcs, &pt); + la = la.ProjectInto(workplane); + lb = lb.ProjectInto(workplane); + } + + Vector closest = pt.ClosestPointOnLine(la, lb.Minus(la)); + if(ShouldDrawExploded()) { + Vector offset = SK.GetEntity(ptA)->ExplodeOffset(); + pt = pt.Plus(offset); + closest = closest.Plus(offset); + } + DoLine(canvas, hcs, pt, closest); + Vector refb; + DoEqualLenTicks(canvas, hcs, pt, closest, gn, &refb); + if(refs) refs->push_back(refb); + return; + } + + case Type::EQ_PT_LN_DISTANCES: { + for(int i = 0; i < 2; i++) { + Entity *ln = SK.GetEntity(i == 0 ? entityA : entityB); + Vector la = SK.GetEntity(ln->point[0])->PointGetNum(), + lb = SK.GetEntity(ln->point[1])->PointGetNum(); + Entity *pte = SK.GetEntity(i == 0 ? ptA : ptB); + Vector pt = pte->PointGetNum(); + + if(workplane != Entity::FREE_IN_3D) { + DoProjectedPoint(canvas, hcs, &pt); + la = la.ProjectInto(workplane); + lb = lb.ProjectInto(workplane); + } + + Vector closest = pt.ClosestPointOnLine(la, lb.Minus(la)); + if(ShouldDrawExploded()) { + Vector offset = pte->ExplodeOffset(); + pt = pt.Plus(offset); + closest = closest.Plus(offset); + } + DoLine(canvas, hcs, pt, closest); + + Vector ref; + DoEqualLenTicks(canvas, hcs, pt, closest, gn, &ref); + if(refs) refs->push_back(ref); + } + return; + } + + { + case Type::SYMMETRIC: + Vector n; + n = SK.GetEntity(entityA)->Normal()->NormalN(); goto s; + case Type::SYMMETRIC_HORIZ: + n = SK.GetEntity(workplane)->Normal()->NormalU(); goto s; + case Type::SYMMETRIC_VERT: + n = SK.GetEntity(workplane)->Normal()->NormalV(); goto s; + case Type::SYMMETRIC_LINE: { + Entity *ln = SK.GetEntity(entityA); + Vector la = SK.GetEntity(ln->point[0])->PointGetNum(), + lb = SK.GetEntity(ln->point[1])->PointGetNum(); + la = la.ProjectInto(workplane); + lb = lb.ProjectInto(workplane); + n = lb.Minus(la); + Vector nw = SK.GetEntity(workplane)->Normal()->NormalN(); + n = n.RotatedAbout(nw, PI/2); + goto s; + } +s: + Vector a = SK.GetEntity(ptA)->PointGetDrawNum(); + Vector b = SK.GetEntity(ptB)->PointGetDrawNum(); + + for(int i = 0; i < 2; i++) { + Vector tail = (i == 0) ? a : b; + Vector d = (i == 0) ? b : a; + d = d.Minus(tail); + // Project the direction in which the arrow is drawn normal + // to the symmetry plane; for projected symmetry constraints, + // they might not be in the same direction, even when the + // constraint is fully solved. + d = n.ScaledBy(d.Dot(n)); + d = d.WithMagnitude(20/camera.scale); + Vector tip = tail.Plus(d); + + DoLine(canvas, hcs, tail, tip); + d = d.WithMagnitude(9/camera.scale); + DoLine(canvas, hcs, tip, tip.Minus(d.RotatedAbout(gn, 0.6))); + DoLine(canvas, hcs, tip, tip.Minus(d.RotatedAbout(gn, -0.6))); + if(refs) refs->push_back(tip); + } + return; + } + + case Type::AT_MIDPOINT: + case Type::HORIZONTAL: + case Type::VERTICAL: + if(entityA.v) { + Vector r, u, n; + if(workplane == Entity::FREE_IN_3D) { + r = gr; u = gu; n = gn; + } else { + r = SK.GetEntity(workplane)->Normal()->NormalU(); + u = SK.GetEntity(workplane)->Normal()->NormalV(); + n = r.Cross(u); + } + // For "at midpoint", this branch is always taken. + Entity *e = SK.GetEntity(entityA); + Vector a = SK.GetEntity(e->point[0])->PointGetDrawNum(); + Vector b = SK.GetEntity(e->point[1])->PointGetDrawNum(); + Vector m = (a.ScaledBy(0.5)).Plus(b.ScaledBy(0.5)); + Vector offset = (a.Minus(b)).Cross(n); + offset = offset.WithMagnitude(textHeight); + // Draw midpoint constraint on other side of line, so that + // a line can be midpoint and horizontal at same time. + if(type == Type::AT_MIDPOINT) offset = offset.ScaledBy(-1); + + std::string s; + switch(type) { + case Type::HORIZONTAL: s = "H"; break; + case Type::VERTICAL: s = "V"; break; + case Type::AT_MIDPOINT: s = "M"; break; + default: ssassert(false, "Unexpected constraint type"); + } + Vector o = m.Plus(offset).Plus(u.WithMagnitude(textHeight/5)), + ex = VectorFont::Builtin()->GetExtents(textHeight, s); + Vector shift = r.WithMagnitude(ex.x).Plus( + u.WithMagnitude(ex.y)); + + canvas->DrawVectorText(s, textHeight, o.Minus(shift.ScaledBy(0.5)), + r.WithMagnitude(1), u.WithMagnitude(1), hcs); + if(refs) refs->push_back(o); + } else { + Vector a = SK.GetEntity(ptA)->PointGetDrawNum(); + Vector b = SK.GetEntity(ptB)->PointGetDrawNum(); + + Entity *w = SK.GetEntity(workplane); + Vector cu = w->Normal()->NormalU(); + Vector cv = w->Normal()->NormalV(); + Vector cn = w->Normal()->NormalN(); + + int i; + for(i = 0; i < 2; i++) { + Vector o = (i == 0) ? a : b; + Vector oo = (i == 0) ? a.Minus(b) : b.Minus(a); + Vector d = (type == Type::HORIZONTAL) ? cu : cv; + if(oo.Dot(d) < 0) d = d.ScaledBy(-1); + + Vector dp = cn.Cross(d); + d = d.WithMagnitude(14/camera.scale); + Vector c = o.Minus(d); + DoLine(canvas, hcs, o, c); + d = d.WithMagnitude(3/camera.scale); + dp = dp.WithMagnitude(2/camera.scale); + canvas->DrawQuad((c.Plus(d)).Plus(dp), + (c.Minus(d)).Plus(dp), + (c.Minus(d)).Minus(dp), + (c.Plus(d)).Minus(dp), + hcf); + if(refs) refs->push_back(c); + } + } + return; + + case Type::COMMENT: { + Vector u, v; + if(workplane == Entity::FREE_IN_3D) { + u = gr; + v = gu; + } else { + EntityBase *norm = SK.GetEntity(workplane)->Normal(); + u = norm->NormalU(); + v = norm->NormalV(); + } + + if(disp.style.v != 0) { + RgbaColor color = stroke.color; + stroke = Style::Stroke(disp.style); + stroke.layer = Canvas::Layer::FRONT; + if(how != DrawAs::DEFAULT) { + stroke.color = color; + } + hcs = canvas->GetStroke(stroke); + } + Vector ref = disp.offset; + if(ptA.v) { + Vector a = SK.GetEntity(ptA)->PointGetNum(); + ref = a.Plus(disp.offset); + } + DoLabel(canvas, hcs, ref, labelPos, u, v); + if(refs) refs->push_back(ref); + return; + } + } + ssassert(false, "Unexpected constraint type"); +} + +void Constraint::Draw(DrawAs how, Canvas *canvas) { + DoLayout(how, canvas, NULL, NULL); +} + +Vector Constraint::GetLabelPos(const Camera &camera) { + Vector p; + + ObjectPicker canvas = {}; + canvas.camera = camera; + DoLayout(DrawAs::DEFAULT, &canvas, &p, NULL); + canvas.Clear(); + + return p; +} + +void Constraint::GetReferencePoints(const Camera &camera, std::vector *refs) { + ObjectPicker canvas = {}; + canvas.camera = camera; + DoLayout(DrawAs::DEFAULT, &canvas, NULL, refs); + canvas.Clear(); +} + +bool Constraint::IsStylable() const { + if(type == Type::COMMENT) return true; + return false; +} + +hStyle Constraint::GetStyle() const { + if(disp.style.v != 0) return disp.style; + return { Style::CONSTRAINT }; +} + +bool Constraint::HasLabel() const { + switch(type) { + case Type::COMMENT: + case Type::PT_PT_DISTANCE: + case Type::PT_PLANE_DISTANCE: + case Type::PT_LINE_DISTANCE: + case Type::PT_FACE_DISTANCE: + case Type::PROJ_PT_DISTANCE: + case Type::LENGTH_RATIO: + case Type::ARC_ARC_LEN_RATIO: + case Type::ARC_LINE_LEN_RATIO: + case Type::LENGTH_DIFFERENCE: + case Type::ARC_ARC_DIFFERENCE: + case Type::ARC_LINE_DIFFERENCE: + case Type::DIAMETER: + case Type::ANGLE: + return true; + + default: + return false; + } +} + +bool Constraint::ShouldDrawExploded() const { + return SK.GetGroup(group)->ShouldDrawExploded(); +} + +} // namespace SolveSpace diff --git a/src/drawentity.cpp b/src/drawentity.cpp new file mode 100644 index 0000000..bf856a1 --- /dev/null +++ b/src/drawentity.cpp @@ -0,0 +1,867 @@ +//----------------------------------------------------------------------------- +// Draw a representation of an entity on-screen, in the case of curves up +// to our chord tolerance, or return the distance from the user's mouse pointer +// to the entity for selection. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +std::string Entity::DescriptionString() const { + if(h.isFromRequest()) { + Request *r = SK.GetRequest(h.request()); + return r->DescriptionString(); + } else { + Group *g = SK.GetGroup(h.group()); + return g->DescriptionString(); + } +} + +void Entity::GenerateEdges(SEdgeList *el) { + SBezierList *sbl = GetOrGenerateBezierCurves(); + + for(int i = 0; i < sbl->l.n; i++) { + SBezier *sb = &(sbl->l[i]); + + List lv = {}; + sb->MakePwlInto(&lv); + for(int j = 1; j < lv.n; j++) { + el->AddEdge(lv[j-1], lv[j], Style::ForEntity(h).v, i); + } + lv.Clear(); + } +} + +SBezierList *Entity::GetOrGenerateBezierCurves() { + if(beziers.l.IsEmpty()) + GenerateBezierCurves(&beziers); + return &beziers; +} + +SEdgeList *Entity::GetOrGenerateEdges() { + if(!edges.l.IsEmpty()) { + if(EXACT(edgesChordTol == SS.ChordTolMm())) + return &edges; + edges.l.Clear(); + } + if(edges.l.IsEmpty()) + GenerateEdges(&edges); + edgesChordTol = SS.ChordTolMm(); + return &edges; +} + +BBox Entity::GetOrGenerateScreenBBox(bool *hasBBox) { + SBezierList *sbl = GetOrGenerateBezierCurves(); + + // We don't bother with bounding boxes for workplanes, etc. + *hasBBox = (IsPoint() || IsNormal() || !sbl->l.IsEmpty()); + if(!*hasBBox) return {}; + + if(screenBBoxValid) + return screenBBox; + + if(IsPoint()) { + Vector proj = SS.GW.ProjectPoint3(PointGetNum()); + screenBBox = BBox::From(proj, proj); + } else if(IsNormal()) { + Vector proj = SS.GW.ProjectPoint3(SK.GetEntity(point[0])->PointGetNum()); + screenBBox = BBox::From(proj, proj); + } else if(!sbl->l.IsEmpty()) { + Vector first = SS.GW.ProjectPoint3(sbl->l[0].ctrl[0]); + screenBBox = BBox::From(first, first); + for(auto &sb : sbl->l) { + for(int i = 0; i <= sb.deg; ++i) { screenBBox.Include(SS.GW.ProjectPoint3(sb.ctrl[i])); } + } + } else + ssassert(false, "Expected entity to be a point or have beziers"); + + screenBBoxValid = true; + return screenBBox; +} + +void Entity::GetReferencePoints(std::vector *refs) { + switch(type) { + case Type::POINT_N_COPY: + case Type::POINT_N_TRANS: + case Type::POINT_N_ROT_TRANS: + case Type::POINT_N_ROT_AA: + case Type::POINT_N_ROT_AXIS_TRANS: + case Type::POINT_IN_3D: + case Type::POINT_IN_2D: + refs->push_back(PointGetDrawNum()); + break; + + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::WORKPLANE: + case Type::CIRCLE: + case Type::ARC_OF_CIRCLE: + case Type::CUBIC: + case Type::CUBIC_PERIODIC: + case Type::TTF_TEXT: + case Type::IMAGE: + refs->push_back(SK.GetEntity(point[0])->PointGetDrawNum()); + break; + + case Type::LINE_SEGMENT: { + Vector a = SK.GetEntity(point[0])->PointGetDrawNum(), + b = SK.GetEntity(point[1])->PointGetDrawNum(); + refs->push_back(b.Plus(a.Minus(b).ScaledBy(0.5))); + break; + } + + case Type::DISTANCE: + case Type::DISTANCE_N_COPY: + case Type::FACE_NORMAL_PT: + case Type::FACE_XPROD: + case Type::FACE_N_ROT_TRANS: + case Type::FACE_N_TRANS: + case Type::FACE_N_ROT_AA: + case Type::FACE_ROT_NORMAL_PT: + case Type::FACE_N_ROT_AXIS_TRANS: + break; + } +} + +int Entity::GetPositionOfPoint(const Camera &camera, Point2d p) { + int position; + + ObjectPicker canvas = {}; + canvas.camera = camera; + canvas.point = p; + canvas.minDistance = 1e12; + Draw(DrawAs::DEFAULT, &canvas); + position = canvas.position; + canvas.Clear(); + + return position; +} + +bool Entity::IsStylable() const { + if(IsPoint()) return false; + if(IsWorkplane()) return false; + if(IsNormal()) return false; + return true; +} + +bool Entity::IsVisible() const { + Group *g = SK.GetGroup(group); + + if(g->h == Group::HGROUP_REFERENCES && IsNormal()) { + // The reference normals are always shown + return true; + } + if(!(g->IsVisible())) return false; + + if(IsPoint() && !SS.GW.showPoints) return false; + if(IsNormal() && !SS.GW.showNormals) return false; + if(construction && !SS.GW.showConstruction) return false; + + if(!SS.GW.showWorkplanes) { + if(IsWorkplane() && !h.isFromRequest()) { + if(g->h != SS.GW.activeGroup) { + // The group-associated workplanes are hidden outside + // their group. + return false; + } + } + } + + if(style.v) { + Style *s = Style::Get(style); + if(!s->visible) return false; + } + + if(forceHidden) return false; + + return true; +} + +static bool PtCanDrag(hEntity pt) { + Entity* p = SK.GetEntity(pt); + // a numeric copy can not move + if(p->type == Entity::Type::POINT_N_COPY) return false; + // these transforms applied zero times can not be moved + if(((p->type == Entity::Type::POINT_N_TRANS) || + (p->type == Entity::Type::POINT_N_ROT_AA) || + (p->type == Entity::Type::POINT_N_ROT_AXIS_TRANS)) + && (p->timesApplied == 0)) return false; + return true; +} + +// entities that were created via some copy types will not be +// draggable with the mouse. We identify the undraggables here +bool Entity::CanBeDragged() const { + if(IsPoint()) { + if(!PtCanDrag(h)) + return false; + // are we constrained pt-on-point from a previous group? + for(const Constraint &cc : SK.constraint) { + if(cc.group == group && cc.type == ConstraintBase::Type::POINTS_COINCIDENT) { + if(cc.ptA == h) { + if((SK.GetEntity(cc.ptB)->group < group) + || (!PtCanDrag(cc.ptB))) + return false; + } + if(cc.ptB == h) { + if((SK.GetEntity(cc.ptA)->group < group) + || (!PtCanDrag(cc.ptA))) + return false; + } + } + } + } + // for these types of entities the first point will indicate draggability + if(HasEndpoints() || type == Entity::Type::CIRCLE) { + return PtCanDrag(point[0]); + } + // if we're not certain it can't be dragged then default to true + return true; +} + +void Entity::CalculateNumerical(bool forExport) { + if(IsPoint()) actPoint = PointGetNum(); + if(IsNormal()) actNormal = NormalGetNum(); + if(type == Type::DISTANCE || type == Type::DISTANCE_N_COPY) { + actDistance = DistanceGetNum(); + } + if(IsFace()) { + actPoint = FaceGetPointNum(); + Vector n = FaceGetNormalNum(); + actNormal = Quaternion::From(0, n.x, n.y, n.z); + } + if(forExport) { + // Visibility in copied linked entities follows source file + actVisible = IsVisible(); + } else { + // Copied entities within a file are always visible + actVisible = true; + } +} + +//----------------------------------------------------------------------------- +// Compute a cubic, second derivative continuous, interpolating spline. Same +// routine for periodic splines (in a loop) or open splines (with specified +// end tangents). +//----------------------------------------------------------------------------- +void Entity::ComputeInterpolatingSpline(SBezierList *sbl, bool periodic) const { + static const int MAX_N = BandedMatrix::MAX_UNKNOWNS; + int ep = extraPoints; + + // The number of unknowns to solve for. + int n = periodic ? 3 + ep : ep; + ssassert(n < MAX_N, "Too many unknowns"); + // The number of on-curve points, one more than the number of segments. + int pts = periodic ? 4 + ep : 2 + ep; + + int i, j, a; + + // The starting and finishing control points that define our end tangents + // (if the spline isn't periodic), and the on-curve points. + Vector ctrl_s = Vector::From(0, 0, 0); + Vector ctrl_f = Vector::From(0, 0, 0); + Vector pt[MAX_N+4]; + if(periodic) { + for(i = 0; i < ep + 3; i++) { + pt[i] = SK.GetEntity(point[i])->PointGetNum(); + } + pt[i++] = SK.GetEntity(point[0])->PointGetNum(); + } else { + ctrl_s = SK.GetEntity(point[1])->PointGetNum(); + ctrl_f = SK.GetEntity(point[ep+2])->PointGetNum(); + j = 0; + pt[j++] = SK.GetEntity(point[0])->PointGetNum(); + for(i = 2; i <= ep + 1; i++) { + pt[j++] = SK.GetEntity(point[i])->PointGetNum(); + } + pt[j++] = SK.GetEntity(point[ep+3])->PointGetNum(); + } + + // The unknowns that we will be solving for, a set for each coordinate. + double Xx[MAX_N], Xy[MAX_N], Xz[MAX_N]; + // For a cubic Bezier section f(t) as t goes from 0 to 1, + // f' (0) = 3*(P1 - P0) + // f' (1) = 3*(P3 - P2) + // f''(0) = 6*(P0 - 2*P1 + P2) + // f''(1) = 6*(P3 - 2*P2 + P1) + for(a = 0; a < 3; a++) { + BandedMatrix bm = {}; + bm.n = n; + + for(i = 0; i < n; i++) { + int im, it, ip; + if(periodic) { + im = WRAP(i - 1, n); + it = i; + ip = WRAP(i + 1, n); + } else { + im = i; + it = i + 1; + ip = i + 2; + } + // All of these are expressed in terms of a constant part, and + // of X[i-1], X[i], and X[i+1]; so let these be the four + // components of that vector; + Vector4 A, B, C, D, E; + // The on-curve interpolated point + C = Vector4::From((pt[it]).Element(a), 0, 0, 0); + // control point one back, C - X[i] + B = C.Plus(Vector4::From(0, 0, -1, 0)); + // control point one forward, C + X[i] + D = C.Plus(Vector4::From(0, 0, 1, 0)); + // control point two back + if(i == 0 && !periodic) { + A = Vector4::From(ctrl_s.Element(a), 0, 0, 0); + } else { + // pt[im] + X[i-1] + A = Vector4::From(pt[im].Element(a), 1, 0, 0); + } + // control point two forward + if(i == (n - 1) && !periodic) { + E = Vector4::From(ctrl_f.Element(a), 0, 0, 0); + } else { + // pt[ip] - X[i+1] + E = Vector4::From((pt[ip]).Element(a), 0, 0, -1); + } + // Write the second derivatives of each segment, dropping constant + Vector4 fprev_pp = (C.Minus(B.ScaledBy(2))).Plus(A), + fnext_pp = (C.Minus(D.ScaledBy(2))).Plus(E), + eq = fprev_pp.Minus(fnext_pp); + + bm.B[i] = -eq.w; + if(periodic) { + bm.A[i][WRAP(i-2, n)] = eq.x; + bm.A[i][WRAP(i-1, n)] = eq.y; + bm.A[i][i] = eq.z; + } else { + // The wrapping would work, except when n = 1 and everything + // wraps to zero... + if(i > 0) { + bm.A[i][i - 1] = eq.x; + } + bm.A[i][i] = eq.y; + if(i < (n-1)) { + bm.A[i][i + 1] = eq.z; + } + } + } + bm.Solve(); + double *X = (a == 0) ? Xx : + (a == 1) ? Xy : + Xz; + memcpy(X, bm.X, n*sizeof(double)); + } + + for(i = 0; i < pts - 1; i++) { + Vector p0, p1, p2, p3; + if(periodic) { + p0 = pt[i]; + int iw = WRAP(i - 1, n); + p1 = p0.Plus(Vector::From(Xx[iw], Xy[iw], Xz[iw])); + } else if(i == 0) { + p0 = pt[0]; + p1 = ctrl_s; + } else { + p0 = pt[i]; + p1 = p0.Plus(Vector::From(Xx[i-1], Xy[i-1], Xz[i-1])); + } + if(periodic) { + p3 = pt[i+1]; + int iw = WRAP(i, n); + p2 = p3.Minus(Vector::From(Xx[iw], Xy[iw], Xz[iw])); + } else if(i == (pts - 2)) { + p3 = pt[pts-1]; + p2 = ctrl_f; + } else { + p3 = pt[i+1]; + p2 = p3.Minus(Vector::From(Xx[i], Xy[i], Xz[i])); + } + SBezier sb = SBezier::From(p0, p1, p2, p3); + sbl->l.Add(&sb); + } +} + +void Entity::GenerateBezierCurves(SBezierList *sbl) const { + SBezier sb; + + int i = sbl->l.n; + + switch(type) { + case Type::LINE_SEGMENT: { + Vector a = SK.GetEntity(point[0])->PointGetNum(); + Vector b = SK.GetEntity(point[1])->PointGetNum(); + sb = SBezier::From(a, b); + sb.entity = h.v; + sbl->l.Add(&sb); + break; + } + case Type::CUBIC: + ComputeInterpolatingSpline(sbl, /*periodic=*/false); + break; + + case Type::CUBIC_PERIODIC: + ComputeInterpolatingSpline(sbl, /*periodic=*/true); + break; + + case Type::CIRCLE: + case Type::ARC_OF_CIRCLE: { + Vector center = SK.GetEntity(point[0])->PointGetNum(); + Quaternion q = SK.GetEntity(normal)->NormalGetNum(); + Vector u = q.RotationU(), v = q.RotationV(); + double r = CircleGetRadiusNum(); + double thetaa, thetab, dtheta; + + if(r < LENGTH_EPS) { + // If a circle or an arc gets dragged through zero radius, + // then we just don't generate anything. + break; + } + + if(type == Type::CIRCLE) { + thetaa = 0; + thetab = 2*PI; + dtheta = 2*PI; + } else { + ArcGetAngles(&thetaa, &thetab, &dtheta); + } + int i, n; + if(dtheta > (3*PI/2 + 0.01)) { + n = 4; + } else if(dtheta > (PI + 0.01)) { + n = 3; + } else if(dtheta > (PI/2 + 0.01)) { + n = 2; + } else { + n = 1; + } + dtheta /= n; + + for(i = 0; i < n; i++) { + double s, c; + + c = cos(thetaa); + s = sin(thetaa); + // The start point of the curve, and the tangent vector at + // that start point. + Vector p0 = center.Plus(u.ScaledBy( r*c)).Plus(v.ScaledBy(r*s)), + t0 = u.ScaledBy(-r*s). Plus(v.ScaledBy(r*c)); + + thetaa += dtheta; + + c = cos(thetaa); + s = sin(thetaa); + Vector p2 = center.Plus(u.ScaledBy( r*c)).Plus(v.ScaledBy(r*s)), + t2 = u.ScaledBy(-r*s). Plus(v.ScaledBy(r*c)); + + // The control point must lie on both tangents. + Vector p1 = Vector::AtIntersectionOfLines(p0, p0.Plus(t0), + p2, p2.Plus(t2), + NULL); + + SBezier sb = SBezier::From(p0, p1, p2); + sb.weight[1] = cos(dtheta/2); + sbl->l.Add(&sb); + } + break; + } + + case Type::TTF_TEXT: { + Vector topLeft = SK.GetEntity(point[0])->PointGetNum(); + Vector botLeft = SK.GetEntity(point[1])->PointGetNum(); + Vector n = Normal()->NormalN(); + Vector v = topLeft.Minus(botLeft); + Vector u = (v.Cross(n)).WithMagnitude(v.Magnitude()); + + // `extraPoints` is storing kerning boolean + SS.fonts.PlotString(font, str, sbl, extraPoints, botLeft, u, v); + break; + } + + default: + // Not a problem, points and normals and such don't generate curves + break; + } + + // Record our style for all of the Beziers that we just created. + for(; i < sbl->l.n; i++) { + sbl->l[i].auxA = Style::ForEntity(h).v; + } +} + +bool Entity::ShouldDrawExploded() const { + return SK.GetGroup(group)->ShouldDrawExploded(); +} + +Vector Entity::ExplodeOffset() const { + if(ShouldDrawExploded() && workplane.v != 0) { + int requestIdx = SK.GetRequest(h.request())->groupRequestIndex; + double offset = SS.explodeDistance * (requestIdx + 1); + return SK.GetEntity(workplane)->Normal()->NormalN().ScaledBy(offset); + } else { + return Vector::From(0, 0, 0); + } +} + +Vector Entity::PointGetDrawNum() const { + // As per EntityBase::PointGetNum but specifically for when drawing/rendering the point + // (and not when solving), so we can potentially draw it somewhere different + return PointGetNum().Plus(ExplodeOffset()); +} + +void Entity::Draw(DrawAs how, Canvas *canvas) { + if(!(how == DrawAs::HOVERED || how == DrawAs::SELECTED) && + !IsVisible()) return; + + int zIndex; + if(IsPoint()) { + zIndex = 6; + } else if(how == DrawAs::HIDDEN) { + zIndex = 2; + } else if(group != SS.GW.activeGroup) { + zIndex = 3; + } else { + zIndex = 5; + } + + hStyle hs; + if(IsPoint()) { + hs.v = Style::DATUM; + } else if(IsNormal() || type == Type::WORKPLANE) { + hs.v = Style::NORMALS; + } else { + hs = Style::ForEntity(h); + if (hs.v == Style::CONSTRUCTION) { + zIndex = 4; + } + } + + Canvas::Stroke stroke = Style::Stroke(hs); + switch(how) { + case DrawAs::DEFAULT: + stroke.layer = Canvas::Layer::NORMAL; + break; + + case DrawAs::OVERLAY: + stroke.layer = Canvas::Layer::FRONT; + break; + + case DrawAs::HIDDEN: + stroke.layer = Canvas::Layer::OCCLUDED; + stroke.stipplePattern = Style::PatternType({ Style::HIDDEN_EDGE }); + stroke.stippleScale = Style::Get({ Style::HIDDEN_EDGE })->stippleScale; + break; + + case DrawAs::HOVERED: + stroke.layer = Canvas::Layer::FRONT; + stroke.color = Style::Color(Style::HOVERED); + break; + + case DrawAs::SELECTED: + stroke.layer = Canvas::Layer::FRONT; + stroke.color = Style::Color(Style::SELECTED); + break; + } + stroke.zIndex = zIndex; + Canvas::hStroke hcs = canvas->GetStroke(stroke); + + switch(type) { + case Type::POINT_N_COPY: + case Type::POINT_N_TRANS: + case Type::POINT_N_ROT_TRANS: + case Type::POINT_N_ROT_AA: + case Type::POINT_N_ROT_AXIS_TRANS: + case Type::POINT_IN_3D: + case Type::POINT_IN_2D: { + if(how == DrawAs::HIDDEN) return; + + // If we're analyzing the sketch to show the degrees of freedom, + // then we draw big colored squares over the points that are + // free to move. + bool free = false; + if(type == Type::POINT_IN_3D) { + Param *px = SK.GetParam(param[0]), + *py = SK.GetParam(param[1]), + *pz = SK.GetParam(param[2]); + + free = px->free || py->free || pz->free; + } else if(type == Type::POINT_IN_2D) { + Param *pu = SK.GetParam(param[0]), + *pv = SK.GetParam(param[1]); + + free = pu->free || pv->free; + } + + Canvas::Stroke pointStroke = {}; + pointStroke.layer = (free) ? Canvas::Layer::FRONT : stroke.layer; + pointStroke.zIndex = stroke.zIndex; + pointStroke.color = stroke.color; + pointStroke.width = 7.0; + pointStroke.unit = Canvas::Unit::PX; + Canvas::hStroke hcsPoint = canvas->GetStroke(pointStroke); + + Vector p = PointGetDrawNum(); + if(free) { + Canvas::Stroke analyzeStroke = Style::Stroke(Style::ANALYZE); + analyzeStroke.width = 14.0; + analyzeStroke.layer = Canvas::Layer::FRONT; + Canvas::hStroke hcsAnalyze = canvas->GetStroke(analyzeStroke); + + canvas->DrawPoint(p, hcsAnalyze); + } + + canvas->DrawPoint(p, hcsPoint); + return; + } + + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: { + const Camera &camera = canvas->GetCamera(); + + if(how == DrawAs::HIDDEN) return; + + for(int i = 0; i < 2; i++) { + bool asReference = (i == 1); + if(asReference) { + if(!h.request().IsFromReferences()) continue; + } else { + if(!SK.GetGroup(group)->IsVisible() || !SS.GW.showNormals) continue; + } + + stroke.layer = (asReference) ? Canvas::Layer::FRONT : Canvas::Layer::NORMAL; + if(how != DrawAs::HOVERED && how != DrawAs::SELECTED) { + // Always draw the x, y, and z axes in red, green, and blue; + // brighter for the ones at the bottom left of the screen, + // dimmer for the ones at the model origin. + hRequest hr = h.request(); + uint8_t luma = (asReference) ? 255 : 100; + if(hr == Request::HREQUEST_REFERENCE_XY) { + stroke.color = RgbaColor::From(0, 0, luma); + } else if(hr == Request::HREQUEST_REFERENCE_YZ) { + stroke.color = RgbaColor::From(luma, 0, 0); + } else if(hr == Request::HREQUEST_REFERENCE_ZX) { + stroke.color = RgbaColor::From(0, luma, 0); + } + } + + Quaternion q = NormalGetNum(); + Vector tail; + if(asReference) { + // Draw an extra copy of the x, y, and z axes, that's + // always in the corner of the view and at the front. + // So those are always available, perhaps useful. + stroke.width = 2; + double s = camera.scale; + double h = 60 - camera.height / 2.0; + double w = 60 - camera.width / 2.0; + // Shift the axis to the right if they would overlap with the toolbar. + if(SS.showToolbar) { + if(h + 30 > -(32*18 + 3*16 + 8) / 2) + w += 60; + } + tail = camera.projRight.ScaledBy(w/s).Plus( + camera.projUp. ScaledBy(h/s)).Minus(camera.offset); + } else { + tail = SK.GetEntity(point[0])->PointGetDrawNum(); + } + tail = camera.AlignToPixelGrid(tail); + + hcs = canvas->GetStroke(stroke); + Vector v = (q.RotationN()).WithMagnitude(50.0 / camera.scale); + Vector tip = tail.Plus(v); + canvas->DrawLine(tail, tip, hcs); + + v = v.WithMagnitude(12.0 / camera.scale); + Vector axis = q.RotationV(); + canvas->DrawLine(tip, tip.Minus(v.RotatedAbout(axis, 0.6)), hcs); + canvas->DrawLine(tip, tip.Minus(v.RotatedAbout(axis, -0.6)), hcs); + + if(type == Type::NORMAL_IN_3D) { + Param *nw = SK.GetParam(param[0]), + *nx = SK.GetParam(param[1]), + *ny = SK.GetParam(param[2]), + *nz = SK.GetParam(param[3]); + + if(nw->free || nx->free || ny->free || nz->free) { + Canvas::Stroke analyzeStroke = Style::Stroke(Style::ANALYZE); + analyzeStroke.layer = Canvas::Layer::FRONT; + Canvas::hStroke hcsAnalyze = canvas->GetStroke(analyzeStroke); + canvas->DrawLine(tail, tip, hcsAnalyze); + } + } + } + return; + } + + case Type::DISTANCE: + case Type::DISTANCE_N_COPY: + // These are used only as data structures, nothing to display. + return; + + case Type::WORKPLANE: { + const Camera &camera = canvas->GetCamera(); + + Vector p = SK.GetEntity(point[0])->PointGetNum(); + p = camera.AlignToPixelGrid(p); + + Vector u = Normal()->NormalU(); + Vector v = Normal()->NormalV(); + + double s = (std::min(camera.width, camera.height)) * 0.45 / camera.scale; + + Vector us = u.ScaledBy(s); + Vector vs = v.ScaledBy(s); + + Vector pp = p.Plus (us).Plus (vs); + Vector pm = p.Plus (us).Minus(vs); + Vector mm = p.Minus(us).Minus(vs), mm2 = mm; + Vector mp = p.Minus(us).Plus (vs); + + Canvas::Stroke strokeBorder = stroke; + strokeBorder.zIndex -= 3; + strokeBorder.stipplePattern = StipplePattern::SHORT_DASH; + strokeBorder.stippleScale = 8.0; + Canvas::hStroke hcsBorder = canvas->GetStroke(strokeBorder); + + double textHeight = Style::TextHeight(hs) / camera.scale; + + if(!h.isFromRequest()) { + mm = mm.Plus(v.ScaledBy(textHeight * 4.7)); + mm2 = mm2.Plus(u.ScaledBy(textHeight * 4.7)); + canvas->DrawLine(mm2, mm, hcsBorder); + } + canvas->DrawLine(pp, pm, hcsBorder); + canvas->DrawLine(mm2, pm, hcsBorder); + canvas->DrawLine(mm, mp, hcsBorder); + canvas->DrawLine(pp, mp, hcsBorder); + + Vector o = mm2.Plus(u.ScaledBy(3.0 / camera.scale)).Plus( + v.ScaledBy(3.0 / camera.scale)); + std::string shortDesc = DescriptionString().substr(5); + canvas->DrawVectorText(shortDesc, textHeight, o, u, v, hcs); + return; + } + + case Type::LINE_SEGMENT: + case Type::CIRCLE: + case Type::ARC_OF_CIRCLE: + case Type::CUBIC: + case Type::CUBIC_PERIODIC: + case Type::TTF_TEXT: { + // Generate the rational polynomial curves, then piecewise linearize + // them, and display those. + // Calculating the draw offset, if necessary. + const bool shouldExplode = ShouldDrawExploded(); + Vector explodeOffset; + SBezierList offsetBeziers = {}; + SBezierList *beziers = GetOrGenerateBezierCurves(); + if(shouldExplode) { + explodeOffset = ExplodeOffset(); + for(const SBezier& b : beziers->l) { + SBezier offset = b.TransformedBy(explodeOffset, Quaternion::IDENTITY, 1.0); + offsetBeziers.l.Add(&offset); + } + beziers = &offsetBeziers; + } + + SEdgeList *edges = nullptr; + SEdgeList offsetEdges = {}; + + if(!canvas->DrawBeziers(*beziers, hcs)) { + edges = GetOrGenerateEdges(); + if(shouldExplode) { + for(const SEdge &e : edges->l) { + offsetEdges.AddEdge(e.a.Plus(explodeOffset), e.b.Plus(explodeOffset), e.auxA, e.auxB, e.tag); + } + edges = &offsetEdges; + } + canvas->DrawEdges(*edges, hcs); + } + if(type == Type::CIRCLE) { + Entity *dist = SK.GetEntity(distance); + if(dist->type == Type::DISTANCE) { + Param *p = SK.GetParam(dist->param[0]); + if(p->free) { + Canvas::Stroke analyzeStroke = Style::Stroke(Style::ANALYZE); + analyzeStroke.layer = Canvas::Layer::FRONT; + Canvas::hStroke hcsAnalyze = canvas->GetStroke(analyzeStroke); + if(!canvas->DrawBeziers(*beziers, hcsAnalyze)) { + canvas->DrawEdges(*edges, hcsAnalyze); + } + } + } + } + offsetBeziers.Clear(); + offsetEdges.Clear(); + return; + } + case Type::IMAGE: { + Canvas::Fill fill = {}; + std::shared_ptr pixmap; + switch(how) { + case DrawAs::HIDDEN: return; + + case DrawAs::HOVERED: { + fill.color = Style::Color(Style::HOVERED).WithAlpha(180); + fill.pattern = Canvas::FillPattern::CHECKERED_A; + fill.zIndex = 2; + break; + } + + case DrawAs::SELECTED: { + fill.color = Style::Color(Style::SELECTED).WithAlpha(180); + fill.pattern = Canvas::FillPattern::CHECKERED_B; + fill.zIndex = 1; + break; + } + + default: + fill.color = RgbaColor::FromFloat(1.0f, 1.0f, 1.0f); + pixmap = SS.images[file]; + break; + } + + Canvas::hFill hf = canvas->GetFill(fill); + Vector v[4] = {}; + for(int i = 0; i < 4; i++) { + v[i] = SK.GetEntity(point[i])->PointGetDrawNum(); + } + Vector iu = v[3].Minus(v[0]); + Vector iv = v[1].Minus(v[0]); + + if(how == DrawAs::DEFAULT && pixmap == NULL) { + Canvas::Stroke stroke = Style::Stroke(Style::DRAW_ERROR); + stroke.color = stroke.color.WithAlpha(50); + Canvas::hStroke hs = canvas->GetStroke(stroke); + canvas->DrawLine(v[0], v[2], hs); + canvas->DrawLine(v[1], v[3], hs); + for(int i = 0; i < 4; i++) { + canvas->DrawLine(v[i], v[(i + 1) % 4], hs); + } + } else { + canvas->DrawPixmap(pixmap, v[0], iu, iv, + Point2d::From(0.0, 0.0), Point2d::From(1.0, 1.0), hf); + } + } + + case Type::FACE_NORMAL_PT: + case Type::FACE_XPROD: + case Type::FACE_N_ROT_TRANS: + case Type::FACE_N_TRANS: + case Type::FACE_N_ROT_AA: + case Type::FACE_ROT_NORMAL_PT: + case Type::FACE_N_ROT_AXIS_TRANS: + // Do nothing; these are drawn with the triangle mesh + return; + } + ssassert(false, "Unexpected entity type"); +} + +} // namespace SolveSpace diff --git a/src/dsc.h b/src/dsc.h new file mode 100644 index 0000000..1a535c6 --- /dev/null +++ b/src/dsc.h @@ -0,0 +1,730 @@ +//----------------------------------------------------------------------------- +// Data structures used frequently in the program, various kinds of vectors +// (of real numbers, not symbolic algebra stuff) and our templated lists. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#ifndef SOLVESPACE_DSC_H +#define SOLVESPACE_DSC_H + +#include +#include +#include +#include +#include + +#include "defs.h" +#include "util.h" + +namespace SolveSpace { + +class Vector; +class Vector4; +class Point2d; +class hEntity; +class hParam; + +class Quaternion { +public: + // a + (vx)*i + (vy)*j + (vz)*k + double w, vx, vy, vz; + + static const Quaternion IDENTITY; + + static Quaternion From(double w, double vx, double vy, double vz); + static Quaternion From(hParam w, hParam vx, hParam vy, hParam vz); + static Quaternion From(Vector u, Vector v); + static Quaternion From(Vector axis, double dtheta); + + Quaternion Plus(Quaternion b) const; + Quaternion Minus(Quaternion b) const; + Quaternion ScaledBy(double s) const; + double Magnitude() const; + Quaternion WithMagnitude(double s) const; + + // Call a rotation matrix [ u' v' n' ]'; this returns the first and + // second rows, where that matrix is generated by this quaternion + Vector RotationU() const; + Vector RotationV() const; + Vector RotationN() const; + Vector Rotate(Vector p) const; + + Quaternion ToThe(double p) const; + Quaternion Inverse() const; + Quaternion Times(Quaternion b) const; + Quaternion Mirror() const; +}; + +class Vector { +public: + double x, y, z; + + static Vector From(double x, double y, double z); + static Vector From(hParam x, hParam y, hParam z); + static Vector AtIntersectionOfPlanes(Vector n1, double d1, + Vector n2, double d2); + static Vector AtIntersectionOfLines(Vector a0, Vector a1, + Vector b0, Vector b1, + bool *skew, + double *pa=NULL, double *pb=NULL); + static Vector AtIntersectionOfPlaneAndLine(Vector n, double d, + Vector p0, Vector p1, + bool *parallel); + static Vector AtIntersectionOfPlanes(Vector na, double da, + Vector nb, double db, + Vector nc, double dc, bool *parallel); + static void ClosestPointBetweenLines(Vector pa, Vector da, + Vector pb, Vector db, + double *ta, double *tb); + + double Element(int i) const; + bool Equals(Vector v, double tol=LENGTH_EPS) const; + bool EqualsExactly(Vector v) const; + Vector Plus(Vector b) const; + Vector Minus(Vector b) const; + Vector Negated() const; + Vector Cross(Vector b) const; + double DirectionCosineWith(Vector b) const; + double Dot(Vector b) const; + Vector Normal(int which) const; + Vector RotatedAbout(Vector orig, Vector axis, double theta) const; + Vector RotatedAbout(Vector axis, double theta) const; + Vector DotInToCsys(Vector u, Vector v, Vector n) const; + Vector ScaleOutOfCsys(Vector u, Vector v, Vector n) const; + double DistanceToLine(Vector p0, Vector dp) const; + double DistanceToPlane(Vector normal, Vector origin) const; + bool OnLineSegment(Vector a, Vector b, double tol=LENGTH_EPS) const; + Vector ClosestPointOnLine(Vector p0, Vector deltal) const; + double Magnitude() const; + double MagSquared() const; + Vector WithMagnitude(double s) const; + Vector ScaledBy(double s) const; + Vector ProjectInto(hEntity wrkpl) const; + Vector ProjectVectorInto(hEntity wrkpl) const; + double DivProjected(Vector delta) const; + Vector ClosestOrtho() const; + void MakeMaxMin(Vector *maxv, Vector *minv) const; + Vector ClampWithin(double minv, double maxv) const; + static bool BoundingBoxesDisjoint(Vector amax, Vector amin, + Vector bmax, Vector bmin); + static bool BoundingBoxIntersectsLine(Vector amax, Vector amin, + Vector p0, Vector p1, bool asSegment); + bool OutsideAndNotOn(Vector maxv, Vector minv) const; + Vector InPerspective(Vector u, Vector v, Vector n, + Vector origin, double cameraTan) const; + Point2d Project2d(Vector u, Vector v) const; + Point2d ProjectXy() const; + Vector4 Project4d() const; +}; + +inline double Vector::Element(int i) const { + switch (i) { + case 0: return x; + case 1: return y; + case 2: return z; + default: ssassert(false, "Unexpected vector element index"); + } +} + +inline bool Vector::Equals(Vector v, double tol) const { + // Quick axis-aligned tests before going further + const Vector dv = this->Minus(v); + if (std::abs(dv.x) > tol) return false; + if (std::abs(dv.y) > tol) return false; + if (std::abs(dv.z) > tol) return false; + + return dv.MagSquared() < tol*tol; +} + +inline Vector Vector::From(double x, double y, double z) { + return {x, y, z}; +} + +inline Vector Vector::Plus(Vector b) const { + return {x + b.x, y + b.y, z + b.z}; +} + +inline Vector Vector::Minus(Vector b) const { + return {x - b.x, y - b.y, z - b.z}; +} + +inline Vector Vector::Negated() const { + return {-x, -y, -z}; +} + +inline Vector Vector::Cross(Vector b) const { + return {-(z * b.y) + (y * b.z), (z * b.x) - (x * b.z), -(y * b.x) + (x * b.y)}; +} + +inline double Vector::Dot(Vector b) const { + return (x * b.x + y * b.y + z * b.z); +} + +inline double Vector::MagSquared() const { + return x * x + y * y + z * z; +} + +inline double Vector::Magnitude() const { + return sqrt(x * x + y * y + z * z); +} + +inline Vector Vector::ScaledBy(const double v) const { + return {x * v, y * v, z * v}; +} + +inline void Vector::MakeMaxMin(Vector *maxv, Vector *minv) const { + maxv->x = std::max(maxv->x, x); + maxv->y = std::max(maxv->y, y); + maxv->z = std::max(maxv->z, z); + + minv->x = std::min(minv->x, x); + minv->y = std::min(minv->y, y); + minv->z = std::min(minv->z, z); +} + +struct VectorHash { + size_t operator()(const Vector &v) const; +}; + +struct VectorPred { + bool operator()(Vector a, Vector b) const; +}; + +class Vector4 { +public: + double w, x, y, z; + + static Vector4 From(double w, double x, double y, double z); + static Vector4 From(double w, Vector v3); + static Vector4 Blend(Vector4 a, Vector4 b, double t); + + Vector4 Plus(Vector4 b) const; + Vector4 Minus(Vector4 b) const; + Vector4 ScaledBy(double s) const; + Vector PerspectiveProject() const; +}; + +class Point2d { +public: + double x, y; + + static Point2d From(double x, double y); + static Point2d FromPolar(double r, double a); + + Point2d Plus(const Point2d &b) const; + Point2d Minus(const Point2d &b) const; + Point2d ScaledBy(double s) const; + double DivProjected(Point2d delta) const; + double Dot(Point2d p) const; + double DistanceTo(const Point2d &p) const; + double DistanceToLine(const Point2d &p0, const Point2d &dp, bool asSegment) const; + double DistanceToLineSigned(const Point2d &p0, const Point2d &dp, bool asSegment) const; + double Angle() const; + double AngleTo(const Point2d &p) const; + double Magnitude() const; + double MagSquared() const; + Point2d WithMagnitude(double v) const; + Point2d Normal() const; + bool Equals(Point2d v, double tol=LENGTH_EPS) const; +}; + +// A simple list +template +class List { + T *elem = nullptr; + int elemsAllocated = 0; + +public: + int n = 0; + + bool IsEmpty() const { return n == 0; } + + void ReserveMore(int howMuch) { + if(n + howMuch > elemsAllocated) { + elemsAllocated = n + howMuch; + T *newElem = (T *)::operator new[]((size_t)elemsAllocated*sizeof(T)); + for(int i = 0; i < n; i++) { + new(&newElem[i]) T(std::move(elem[i])); + elem[i].~T(); + } + ::operator delete[](elem); + elem = newElem; + } + } + + void AllocForOneMore() { + if(n >= elemsAllocated) { + ReserveMore((elemsAllocated + 32)*2 - n); + } + } + + void Add(const T *t) { + AllocForOneMore(); + new(&elem[n++]) T(*t); + } + + void AddToBeginning(const T *t) { + AllocForOneMore(); + new(&elem[n]) T(); + std::move_backward(elem, elem + 1, elem + n + 1); + elem[0] = *t; + n++; + } + + T *First() { + return IsEmpty() ? nullptr : &(elem[0]); + } + const T *First() const { + return IsEmpty() ? nullptr : &(elem[0]); + } + + T *Last() { return IsEmpty() ? nullptr : &(elem[n - 1]); } + const T *Last() const { return IsEmpty() ? nullptr : &(elem[n - 1]); } + + T *NextAfter(T *prev) { + if(IsEmpty() || !prev) return NULL; + if(prev - First() == (n - 1)) return NULL; + return prev + 1; + } + const T *NextAfter(const T *prev) const { + if(IsEmpty() || !prev) return NULL; + if(prev - First() == (n - 1)) return NULL; + return prev + 1; + } + + T &Get(size_t i) { return elem[i]; } + T const &Get(size_t i) const { return elem[i]; } + T &operator[](size_t i) { return Get(i); } + T const &operator[](size_t i) const { return Get(i); } + + T *begin() { return IsEmpty() ? nullptr : &elem[0]; } + T *end() { return IsEmpty() ? nullptr : &elem[n]; } + const T *begin() const { return IsEmpty() ? nullptr : &elem[0]; } + const T *end() const { return IsEmpty() ? nullptr : &elem[n]; } + const T *cbegin() const { return begin(); } + const T *cend() const { return end(); } + + void ClearTags() { + for(auto & elt : *this) { + elt.tag = 0; + } + } + + void Clear() { + for(int i = 0; i < n; i++) + elem[i].~T(); + if(elem) ::operator delete[](elem); + elem = NULL; + n = elemsAllocated = 0; + } + + void RemoveTagged() { + auto newEnd = std::remove_if(this->begin(), this->end(), [](T &t) { + if(t.tag) { + return true; + } + return false; + }); + auto oldEnd = this->end(); + n = newEnd - begin(); + if (newEnd != nullptr && oldEnd != nullptr) { + while(newEnd != oldEnd) { + newEnd->~T(); + ++newEnd; + } + } + // and elemsAllocated is untouched, because we didn't resize + } + + void RemoveLast(int cnt) { + ssassert(n >= cnt, "Removing more elements than the list contains"); + for(int i = n - cnt; i < n; i++) + elem[i].~T(); + n -= cnt; + // and elemsAllocated is untouched, same as in RemoveTagged + } + + void Reverse() { + int i; + for(i = 0; i < (n/2); i++) { + swap(elem[i], elem[(n-1)-i]); + } + } +}; + +template class IdList; + +// Comparison functor used by IdList and related classes +template +struct CompareId { + + CompareId(const IdList *list) { + idlist = list; + } + + bool operator()(int lhs, T const& rhs) const { + return idlist->elemstore[lhs].h.v < rhs.h.v; + } + bool operator()(int lhs, H rhs) const { + return idlist->elemstore[lhs].h.v < rhs.v; + } + bool operator()(T *lhs, int rhs) const { + return lhs->h.v < idlist->elemstore[rhs].h.v; + } + +private: + const IdList *idlist; +}; + +// A list, where each element has an integer identifier. The list is kept +// sorted by that identifier, and items can be looked up in log n time by +// id. +template +class IdList { + std::vector elemstore; + std::vector elemidx; + std::vector freelist; +public: + int n = 0; // PAR@@@@@ make this private to see all interesting and suspicious places in SoveSpace ;-) + + friend struct CompareId; + using Compare = CompareId; + + struct iterator { + typedef std::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef int difference_type; + typedef T *pointer; + typedef T &reference; + + public: + T &operator*() const noexcept { return *elem; } + const T *operator->() const noexcept { return elem; } + + bool operator==(const iterator &p) const { return p.position == position; } + bool operator!=(const iterator &p) const { return !operator==(p); } + + iterator &operator++() { + ++position; + if(position >= (int)list->elemidx.size()) { + elem = nullptr; // PAR@@@@ Remove just debugging + } else if(0 <= position) { + elem = &(list->elemstore[list->elemidx[position]]); + } + return *this; + } + + // Needed for std:find_if of gcc used in entity.cpp GenerateEquations + difference_type operator-(const iterator &rhs) const noexcept { + return position - rhs.position; + } + + iterator(IdList *l) : position(0), list(l) { + if(list) { + if(list->elemstore.size() && list->elemidx.size()) { + elem = &(list->elemstore[list->elemidx[position]]); + } + } + }; + iterator(IdList *l, int pos) : position(pos), list(l) { + if(position >= (int)list->elemidx.size()) { + elem = nullptr; + } else if(0 <= position) { + elem = &((list->elemstore)[list->elemidx[position]]); + } + }; + + private: + int position; + T *elem; + IdList *list; + }; + + + bool IsEmpty() const { + return n == 0; + } + + uint32_t MaximumId() { + if(IsEmpty()) { + return 0; + } else { + return elemstore[elemidx.back()].h.v; + } + } + + H AddAndAssignId(T *t) { + t->h.v = (MaximumId() + 1); + + // Add at the end of the list. + elemstore.push_back(*t); + elemidx.push_back(elemstore.size()-1); + ++n; + + return t->h; + } + + void ReserveMore(int howMuch) { + elemstore.reserve(elemstore.size() + howMuch); + elemidx.reserve(elemidx.size() + howMuch); + // freelist.reserve(freelist.size() + howMuch); // PAR@@@@ maybe we should - not much more RAM + } + + void Add(T *t) { + // Look to see if we already have something with the same handle value. + ssassert(FindByIdNoOops(t->h) == nullptr, "Handle isn't unique"); + + // Find out where the added element should be. + auto pos = std::lower_bound(elemidx.begin(), elemidx.end(), *t, Compare(this)); + + if(freelist.empty()) { // Add a new element to the store + elemstore.push_back(*t); + // Insert a pointer to the element at the correct position + if(elemidx.empty()) { + // The list is empty so pos, begin and end are all null. + // insert does not work in this case. + elemidx.push_back(elemstore.size()-1); + } else { + elemidx.insert(pos, elemstore.size() - 1); + } + } else { // Use the last element from the freelist + // Insert an index to the element at the correct position + elemidx.insert(pos, freelist.back()); + // Remove the element from the freelist + freelist.pop_back(); + + // Copy-construct to the element storage. + elemstore[*pos] = T(*t); + // *elemptr[pos] = *t; // PAR@@@@@@ maybe this? + } + + ++n; + } + + T *FindById(H h) { + T *t = FindByIdNoOops(h); + ssassert(t != nullptr, "Cannot find handle"); + return t; + } + + T *FindByIdNoOops(H h) { + if(IsEmpty()) { + return nullptr; + } + auto it = std::lower_bound(elemidx.begin(), elemidx.end(), h, Compare(this)); + if(it == elemidx.end()) { + return nullptr; + } else { + if(elemstore[*it].h.v != h.v) { + return nullptr; + } + return &elemstore[*it]; + } + } + + T &Get(size_t i) { return elemstore[elemidx[i]]; } + T &operator[](size_t i) { return Get(i); } + + iterator begin() { return IsEmpty() ? nullptr : iterator(this); } + iterator end() { return IsEmpty() ? nullptr : iterator(this, elemidx.size()); } + + void ClearTags() { + for(auto &elt : *this) { elt.tag = 0; } + } + + void Tag(H h, int tag) { + auto it = FindByIdNoOops(h); + if (it != nullptr) { + it->tag = tag; + } + } + + void RemoveTagged() { + int src, dest; + dest = 0; + for(src = 0; src < n; src++) { + if(elemstore[elemidx[src]].tag) { + // this item should be deleted + elemstore[elemidx[src]].Clear(); +// elemstore[elemidx[src]].~T(); // Clear below calls the destructors + freelist.push_back(elemidx[src]); + elemidx[src] = 0xDEADBEEF; // PAR@@@@@ just for debugging, not needed, remove later + } else { + if(src != dest) { + elemidx[dest] = elemidx[src]; + } + dest++; + } + } + n = dest; + elemidx.resize(n); // Clear left over elements at the end. + } + void RemoveById(H h) { // PAR@@@@@ this can be optimized + ClearTags(); + FindById(h)->tag = 1; + RemoveTagged(); + } + + void MoveSelfInto(IdList *l) { + l->Clear(); + std::swap(l->elemstore, elemstore); + std::swap(l->elemidx, elemidx); + std::swap(l->freelist, freelist); + std::swap(l->n, n); + } + + void DeepCopyInto(IdList *l) { + l->Clear(); + + for(auto const &it : elemstore) { + l->elemstore.push_back(it); + } + + for(auto const &it : elemidx) { + l->elemidx.push_back(it); + } + + l->n = n; + } + + void Clear() { + for(auto &it : elemidx) { + elemstore[it].Clear(); +// elemstore[it].~T(); // clear below calls the destructors + } + freelist.clear(); + elemidx.clear(); + elemstore.clear(); + n = 0; + } + +}; + +class BandedMatrix { +public: + enum { + MAX_UNKNOWNS = 16, + RIGHT_OF_DIAG = 1, + LEFT_OF_DIAG = 2 + }; + + double A[MAX_UNKNOWNS][MAX_UNKNOWNS]; + double B[MAX_UNKNOWNS]; + double X[MAX_UNKNOWNS]; + int n; + + void Solve(); +}; + +#define RGBi(r, g, b) RgbaColor::From((r), (g), (b)) +#define RGBf(r, g, b) RgbaColor::FromFloat((float)(r), (float)(g), (float)(b)) + +// Note: sizeof(class RgbaColor) should be exactly 4 +// +class RgbaColor { +public: + uint8_t red, green, blue, alpha; + + float redF() const { return (float)red / 255.0f; } + float greenF() const { return (float)green / 255.0f; } + float blueF() const { return (float)blue / 255.0f; } + float alphaF() const { return (float)alpha / 255.0f; } + + bool IsEmpty() const { return alpha == 0; } + + bool Equals(RgbaColor c) const { + return + c.red == red && + c.green == green && + c.blue == blue && + c.alpha == alpha; + } + + RgbaColor WithAlpha(uint8_t newAlpha) const { + RgbaColor color = *this; + color.alpha = newAlpha; + return color; + } + + uint32_t ToPackedIntBGRA() const { + return + blue | + (uint32_t)(green << 8) | + (uint32_t)(red << 16) | + (uint32_t)((255 - alpha) << 24); + } + + uint32_t ToPackedInt() const { + return + red | + (uint32_t)(green << 8) | + (uint32_t)(blue << 16) | + (uint32_t)((255 - alpha) << 24); + } + + uint32_t ToARGB32() const { + return + blue | + (uint32_t)(green << 8) | + (uint32_t)(red << 16) | + (uint32_t)(alpha << 24); + } + + static RgbaColor From(int r, int g, int b, int a = 255) { + RgbaColor c; + c.red = (uint8_t)r; + c.green = (uint8_t)g; + c.blue = (uint8_t)b; + c.alpha = (uint8_t)a; + return c; + } + + static RgbaColor FromFloat(float r, float g, float b, float a = 1.0) { + return From( + (int)(255.1f * r), + (int)(255.1f * g), + (int)(255.1f * b), + (int)(255.1f * a)); + } + + static RgbaColor FromPackedInt(uint32_t rgba) { + return From( + (int)((rgba) & 0xff), + (int)((rgba >> 8) & 0xff), + (int)((rgba >> 16) & 0xff), + (int)(255 - ((rgba >> 24) & 0xff))); + } + + static RgbaColor FromPackedIntBGRA(uint32_t bgra) { + return From( + (int)((bgra >> 16) & 0xff), + (int)((bgra >> 8) & 0xff), + (int)((bgra) & 0xff), + (int)(255 - ((bgra >> 24) & 0xff))); + } +}; + +struct RgbaColorCompare { + bool operator()(RgbaColor a, RgbaColor b) const { + return a.ToARGB32() < b.ToARGB32(); + } +}; + +class BBox { +public: + Vector minp; + Vector maxp; + + static BBox From(const Vector &p0, const Vector &p1); + + Vector GetOrigin() const; + Vector GetExtents() const; + + void Include(const Vector &v, double r = 0.0); + bool Overlaps(const BBox &b1) const; + bool Contains(const Point2d &p, double r = 0.0) const; +}; + +} // namespace SolveSpace + +#endif diff --git a/src/entity.cpp b/src/entity.cpp new file mode 100644 index 0000000..7b7b7a0 --- /dev/null +++ b/src/entity.cpp @@ -0,0 +1,997 @@ +//----------------------------------------------------------------------------- +// The implementation of our entities in the symbolic algebra system, methods +// to return a symbolic representation of the entity (line by its endpoints, +// circle by center and radius, etc.). +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +const hEntity EntityBase::FREE_IN_3D = { 0 }; +const hEntity EntityBase::NO_ENTITY = { 0 }; + +bool EntityBase::HasVector() const { + switch(type) { + case Type::LINE_SEGMENT: + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + return true; + + default: + return false; + } +} + +ExprVector EntityBase::VectorGetExprsInWorkplane(hEntity wrkpl) const { + if(IsFace()) { + return FaceGetNormalExprs(); + } + switch(type) { + case Type::LINE_SEGMENT: + return (SK.GetEntity(point[0])->PointGetExprsInWorkplane(wrkpl)).Minus( + SK.GetEntity(point[1])->PointGetExprsInWorkplane(wrkpl)); + + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: { + ExprVector ev = NormalExprsN(); + if(wrkpl == EntityBase::FREE_IN_3D) { + return ev; + } + // Get the offset and basis vectors for this weird exotic csys. + EntityBase *w = SK.GetEntity(wrkpl); + ExprVector wu = w->Normal()->NormalExprsU(); + ExprVector wv = w->Normal()->NormalExprsV(); + + // Get our coordinates in three-space, and project them into that + // coordinate system. + ExprVector result; + result.x = ev.Dot(wu); + result.y = ev.Dot(wv); + result.z = Expr::From(0.0); + return result; + } + default: ssassert(false, "Unexpected entity type"); + } +} + +ExprVector EntityBase::VectorGetExprs() const { + return VectorGetExprsInWorkplane(EntityBase::FREE_IN_3D); +} + +Vector EntityBase::VectorGetNum() const { + if(IsFace()) { + return FaceGetNormalNum(); + } + switch(type) { + case Type::LINE_SEGMENT: + return (SK.GetEntity(point[0])->PointGetNum()).Minus( + SK.GetEntity(point[1])->PointGetNum()); + + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + return NormalN(); + + default: ssassert(false, "Unexpected entity type"); + } +} + +Vector EntityBase::VectorGetRefPoint() const { + if(IsFace()) { + return FaceGetPointNum(); + } + switch(type) { + case Type::LINE_SEGMENT: + return ((SK.GetEntity(point[0])->PointGetNum()).Plus( + SK.GetEntity(point[1])->PointGetNum())).ScaledBy(0.5); + + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + return SK.GetEntity(point[0])->PointGetNum(); + + default: ssassert(false, "Unexpected entity type"); + } +} + +Vector EntityBase::VectorGetStartPoint() const { + switch(type) { + case Type::LINE_SEGMENT: + return SK.GetEntity(point[1])->PointGetNum(); + + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + return SK.GetEntity(point[0])->PointGetNum(); + + default: ssassert(false, "Unexpected entity type"); + } +} + +bool EntityBase::IsCircle() const { + return (type == Type::CIRCLE) || (type == Type::ARC_OF_CIRCLE); +} + +Expr *EntityBase::CircleGetRadiusExpr() const { + if(type == Type::CIRCLE) { + return SK.GetEntity(distance)->DistanceGetExpr(); + } else if(type == Type::ARC_OF_CIRCLE) { + return Constraint::Distance(workplane, point[0], point[1]); + } else ssassert(false, "Unexpected entity type"); +} + +double EntityBase::CircleGetRadiusNum() const { + if(type == Type::CIRCLE) { + return SK.GetEntity(distance)->DistanceGetNum(); + } else if(type == Type::ARC_OF_CIRCLE) { + Vector c = SK.GetEntity(point[0])->PointGetNum(); + Vector pa = SK.GetEntity(point[1])->PointGetNum(); + return (pa.Minus(c)).Magnitude(); + } else ssassert(false, "Unexpected entity type"); +} + +void EntityBase::ArcGetAngles(double *thetaa, double *thetab, double *dtheta) const { + ssassert(type == Type::ARC_OF_CIRCLE, "Unexpected entity type"); + + Quaternion q = Normal()->NormalGetNum(); + Vector u = q.RotationU(), v = q.RotationV(); + + Vector c = SK.GetEntity(point[0])->PointGetNum(); + Vector pa = SK.GetEntity(point[1])->PointGetNum(); + Vector pb = SK.GetEntity(point[2])->PointGetNum(); + + Point2d c2 = c.Project2d(u, v); + Point2d pa2 = (pa.Project2d(u, v)).Minus(c2); + Point2d pb2 = (pb.Project2d(u, v)).Minus(c2); + + *thetaa = atan2(pa2.y, pa2.x); + *thetab = atan2(pb2.y, pb2.x); + *dtheta = *thetab - *thetaa; + // If the endpoints are coincident, call it a full arc, not a zero arc; + // useful concept to have when splitting + while(*dtheta < 1e-6) *dtheta += 2*PI; + while(*dtheta > (2*PI)) *dtheta -= 2*PI; +} + +Vector EntityBase::CubicGetStartNum() const { + return SK.GetEntity(point[0])->PointGetNum(); +} +Vector EntityBase::CubicGetFinishNum() const { + return SK.GetEntity(point[3+extraPoints])->PointGetNum(); +} +ExprVector EntityBase::CubicGetStartTangentExprs() const { + ExprVector pon = SK.GetEntity(point[0])->PointGetExprs(), + poff = SK.GetEntity(point[1])->PointGetExprs(); + return (pon.Minus(poff)); +} +ExprVector EntityBase::CubicGetFinishTangentExprs() const { + ExprVector pon = SK.GetEntity(point[3+extraPoints])->PointGetExprs(), + poff = SK.GetEntity(point[2+extraPoints])->PointGetExprs(); + return (pon.Minus(poff)); +} +Vector EntityBase::CubicGetStartTangentNum() const { + Vector pon = SK.GetEntity(point[0])->PointGetNum(), + poff = SK.GetEntity(point[1])->PointGetNum(); + return (pon.Minus(poff)); +} +Vector EntityBase::CubicGetFinishTangentNum() const { + Vector pon = SK.GetEntity(point[3+extraPoints])->PointGetNum(), + poff = SK.GetEntity(point[2+extraPoints])->PointGetNum(); + return (pon.Minus(poff)); +} + +bool EntityBase::IsWorkplane() const { + return (type == Type::WORKPLANE); +} + +ExprVector EntityBase::WorkplaneGetOffsetExprs() const { + return SK.GetEntity(point[0])->PointGetExprs(); +} + +Vector EntityBase::WorkplaneGetOffset() const { + return SK.GetEntity(point[0])->PointGetNum(); +} + +void EntityBase::WorkplaneGetPlaneExprs(ExprVector *n, Expr **dn) const { + if(type == Type::WORKPLANE) { + *n = Normal()->NormalExprsN(); + + ExprVector p0 = SK.GetEntity(point[0])->PointGetExprs(); + // The plane is n dot (p - p0) = 0, or + // n dot p - n dot p0 = 0 + // so dn = n dot p0 + *dn = p0.Dot(*n); + } else ssassert(false, "Unexpected entity type"); +} + +bool EntityBase::IsDistance() const { + return (type == Type::DISTANCE) || + (type == Type::DISTANCE_N_COPY); +} +double EntityBase::DistanceGetNum() const { + if(type == Type::DISTANCE) { + return SK.GetParam(param[0])->val; + } else if(type == Type::DISTANCE_N_COPY) { + return numDistance; + } else ssassert(false, "Unexpected entity type"); +} +Expr *EntityBase::DistanceGetExpr() const { + if(type == Type::DISTANCE) { + return Expr::From(param[0]); + } else if(type == Type::DISTANCE_N_COPY) { + return Expr::From(numDistance); + } else ssassert(false, "Unexpected entity type"); +} +void EntityBase::DistanceForceTo(double v) { + if(type == Type::DISTANCE) { + (SK.GetParam(param[0]))->val = v; + } else if(type == Type::DISTANCE_N_COPY) { + // do nothing, it's locked + } else ssassert(false, "Unexpected entity type"); +} + +EntityBase *EntityBase::Normal() const { + return SK.GetEntity(normal); +} + +bool EntityBase::IsPoint() const { + switch(type) { + case Type::POINT_IN_3D: + case Type::POINT_IN_2D: + case Type::POINT_N_COPY: + case Type::POINT_N_TRANS: + case Type::POINT_N_ROT_TRANS: + case Type::POINT_N_ROT_AA: + case Type::POINT_N_ROT_AXIS_TRANS: + return true; + + default: + return false; + } +} + +bool EntityBase::IsNormal() const { + switch(type) { + case Type::NORMAL_IN_3D: + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + case Type::NORMAL_N_ROT: + case Type::NORMAL_N_ROT_AA: + return true; + + default: return false; + } +} + +Quaternion EntityBase::NormalGetNum() const { + Quaternion q; + switch(type) { + case Type::NORMAL_IN_3D: + q = Quaternion::From(param[0], param[1], param[2], param[3]); + break; + + case Type::NORMAL_IN_2D: { + EntityBase *wrkpl = SK.GetEntity(workplane); + EntityBase *norm = SK.GetEntity(wrkpl->normal); + q = norm->NormalGetNum(); + break; + } + case Type::NORMAL_N_COPY: + q = numNormal; + break; + + case Type::NORMAL_N_ROT: + q = Quaternion::From(param[0], param[1], param[2], param[3]); + q = q.Times(numNormal); + break; + + case Type::NORMAL_N_ROT_AA: { + q = GetAxisAngleQuaternion(0); + q = q.Times(numNormal); + break; + } + + default: ssassert(false, "Unexpected entity type"); + } + return q; +} + +void EntityBase::NormalForceTo(Quaternion q) { + switch(type) { + case Type::NORMAL_IN_3D: + SK.GetParam(param[0])->val = q.w; + SK.GetParam(param[1])->val = q.vx; + SK.GetParam(param[2])->val = q.vy; + SK.GetParam(param[3])->val = q.vz; + break; + + case Type::NORMAL_IN_2D: + case Type::NORMAL_N_COPY: + // There's absolutely nothing to do; these are locked. + break; + case Type::NORMAL_N_ROT: { + Quaternion qp = q.Times(numNormal.Inverse()); + + SK.GetParam(param[0])->val = qp.w; + SK.GetParam(param[1])->val = qp.vx; + SK.GetParam(param[2])->val = qp.vy; + SK.GetParam(param[3])->val = qp.vz; + break; + } + + case Type::NORMAL_N_ROT_AA: + // Not sure if I'll bother implementing this one + break; + + default: ssassert(false, "Unexpected entity type"); + } +} + +Vector EntityBase::NormalU() const { + return NormalGetNum().RotationU(); +} +Vector EntityBase::NormalV() const { + return NormalGetNum().RotationV(); +} +Vector EntityBase::NormalN() const { + return NormalGetNum().RotationN(); +} + +ExprVector EntityBase::NormalExprsU() const { + return NormalGetExprs().RotationU(); +} +ExprVector EntityBase::NormalExprsV() const { + return NormalGetExprs().RotationV(); +} +ExprVector EntityBase::NormalExprsN() const { + return NormalGetExprs().RotationN(); +} + +ExprQuaternion EntityBase::NormalGetExprs() const { + ExprQuaternion q; + switch(type) { + case Type::NORMAL_IN_3D: + q = ExprQuaternion::From(param[0], param[1], param[2], param[3]); + break; + + case Type::NORMAL_IN_2D: { + EntityBase *wrkpl = SK.GetEntity(workplane); + EntityBase *norm = SK.GetEntity(wrkpl->normal); + q = norm->NormalGetExprs(); + break; + } + case Type::NORMAL_N_COPY: + q = ExprQuaternion::From(numNormal); + break; + + case Type::NORMAL_N_ROT: { + ExprQuaternion orig = ExprQuaternion::From(numNormal); + q = ExprQuaternion::From(param[0], param[1], param[2], param[3]); + + q = q.Times(orig); + break; + } + + case Type::NORMAL_N_ROT_AA: { + ExprQuaternion orig = ExprQuaternion::From(numNormal); + q = GetAxisAngleQuaternionExprs(0); + q = q.Times(orig); + break; + } + + default: ssassert(false, "Unexpected entity type"); + } + return q; +} + +void EntityBase::PointForceParamTo(Vector p) { + switch(type) { + case Type::POINT_IN_3D: + SK.GetParam(param[0])->val = p.x; + SK.GetParam(param[1])->val = p.y; + SK.GetParam(param[2])->val = p.z; + break; + + case Type::POINT_IN_2D: + SK.GetParam(param[0])->val = p.x; + SK.GetParam(param[1])->val = p.y; + break; + + default: ssassert(false, "Unexpected entity type"); + } +} + +void EntityBase::PointForceTo(Vector p) { + switch(type) { + case Type::POINT_IN_3D: + SK.GetParam(param[0])->val = p.x; + SK.GetParam(param[1])->val = p.y; + SK.GetParam(param[2])->val = p.z; + break; + + case Type::POINT_IN_2D: { + EntityBase *c = SK.GetEntity(workplane); + p = p.Minus(c->WorkplaneGetOffset()); + SK.GetParam(param[0])->val = p.Dot(c->Normal()->NormalU()); + SK.GetParam(param[1])->val = p.Dot(c->Normal()->NormalV()); + break; + } + + case Type::POINT_N_TRANS: { + if(timesApplied == 0) break; + Vector trans = (p.Minus(numPoint)).ScaledBy(1.0/timesApplied); + SK.GetParam(param[0])->val = trans.x; + SK.GetParam(param[1])->val = trans.y; + SK.GetParam(param[2])->val = trans.z; + break; + } + + case Type::POINT_N_ROT_TRANS: { + // Force only the translation; leave the rotation unchanged. But + // remember that we're working with respect to the rotated + // point. + Vector trans = p.Minus(PointGetQuaternion().Rotate(numPoint)); + SK.GetParam(param[0])->val = trans.x; + SK.GetParam(param[1])->val = trans.y; + SK.GetParam(param[2])->val = trans.z; + break; + } + + case Type::POINT_N_ROT_AA: { + // Force only the angle; the axis and center of rotation stay + Vector offset = Vector::From(param[0], param[1], param[2]); + Vector normal = Vector::From(param[4], param[5], param[6]); + Vector u = normal.Normal(0), v = normal.Normal(1); + Vector po = p.Minus(offset), numo = numPoint.Minus(offset); + double thetap = atan2(v.Dot(po), u.Dot(po)); + double thetan = atan2(v.Dot(numo), u.Dot(numo)); + double thetaf = (thetap - thetan); + double thetai = (SK.GetParam(param[3])->val)*timesApplied*2; + double dtheta = thetaf - thetai; + // Take the smallest possible change in the actual step angle, + // in order to avoid jumps when you cross from +pi to -pi + while(dtheta < -PI) dtheta += 2*PI; + while(dtheta > PI) dtheta -= 2*PI; + // this extra *2 explains the mystery *4 + SK.GetParam(param[3])->val = (thetai + dtheta)/(timesApplied*2); + break; + } + + case Type::POINT_N_ROT_AXIS_TRANS: { + if(timesApplied == 0) break; + // is the point on the rotation axis? + Vector offset = Vector::From(param[0], param[1], param[2]); + Vector normal = Vector::From(param[4], param[5], param[6]).WithMagnitude(1.0); + Vector check = numPoint.Minus(offset).Cross(normal); + if (check.Dot(check) < LENGTH_EPS) { // if so, do extrusion style drag + Vector trans = (p.Minus(numPoint)); + SK.GetParam(param[7])->val = trans.Dot(normal)/timesApplied; + } else { // otherwise do rotation style + Vector u = normal.Normal(0), v = normal.Normal(1); + Vector po = p.Minus(offset), numo = numPoint.Minus(offset); + double thetap = atan2(v.Dot(po), u.Dot(po)); + double thetan = atan2(v.Dot(numo), u.Dot(numo)); + double thetaf = (thetap - thetan); + double thetai = (SK.GetParam(param[3])->val)*timesApplied*2; + double dtheta = thetaf - thetai; + // Take the smallest possible change in the actual step angle, + // in order to avoid jumps when you cross from +pi to -pi + while(dtheta < -PI) dtheta += 2*PI; + while(dtheta > PI) dtheta -= 2*PI; + // this extra *2 explains the mystery *4 + SK.GetParam(param[3])->val = (thetai + dtheta)/(timesApplied*2); + } + break; + } + + case Type::POINT_N_COPY: + // Nothing to do; it's a static copy + break; + + default: ssassert(false, "Unexpected entity type"); + } +} + +Vector EntityBase::PointGetNum() const { + Vector p; + switch(type) { + case Type::POINT_IN_3D: + p = Vector::From(param[0], param[1], param[2]); + break; + + case Type::POINT_IN_2D: { + EntityBase *c = SK.GetEntity(workplane); + Vector u = c->Normal()->NormalU(); + Vector v = c->Normal()->NormalV(); + p = u.ScaledBy(SK.GetParam(param[0])->val); + p = p.Plus(v.ScaledBy(SK.GetParam(param[1])->val)); + p = p.Plus(c->WorkplaneGetOffset()); + break; + } + + case Type::POINT_N_TRANS: { + Vector trans = Vector::From(param[0], param[1], param[2]); + p = numPoint.Plus(trans.ScaledBy(timesApplied)); + break; + } + + case Type::POINT_N_ROT_TRANS: { + Vector offset = Vector::From(param[0], param[1], param[2]); + Quaternion q = PointGetQuaternion(); + p = q.Rotate(numPoint); + p = p.Plus(offset); + break; + } + + case Type::POINT_N_ROT_AA: { + Vector offset = Vector::From(param[0], param[1], param[2]); + Quaternion q = PointGetQuaternion(); + p = numPoint.Minus(offset); + p = q.Rotate(p); + p = p.Plus(offset); + break; + } + + case Type::POINT_N_ROT_AXIS_TRANS: { + Vector offset = Vector::From(param[0], param[1], param[2]); + Vector displace = Vector::From(param[4], param[5], param[6]) + .WithMagnitude(SK.GetParam(param[7])->val).ScaledBy(timesApplied); + Quaternion q = PointGetQuaternion(); + p = numPoint.Minus(offset); + p = q.Rotate(p); + p = p.Plus(offset).Plus(displace); + break; + } + + case Type::POINT_N_COPY: + p = numPoint; + break; + + default: ssassert(false, "Unexpected entity type"); + } + return p; +} + +ExprVector EntityBase::PointGetExprs() const { + ExprVector r; + switch(type) { + case Type::POINT_IN_3D: + r = ExprVector::From(param[0], param[1], param[2]); + break; + + case Type::POINT_IN_2D: { + EntityBase *c = SK.GetEntity(workplane); + ExprVector u = c->Normal()->NormalExprsU(); + ExprVector v = c->Normal()->NormalExprsV(); + r = c->WorkplaneGetOffsetExprs(); + r = r.Plus(u.ScaledBy(Expr::From(param[0]))); + r = r.Plus(v.ScaledBy(Expr::From(param[1]))); + break; + } + case Type::POINT_N_TRANS: { + ExprVector orig = ExprVector::From(numPoint); + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + r = orig.Plus(trans.ScaledBy(Expr::From(timesApplied))); + break; + } + case Type::POINT_N_ROT_TRANS: { + ExprVector orig = ExprVector::From(numPoint); + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + ExprQuaternion q = + ExprQuaternion::From(param[3], param[4], param[5], param[6]); + orig = q.Rotate(orig); + r = orig.Plus(trans); + break; + } + case Type::POINT_N_ROT_AA: { + ExprVector orig = ExprVector::From(numPoint); + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + ExprQuaternion q = GetAxisAngleQuaternionExprs(3); + orig = orig.Minus(trans); + orig = q.Rotate(orig); + r = orig.Plus(trans); + break; + } + case Type::POINT_N_ROT_AXIS_TRANS: { + ExprVector orig = ExprVector::From(numPoint); + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + ExprVector displace = ExprVector::From(param[4], param[5], param[6]) + .WithMagnitude(Expr::From(1.0)).ScaledBy(Expr::From(timesApplied)).ScaledBy(Expr::From(param[7])); + + ExprQuaternion q = GetAxisAngleQuaternionExprs(3); + orig = orig.Minus(trans); + orig = q.Rotate(orig); + r = orig.Plus(trans).Plus(displace); + break; + } + case Type::POINT_N_COPY: + r = ExprVector::From(numPoint); + break; + + default: ssassert(false, "Unexpected entity type"); + } + return r; +} + +void EntityBase::PointGetExprsInWorkplane(hEntity wrkpl, Expr **u, Expr **v) const { + if(type == Type::POINT_IN_2D && workplane == wrkpl) { + // They want our coordinates in the form that we've written them, + // very nice. + *u = Expr::From(param[0]); + *v = Expr::From(param[1]); + } else { + // Get the offset and basis vectors for this weird exotic csys. + EntityBase *w = SK.GetEntity(wrkpl); + ExprVector wp = w->WorkplaneGetOffsetExprs(); + ExprVector wu = w->Normal()->NormalExprsU(); + ExprVector wv = w->Normal()->NormalExprsV(); + + // Get our coordinates in three-space, and project them into that + // coordinate system. + ExprVector ev = PointGetExprs(); + ev = ev.Minus(wp); + *u = ev.Dot(wu); + *v = ev.Dot(wv); + } +} + +ExprVector EntityBase::PointGetExprsInWorkplane(hEntity wrkpl) const { + if(wrkpl == Entity::FREE_IN_3D) { + return PointGetExprs(); + } + + ExprVector r; + PointGetExprsInWorkplane(wrkpl, &r.x, &r.y); + r.z = Expr::From(0.0); + return r; +} + +void EntityBase::PointForceQuaternionTo(Quaternion q) { + ssassert(type == Type::POINT_N_ROT_TRANS, "Unexpected entity type"); + + SK.GetParam(param[3])->val = q.w; + SK.GetParam(param[4])->val = q.vx; + SK.GetParam(param[5])->val = q.vy; + SK.GetParam(param[6])->val = q.vz; +} + +Quaternion EntityBase::GetAxisAngleQuaternion(int param0) const { + Quaternion q; + double theta = timesApplied*SK.GetParam(param[param0+0])->val; + double s = sin(theta), c = cos(theta); + q.w = c; + q.vx = s*SK.GetParam(param[param0+1])->val; + q.vy = s*SK.GetParam(param[param0+2])->val; + q.vz = s*SK.GetParam(param[param0+3])->val; + return q; +} + +ExprQuaternion EntityBase::GetAxisAngleQuaternionExprs(int param0) const { + ExprQuaternion q; + + Expr *theta = Expr::From(timesApplied)->Times( + Expr::From(param[param0+0])); + Expr *c = theta->Cos(), *s = theta->Sin(); + q.w = c; + q.vx = s->Times(Expr::From(param[param0+1])); + q.vy = s->Times(Expr::From(param[param0+2])); + q.vz = s->Times(Expr::From(param[param0+3])); + return q; +} + +Quaternion EntityBase::PointGetQuaternion() const { + Quaternion q; + + if(type == Type::POINT_N_ROT_AA || type == Type::POINT_N_ROT_AXIS_TRANS) { + q = GetAxisAngleQuaternion(3); + } else if(type == Type::POINT_N_ROT_TRANS) { + q = Quaternion::From(param[3], param[4], param[5], param[6]); + } else ssassert(false, "Unexpected entity type"); + + return q; +} + +bool EntityBase::IsFace() const { + switch(type) { + case Type::FACE_NORMAL_PT: + case Type::FACE_XPROD: + case Type::FACE_N_ROT_TRANS: + case Type::FACE_N_TRANS: + case Type::FACE_N_ROT_AA: + case Type::FACE_ROT_NORMAL_PT: + case Type::FACE_N_ROT_AXIS_TRANS: + return true; + default: + return false; + } +} + +ExprVector EntityBase::FaceGetNormalExprs() const { + ExprVector r; + if(type == Type::FACE_NORMAL_PT) { + Vector v = Vector::From(numNormal.vx, numNormal.vy, numNormal.vz); + r = ExprVector::From(v.WithMagnitude(1)); + } else if(type == Type::FACE_XPROD) { + ExprVector vc = ExprVector::From(param[0], param[1], param[2]); + ExprVector vn = + ExprVector::From(numNormal.vx, numNormal.vy, numNormal.vz); + r = vc.Cross(vn); + r = r.WithMagnitude(Expr::From(1.0)); + } else if(type == Type::FACE_N_ROT_TRANS) { + // The numerical normal vector gets the rotation; the numerical + // normal has magnitude one, and the rotation doesn't change that, + // so there's no need to fix it up. + r = ExprVector::From(numNormal.vx, numNormal.vy, numNormal.vz); + ExprQuaternion q = + ExprQuaternion::From(param[3], param[4], param[5], param[6]); + r = q.Rotate(r); + } else if(type == Type::FACE_N_TRANS) { + r = ExprVector::From(numNormal.vx, numNormal.vy, numNormal.vz); + } else if((type == Type::FACE_N_ROT_AA) || (type == Type::FACE_ROT_NORMAL_PT)) { + r = ExprVector::From(numNormal.vx, numNormal.vy, numNormal.vz); + ExprQuaternion q = GetAxisAngleQuaternionExprs(3); + r = q.Rotate(r); + } else ssassert(false, "Unexpected entity type"); + return r; +} + +Vector EntityBase::FaceGetNormalNum() const { + Vector r; + if(type == Type::FACE_NORMAL_PT) { + r = Vector::From(numNormal.vx, numNormal.vy, numNormal.vz); + } else if(type == Type::FACE_XPROD) { + Vector vc = Vector::From(param[0], param[1], param[2]); + Vector vn = Vector::From(numNormal.vx, numNormal.vy, numNormal.vz); + r = vc.Cross(vn); + } else if(type == Type::FACE_N_ROT_TRANS) { + // The numerical normal vector gets the rotation + r = Vector::From(numNormal.vx, numNormal.vy, numNormal.vz); + Quaternion q = Quaternion::From(param[3], param[4], param[5], param[6]); + r = q.Rotate(r); + } else if(type == Type::FACE_N_TRANS) { + r = Vector::From(numNormal.vx, numNormal.vy, numNormal.vz); + } else if((type == Type::FACE_N_ROT_AA) || (type == Type::FACE_ROT_NORMAL_PT)) { + r = Vector::From(numNormal.vx, numNormal.vy, numNormal.vz); + Quaternion q = GetAxisAngleQuaternion(3); + r = q.Rotate(r); + } else ssassert(false, "Unexpected entity type"); + return r.WithMagnitude(1); +} + +ExprVector EntityBase::FaceGetPointExprs() const { + ExprVector r; + if((type == Type::FACE_NORMAL_PT) || (type==Type::FACE_ROT_NORMAL_PT)) { + r = SK.GetEntity(point[0])->PointGetExprs(); + } else if(type == Type::FACE_XPROD) { + r = ExprVector::From(numPoint); + } else if(type == Type::FACE_N_ROT_TRANS) { + // The numerical point gets the rotation and translation. + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + ExprQuaternion q = + ExprQuaternion::From(param[3], param[4], param[5], param[6]); + r = ExprVector::From(numPoint); + r = q.Rotate(r); + r = r.Plus(trans); + } else if(type == Type::FACE_N_ROT_AXIS_TRANS) { + ExprVector orig = ExprVector::From(numPoint); + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + ExprVector displace = ExprVector::From(param[4], param[5], param[6]) + .WithMagnitude(Expr::From(param[7])).ScaledBy(Expr::From(timesApplied)); + ExprQuaternion q = GetAxisAngleQuaternionExprs(3); + orig = orig.Minus(trans); + orig = q.Rotate(orig); + r = orig.Plus(trans).Plus(displace); + } else if(type == Type::FACE_N_TRANS) { + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + r = ExprVector::From(numPoint); + r = r.Plus(trans.ScaledBy(Expr::From(timesApplied))); + } else if(type == Type::FACE_N_ROT_AA) { + ExprVector trans = ExprVector::From(param[0], param[1], param[2]); + ExprQuaternion q = GetAxisAngleQuaternionExprs(3); + r = ExprVector::From(numPoint); + r = r.Minus(trans); + r = q.Rotate(r); + r = r.Plus(trans); + } else ssassert(false, "Unexpected entity type"); + return r; +} + +Vector EntityBase::FaceGetPointNum() const { + Vector r; + if((type == Type::FACE_NORMAL_PT) || (type==Type::FACE_ROT_NORMAL_PT)) { + r = SK.GetEntity(point[0])->PointGetNum(); + } else if(type == Type::FACE_XPROD) { + r = numPoint; + } else if(type == Type::FACE_N_ROT_TRANS) { + // The numerical point gets the rotation and translation. + Vector trans = Vector::From(param[0], param[1], param[2]); + Quaternion q = Quaternion::From(param[3], param[4], param[5], param[6]); + r = q.Rotate(numPoint); + r = r.Plus(trans); + } else if(type == Type::FACE_N_ROT_AXIS_TRANS) { + Vector offset = Vector::From(param[0], param[1], param[2]); + Vector displace = Vector::From(param[4], param[5], param[6]) + .WithMagnitude(SK.GetParam(param[7])->val).ScaledBy(timesApplied); + Quaternion q = PointGetQuaternion(); + r = numPoint.Minus(offset); + r = q.Rotate(r); + r = r.Plus(offset).Plus(displace); + } else if(type == Type::FACE_N_TRANS) { + Vector trans = Vector::From(param[0], param[1], param[2]); + r = numPoint.Plus(trans.ScaledBy(timesApplied)); + } else if(type == Type::FACE_N_ROT_AA) { + Vector trans = Vector::From(param[0], param[1], param[2]); + Quaternion q = GetAxisAngleQuaternion(3); + r = numPoint.Minus(trans); + r = q.Rotate(r); + r = r.Plus(trans); + } else ssassert(false, "Unexpected entity type"); + return r; +} + +bool EntityBase::HasEndpoints() const { + return (type == Type::LINE_SEGMENT) || + (type == Type::CUBIC) || + (type == Type::ARC_OF_CIRCLE); +} +Vector EntityBase::EndpointStart() const { + if(type == Type::LINE_SEGMENT) { + return SK.GetEntity(point[0])->PointGetNum(); + } else if(type == Type::CUBIC) { + return CubicGetStartNum(); + } else if(type == Type::ARC_OF_CIRCLE) { + return SK.GetEntity(point[1])->PointGetNum(); + } else ssassert(false, "Unexpected entity type"); +} +Vector EntityBase::EndpointFinish() const { + if(type == Type::LINE_SEGMENT) { + return SK.GetEntity(point[1])->PointGetNum(); + } else if(type == Type::CUBIC) { + return CubicGetFinishNum(); + } else if(type == Type::ARC_OF_CIRCLE) { + return SK.GetEntity(point[2])->PointGetNum(); + } else ssassert(false, "Unexpected entity type"); +} +static bool PointInPlane(hEntity h, Vector norm, double distance) { + Vector p = SK.GetEntity(h)->PointGetNum(); + return (fabs(norm.Dot(p) - distance) < LENGTH_EPS); +} +bool EntityBase::IsInPlane(Vector norm, double distance) const { + switch(type) { + case Type::LINE_SEGMENT: { + return PointInPlane(point[0], norm, distance) + && PointInPlane(point[1], norm, distance); + } + case Type::CUBIC: + case Type::CUBIC_PERIODIC: { + bool periodic = type == Type::CUBIC_PERIODIC; + int n = periodic ? 3 + extraPoints : extraPoints; + int i; + for (i=0; iNormalN(); + if (!norm.Equals(n) && !norm.Equals(n.Negated())) return false; + return PointInPlane(point[0], norm, distance); + } + + case Type::TTF_TEXT: { + Vector n = Normal()->NormalN(); + if (!norm.Equals(n) && !norm.Equals(n.Negated())) return false; + return PointInPlane(point[0], norm, distance) + && PointInPlane(point[1], norm, distance); + } + + default: + return false; + } +} + +void EntityBase::RectGetPointsExprs(ExprVector *eb, ExprVector *ec) const { + ssassert(type == Type::TTF_TEXT || type == Type::IMAGE, + "Unexpected entity type"); + + EntityBase *a = SK.GetEntity(point[0]); + EntityBase *o = SK.GetEntity(point[1]); + + // Write equations for each point in the current workplane. + // This reduces the complexity of resulting equations. + ExprVector ea = a->PointGetExprsInWorkplane(workplane); + ExprVector eo = o->PointGetExprsInWorkplane(workplane); + + // Take perpendicular vector and scale it by aspect ratio. + ExprVector eu = ea.Minus(eo); + ExprVector ev = ExprVector::From(eu.y, eu.x->Negate(), eu.z).ScaledBy(Expr::From(aspectRatio)); + + *eb = eo.Plus(ev); + *ec = eo.Plus(eu).Plus(ev); +} + +void EntityBase::AddEq(IdList *l, Expr *expr, int index) const { + Equation eq; + eq.e = expr; + eq.h = h.equation(index); + l->Add(&eq); +} + +void EntityBase::GenerateEquations(IdList *l) const { + switch(type) { + case Type::NORMAL_IN_3D: { + ExprQuaternion q = NormalGetExprs(); + AddEq(l, (q.Magnitude())->Minus(Expr::From(1)), 0); + break; + } + + case Type::ARC_OF_CIRCLE: { + // If this is a copied entity, with its point already fixed + // with respect to each other, then we don't want to generate + // the distance constraint! + if(SK.GetEntity(point[0])->type != Type::POINT_IN_2D) break; + + // If the two endpoints of the arc are constrained coincident + // (to make a complete circle), then our distance constraint + // would be redundant and therefore overconstrain things. + auto it = std::find_if(SK.constraint.begin(), SK.constraint.end(), + [&](ConstraintBase const &con) { + return (con.group == group) && + (con.type == Constraint::Type::POINTS_COINCIDENT) && + ((con.ptA == point[1] && con.ptB == point[2]) || + (con.ptA == point[2] && con.ptB == point[1])); + }); + if(it != SK.constraint.end()) { + break; + } + + Expr *ra = Constraint::Distance(workplane, point[0], point[1]); + Expr *rb = Constraint::Distance(workplane, point[0], point[2]); + AddEq(l, ra->Minus(rb), 0); + break; + } + + case Type::IMAGE: + case Type::TTF_TEXT: { + if(SK.GetEntity(point[0])->type != Type::POINT_IN_2D) break; + EntityBase *b = SK.GetEntity(point[2]); + EntityBase *c = SK.GetEntity(point[3]); + ExprVector eb = b->PointGetExprsInWorkplane(workplane); + ExprVector ec = c->PointGetExprsInWorkplane(workplane); + + ExprVector ebp, ecp; + RectGetPointsExprs(&ebp, &ecp); + + ExprVector beq = eb.Minus(ebp); + AddEq(l, beq.x, 0); + AddEq(l, beq.y, 1); + ExprVector ceq = ec.Minus(ecp); + AddEq(l, ceq.x, 2); + AddEq(l, ceq.y, 3); + break; + } + + default: // Most entities do not generate equations. + break; + } +} + +} // namespace SolveSpace diff --git a/src/export.cpp b/src/export.cpp new file mode 100644 index 0000000..5e6ad07 --- /dev/null +++ b/src/export.cpp @@ -0,0 +1,1272 @@ +//----------------------------------------------------------------------------- +// The 2d vector output stuff that isn't specific to any particular file +// format: getting the appropriate lines and curves, performing hidden line +// removal, calculating bounding boxes, and so on. Also raster and triangle +// mesh output. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include "config.h" + +namespace SolveSpace { + +void SolveSpaceUI::ExportSectionTo(const Platform::Path &filename) { + Vector gn = (SS.GW.projRight).Cross(SS.GW.projUp); + gn = gn.WithMagnitude(1); + + Group *g = SK.GetGroup(SS.GW.activeGroup); + g->GenerateDisplayItems(); + if(g->displayMesh.IsEmpty()) { + Error(_("No solid model present; draw one with extrudes and revolves, " + "or use Export 2d View to export bare lines and curves.")); + return; + } + + // The plane in which the exported section lies; need this because we'll + // reorient from that plane into the xy plane before exporting. + Vector origin, u, v, n; + double d; + + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + if((gs.n == 0 && g->activeWorkplane != Entity::FREE_IN_3D)) { + Entity *wrkpl = SK.GetEntity(g->activeWorkplane); + origin = wrkpl->WorkplaneGetOffset(); + n = wrkpl->Normal()->NormalN(); + u = wrkpl->Normal()->NormalU(); + v = wrkpl->Normal()->NormalV(); + } else if(gs.n == 1 && gs.faces == 1) { + Entity *face = SK.GetEntity(gs.entity[0]); + origin = face->FaceGetPointNum(); + n = face->FaceGetNormalNum(); + if(n.Dot(gn) < 0) n = n.ScaledBy(-1); + u = n.Normal(0); + v = n.Normal(1); + } else if(gs.n == 3 && gs.vectors == 2 && gs.points == 1) { + Vector ut = SK.GetEntity(gs.entity[0])->VectorGetNum(), + vt = SK.GetEntity(gs.entity[1])->VectorGetNum(); + ut = ut.WithMagnitude(1); + vt = vt.WithMagnitude(1); + + if(fabs(SS.GW.projUp.Dot(vt)) < fabs(SS.GW.projUp.Dot(ut))) { + swap(ut, vt); + } + if(SS.GW.projRight.Dot(ut) < 0) ut = ut.ScaledBy(-1); + if(SS.GW.projUp. Dot(vt) < 0) vt = vt.ScaledBy(-1); + + origin = SK.GetEntity(gs.point[0])->PointGetNum(); + n = ut.Cross(vt); + u = ut.WithMagnitude(1); + v = (n.Cross(u)).WithMagnitude(1); + } else { + Error(_("Bad selection for export section. Please select:\n\n" + " * nothing, with an active workplane " + "(workplane is section plane)\n" + " * a face (section plane through face)\n" + " * a point and two line segments " + "(plane through point and parallel to lines)\n")); + return; + } + SS.GW.ClearSelection(); + + n = n.WithMagnitude(1); + d = origin.Dot(n); + + SEdgeList el = {}; + SBezierList bl = {}; + + // If there's a mesh, then grab the edges from it. + g->runningMesh.MakeEdgesInPlaneInto(&el, n, d); + + // If there's a shell, then grab the edges and possibly Beziers. + bool export_as_pwl = SS.exportPwlCurves || fabs(SS.exportOffset) > LENGTH_EPS; + g->runningShell.MakeSectionEdgesInto(n, d, &el, export_as_pwl ? NULL : &bl); + + // All of these are solid model edges, so use the appropriate style. + SEdge *se; + for(se = el.l.First(); se; se = el.l.NextAfter(se)) { + se->auxA = Style::SOLID_EDGE; + } + SBezier *sb; + for(sb = bl.l.First(); sb; sb = bl.l.NextAfter(sb)) { + sb->auxA = Style::SOLID_EDGE; + } + + // Remove all overlapping edges/beziers to merge the areas they describe. + el.CullExtraneousEdges(/*both=*/true); + bl.CullIdenticalBeziers(/*both=*/true); + + // Collect lines and beziers with custom style & export. + for(auto &ent : SK.entity) { + Entity *e = &ent; + if (!e->IsVisible()) continue; + if (e->style.v < Style::FIRST_CUSTOM) continue; + if (!Style::Exportable(e->style.v)) continue; + if (!e->IsInPlane(n,d)) continue; + if (export_as_pwl) { + e->GenerateEdges(&el); + } else { + e->GenerateBezierCurves(&bl); + } + } + + // Only remove half of the overlapping edges/beziers to support TTF Stick Fonts. + el.CullExtraneousEdges(/*both=*/false); + bl.CullIdenticalBeziers(/*both=*/false); + + // And write the edges. + VectorFileWriter *out = VectorFileWriter::ForFile(filename); + if(out) { + // parallel projection (no perspective), and no mesh + ExportLinesAndMesh(&el, &bl, NULL, + u, v, n, origin, 0, + out); + } + el.Clear(); + bl.Clear(); +} + +// This is an awful temporary hack to replace Constraint::GetEdges until we have proper +// export through Canvas. +class GetEdgesCanvas : public Canvas { +public: + Camera camera; + SEdgeList *edges; + + const Camera &GetCamera() const override { + return camera; + } + + void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override { + edges->AddEdge(a, b, Style::CONSTRAINT); + } + void DrawEdges(const SEdgeList &el, hStroke hcs) override { + for(const SEdge &e : el.l) { + edges->AddEdge(e.a, e.b, Style::CONSTRAINT); + } + } + void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) override { + auto traceEdge = [&](Vector a, Vector b) { edges->AddEdge(a, b, Style::CONSTRAINT); }; + VectorFont::Builtin()->Trace(height, o, u, v, text, traceEdge, camera); + } + + void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) override { + // Do nothing + } + + bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { + ssassert(false, "Not implemented"); + } + void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override { + ssassert(false, "Not implemented"); + } + void DrawPoint(const Vector &o, hStroke hcs) override { + ssassert(false, "Not implemented"); + } + void DrawPolygon(const SPolygon &p, hFill hcf) override { + ssassert(false, "Not implemented"); + } + void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack = {}) override { + ssassert(false, "Not implemented"); + } + void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) override { + ssassert(false, "Not implemented"); + } + void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) override { + ssassert(false, "Not implemented"); + } + void InvalidatePixmap(std::shared_ptr pm) override { + ssassert(false, "Not implemented"); + } +}; + +void SolveSpaceUI::ExportViewOrWireframeTo(const Platform::Path &filename, bool exportWireframe) { + SEdgeList edges = {}; + SBezierList beziers = {}; + + VectorFileWriter *out = VectorFileWriter::ForFile(filename); + if(!out) return; + + SS.exportMode = true; + GenerateAll(Generate::ALL); + + SMesh *sm = NULL; + if(SS.GW.showShaded || SS.GW.drawOccludedAs != GraphicsWindow::DrawOccludedAs::VISIBLE) { + Group *g = SK.GetGroup(SS.GW.activeGroup); + g->GenerateDisplayItems(); + sm = &(g->displayMesh); + } + if(sm && sm->IsEmpty()) { + sm = NULL; + } + + for(auto &entity : SK.entity) { + Entity *e = &entity; + if(!e->IsVisible()) continue; + + if(SS.exportPwlCurves || sm || fabs(SS.exportOffset) > LENGTH_EPS) + { + // We will be doing hidden line removal, which we can't do on + // exact curves; so we need things broken down to pwls. Same + // problem with cutter radius compensation. + e->GenerateEdges(&edges); + } else { + e->GenerateBezierCurves(&beziers); + } + } + + if(SS.GW.showEdges || SS.GW.showOutlines) { + Group *g = SK.GetGroup(SS.GW.activeGroup); + g->GenerateDisplayItems(); + if(SS.GW.showEdges) { + g->displayOutlines.ListTaggedInto(&edges, Style::SOLID_EDGE); + } + } + + if(SS.GW.showConstraints != GraphicsWindow::ShowConstraintMode::SCM_NOSHOW ) { + if(!out->OutputConstraints(&SK.constraint)) { + GetEdgesCanvas canvas = {}; + canvas.camera = SS.GW.GetCamera(); + canvas.edges = &edges; + + // The output format cannot represent constraints directly, + // so convert them to edges. + for(Constraint &c : SK.constraint) { + c.Draw(Constraint::DrawAs::DEFAULT, &canvas); + } + + canvas.Clear(); + } + } + + if(exportWireframe) { + Vector u = Vector::From(1.0, 0.0, 0.0), + v = Vector::From(0.0, 1.0, 0.0), + n = Vector::From(0.0, 0.0, 1.0), + origin = Vector::From(0.0, 0.0, 0.0); + double cameraTan = 0.0, + scale = 1.0; + + out->SetModelviewProjection(u, v, n, origin, cameraTan, scale); + + ExportWireframeCurves(&edges, &beziers, out); + } else { + Vector u = SS.GW.projRight, + v = SS.GW.projUp, + n = u.Cross(v), + origin = SS.GW.offset.ScaledBy(-1); + + out->SetModelviewProjection(u, v, n, origin, + SS.CameraTangent()*SS.GW.scale, SS.exportScale); + + ExportLinesAndMesh(&edges, &beziers, sm, + u, v, n, origin, SS.CameraTangent()*SS.GW.scale, + out); + + if(!out->HasCanvasSize()) { + // These file formats don't have a canvas size, so they just + // get exported in the raw coordinate system. So indicate what + // that was on-screen. + SS.justExportedInfo.showOrigin = true; + SS.justExportedInfo.pt = origin; + SS.justExportedInfo.u = u; + SS.justExportedInfo.v = v; + } else { + SS.justExportedInfo.showOrigin = false; + } + + SS.justExportedInfo.draw = true; + GW.Invalidate(); + } + + edges.Clear(); + beziers.Clear(); +} + +void SolveSpaceUI::ExportWireframeCurves(SEdgeList *sel, SBezierList *sbl, + VectorFileWriter *out) +{ + SBezierLoopSetSet sblss = {}; + SEdge *se; + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + SBezier sb = SBezier::From( + (se->a).ScaledBy(1.0 / SS.exportScale), + (se->b).ScaledBy(1.0 / SS.exportScale)); + sblss.AddOpenPath(&sb); + } + + sbl->ScaleSelfBy(1.0/SS.exportScale); + SBezier *sb; + for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { + sblss.AddOpenPath(sb); + } + + out->OutputLinesAndMesh(&sblss, NULL); + sblss.Clear(); +} + +void SolveSpaceUI::ExportLinesAndMesh(SEdgeList *sel, SBezierList *sbl, SMesh *sm, + Vector u, Vector v, Vector n, + Vector origin, double cameraTan, + VectorFileWriter *out) +{ + double s = 1.0 / SS.exportScale; + + // Project into the export plane; so when we're done, z doesn't matter, + // and x and y are what goes in the DXF. + for(SEdge *e = sel->l.First(); e; e = sel->l.NextAfter(e)) { + // project into the specified csys, and apply export scale + (e->a) = e->a.InPerspective(u, v, n, origin, cameraTan).ScaledBy(s); + (e->b) = e->b.InPerspective(u, v, n, origin, cameraTan).ScaledBy(s); + } + + if(sbl) { + for(SBezier *b = sbl->l.First(); b; b = sbl->l.NextAfter(b)) { + *b = b->InPerspective(u, v, n, origin, cameraTan); + int i; + for(i = 0; i <= b->deg; i++) { + b->ctrl[i] = (b->ctrl[i]).ScaledBy(s); + } + } + } + + // If cutter radius compensation is requested, then perform it now + if(fabs(SS.exportOffset) > LENGTH_EPS) { + // assemble those edges into a polygon, and clear the edge list + SPolygon sp = {}; + sel->AssemblePolygon(&sp, NULL); + sel->Clear(); + + SPolygon compd = {}; + sp.normal = Vector::From(0, 0, -1); + sp.FixContourDirections(); + sp.OffsetInto(&compd, SS.exportOffset*s); + sp.Clear(); + + compd.MakeEdgesInto(sel); + compd.Clear(); + } + + // Now the triangle mesh; project, then build a BSP to perform + // occlusion testing and generated the shaded surfaces. + SMesh smp = {}; + if(sm) { + Vector l0 = (SS.lightDir[0]).WithMagnitude(1), + l1 = (SS.lightDir[1]).WithMagnitude(1); + STriangle *tr; + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + STriangle tt = *tr; + tt.a = (tt.a).InPerspective(u, v, n, origin, cameraTan).ScaledBy(s); + tt.b = (tt.b).InPerspective(u, v, n, origin, cameraTan).ScaledBy(s); + tt.c = (tt.c).InPerspective(u, v, n, origin, cameraTan).ScaledBy(s); + + // And calculate lighting for the triangle + Vector n = tt.Normal().WithMagnitude(1); + double lighting = min(1.0, SS.ambientIntensity + + max(0.0, (SS.lightIntensity[0])*(n.Dot(l0))) + + max(0.0, (SS.lightIntensity[1])*(n.Dot(l1)))); + double r = min(1.0, tt.meta.color.redF() * lighting), + g = min(1.0, tt.meta.color.greenF() * lighting), + b = min(1.0, tt.meta.color.blueF() * lighting); + tt.meta.color = RGBf(r, g, b); + smp.AddTriangle(&tt); + } + } + + SMesh sms = {}; + + // We need the mesh for occlusion testing, but if we don't/can't export it, + // don't generate it. + if(SS.GW.showShaded && out->CanOutputMesh()) { + // Use the BSP routines to generate the split triangles in paint order. + SBsp3 *bsp = SBsp3::FromMesh(&smp); + if(bsp) bsp->GenerateInPaintOrder(&sms); + // And cull the back-facing triangles + STriangle *tr; + sms.l.ClearTags(); + for(tr = sms.l.First(); tr; tr = sms.l.NextAfter(tr)) { + Vector n = tr->Normal(); + if(n.z < 0) { + tr->tag = 1; + } + } + sms.l.RemoveTagged(); + } + + // And now we perform hidden line removal if requested + SEdgeList hlrd = {}; + if(sm) { + SKdNode *root = SKdNode::From(&smp); + + // Generate the edges where a curved surface turns from front-facing + // to back-facing. + if(SS.GW.showEdges || SS.GW.showOutlines) { + root->MakeCertainEdgesInto(sel, EdgeKind::TURNING, + /*coplanarIsInter=*/false, NULL, NULL, + GW.showOutlines ? Style::OUTLINE : Style::SOLID_EDGE); + } + + root->ClearTags(); + int cnt = 1234; + + SEdge *se; + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + if(se->auxA == Style::CONSTRAINT) { + // Constraints should not get hidden line removed; they're + // always on top. + hlrd.AddEdge(se->a, se->b, se->auxA); + continue; + } + + SEdgeList edges = {}; + // Split the original edge against the mesh + edges.AddEdge(se->a, se->b, se->auxA); + root->OcclusionTestLine(*se, &edges, cnt); + if(SS.GW.drawOccludedAs == GraphicsWindow::DrawOccludedAs::STIPPLED) { + for(SEdge &se : edges.l) { + if(se.tag == 1) { + se.auxA = Style::HIDDEN_EDGE; + } + } + } else if(SS.GW.drawOccludedAs == GraphicsWindow::DrawOccludedAs::INVISIBLE) { + edges.l.RemoveTagged(); + } + + // the occlusion test splits unnecessarily; so fix those + edges.MergeCollinearSegments(se->a, se->b); + cnt++; + // And add the results to our output + SEdge *sen; + for(sen = edges.l.First(); sen; sen = edges.l.NextAfter(sen)) { + hlrd.AddEdge(sen->a, sen->b, sen->auxA); + } + edges.Clear(); + } + + sel = &hlrd; + } + + // Clean up: remove overlapping line segments and + // segments with zero-length projections. + sel->l.ClearTags(); + for(int i = 0; i < sel->l.n; ++i) { + SEdge *sei = &sel->l[i]; + hStyle hsi = { (uint32_t)sei->auxA }; + Style *si = Style::Get(hsi); + if(sei->tag != 0) continue; + + // Remove segments with zero length projections. + Vector ai = sei->a; + ai.z = 0.0; + Vector bi = sei->b; + bi.z = 0.0; + Vector di = bi.Minus(ai); + if(fabs(di.x) < LENGTH_EPS && fabs(di.y) < LENGTH_EPS) { + sei->tag = 1; + continue; + } + + for(int j = i + 1; j < sel->l.n; ++j) { + SEdge *sej = &sel->l[j]; + if(sej->tag != 0) continue; + + Vector *pAj = &sej->a; + Vector *pBj = &sej->b; + + // Remove segments with zero length projections. + Vector aj = sej->a; + aj.z = 0.0; + Vector bj = sej->b; + bj.z = 0.0; + Vector dj = bj.Minus(aj); + if(fabs(dj.x) < LENGTH_EPS && fabs(dj.y) < LENGTH_EPS) { + sej->tag = 1; + continue; + } + + // Skip non-collinear segments. + const double eps = 1e-6; + if(aj.DistanceToLine(ai, di) > eps) continue; + if(bj.DistanceToLine(ai, di) > eps) continue; + + double ta = aj.Minus(ai).Dot(di) / di.Dot(di); + double tb = bj.Minus(ai).Dot(di) / di.Dot(di); + if(ta > tb) { + std::swap(pAj, pBj); + std::swap(ta, tb); + } + + hStyle hsj = { (uint32_t)sej->auxA }; + Style *sj = Style::Get(hsj); + + bool canRemoveI = sej->auxA == sei->auxA || si->zIndex < sj->zIndex; + bool canRemoveJ = sej->auxA == sei->auxA || sj->zIndex < si->zIndex; + + if(canRemoveJ) { + // j-segment inside i-segment + if(ta > 0.0 - eps && tb < 1.0 + eps) { + sej->tag = 1; + continue; + } + + // cut segment + bool aInside = ta > 0.0 - eps && ta < 1.0 + eps; + if(tb > 1.0 - eps && aInside) { + *pAj = sei->b; + continue; + } + + // cut segment + bool bInside = tb > 0.0 - eps && tb < 1.0 + eps; + if(ta < 0.0 - eps && bInside) { + *pBj = sei->a; + continue; + } + + // split segment + if(ta < 0.0 - eps && tb > 1.0 + eps) { + sel->AddEdge(sei->b, *pBj, sej->auxA, sej->auxB); + *pBj = sei->a; + continue; + } + } + + if(canRemoveI) { + // j-segment inside i-segment + if(ta < 0.0 + eps && tb > 1.0 - eps) { + sei->tag = 1; + break; + } + + // cut segment + bool aInside = ta > 0.0 + eps && ta < 1.0 - eps; + if(tb > 1.0 - eps && aInside) { + sei->b = *pAj; + i--; + break; + } + + // cut segment + bool bInside = tb > 0.0 + eps && tb < 1.0 - eps; + if(ta < 0.0 + eps && bInside) { + sei->a = *pBj; + i--; + break; + } + + // split segment + if(ta > 0.0 + eps && tb < 1.0 - eps) { + sel->AddEdge(*pBj, sei->b, sei->auxA, sei->auxB); + sei->b = *pAj; + i--; + break; + } + } + } + } + sel->l.RemoveTagged(); + + // We kept the line segments and Beziers separate until now; but put them + // all together, and also project everything into the xy plane, since not + // all export targets ignore the z component of the points. + ssassert(sbl != nullptr, "Adding line segments to beziers assumes bezier list is non-null."); + for(SEdge *e = sel->l.First(); e; e = sel->l.NextAfter(e)) { + SBezier sb = SBezier::From(e->a, e->b); + sb.auxA = e->auxA; + sbl->l.Add(&sb); + } + for(SBezier *b = sbl->l.First(); b; b = sbl->l.NextAfter(b)) { + for(int i = 0; i <= b->deg; i++) { + b->ctrl[i].z = 0; + } + } + + // If possible, then we will assemble these output curves into loops. They + // will then get exported as closed paths. + SBezierLoopSetSet sblss = {}; + SBezierLoopSet leftovers = {}; + SSurface srf = SSurface::FromPlane(Vector::From(0, 0, 0), + Vector::From(1, 0, 0), + Vector::From(0, 1, 0)); + SPolygon spxyz = {}; + bool allClosed; + SEdge notClosedAt; + sbl->l.ClearTags(); + sblss.FindOuterFacesFrom(sbl, &spxyz, &srf, + SS.ExportChordTolMm(), + &allClosed, ¬ClosedAt, + NULL, NULL, + &leftovers); + sblss.l.Add(&leftovers); + + // Now write the lines and triangles to the output file + out->OutputLinesAndMesh(&sblss, &sms); + + spxyz.Clear(); + sblss.Clear(); + smp.Clear(); + sms.Clear(); + hlrd.Clear(); +} + +double VectorFileWriter::MmToPts(double mm) { + // 72 points in an inch + return (mm/25.4)*72; +} + +VectorFileWriter *VectorFileWriter::ForFile(const Platform::Path &filename) { + VectorFileWriter *ret; + bool needOpen = true; + if(filename.HasExtension("dxf")) { + static DxfFileWriter DxfWriter; + ret = &DxfWriter; + needOpen = false; + } else if(filename.HasExtension("ps") || filename.HasExtension("eps")) { + static EpsFileWriter EpsWriter; + ret = &EpsWriter; + } else if(filename.HasExtension("pdf")) { + static PdfFileWriter PdfWriter; + ret = &PdfWriter; + } else if(filename.HasExtension("svg")) { + static SvgFileWriter SvgWriter; + ret = &SvgWriter; + } else if(filename.HasExtension("plt") || filename.HasExtension("hpgl")) { + static HpglFileWriter HpglWriter; + ret = &HpglWriter; + } else if(filename.HasExtension("step") || filename.HasExtension("stp")) { + static Step2dFileWriter Step2dWriter; + ret = &Step2dWriter; + } else if(filename.HasExtension("txt") || filename.HasExtension("ngc")) { + static GCodeFileWriter GCodeWriter; + ret = &GCodeWriter; + } else { + Error("Can't identify output file type from file extension of " + "filename '%s'; try " + ".step, .stp, .dxf, .svg, .plt, .hpgl, .pdf, .txt, .ngc, " + ".eps, or .ps.", + filename.raw.c_str()); + return NULL; + } + ret->filename = filename; + if(!needOpen) return ret; + + FILE *f = OpenFile(filename, "wb"); + if(!f) { + Error("Couldn't write to '%s'", filename.raw.c_str()); + return NULL; + } + ret->f = f; + return ret; +} + +void VectorFileWriter::SetModelviewProjection(const Vector &u, const Vector &v, const Vector &n, + const Vector &origin, double cameraTan, + double scale) { + this->u = u; + this->v = v; + this->n = n; + this->origin = origin; + this->cameraTan = cameraTan; + this->scale = scale; +} + +Vector VectorFileWriter::Transform(Vector &pos) const { + return pos.InPerspective(u, v, n, origin, cameraTan).ScaledBy(1.0 / scale); +} + +void VectorFileWriter::OutputLinesAndMesh(SBezierLoopSetSet *sblss, SMesh *sm) { + STriangle *tr; + SBezier *b; + + // First calculate the bounding box. + ptMin = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); + ptMax = Vector::From(VERY_NEGATIVE, VERY_NEGATIVE, VERY_NEGATIVE); + if(sm) { + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + (tr->a).MakeMaxMin(&ptMax, &ptMin); + (tr->b).MakeMaxMin(&ptMax, &ptMin); + (tr->c).MakeMaxMin(&ptMax, &ptMin); + } + } + if(sblss) { + SBezierLoopSet *sbls; + for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) { + SBezierLoop *sbl; + for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { + for(b = sbl->l.First(); b; b = sbl->l.NextAfter(b)) { + for(int i = 0; i <= b->deg; i++) { + (b->ctrl[i]).MakeMaxMin(&ptMax, &ptMin); + } + } + } + } + } + + // And now we compute the canvas size. + double s = 1.0 / SS.exportScale; + if(SS.exportCanvasSizeAuto) { + // It's based on the calculated bounding box; we grow it along each + // boundary by the specified amount. + ptMin.x -= s*SS.exportMargin.left; + ptMax.x += s*SS.exportMargin.right; + ptMin.y -= s*SS.exportMargin.bottom; + ptMax.y += s*SS.exportMargin.top; + } else { + ptMin.x = (s*SS.exportCanvas.dx); + ptMin.y = (s*SS.exportCanvas.dy); + ptMax.x = ptMin.x + (s*SS.exportCanvas.width); + ptMax.y = ptMin.y + (s*SS.exportCanvas.height); + } + + StartFile(); + if(SS.exportBackgroundColor) { + Background(SS.backgroundColor); + } + if(sm && SS.exportShadedTriangles) { + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + Triangle(tr); + } + } + if(sblss) { + SBezierLoopSet *sbls; + for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) { + for(SBezierLoop *sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { + b = sbl->l.First(); + if(!b || !Style::Exportable(b->auxA)) continue; + + hStyle hs = { (uint32_t)b->auxA }; + Style *stl = Style::Get(hs); + double lineWidth = Style::WidthMm(b->auxA)*s; + RgbaColor strokeRgb = Style::Color(hs, /*forExport=*/true); + RgbaColor fillRgb = Style::FillColor(hs, /*forExport=*/true); + + StartPath(strokeRgb, lineWidth, stl->filled, fillRgb, hs); + for(b = sbl->l.First(); b; b = sbl->l.NextAfter(b)) { + Bezier(b); + } + FinishPath(strokeRgb, lineWidth, stl->filled, fillRgb, hs); + } + } + } + FinishAndCloseFile(); +} + +void VectorFileWriter::BezierAsPwl(SBezier *sb) { + List lv = {}; + sb->MakePwlInto(&lv, SS.ExportChordTolMm()); + + for(int i = 1; i < lv.n; i++) { + SBezier sb = SBezier::From(lv[i-1], lv[i]); + Bezier(&sb); + } + lv.Clear(); +} + +void VectorFileWriter::BezierAsNonrationalCubic(SBezier *sb, int depth) { + Vector t0 = sb->TangentAt(0), t1 = sb->TangentAt(1); + // The curve is correct, and the first derivatives are correct, at the + // endpoints. + SBezier bnr = SBezier::From( + sb->Start(), + sb->Start().Plus(t0.ScaledBy(1.0/3)), + sb->Finish().Minus(t1.ScaledBy(1.0/3)), + sb->Finish()); + + double tol = SS.ExportChordTolMm(); + // Arbitrary choice, but make it a little finer than pwl tolerance since + // it should be easier to achieve that with the smooth curves. + tol /= 2; + + bool closeEnough = true; + int i; + for(i = 1; i <= 3; i++) { + double t = i/4.0; + Vector p0 = sb->PointAt(t), + pn = bnr.PointAt(t); + double d = (p0.Minus(pn)).Magnitude(); + if(d > tol) { + closeEnough = false; + } + } + + if(closeEnough || depth > 3) { + Bezier(&bnr); + } else { + SBezier bef, aft; + sb->SplitAt(0.5, &bef, &aft); + BezierAsNonrationalCubic(&bef, depth+1); + BezierAsNonrationalCubic(&aft, depth+1); + } +} + +//----------------------------------------------------------------------------- +// Export a triangle mesh, in the requested format. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ExportMeshTo(const Platform::Path &filename) { + SS.exportMode = true; + GenerateAll(Generate::ALL); + + Group *g = SK.GetGroup(SS.GW.activeGroup); + g->GenerateDisplayItems(); + + SMesh *m = &(SK.GetGroup(SS.GW.activeGroup)->displayMesh); + if(m->IsEmpty()) { + Error(_("Active group mesh is empty; nothing to export.")); + return; + } + + FILE *f = OpenFile(filename, "wb"); + if(!f) { + Error("Couldn't write to '%s'", filename.raw.c_str()); + return; + } + ShowNakedEdges(/*reportOnlyWhenNotOkay=*/true); + if(filename.HasExtension("stl")) { + ExportMeshAsStlTo(f, m); + } else if(filename.HasExtension("obj")) { + Platform::Path mtlFilename = filename.WithExtension("mtl"); + FILE *fMtl = OpenFile(mtlFilename, "wb"); + if(!fMtl) { + Error("Couldn't write to '%s'", filename.raw.c_str()); + return; + } + + fprintf(f, "mtllib %s\n", mtlFilename.FileName().c_str()); + ExportMeshAsObjTo(f, fMtl, m); + + fclose(fMtl); + } else if(filename.HasExtension("js") || + filename.HasExtension("html")) { + SOutlineList *e = &(SK.GetGroup(SS.GW.activeGroup)->displayOutlines); + ExportMeshAsThreeJsTo(f, filename, m, e); + } else if(filename.HasExtension("wrl")) { + ExportMeshAsVrmlTo(f, filename, m); + } else { + Error("Can't identify output file type from file extension of " + "filename '%s'; try .stl, .obj, .js, .html.", filename.raw.c_str()); + } + + fclose(f); + + SS.justExportedInfo.showOrigin = false; + SS.justExportedInfo.draw = true; + GW.Invalidate(); +} + +//----------------------------------------------------------------------------- +// Export the mesh as an STL file; it should always be vertex-to-vertex and +// not self-intersecting, so not much to do. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ExportMeshAsStlTo(FILE *f, SMesh *sm) { + char str[80] = {}; + strcpy(str, "STL exported mesh"); + fwrite(str, 1, 80, f); + + uint32_t n = sm->l.n; + fwrite(&n, 4, 1, f); + + double s = SS.exportScale; + int i; + for(i = 0; i < sm->l.n; i++) { + STriangle *tr = &(sm->l[i]); + Vector n = tr->Normal().WithMagnitude(1); + float w; + w = (float)n.x; fwrite(&w, 4, 1, f); + w = (float)n.y; fwrite(&w, 4, 1, f); + w = (float)n.z; fwrite(&w, 4, 1, f); + w = (float)((tr->a.x)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->a.y)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->a.z)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->b.x)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->b.y)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->b.z)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->c.x)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->c.y)/s); fwrite(&w, 4, 1, f); + w = (float)((tr->c.z)/s); fwrite(&w, 4, 1, f); + fputc(0, f); + fputc(0, f); + } +} + +//----------------------------------------------------------------------------- +// Export the mesh as Wavefront OBJ format. This requires us to reduce all the +// identical vertices to the same identifier, so do that first. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ExportMeshAsObjTo(FILE *fObj, FILE *fMtl, SMesh *sm) { + std::map colors; + for(const STriangle &t : sm->l) { + RgbaColor color = t.meta.color; + if(colors.find(color) == colors.end()) { + std::string id = ssprintf("h%02x%02x%02x", + color.red, + color.green, + color.blue); + colors.emplace(color, id); + } + for(int i = 0; i < 3; i++) { + fprintf(fObj, "v %.10f %.10f %.10f\n", + CO(t.vertices[i].ScaledBy(1 / SS.exportScale))); + } + } + + for(auto &it : colors) { + fprintf(fMtl, "newmtl %s\n", + it.second.c_str()); + fprintf(fMtl, "Kd %.3f %.3f %.3f\n", + it.first.redF(), it.first.greenF(), it.first.blueF()); + } + + for(const STriangle &t : sm->l) { + for(int i = 0; i < 3; i++) { + Vector n = t.normals[i].WithMagnitude(1.0); + fprintf(fObj, "vn %.10f %.10f %.10f\n", + CO(n)); + } + } + + RgbaColor currentColor = {}; + for(int i = 0; i < sm->l.n; i++) { + const STriangle &t = sm->l[i]; + if(!currentColor.Equals(t.meta.color)) { + currentColor = t.meta.color; + fprintf(fObj, "usemtl %s\n", colors[currentColor].c_str()); + } + + fprintf(fObj, "f %d//%d %d//%d %d//%d\n", + i * 3 + 1, i * 3 + 1, + i * 3 + 2, i * 3 + 2, + i * 3 + 3, i * 3 + 3); + } +} + +//----------------------------------------------------------------------------- +// Export the mesh as a JavaScript script, which is compatible with Three.js. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ExportMeshAsThreeJsTo(FILE *f, const Platform::Path &filename, + SMesh *sm, SOutlineList *sol) +{ + SPointList spl = {}; + STriangle *tr; + Vector bndl, bndh; + + const std::string THREE_FN("three-r111.min.js"); + const std::string HAMMER_FN("hammer-2.0.8.js"); + const std::string CONTROLS_FN("SolveSpaceControls.js"); + + const char htmlbegin[] = R"( + + + + + Three.js Solvespace Mesh + + + + + + + + + +)"; + + // A default three.js viewer with OrthographicTrackballControls is + // generated as a comment preceding the data. + + // x bounds should be the range of x or y, whichever + // is larger, before aspect ratio correction is applied. + // y bounds should be the range of x or y, whichever is + // larger. No aspect ratio correction is applied. + // Near plane should be 1. + // Camera's z-position should be the range of z + 1 or the larger of + // the x or y bounds, whichever is larger. + // Far plane should be at least twice as much as the camera's + // z-position. + // Edge projection bias should be about 1/500 of the far plane's distance. + // Further corrections will be applied to the z-position and far plane in + // the default viewer, but the defaults are fine for a model which + // only rotates about the world origin. + + sm->GetBounding(&bndh, &bndl); + double largerBoundXY = max((bndh.x - bndl.x), (bndh.y - bndl.y)); + double largerBoundZ = max(largerBoundXY, (bndh.z - bndl.z + 1)); + + std::string basename = filename.FileStem(); + for(size_t i = 0; i < basename.length(); i++) { + if(!(isalnum(basename[i]) || ((unsigned)basename[i] >= 0x80))) { + basename[i] = '_'; + } + } + + if(filename.HasExtension("html")) { + fprintf(f, htmlbegin, + THREE_FN.c_str(), + LoadStringFromGzip("threejs/" + THREE_FN + ".gz").c_str(), + HAMMER_FN.c_str(), + LoadStringFromGzip("threejs/" + HAMMER_FN + ".gz").c_str(), + CONTROLS_FN.c_str(), + LoadString("threejs/" + CONTROLS_FN).c_str()); + } + + fprintf(f, "var solvespace_model_%s = {\n" + " bounds: {\n" + " x: %f, y: %f, near: %f, far: %f, z: %f, edgeBias: %f\n" + " },\n", + basename.c_str(), + largerBoundXY, + largerBoundXY, + 1.0, + largerBoundZ * 2, + largerBoundZ, + largerBoundZ / 250); + + // Output lighting information. + fputs(" lights: {\n" + " d: [\n", f); + + // Directional. + int lightCount; + for(lightCount = 0; lightCount < 2; lightCount++) { + fprintf(f, " {\n" + " intensity: %f, direction: [%f, %f, %f]\n" + " },\n", + SS.lightIntensity[lightCount], + CO(SS.lightDir[lightCount])); + } + + // Global Ambience. + fprintf(f, " ],\n" + " a: %f\n", SS.ambientIntensity); + + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + spl.IncrementTagFor(tr->a); + spl.IncrementTagFor(tr->b); + spl.IncrementTagFor(tr->c); + } + + // Output all the vertices. + SPoint *sp; + fputs(" },\n" + " points: [\n", f); + for(sp = spl.l.First(); sp; sp = spl.l.NextAfter(sp)) { + fprintf(f, " [%f, %f, %f],\n", + sp->p.x / SS.exportScale, + sp->p.y / SS.exportScale, + sp->p.z / SS.exportScale); + } + + fputs(" ],\n" + " faces: [\n", f); + // And now all the triangular faces, in terms of those vertices. + // This time we count from zero. + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + fprintf(f, " [%d, %d, %d],\n", + spl.IndexForPoint(tr->a), + spl.IndexForPoint(tr->b), + spl.IndexForPoint(tr->c)); + } + + // Output face normals. + fputs(" ],\n" + " normals: [\n", f); + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + fprintf(f, " [[%f, %f, %f], [%f, %f, %f], [%f, %f, %f]],\n", + CO(tr->an), CO(tr->bn), CO(tr->cn)); + } + + fputs(" ],\n" + " colors: [\n", f); + // Output triangle colors. + for(tr = sm->l.First(); tr; tr = sm->l.NextAfter(tr)) { + fprintf(f, " 0x%x,\n", tr->meta.color.ToARGB32()); + } + + fputs(" ],\n" + " edges: [\n", f); + // Output edges. Assume user's model colors do not obscure white edges. + for(const SOutline &so : sol->l) { + if(so.tag == 0) continue; + fprintf(f, " [[%f, %f, %f], [%f, %f, %f]],\n", + so.a.x / SS.exportScale, + so.a.y / SS.exportScale, + so.a.z / SS.exportScale, + so.b.x / SS.exportScale, + so.b.y / SS.exportScale, + so.b.z / SS.exportScale); + } + + fputs(" ]\n};\n", f); + + if(filename.HasExtension("html")) { + fprintf(f, htmlend, + basename.c_str(), + SS.GW.scale, + CO(SS.GW.offset), + CO(SS.GW.projUp), + CO(SS.GW.projRight)); + } + + spl.Clear(); +} + +//----------------------------------------------------------------------------- +// Export the mesh as a VRML text file / WRL. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ExportMeshAsVrmlTo(FILE *f, const Platform::Path &filename, SMesh *sm) { + struct STriangleSpan { + STriangle *first, *past_last; + + STriangle *begin() const { return first; } + STriangle *end() const { return past_last; } + }; + + + std::string basename = filename.FileStem(); + for(auto & c : basename) { + if(!(isalnum(c) || ((unsigned)c >= 0x80))) { + c = '_'; + } + } + + fprintf(f, "#VRML V2.0 utf8\n" + "#Exported from SolveSpace %s\n" + "\n" + "DEF %s Transform {\n" + " children [", + PACKAGE_VERSION, + basename.c_str()); + + + std::map> opacities; + STriangle *start = sm->l.begin(); + std::uint8_t last_opacity = start->meta.color.alpha; + for(auto & tr : sm->l) { + if(tr.meta.color.alpha != last_opacity) { + opacities[last_opacity].push_back(STriangleSpan{start, &tr}); + start = &tr; + last_opacity = start->meta.color.alpha; + } + } + opacities[last_opacity].push_back(STriangleSpan{start, sm->l.end()}); + + for(auto && op : opacities) { + fprintf(f, "\n" + " Shape {\n" + " appearance Appearance {\n" + " material DEF %s_material_%u Material {\n" + " diffuseColor %f %f %f\n" + " ambientIntensity %f\n" + " transparency %f\n" + " }\n" + " }\n" + " geometry IndexedFaceSet {\n" + " colorPerVertex TRUE\n" + " coord Coordinate { point [\n", + basename.c_str(), + (unsigned)op.first, + SS.ambientIntensity, + SS.ambientIntensity, + SS.ambientIntensity, + SS.ambientIntensity, + 1.f - ((float)op.first / 255.0f)); + + SPointList spl = {}; + + for(const auto & sp : op.second) { + for(const auto & tr : sp) { + spl.IncrementTagFor(tr.a); + spl.IncrementTagFor(tr.b); + spl.IncrementTagFor(tr.c); + } + } + + // Output all the vertices. + for(const auto &sp : spl.l) { + fprintf(f, " %f %f %f,\n", + sp.p.x / SS.exportScale, + sp.p.y / SS.exportScale, + sp.p.z / SS.exportScale); + } + + fputs(" ] }\n" + " coordIndex [\n", f); + // And now all the triangular faces, in terms of those vertices. + for(const auto & sp : op.second) { + for(const auto & tr : sp) { + fprintf(f, " %d, %d, %d, -1,\n", + spl.IndexForPoint(tr.a), + spl.IndexForPoint(tr.b), + spl.IndexForPoint(tr.c)); + } + } + + fputs(" ]\n" + " color Color { color [\n", f); + // Output triangle colors. + std::vector triangle_colour_ids; + std::vector colours_present; + for(const auto & sp : op.second) { + for(const auto & tr : sp) { + const auto colour_itr = std::find_if(colours_present.begin(), colours_present.end(), + [&](const RgbaColor & c) { + return c.Equals(tr.meta.color); + }); + if(colour_itr == colours_present.end()) { + fprintf(f, " %.10f %.10f %.10f,\n", + tr.meta.color.redF(), + tr.meta.color.greenF(), + tr.meta.color.blueF()); + triangle_colour_ids.push_back(colours_present.size()); + colours_present.insert(colours_present.end(), tr.meta.color); + } else { + triangle_colour_ids.push_back(colour_itr - colours_present.begin()); + } + } + } + + fputs(" ] }\n" + " colorIndex [\n", f); + + for(auto colour_idx : triangle_colour_ids) { + fprintf(f, " %d, %d, %d, -1,\n", colour_idx, colour_idx, colour_idx); + } + + fputs(" ]\n" + " }\n" + " }\n", f); + + spl.Clear(); + } + + fputs(" ]\n" + "}\n", f); +} + +//----------------------------------------------------------------------------- +// Export a view of the model as an image; we just take a screenshot, by +// rendering the view in the usual way and then copying the pixels. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ExportAsPngTo(const Platform::Path &filename) { + screenshotFile = filename; + // The rest of the work is done in the next redraw. + GW.Invalidate(); +} + +} // namespace SolveSpace diff --git a/src/exportstep.cpp b/src/exportstep.cpp new file mode 100644 index 0000000..6bfd974 --- /dev/null +++ b/src/exportstep.cpp @@ -0,0 +1,721 @@ +//----------------------------------------------------------------------------- +// Export a STEP file describing our ratpoly shell. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +#define FP "%.5f" // Floating Point coordinate precision. Since LENGTH_EPS = 1e-6 output 5 decimal places thus rounding out errors e.g. 0.999999mm +#define CARTESIAN_POINT_FORMAT "#%d=CARTESIAN_POINT('',(" FP "," FP "," FP "));\n" +const double PRECISION = 2*LENGTH_EPS; + +//----------------------------------------------------------------------------- +// Functions for STEP export: duplication check. +//----------------------------------------------------------------------------- +// Check if this point was already defined with a different ID number. +// inputs: +// number -> id of the cartesian point +// v -> position of the cartesian point +// vertex -> id of the vertex linked to this point (<1 if none) +// return: +// true, if the cartesian point is already defined +bool StepFileWriter::HasCartesianPointAnAlias(int number, Vector v, int vertex, bool *vertex_has_alias) { + // Look for this point "v" in the alias list. + for(pointAliases_t &p : pointAliases) { + if(p.v.Equals(v, PRECISION)) { + // This point was already defined. + // The new number is just an alias. + p.alias.aliases.push_back(number); + if(vertex > 0) { + p.vertexAlias.reference = (p.vertexAlias.reference <= 0 ? + vertex : p.vertexAlias.reference); + p.vertexAlias.aliases.push_back(vertex); + + // If the caller is interested let them know if the vertex is new or has an existing alias. + if(nullptr != vertex_has_alias) { + if(p.vertexAlias.aliases.size() == 1) { + // This is a new vertex. + *vertex_has_alias = false; + } else { + *vertex_has_alias = true; + } + } + } + return true; + } + } + + // No point was found, it means this is a new point. + pointAliases_t newPoint; + newPoint.alias.reference = number; + newPoint.alias.aliases.push_back(number); + newPoint.v = v; + newPoint.vertexAlias.reference = vertex; + if(vertex > 0) { + newPoint.vertexAlias.aliases.push_back(vertex); + } + + // A new entry in the list. + pointAliases.push_back(newPoint); + return false; +} + +// Return a cartesian point index; if the point has aliases return the +// first one. +// input: +// number -> the id of the requested cartesian point +// return: +// number, if the point has no aliases, otherwise its first alias +int StepFileWriter::InsertPoint(int number) { + // Look for a point with index "number" in the list of aliases. + for(pointAliases_t p : pointAliases) { + for(int alias : p.alias.aliases) { + if(alias == number) { + return p.alias.reference; + } + } + } + + // ERROR: it should never reach this point... + return -1; +} + +// Return a vertex index; if the vertex has aliases return the +// first one. +// input: +// number -> the id of the requested vertex +// return: +// number, if the vertex has no aliases, otherwise its first alias +int StepFileWriter::InsertVertex(int number) { + // Look for a point with index "number" in the list of vertex aliases. + for(pointAliases_t p : pointAliases) { + for(int alias : p.vertexAlias.aliases) { + if(alias == number) { + return p.vertexAlias.reference; + } + } + } + + // ERROR: it should never reach this point... + return -1; +} + +// Check whether this curve was already defined with a different ID number. +// inputs: +// number -> id of the curve +// points -> list of points that define the curve +// return: +// true, if the curve is already defined +bool StepFileWriter::HasBSplineCurveAnAlias(int number, std::vector points) { + // Look for this curve in the alias list. + for(curveAliases_t &c : curveAliases) { + if(points.size() != c.memberPoints.size()) { + continue; + } if(exportParts && !(c.color.Equals(currentColor))) { + continue; + } else { + size_t matches = 0; // is this the same curve? + // FIXME: this hack should work _most_ of the times + for(size_t i = 0; i < points.size(); i++) { + for(size_t j = 0; j < points.size(); j++) { + if(points[i] == c.memberPoints[j]) { + matches++; + } + } + } + + if(matches == points.size()) { + // Add this alias. + c.alias.aliases.push_back(number); + return true; + } + } + } + + // No curve was found, it means this is a new curve. + curveAliases_t newCurve; + newCurve.alias.reference = number; + newCurve.alias.aliases.push_back(number); + newCurve.memberPoints = points; + newCurve.color = currentColor; + + // A new entry in the list. + curveAliases.push_back(newCurve); + return false; +} + +// Return a curve index. As above. +int StepFileWriter::InsertCurve(int number) { + for(curveAliases_t c : curveAliases) { + for(int alias : c.alias.aliases) { + if(alias == number && (!exportParts || c.color.Equals(currentColor))) { + return c.alias.reference; + } + } + } + + // ERROR: it should never reach this point... + return -1; +} + +// Check whether this edge curve was already defined with a different ID number. +// inputs: +// number -> id of the edge +// prevFinish, thisFinish -> points of the edge +// curveID -> curve of the edge +// flip -> if an edge curve already exists this indicates whether it is in the other direction +// return: +// true, if the edge curve is already defined +bool StepFileWriter::HasEdgeCurveAnAlias(int number, int prevFinish, int thisFinish, int curveId, bool *flip) { + // Look for this edge in the alias list. + for(edgeCurveAliases_t &e : edgeCurveAliases) { + if(exportParts && !(e.color.Equals(currentColor))) { + continue; + } + // Check both directions. + if(((prevFinish == e.prevFinish && thisFinish == e.thisFinish) || + (prevFinish == e.thisFinish && thisFinish == e.prevFinish)) && + curveId == e.curveId) { + e.alias.aliases.push_back(number); + if(nullptr != flip) { + if(prevFinish == e.thisFinish && thisFinish == e.prevFinish) + *flip = true; + else + *flip = false; + } + return true; + } + } + + // New edge curve. + edgeCurveAliases_t newEdgeCurve; + newEdgeCurve.alias.reference = number; + newEdgeCurve.alias.aliases.push_back(number); + newEdgeCurve.prevFinish = prevFinish; + newEdgeCurve.thisFinish = thisFinish; + newEdgeCurve.curveId = curveId; + newEdgeCurve.color = currentColor; + + edgeCurveAliases.push_back(newEdgeCurve); + return false; +} + +// Return an edge curve index. As above. +int StepFileWriter::InsertEdgeCurve(int number) { + for(edgeCurveAliases_t e : edgeCurveAliases) { + for(int alias : e.alias.aliases) { + if(alias == number && (!exportParts || e.color.Equals(currentColor))) { + return e.alias.reference; + } + } + } + + // ERROR: it should never reach this point... + return -1; +} + +// Check whether this oriented edge curve was already defined with a different ID number. +// inputs: +// number -> id of the edge +// edgeCurveId -> curve of the edge +// flip -> the direction of the oriented edge +// return: +// true, if the oriented edge is already defined +bool StepFileWriter::HasOrientedEdgeAnAlias(int number, int edgeCurveId, bool flip) { + // Look for this edge in the alias list. + for(orientedEdgeAliases_t &e : orientedEdgeAliases) { + if((edgeCurveId == e.edgeCurveId) && (flip == e.flip)) { + e.alias.aliases.push_back(number); + return true; + } + } + + // New oriented edge. + orientedEdgeAliases_t newOrientedEdge; + newOrientedEdge.alias.reference = number; + newOrientedEdge.alias.aliases.push_back(number); + newOrientedEdge.edgeCurveId = edgeCurveId; + newOrientedEdge.flip = flip; + + orientedEdgeAliases.push_back(newOrientedEdge); + return false; +} + +// Return an oriented edge index. As above. +int StepFileWriter::InsertOrientedEdge(int number) { + for(orientedEdgeAliases_t e : orientedEdgeAliases) { + for(int alias : e.alias.aliases) { + if(alias == number) { + return e.alias.reference; + } + } + } + + // ERROR: it should never reach this point... + return -1; +} + +//----------------------------------------------------------------------------- +// Functions for STEP export: print to file. +//----------------------------------------------------------------------------- +void StepFileWriter::WriteHeader() { + fprintf(f, +"ISO-10303-21;\n" +"HEADER;\n" +"\n" +"FILE_DESCRIPTION((''), '2;1');\n" +"\n" +"FILE_NAME(\n" +" 'output_file',\n" +" '2009-06-07T17:44:47-07:00',\n" +" (''),\n" +" (''),\n" +" 'SolveSpace',\n" +" '',\n" +" ''\n" +");\n" +"\n" +"FILE_SCHEMA (('CONFIG_CONTROL_DESIGN'));\n" +"ENDSEC;\n" +"\n" +"DATA;\n" +"\n" +"/**********************************************************\n" +" * This defines the units and tolerances for the file. It\n" +" * is always the same, independent of the actual data.\n" +" **********************************************************/\n" +"#158=(\n" +"LENGTH_UNIT()\n" +"NAMED_UNIT(*)\n" +"SI_UNIT(.MILLI.,.METRE.)\n" +");\n" +"#161=(\n" +"NAMED_UNIT(*)\n" +"PLANE_ANGLE_UNIT()\n" +"SI_UNIT($,.RADIAN.)\n" +");\n" +"#166=(\n" +"NAMED_UNIT(*)\n" +"SI_UNIT($,.STERADIAN.)\n" +"SOLID_ANGLE_UNIT()\n" +");\n" +"#167=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(%f),#158,\n" +"'DISTANCE_ACCURACY_VALUE',\n" +"'string');\n" +"#168=(\n" +"GEOMETRIC_REPRESENTATION_CONTEXT(3)\n" +"GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#167))\n" +"GLOBAL_UNIT_ASSIGNED_CONTEXT((#166,#161,#158))\n" +"REPRESENTATION_CONTEXT('ID1','3D')\n" +");\n" +"#169=SHAPE_REPRESENTATION('',(#170),#168);\n" +"#170=AXIS2_PLACEMENT_3D('',#173,#171,#172);\n" +"#171=DIRECTION('',(0.,0.,1.));\n" +"#172=DIRECTION('',(1.,0.,0.));\n" +"#173=CARTESIAN_POINT('',(0.,0.,0.));\n" +"\n", + PRECISION); + + // Start the ID somewhere beyond the header IDs. + id = 200; +} +void StepFileWriter::WriteProductHeader() { + fprintf(f, + "#175 = SHAPE_DEFINITION_REPRESENTATION(#176, #169);\n" + "#176 = PRODUCT_DEFINITION_SHAPE('Version', 'Test Part', #177);\n" + "#177 = PRODUCT_DEFINITION('Version', 'Test Part', #182, #178);\n" + "#178 = DESIGN_CONTEXT('3D Mechanical Parts', #181, 'design');\n" + "#179 = PRODUCT('1', 'Product', 'Test Part', (#180));\n" + "#180 = MECHANICAL_CONTEXT('3D Mechanical Parts', #181, 'mechanical');\n" + "#181 = APPLICATION_CONTEXT(\n" + "'configuration controlled 3d designs of mechanical parts and assemblies');\n" + "#182 = PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE('Version',\n" + "'Test Part', #179, .MADE.);\n" + "\n" + ); +} +int StepFileWriter::ExportCurve(SBezier *sb) { + int i, ret = id; + std::vector curvePoints = {}; + + for(i = 0; i <= sb->deg; i++) { + if (!HasCartesianPointAnAlias(id + 1 + i, sb->ctrl[i], -1)) + fprintf(f, CARTESIAN_POINT_FORMAT, + id + 1 + i, + CO(sb->ctrl[i])); + } + + for(i = 0; i <= sb->deg; i++) { + int point = InsertPoint(id + 1 + i); + curvePoints.push_back(point); + } + + if (!HasBSplineCurveAnAlias(ret, curvePoints)) { + fprintf(f, "#%d=(\n", ret); + fprintf(f, "BOUNDED_CURVE()\n"); + fprintf(f, "B_SPLINE_CURVE(%d,(", sb->deg); + for(i = 0; i <= sb->deg; i++) { + fprintf(f, "#%d", InsertPoint(ret + i + 1)); + if(i != sb->deg) fprintf(f, ","); + } + fprintf(f, "),.UNSPECIFIED.,.F.,.F.)\n"); + fprintf(f, "B_SPLINE_CURVE_WITH_KNOTS((%d,%d),", + (sb->deg + 1), (sb-> deg + 1)); + fprintf(f, "(0.000,1.000),.UNSPECIFIED.)\n"); + fprintf(f, "CURVE()\n"); + fprintf(f, "GEOMETRIC_REPRESENTATION_ITEM()\n"); + fprintf(f, "RATIONAL_B_SPLINE_CURVE(("); + for(i = 0; i <= sb->deg; i++) { + fprintf(f, "%.10f", sb->weight[i]); + if(i != sb->deg) fprintf(f, ","); + } + fprintf(f, "))\n"); + fprintf(f, "REPRESENTATION_ITEM('')\n);\n"); + fprintf(f, "\n"); + } + + id = ret + 1 + (sb->deg + 1); + return ret; +} + +int StepFileWriter::ExportCurveLoop(SBezierLoop *loop, bool inner) { + ssassert(loop->l.n >= 1, "Expected at least one loop"); + + List listOfTrims = {}; + + SBezier *sb = loop->l.Last(); + + int lastFinish, prevFinish; + // Generate "exactly closed" contours, with the same vertex id for the + // finish of a previous edge and the start of the next one. So we need + // the finish of the last Bezier in the loop before we start our process. + bool vertex_has_alias; + if(!HasCartesianPointAnAlias(id, sb->Finish(), id + 1, &vertex_has_alias)) { + fprintf(f, CARTESIAN_POINT_FORMAT, + id, CO(sb->Finish())); + fprintf(f, "#%d=VERTEX_POINT('',#%d);\n", id + 1, InsertPoint(id)); + lastFinish = id + 1; + } else if(!vertex_has_alias) { + fprintf(f, "#%d=VERTEX_POINT('',#%d);\n", id + 1, InsertPoint(id)); + lastFinish = id + 1; + } + else { + lastFinish = InsertVertex(id+1); + } + prevFinish = lastFinish; + id += 2; + + for(sb = loop->l.First(); sb; sb = loop->l.NextAfter(sb)) { + int curveId = ExportCurve(sb); + + int thisFinish; + if(loop->l.NextAfter(sb) != NULL) { + if(!HasCartesianPointAnAlias(id, sb->Finish(), id + 1, &vertex_has_alias)) { + fprintf(f, CARTESIAN_POINT_FORMAT, + id, CO(sb->Finish())); + fprintf(f, "#%d=VERTEX_POINT('',#%d);\n", id + 1, InsertPoint(id)); + thisFinish = id + 1; + } else if(!vertex_has_alias) { + fprintf(f, "#%d=VERTEX_POINT('',#%d);\n", id + 1, InsertPoint(id)); + thisFinish = id + 1; + } else { + thisFinish = InsertVertex(id+1); + } + id += 2; + } else { + thisFinish = lastFinish; + } + + bool flip_edge; + if (!HasEdgeCurveAnAlias(id, prevFinish, thisFinish, InsertCurve(curveId), &flip_edge)) { + fprintf(f, "#%d=EDGE_CURVE('',#%d,#%d,#%d,%s);\n", + id, prevFinish, thisFinish, InsertCurve(curveId), ".T."); + if(!HasOrientedEdgeAnAlias(id + 1, id, flip_edge)) { + fprintf(f, "#%d=ORIENTED_EDGE('',*,*,#%d,.T.);\n", id + 1, id); + } else { + ssassert(false, "Impossible"); + } + } else if(!HasOrientedEdgeAnAlias(id + 1, id, flip_edge)) { + fprintf(f, "#%d=ORIENTED_EDGE('',*,*,#%d,.%c.);\n", id + 1, InsertEdgeCurve(id), + flip_edge ? 'F' : 'T'); + } + + int oe = id+1; + listOfTrims.Add(&oe); + id += 2; + + prevFinish = thisFinish; + } + + fprintf(f, "#%d=EDGE_LOOP('',(", id); + int *oe; + for(oe = listOfTrims.First(); oe; oe = listOfTrims.NextAfter(oe)) { + fprintf(f, "#%d", InsertOrientedEdge(*oe)); + if(listOfTrims.NextAfter(oe) != NULL) fprintf(f, ","); + } + fprintf(f, "));\n"); + + int fb = id + 1; + fprintf(f, "#%d=%s('',#%d,.T.);\n", + fb, inner ? "FACE_BOUND" : "FACE_OUTER_BOUND", id); + + id += 2; + listOfTrims.Clear(); + + return fb; +} + +void StepFileWriter::ExportSurface(SSurface *ss, SBezierList *sbl) { + int i, j, srfid = id; + + // Read the colour of the surface: use it to tell apart surfaces + // from different parts. + currentColor = ss->color; + + // First, define the control points for the untrimmed surface, if they + // were not already defined. + for(i = 0; i <= ss->degm; i++) { + for(j = 0; j <= ss->degn; j++) { + if (!HasCartesianPointAnAlias(srfid + 1 + j + i*(ss->degn + 1), + ss->ctrl[i][j], -1)) { + fprintf(f, CARTESIAN_POINT_FORMAT, + srfid + 1 + j + i*(ss->degn + 1), + CO(ss->ctrl[i][j])); + } + } + } + + // Then, we create the untrimmed surface. We always specify a rational + // B-spline surface (in fact, just a Bezier surface). + fprintf(f, "#%d=(\n", srfid); + fprintf(f, "BOUNDED_SURFACE()\n"); + fprintf(f, "B_SPLINE_SURFACE(%d,%d,(", ss->degm, ss->degn); + for(i = 0; i <= ss->degm; i++) { + fprintf(f, "("); + for(j = 0; j <= ss->degn; j++) { + fprintf(f, "#%d", InsertPoint(srfid + 1 + j + i*(ss->degn + 1))); + if(j != ss->degn) fprintf(f, ","); + } + fprintf(f, ")"); + if(i != ss->degm) fprintf(f, ","); + } + fprintf(f, "),.UNSPECIFIED.,.F.,.F.,.F.)\n"); + fprintf(f, "B_SPLINE_SURFACE_WITH_KNOTS((%d,%d),(%d,%d),", + (ss->degm + 1), (ss->degm + 1), + (ss->degn + 1), (ss->degn + 1)); + fprintf(f, "(0.000,1.000),(0.000,1.000),.UNSPECIFIED.)\n"); + fprintf(f, "GEOMETRIC_REPRESENTATION_ITEM()\n"); + fprintf(f, "RATIONAL_B_SPLINE_SURFACE(("); + for(i = 0; i <= ss->degm; i++) { + fprintf(f, "("); + for(j = 0; j <= ss->degn; j++) { + fprintf(f, "%.10f", ss->weight[i][j]); + if(j != ss->degn) fprintf(f, ","); + } + fprintf(f, ")"); + if(i != ss->degm) fprintf(f, ","); + } + fprintf(f, "))\n"); + fprintf(f, "REPRESENTATION_ITEM('')\n"); + fprintf(f, "SURFACE()\n"); + fprintf(f, ");\n"); + + fprintf(f, "\n"); + + id = srfid + 1 + (ss->degm + 1)*(ss->degn + 1); + + // Now we do the trim curves. We must group each outer loop separately + // along with its inner faces, so do that now. + SBezierLoopSetSet sblss = {}; + SPolygon spxyz = {}; + bool allClosed; + SEdge notClosedAt; + // We specify a surface, so it doesn't check for coplanarity; and we + // don't want it to give us any open contours. The polygon and chord + // tolerance are required, because they are used to calculate the + // contour directions and determine inner vs. outer contours. + sblss.FindOuterFacesFrom(sbl, &spxyz, ss, + SS.ExportChordTolMm(), + &allClosed, ¬ClosedAt, + NULL, NULL, + NULL); + + // So in our list of SBezierLoopSet, each set contains at least one loop + // (the outer boundary), plus any inner loops associated with that outer + // loop. + SBezierLoopSet *sbls; + for(sbls = sblss.l.First(); sbls; sbls = sblss.l.NextAfter(sbls)) { + SBezierLoop *loop = sbls->l.First(); + + List listOfLoops = {}; + // Create the face outer boundary from the outer loop. + int fob = ExportCurveLoop(loop, /*inner=*/false); + listOfLoops.Add(&fob); + + // And create the face inner boundaries from any inner loops that + // lie within this contour. + loop = sbls->l.NextAfter(loop); + for(; loop; loop = sbls->l.NextAfter(loop)) { + int fib = ExportCurveLoop(loop, /*inner=*/true); + listOfLoops.Add(&fib); + } + + // And now create the face that corresponds to this outer loop + // and all of its holes. + int advFaceId = id; + fprintf(f, "#%d=ADVANCED_FACE('',(", advFaceId); + int *fb; + for(fb = listOfLoops.First(); fb; fb = listOfLoops.NextAfter(fb)) { + fprintf(f, "#%d", *fb); + if(listOfLoops.NextAfter(fb) != NULL) fprintf(f, ","); + } + + fprintf(f, "),#%d,.T.);\n", srfid); + advancedFaces.Add(&advFaceId); + + // Export the surface color and transparency + // https://www.cax-if.org/documents/rec_prac_styling_org_v16.pdf sections 4.4.2 4.2.4 etc. + // https://tracker.dev.opencascade.org/view.php?id=31550 + fprintf(f, "#%d=COLOUR_RGB('',%.2f,%.2f,%.2f);\n", ++id, ss->color.redF(), + ss->color.greenF(), ss->color.blueF()); + +/* // This works in Kisters 3DViewStation but not in KiCAD and Horison EDA, + // it seems they do not support transparency so use the more verbose one below + fprintf(f, "#%d=SURFACE_STYLE_TRANSPARENT(%.2f);\n", ++id, 1.0 - ss->color.alphaF()); + ++id; + fprintf(f, "#%d=SURFACE_STYLE_RENDERING_WITH_PROPERTIES(.NORMAL_SHADING.,#%d,(#%d));\n", + id, id - 2, id - 1); + ++id; + fprintf(f, "#%d=SURFACE_SIDE_STYLE('',(#%d));\n", id, id - 1); +*/ + + // This works in Horison EDA but is more verbose. + ++id; + fprintf(f, "#%d=FILL_AREA_STYLE_COLOUR('',#%d);\n", id, id - 1); + ++id; + fprintf(f, "#%d=FILL_AREA_STYLE('',(#%d));\n", id, id - 1); + ++id; + fprintf(f, "#%d=SURFACE_STYLE_FILL_AREA(#%d);\n", id, id - 1); + fprintf(f, "#%d=SURFACE_STYLE_TRANSPARENT(%.2f);\n", ++id, 1.0 - ss->color.alphaF()); + ++id; + fprintf(f, "#%d=SURFACE_STYLE_RENDERING_WITH_PROPERTIES(.NORMAL_SHADING.,#%d,(#%d));\n", id, id - 5, id - 1); + ++id; + fprintf(f, "#%d=SURFACE_SIDE_STYLE('',(#%d, #%d));\n", id, id - 3, id - 1); + + ++id; + fprintf(f, "#%d=SURFACE_STYLE_USAGE(.BOTH.,#%d);\n", id, id - 1); + ++id; + fprintf(f, "#%d=PRESENTATION_STYLE_ASSIGNMENT((#%d));\n", id, id - 1); + ++id; + fprintf(f, "#%d=STYLED_ITEM('',(#%d),#%d);\n", id, id - 1, advFaceId); + fprintf(f, "\n"); + + id++; + listOfLoops.Clear(); + } + sblss.Clear(); + spxyz.Clear(); +} + +void StepFileWriter::WriteFooter() { + fprintf(f, +"\n" +"ENDSEC;\n" +"\n" +"END-ISO-10303-21;\n" + ); +} + +void StepFileWriter::ExportSurfacesTo(const Platform::Path &filename) { + Group *g = SK.GetGroup(SS.GW.activeGroup); + SShell *shell = &(g->runningShell); + + if(shell->surface.IsEmpty()) { + Error("The model does not contain any surfaces to export.%s", + !g->runningMesh.l.IsEmpty() + ? "\n\nThe model does contain triangles from a mesh, but " + "a triangle mesh cannot be exported as a STEP file. Try " + "File -> Export Mesh... instead." + : ""); + return; + } + + f = OpenFile(filename, "wb"); + if(!f) { + Error("Couldn't write to '%s'", filename.raw.c_str()); + return; + } + + // Initialization of lists. + pointAliases = {}; + curveAliases = {}; + edgeCurveAliases = {}; + orientedEdgeAliases = {}; + + WriteHeader(); + WriteProductHeader(); + + advancedFaces = {}; + + for(SSurface &ss : shell->surface) { + if(ss.trim.IsEmpty()) + continue; + + // Get all of the loops of Beziers that trim our surface (with each + // Bezier split so that we use the section as t goes from 0 to 1), and + // the piecewise linearization of those loops in xyz space. + SBezierList sbl = {}; + ss.MakeSectionEdgesInto(shell, NULL, &sbl); + + // Apply the export scale factor. + ss.ScaleSelfBy(1.0/SS.exportScale); + sbl.ScaleSelfBy(1.0/SS.exportScale); + + ExportSurface(&ss, &sbl); + + sbl.Clear(); + } + + fprintf(f, "#%d=CLOSED_SHELL('',(", id); + int *af; + for(af = advancedFaces.First(); af; af = advancedFaces.NextAfter(af)) { + fprintf(f, "#%d", *af); + if(advancedFaces.NextAfter(af) != NULL) fprintf(f, ","); + } + fprintf(f, "));\n"); + fprintf(f, "#%d=MANIFOLD_SOLID_BREP('brep',#%d);\n", id+1, id); + fprintf(f, "#%d=ADVANCED_BREP_SHAPE_REPRESENTATION('',(#%d,#170),#168);\n", + id+2, id+1); + fprintf(f, "#%d=SHAPE_REPRESENTATION_RELATIONSHIP($,$,#169,#%d);\n", + id+3, id+2); + + WriteFooter(); + + fclose(f); + advancedFaces.Clear(); + pointAliases.clear(); + curveAliases.clear(); + edgeCurveAliases.clear(); + orientedEdgeAliases.clear(); +} + +void StepFileWriter::WriteWireframe() { + fprintf(f, "#%d=GEOMETRIC_CURVE_SET('curves',(", id); + int *c; + for(c = curves.First(); c; c = curves.NextAfter(c)) { + fprintf(f, "#%d", *c); + if(curves.NextAfter(c) != NULL) fprintf(f, ","); + } + fprintf(f, "));\n"); + fprintf(f, "#%d=GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION" + "('',(#%d,#170),#168);\n", id+1, id); + fprintf(f, "#%d=SHAPE_REPRESENTATION_RELATIONSHIP($,$,#169,#%d);\n", + id+2, id+1); + + id += 3; + curves.Clear(); +} + +} // namespace SolveSpace diff --git a/src/exportvector.cpp b/src/exportvector.cpp new file mode 100644 index 0000000..1753997 --- /dev/null +++ b/src/exportvector.cpp @@ -0,0 +1,1360 @@ +//----------------------------------------------------------------------------- +// The file format-specific stuff for all of the 2d vector output formats. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include +#include "solvespace.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Routines for DXF export +//----------------------------------------------------------------------------- +class DxfWriteInterface : public DRW_Interface { +public: + DxfFileWriter *writer; + dxfRW *dxf; + + std::set messages; + + static DRW_Coord toCoord(const Vector &v) { + return DRW_Coord(v.x, v.y, v.z); + } + + Vector xfrm(Vector v) { + return writer->Transform(v); + } + + void writeTextstyles() override { + DRW_Textstyle ts; + ts.name = "unicode"; + ts.font = "unicode"; + dxf->writeTextstyle(&ts); + } + + void writeLayers() override { + DRW_Layer layer; + + layer.name = "dimensions"; + dxf->writeLayer(&layer); + layer.name = "text"; + dxf->writeLayer(&layer); + + std::set usedStyles; + + for(DxfFileWriter::BezierPath &path : writer->paths) { + for(SBezier *sb : path.beziers) { + usedStyles.insert((uint32_t)sb->auxA); + } + } + + for(uint32_t v : usedStyles) { + Style *s = Style::Get(hStyle{v}); + layer.name = s->DescriptionString(); + dxf->writeLayer(&layer); + } + } + + void writeLTypes() override { + for(uint32_t i = 0; i <= (uint32_t)StipplePattern::LAST; i++) { + StipplePattern st = (StipplePattern)i; + DRW_LType type; + // LibreCAD requires the line type to have one of these exact names, + // or otherwise it overwrites it with its own (continuous) style. + type.name = DxfFileWriter::lineTypeName(st); + double sw = 1.0; + switch(st) { + case StipplePattern::CONTINUOUS: + break; + + case StipplePattern::SHORT_DASH: + type.path.push_back(sw); + type.path.push_back(-sw * 2.0); + break; + + case StipplePattern::DASH: + type.path.push_back(sw); + type.path.push_back(-sw); + break; + + case StipplePattern::LONG_DASH: + type.path.push_back(sw * 2.0); + type.path.push_back(-sw); + break; + + case StipplePattern::DASH_DOT: + type.path.push_back(sw); + type.path.push_back(-sw); + type.path.push_back(0.0); + type.path.push_back(-sw); + break; + + case StipplePattern::DOT: + type.path.push_back(sw); + type.path.push_back(0.0); + break; + + case StipplePattern::DASH_DOT_DOT: + type.path.push_back(sw); + type.path.push_back(-sw); + type.path.push_back(0.0); + type.path.push_back(-sw); + type.path.push_back(0.0); + type.path.push_back(-sw); + break; + + case StipplePattern::FREEHAND: + case StipplePattern::ZIGZAG: + // Not implemented; exported as continuous. + break; + } + dxf->writeLineType(&type); + } + } + + void writePolylines() { + PolylineBuilder builder; + + for(DxfFileWriter::BezierPath &path : writer->paths) { + for(SBezier *sb : path.beziers) { + if(sb->deg != 1) continue; + builder.AddEdge(sb->ctrl[0], sb->ctrl[1], (uint32_t)sb->auxA); + } + } + + DRW_Polyline polyline; + + auto startFunc = [&](PolylineBuilder::Vertex *start, + PolylineBuilder::Vertex *next, + PolylineBuilder::Edge *e) { + hStyle hs = { e->kind }; + polyline = {}; + assignEntityDefaults(&polyline, hs); + + if(!(EXACT(start->pos.z == 0.0) && EXACT(next->pos.z == 0.0))) { + polyline.flags |= 8 /* 3d polyline */; + } + polyline.vertlist.push_back( + std::make_shared(start->pos.x, start->pos.y, start->pos.z, 0.0)); + polyline.vertlist.push_back( + std::make_shared(next->pos.x, next->pos.y, next->pos.z, 0.0)); + }; + + auto nextFunc = [&](PolylineBuilder::Vertex *next, PolylineBuilder::Edge *e) { + if(!EXACT(next->pos.z == 0.0)) { + polyline.flags |= 8 /* 3d polyline */; + } + polyline.vertlist.push_back( + std::make_shared(next->pos.x, next->pos.y, next->pos.z, 0.0)); + }; + + auto endFunc = [&]() { + dxf->writePolyline(&polyline); + }; + + auto aloneFunc = [&](PolylineBuilder::Edge *e) { + hStyle hs = { e->kind }; + writeLine(e->a->pos, e->b->pos, hs); + }; + + builder.Generate(startFunc, nextFunc, aloneFunc, endFunc); + } + + void writeEntities() override { + writePolylines(); + + for(DxfFileWriter::BezierPath &path : writer->paths) { + for(SBezier *sb : path.beziers) { + if(sb->deg == 1) continue; + writeBezier(sb); + } + } + + if(writer->constraint) { + for(Constraint &c : *writer->constraint) { + if(!writer->NeedToOutput(&c)) continue; + switch(c.type) { + case Constraint::Type::PT_PT_DISTANCE: { + Vector ap = SK.GetEntity(c.ptA)->PointGetNum(); + Vector bp = SK.GetEntity(c.ptB)->PointGetNum(); + Vector ref = ((ap.Plus(bp)).ScaledBy(0.5)).Plus(c.disp.offset); + writeAlignedDimension(xfrm(ap), xfrm(bp), xfrm(ref), + xfrm(ref), c.Label(), c.GetStyle(), c.valA); + break; + } + + case Constraint::Type::PT_LINE_DISTANCE: { + Vector pt = SK.GetEntity(c.ptA)->PointGetNum(); + Entity *line = SK.GetEntity(c.entityA); + Vector lA = SK.GetEntity(line->point[0])->PointGetNum(); + Vector lB = SK.GetEntity(line->point[1])->PointGetNum(); + Vector dl = lB.Minus(lA); + + Vector closest = pt.ClosestPointOnLine(lA, dl); + + if(pt.Equals(closest)) break; + + Vector ref = ((closest.Plus(pt)).ScaledBy(0.5)).Plus(c.disp.offset); + Vector refClosest = ref.ClosestPointOnLine(lA, dl); + + double ddl = dl.Dot(dl); + if(fabs(ddl) > LENGTH_EPS * LENGTH_EPS) { + double t = refClosest.Minus(lA).Dot(dl) / ddl; + if(t < 0.0) { + refClosest = lA; + } else if(t > 1.0) { + refClosest = lB; + } + } + + Vector xdl = xfrm(lB).Minus(xfrm(lA)); + writeLinearDimension(xfrm(pt), xfrm(refClosest), xfrm(ref), + xfrm(ref), c.Label(), + atan2(xdl.y, xdl.x) / PI * 180.0 + 90.0, 0.0, + c.GetStyle(), c.valA); + break; + } + + case Constraint::Type::DIAMETER: { + Entity *circle = SK.GetEntity(c.entityA); + Vector center = SK.GetEntity(circle->point[0])->PointGetNum(); + Quaternion q = SK.GetEntity(circle->normal)->NormalGetNum(); + Vector n = q.RotationN().WithMagnitude(1); + double r = circle->CircleGetRadiusNum(); + + Vector ref = center.Plus(c.disp.offset); + // Force the label into the same plane as the circle. + ref = ref.Minus(n.ScaledBy(n.Dot(ref) - n.Dot(center))); + + Vector rad = ref.Minus(center).WithMagnitude(r); + if(/*isRadius*/c.other) { + writeRadialDimension( + xfrm(center), xfrm(center.Plus(rad)), + xfrm(ref), c.Label(), c.GetStyle(), c.valA); + } else { + writeDiametricDimension( + xfrm(center.Minus(rad)), xfrm(center.Plus(rad)), + xfrm(ref), c.Label(), c.GetStyle(), c.valA); + } + break; + } + + case Constraint::Type::ANGLE: { + Entity *a = SK.GetEntity(c.entityA); + Entity *b = SK.GetEntity(c.entityB); + + Vector a0 = a->VectorGetStartPoint(); + Vector b0 = b->VectorGetStartPoint(); + Vector da = a->VectorGetNum(); + Vector db = b->VectorGetNum(); + if(/*otherAngle*/c.other) { + a0 = a0.Plus(da); + da = da.ScaledBy(-1); + } + + bool skew = false; + Vector ref = c.disp.offset; + Vector pi = Vector::AtIntersectionOfLines(a0, a0.Plus(da), b0, b0.Plus(db), + &skew); + if(!skew) ref = pi.Plus(c.disp.offset); + + Vector norm = da.Cross(db); + Vector dna = norm.Cross(da).WithMagnitude(1.0); + + double thetaf = acos(da.DirectionCosineWith(db)); + + // Calculate median + Vector m = da.WithMagnitude(1.0).ScaledBy(cos(thetaf/2)).Plus( + dna.ScaledBy(sin(thetaf/2))); + Vector rm = ref.Minus(pi); + + // Test which side we have to place an arc + if(m.Dot(rm) < 0) { + da = da.ScaledBy(-1); dna = dna.ScaledBy(-1); + db = db.ScaledBy(-1); + } + + Vector bisect = da.WithMagnitude(1.0).ScaledBy(cos(thetaf / 2.0)).Plus( + dna.ScaledBy(sin(thetaf / 2.0))); + + ref = pi.Plus(bisect.WithMagnitude(c.disp.offset.Magnitude())); + + // Get lines again to write exact line. + a0 = a->VectorGetStartPoint(); + b0 = b->VectorGetStartPoint(); + da = a->VectorGetNum(); + db = b->VectorGetNum(); + + writeAngularDimension( + xfrm(a0), xfrm(a0.Plus(da)), xfrm(b0), xfrm(b0.Plus(db)), xfrm(ref), + xfrm(ref), c.Label(), c.GetStyle(), c.valA); + break; + } + + case Constraint::Type::COMMENT: { + Style *st = SK.style.FindById(c.GetStyle()); + writeText(xfrm(c.disp.offset), c.Label(), + Style::TextHeight(c.GetStyle()) / SS.GW.scale, + st->textAngle, st->textOrigin, c.GetStyle()); + break; + } + + default: + // Other types of constraints do not have a DXF dimension equivalent. + break; + } + } + } + } + + int findDxfColor(const RgbaColor &src) { + int best = 0; + double minDist = VERY_POSITIVE; + Vector srcv = Vector::From(src.redF(), src.greenF(), src.blueF()); + for(int i = 1; i < 256; i++) { + RgbaColor dst = RGBi(DRW::dxfColors[i][0], DRW::dxfColors[i][1], DRW::dxfColors[i][2]); + Vector dstv = Vector::From(dst.redF(), dst.greenF(), dst.blueF()); + double dist = srcv.Minus(dstv).Magnitude(); + if(dist < minDist || best == 0) { + best = i; + minDist = dist; + } + } + return best; + } + + void assignEntityDefaults(DRW_Entity *entity, hStyle hs) { + Style *s = Style::Get(hs); + RgbaColor color = Style::Color(hs, /*forExport=*/true); + entity->color24 = color.ToPackedIntBGRA(); + entity->color = findDxfColor(color); + entity->layer = s->DescriptionString(); + entity->lineType = DxfFileWriter::lineTypeName(s->stippleType); + entity->ltypeScale = Style::StippleScaleMm(s->h); + entity->setWidthMm(Style::WidthMm(hs.v)); + + if(s->stippleType == StipplePattern::FREEHAND) { + messages.insert(_("freehand lines were replaced with continuous lines")); + } else if(s->stippleType == StipplePattern::ZIGZAG) { + messages.insert(_("zigzag lines were replaced with continuous lines")); + } + } + + void assignDimensionDefaults(DRW_Dimension *dimension, hStyle hs) { + assignEntityDefaults(dimension, hs); + dimension->layer = "dimensions"; + } + + void writeLine(const Vector &p0, const Vector &p1, hStyle hs) { + DRW_Line line; + assignEntityDefaults(&line, hs); + line.basePoint = toCoord(p0); + line.secPoint = toCoord(p1); + dxf->writeLine(&line); + } + + void writeArc(const Vector &c, double r, double sa, double ea, hStyle hs) { + DRW_Arc arc; + assignEntityDefaults(&arc, hs); + arc.radious = r; + arc.basePoint = toCoord(c); + arc.staangle = sa; + arc.endangle = ea; + dxf->writeArc(&arc); + } + + void writeBezierAsPwl(SBezier *sb) { + List lv = {}; + sb->MakePwlInto(&lv, SS.ExportChordTolMm()); + hStyle hs = { (uint32_t)sb->auxA }; + DRW_Polyline polyline; + assignEntityDefaults(&polyline, hs); + for(int i = 0; i < lv.n; i++) { + Vector *v = &lv[i]; + polyline.vertlist.push_back(std::make_shared(v->x, v->y, v->z, 0.0)); + } + dxf->writePolyline(&polyline); + lv.Clear(); + } + + void makeKnotsFor(DRW_Spline *spline) { + // QCad/LibreCAD require this for some reason. + if(spline->degree == 3) { + spline->nknots = 8; + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(1.0); + spline->knotslist.push_back(1.0); + spline->knotslist.push_back(1.0); + spline->knotslist.push_back(1.0); + } else if(spline->degree == 2) { + spline->nknots = 6; + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(0.0); + spline->knotslist.push_back(1.0); + spline->knotslist.push_back(1.0); + spline->knotslist.push_back(1.0); + } else ssassert(false, "Unexpected degree of spline"); + } + + void writeSpline(SBezier *sb) { + bool isRational = sb->IsRational(); + hStyle hs = { (uint32_t)sb->auxA }; + DRW_Spline spline; + assignEntityDefaults(&spline, hs); + spline.flags = (isRational) ? 0x04 : 0x08; + spline.degree = sb->deg; + spline.ncontrol = sb->deg + 1; + makeKnotsFor(&spline); + for(int i = 0; i <= sb->deg; i++) { + spline.controllist.push_back( + std::make_shared(sb->ctrl[i].x, sb->ctrl[i].y, sb->ctrl[i].z)); + if(isRational) spline.weightlist.push_back(sb->weight[i]); + } + dxf->writeSpline(&spline); + } + + void writeBezier(SBezier *sb) { + hStyle hs = { (uint32_t)sb->auxA }; + Vector c; + Vector n = Vector::From(0.0, 0.0, 1.0); + double r; + + if(sb->deg == 1) { + // Line + writeLine(sb->ctrl[0], sb->ctrl[1], hs); + } else if(sb->IsInPlane(n, 0) && sb->IsCircle(n, &c, &r)) { + // Circle perpendicular to camera + double theta0 = atan2(sb->ctrl[0].y - c.y, sb->ctrl[0].x - c.x); + double theta1 = atan2(sb->ctrl[2].y - c.y, sb->ctrl[2].x - c.x); + double dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2.0 * PI); + if(dtheta < 0.0) swap(theta0, theta1); + + writeArc(c, r, theta0, theta1, hs); + } else if(sb->IsRational()) { + // Rational bezier + // We'd like to export rational beziers exactly, but the resulting DXF + // files can only be read by AutoCAD; LibreCAD/QCad simply do not + // implement the feature. So, export as piecewise linear for compatibility. + writeBezierAsPwl(sb); + } else { + // Any other curve + writeSpline(sb); + } + } + + void writeAlignedDimension(Vector def1, Vector def2, Vector dimp, + Vector textp, const std::string &text, hStyle hs, double actual) { + DRW_DimAligned dim; + assignDimensionDefaults(&dim, hs); + dim.setDef1Point(toCoord(def1)); + dim.setDef2Point(toCoord(def2)); + dim.setDimPoint(toCoord(dimp)); + dim.setTextPoint(toCoord(textp)); + dim.setText(text); + dim.setActualMeasurement(actual); + dxf->writeDimension(&dim); + } + + void writeLinearDimension(Vector def1, Vector def2, Vector dimp, + Vector textp, const std::string &text, + double angle, double oblique, hStyle hs, double actual) { + DRW_DimLinear dim; + assignDimensionDefaults(&dim, hs); + dim.setDef1Point(toCoord(def1)); + dim.setDef2Point(toCoord(def2)); + dim.setDimPoint(toCoord(dimp)); + dim.setTextPoint(toCoord(textp)); + dim.setText(text); + dim.setAngle(angle); + dim.setOblique(oblique); + dim.setActualMeasurement(actual); + dxf->writeDimension(&dim); + } + + void writeRadialDimension(Vector center, Vector radius, + Vector textp, const std::string &text, hStyle hs, double actual) { + DRW_DimRadial dim; + assignDimensionDefaults(&dim, hs); + dim.setCenterPoint(toCoord(center)); + dim.setDiameterPoint(toCoord(radius)); + dim.setTextPoint(toCoord(textp)); + dim.setText(text); + dim.setActualMeasurement(actual); + dxf->writeDimension(&dim); + } + + void writeDiametricDimension(Vector def1, Vector def2, + Vector textp, const std::string &text, hStyle hs, double actual) { + DRW_DimDiametric dim; + assignDimensionDefaults(&dim, hs); + dim.setDiameter1Point(toCoord(def1)); + dim.setDiameter2Point(toCoord(def2)); + dim.setTextPoint(toCoord(textp)); + dim.setText(text); + dim.setActualMeasurement(actual); + dxf->writeDimension(&dim); + } + + void writeAngularDimension(Vector fl1, Vector fl2, Vector sl1, Vector sl2, Vector dimp, + Vector textp, const std::string &text, hStyle hs, double actual) { + DRW_DimAngular dim; + assignDimensionDefaults(&dim, hs); + dim.setFirstLine1(toCoord(fl1)); + dim.setFirstLine2(toCoord(fl2)); + dim.setSecondLine1(toCoord(sl1)); + dim.setSecondLine2(toCoord(sl2)); + dim.setDimPoint(toCoord(dimp)); + dim.setTextPoint(toCoord(textp)); + dim.setText(text); + dim.setActualMeasurement(actual * PI / 180.0); + dxf->writeDimension(&dim); + } + + void writeText(Vector textp, const std::string &text, + double height, double angle, Style::TextOrigin origin, hStyle hs) { + DRW_Text txt; + assignEntityDefaults(&txt, hs); + txt.layer = "text"; + txt.style = "unicode"; + txt.basePoint = toCoord(textp); + txt.secPoint = txt.basePoint; + txt.text = text; + txt.height = height; + txt.angle = angle; + txt.alignH = DRW_Text::HCenter; + if((uint32_t)origin & (uint32_t)Style::TextOrigin::LEFT) { + txt.alignH = DRW_Text::HLeft; + } else if((uint32_t)origin & (uint32_t)Style::TextOrigin::RIGHT) { + txt.alignH = DRW_Text::HRight; + } + txt.alignV = DRW_Text::VMiddle; + if((uint32_t)origin & (uint32_t)Style::TextOrigin::TOP) { + txt.alignV = DRW_Text::VTop; + } else if((uint32_t)origin & (uint32_t)Style::TextOrigin::BOT) { + txt.alignV = DRW_Text::VBaseLine; + } + dxf->writeText(&txt); + } +}; + +bool DxfFileWriter::OutputConstraints(IdList *constraint) { + this->constraint = constraint; + return true; +} + +void DxfFileWriter::StartFile() { + paths.clear(); +} + +void DxfFileWriter::Background(RgbaColor color) { +} + +void DxfFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ + BezierPath path = {}; + paths.push_back(path); +} +void DxfFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} + +void DxfFileWriter::Triangle(STriangle *tr) { +} + +void DxfFileWriter::Bezier(SBezier *sb) { + paths.back().beziers.push_back(sb); +} + +void DxfFileWriter::FinishAndCloseFile() { + dxfRW dxf; + + DxfWriteInterface interface = {}; + interface.writer = this; + interface.dxf = &dxf; + + std::stringstream stream; + dxf.write(stream, &interface, DRW::AC1021, /*bin=*/false); + paths.clear(); + constraint = NULL; + + if(!WriteFile(filename, stream.str())) { + Error("Couldn't write to '%s'", filename.raw.c_str()); + return; + } + + if(!interface.messages.empty()) { + std::string text = _("Some aspects of the drawing have no DXF equivalent and " + "were not exported:\n"); + for(const std::string &message : interface.messages) { + text += " * " + message + "\n"; + } + Message(text.c_str()); + } +} + +bool DxfFileWriter::NeedToOutput(Constraint *c) { + switch(c->type) { + case Constraint::Type::PT_PT_DISTANCE: + case Constraint::Type::PT_LINE_DISTANCE: + case Constraint::Type::DIAMETER: + case Constraint::Type::ANGLE: + case Constraint::Type::COMMENT: + return c->IsVisible(); + + default: // See writeEntities(). + break; + } + return false; +} + +const char *DxfFileWriter::lineTypeName(StipplePattern stippleType) { + switch(stippleType) { + case StipplePattern::CONTINUOUS: return "CONTINUOUS"; + case StipplePattern::SHORT_DASH: return "DASHED"; + case StipplePattern::DASH: return "DASHED"; + case StipplePattern::LONG_DASH: return "DASHEDX2"; + case StipplePattern::DASH_DOT: return "DASHDOT"; + case StipplePattern::DASH_DOT_DOT: return "DIVIDE"; + case StipplePattern::DOT: return "DOT"; + + case StipplePattern::FREEHAND: + case StipplePattern::ZIGZAG: + /* no corresponding DXF line type */ + break; + } + + return "CONTINUOUS"; +} + +//----------------------------------------------------------------------------- +// Routines for EPS output +//----------------------------------------------------------------------------- + +static std::string MakeStipplePattern(StipplePattern pattern, double scale, char delimiter, + bool inkscapeWorkaround = false) { + scale /= 2.0; + + // Inkscape ignores all elements that are exactly zero instead of drawing + // them as dots. + double zero = inkscapeWorkaround ? 1e-6 : 0; + + std::string result; + switch(pattern) { + case StipplePattern::CONTINUOUS: + return ""; + + case StipplePattern::SHORT_DASH: + result = ssprintf("%.3f_%.3f", scale, scale * 2.0); + break; + case StipplePattern::DASH: + result = ssprintf("%.3f_%.3f", scale, scale); + break; + case StipplePattern::DASH_DOT: + result = ssprintf("%.3f_%.3f_%.6f_%.3f", + scale, scale * 0.5, zero, scale * 0.5); + break; + case StipplePattern::DASH_DOT_DOT: + result = ssprintf("%.3f_%.3f_%.6f_%.3f_%.6f_%.3f", + scale, scale * 0.5, zero, + scale * 0.5, scale * 0.5, zero); + break; + case StipplePattern::DOT: + result = ssprintf("%.6f_%.3f", zero, scale * 0.5); + break; + case StipplePattern::LONG_DASH: + result = ssprintf("%.3f_%.3f", scale * 2.0, scale * 0.5); + break; + + case StipplePattern::FREEHAND: + case StipplePattern::ZIGZAG: + ssassert(false, "Freehand and zigzag export not implemented"); + } + std::replace(result.begin(), result.end(), '_', delimiter); + return result; +} + +void EpsFileWriter::StartFile() { + fprintf(f, +"%%!PS-Adobe-2.0\r\n" +"%%%%Creator: SolveSpace\r\n" +"%%%%Title: title\r\n" +"%%%%Pages: 0\r\n" +"%%%%PageOrder: Ascend\r\n" +"%%%%BoundingBox: 0 0 %d %d\r\n" +"%%%%HiResBoundingBox: 0 0 %.3f %.3f\r\n" +"%%%%EndComments\r\n" +"\r\n" +"gsave\r\n" +"\r\n", + (int)ceil(MmToPts(ptMax.x - ptMin.x)), + (int)ceil(MmToPts(ptMax.y - ptMin.y)), + MmToPts(ptMax.x - ptMin.x), + MmToPts(ptMax.y - ptMin.y)); +} + +void EpsFileWriter::Background(RgbaColor color) { + double width = ptMax.x - ptMin.x; + double height = ptMax.y - ptMin.y; + + fprintf(f, +"%.3f %.3f %.3f setrgbcolor\r\n" +"newpath\r\n" +" %.3f %.3f moveto\r\n" +" %.3f %.3f lineto\r\n" +" %.3f %.3f lineto\r\n" +" %.3f %.3f lineto\r\n" +" closepath\r\n" +"gsave fill grestore\r\n", + color.redF(), color.greenF(), color.blueF(), + MmToPts(0), MmToPts(0), + MmToPts(width), MmToPts(0), + MmToPts(width), MmToPts(height), + MmToPts(0), MmToPts(height)); + + // same issue with cracks, stroke it to avoid them + double sw = max(width, height) / 1000; + fprintf(f, +"1 setlinejoin\r\n" +"1 setlinecap\r\n" +"%.3f setlinewidth\r\n" +"gsave stroke grestore\r\n", + MmToPts(sw)); +} + +void EpsFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ + fprintf(f, "newpath\r\n"); + prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); +} +void EpsFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ + StipplePattern pattern = Style::PatternType(hs); + double stippleScale = MmToPts(Style::StippleScaleMm(hs)); + + fprintf(f, " %.3f setlinewidth\r\n" + " %.3f %.3f %.3f setrgbcolor\r\n" + " 1 setlinejoin\r\n" // rounded + " 1 setlinecap\r\n" // rounded + " [%s] 0 setdash\r\n" + " gsave stroke grestore\r\n", + MmToPts(lineWidth), + strokeRgb.redF(), strokeRgb.greenF(), strokeRgb.blueF(), + MakeStipplePattern(pattern, stippleScale, ' ').c_str()); + if(filled) { + fprintf(f, " %.3f %.3f %.3f setrgbcolor\r\n" + " gsave fill grestore\r\n", + fillRgb.redF(), fillRgb.greenF(), fillRgb.blueF()); + } +} + +void EpsFileWriter::MaybeMoveTo(Vector st, Vector fi) { + if(!prevPt.Equals(st)) { + fprintf(f, " %.3f %.3f moveto\r\n", + MmToPts(st.x - ptMin.x), MmToPts(st.y - ptMin.y)); + } + prevPt = fi; +} + +void EpsFileWriter::Triangle(STriangle *tr) { + fprintf(f, +"%.3f %.3f %.3f setrgbcolor\r\n" +"newpath\r\n" +" %.3f %.3f moveto\r\n" +" %.3f %.3f lineto\r\n" +" %.3f %.3f lineto\r\n" +" closepath\r\n" +"gsave fill grestore\r\n", + tr->meta.color.redF(), tr->meta.color.greenF(), tr->meta.color.blueF(), + MmToPts(tr->a.x - ptMin.x), MmToPts(tr->a.y - ptMin.y), + MmToPts(tr->b.x - ptMin.x), MmToPts(tr->b.y - ptMin.y), + MmToPts(tr->c.x - ptMin.x), MmToPts(tr->c.y - ptMin.y)); + + // same issue with cracks, stroke it to avoid them + double sw = max(ptMax.x - ptMin.x, ptMax.y - ptMin.y) / 1000; + fprintf(f, +"1 setlinejoin\r\n" +"1 setlinecap\r\n" +"%.3f setlinewidth\r\n" +"gsave stroke grestore\r\n", + MmToPts(sw)); +} + +void EpsFileWriter::Bezier(SBezier *sb) { + Vector c, n = Vector::From(0, 0, 1); + double r; + if(sb->deg == 1) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[1]); + fprintf(f, " %.3f %.3f lineto\r\n", + MmToPts(sb->ctrl[1].x - ptMin.x), + MmToPts(sb->ctrl[1].y - ptMin.y)); + } else if(sb->IsCircle(n, &c, &r)) { + Vector p0 = sb->ctrl[0], p1 = sb->ctrl[2]; + double theta0 = atan2(p0.y - c.y, p0.x - c.x), + theta1 = atan2(p1.y - c.y, p1.x - c.x), + dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI); + MaybeMoveTo(p0, p1); + fprintf(f, +" %.3f %.3f %.3f %.3f %.3f %s\r\n", + MmToPts(c.x - ptMin.x), MmToPts(c.y - ptMin.y), + MmToPts(r), + theta0*180/PI, theta1*180/PI, + dtheta < 0 ? "arcn" : "arc"); + } else if(sb->deg == 3 && !sb->IsRational()) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[3]); + fprintf(f, +" %.3f %.3f %.3f %.3f %.3f %.3f curveto\r\n", + MmToPts(sb->ctrl[1].x - ptMin.x), MmToPts(sb->ctrl[1].y - ptMin.y), + MmToPts(sb->ctrl[2].x - ptMin.x), MmToPts(sb->ctrl[2].y - ptMin.y), + MmToPts(sb->ctrl[3].x - ptMin.x), MmToPts(sb->ctrl[3].y - ptMin.y)); + } else { + BezierAsNonrationalCubic(sb); + } +} + +void EpsFileWriter::FinishAndCloseFile() { + fprintf(f, +"\r\n" +"grestore\r\n" +"\r\n"); + fclose(f); +} + +//----------------------------------------------------------------------------- +// Routines for PDF output, some extra complexity because we have to generate +// a correct xref table. +//----------------------------------------------------------------------------- +void PdfFileWriter::StartFile() { + if((ptMax.x - ptMin.x) > 200*25.4 || + (ptMax.y - ptMin.y) > 200*25.4) + { + Message(_("PDF page size exceeds 200 by 200 inches; many viewers may " + "reject this file.")); + } + + fprintf(f, +"%%PDF-1.1\r\n" +"%%%c%c%c%c\r\n", + 0xe2, 0xe3, 0xcf, 0xd3); + + xref[1] = (uint32_t)ftell(f); + fprintf(f, +"1 0 obj\r\n" +" << /Type /Catalog\r\n" +" /Outlines 2 0 R\r\n" +" /Pages 3 0 R\r\n" +" >>\r\n" +"endobj\r\n"); + + xref[2] = (uint32_t)ftell(f); + fprintf(f, +"2 0 obj\r\n" +" << /Type /Outlines\r\n" +" /Count 0\r\n" +" >>\r\n" +"endobj\r\n"); + + xref[3] = (uint32_t)ftell(f); + fprintf(f, +"3 0 obj\r\n" +" << /Type /Pages\r\n" +" /Kids [4 0 R]\r\n" +" /Count 1\r\n" +" >>\r\n" +"endobj\r\n"); + + xref[4] = (uint32_t)ftell(f); + fprintf(f, +"4 0 obj\r\n" +" << /Type /Page\r\n" +" /Parent 3 0 R\r\n" +" /MediaBox [0 0 %.3f %.3f]\r\n" +" /Contents 5 0 R\r\n" +" /Resources << /ProcSet 7 0 R\r\n" +" /Font << /F1 8 0 R >>\r\n" +" >>\r\n" +" >>\r\n" +"endobj\r\n", + MmToPts(ptMax.x - ptMin.x), + MmToPts(ptMax.y - ptMin.y)); + + xref[5] = (uint32_t)ftell(f); + fprintf(f, +"5 0 obj\r\n" +" << /Length 6 0 R >>\r\n" +"stream\r\n"); + bodyStart = (uint32_t)ftell(f); +} + +void PdfFileWriter::FinishAndCloseFile() { + uint32_t bodyEnd = (uint32_t)ftell(f); + + fprintf(f, +"endstream\r\n" +"endobj\r\n"); + + xref[6] = (uint32_t)ftell(f); + fprintf(f, +"6 0 obj\r\n" +" %d\r\n" +"endobj\r\n", + bodyEnd - bodyStart); + + xref[7] = (uint32_t)ftell(f); + fprintf(f, +"7 0 obj\r\n" +" [/PDF /Text]\r\n" +"endobj\r\n"); + + xref[8] = (uint32_t)ftell(f); + fprintf(f, +"8 0 obj\r\n" +" << /Type /Font\r\n" +" /Subtype /Type1\r\n" +" /Name /F1\r\n" +" /BaseFont /Helvetica\r\n" +" /Encoding /WinAnsiEncoding\r\n" +" >>\r\n" +"endobj\r\n"); + + xref[9] = (uint32_t)ftell(f); + fprintf(f, +"9 0 obj\r\n" +" << /Creator (SolveSpace)\r\n" +" >>\r\n"); + + uint32_t xrefStart = (uint32_t)ftell(f); + fprintf(f, +"xref\r\n" +"0 10\r\n" +"0000000000 65535 f\r\n"); + + int i; + for(i = 1; i <= 9; i++) { + fprintf(f, "%010d %05d n\r\n", xref[i], 0); + } + + fprintf(f, +"\r\n" +"trailer\r\n" +" << /Size 10\r\n" +" /Root 1 0 R\r\n" +" /Info 9 0 R\r\n" +" >>\r\n" +"startxref\r\n" +"%d\r\n" +"%%%%EOF\r\n", + xrefStart); + + fclose(f); + +} + +void PdfFileWriter::Background(RgbaColor color) { + double width = ptMax.x - ptMin.x; + double height = ptMax.y - ptMin.y; + double sw = max(width, height) / 1000; + + fprintf(f, +"1 J 1 j\r\n" +"%.3f %.3f %.3f RG\r\n" +"%.3f %.3f %.3f rg\r\n" +"%.3f w\r\n" +"%.3f %.3f m\r\n" +"%.3f %.3f l\r\n" +"%.3f %.3f l\r\n" +"%.3f %.3f l\r\n" +"b\r\n", + color.redF(), color.greenF(), color.blueF(), + color.redF(), color.greenF(), color.blueF(), + MmToPts(sw), + MmToPts(0), MmToPts(0), + MmToPts(width), MmToPts(0), + MmToPts(width), MmToPts(height), + MmToPts(0), MmToPts(height)); +} + +void PdfFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ + StipplePattern pattern = Style::PatternType(hs); + double stippleScale = MmToPts(Style::StippleScaleMm(hs)); + + fprintf(f, "1 J 1 j " // round endcaps and joins + "%.3f w [%s] 0 d " + "%.3f %.3f %.3f RG\r\n", + MmToPts(lineWidth), + MakeStipplePattern(pattern, stippleScale, ' ').c_str(), + strokeRgb.redF(), strokeRgb.greenF(), strokeRgb.blueF()); + if(filled) { + fprintf(f, "%.3f %.3f %.3f rg\r\n", + fillRgb.redF(), fillRgb.greenF(), fillRgb.blueF()); + } + + prevPt = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); +} +void PdfFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ + if(filled) { + fprintf(f, "b\r\n"); + } else { + fprintf(f, "S\r\n"); + } +} + +void PdfFileWriter::MaybeMoveTo(Vector st, Vector fi) { + if(!prevPt.Equals(st)) { + fprintf(f, "%.3f %.3f m\r\n", + MmToPts(st.x - ptMin.x), MmToPts(st.y - ptMin.y)); + } + prevPt = fi; +} + +void PdfFileWriter::Triangle(STriangle *tr) { + double sw = max(ptMax.x - ptMin.x, ptMax.y - ptMin.y) / 1000; + + fprintf(f, +"1 J 1 j\r\n" +"%.3f %.3f %.3f RG\r\n" +"%.3f %.3f %.3f rg\r\n" +"%.3f w\r\n" +"%.3f %.3f m\r\n" +"%.3f %.3f l\r\n" +"%.3f %.3f l\r\n" +"b\r\n", + tr->meta.color.redF(), tr->meta.color.greenF(), tr->meta.color.blueF(), + tr->meta.color.redF(), tr->meta.color.greenF(), tr->meta.color.blueF(), + MmToPts(sw), + MmToPts(tr->a.x - ptMin.x), MmToPts(tr->a.y - ptMin.y), + MmToPts(tr->b.x - ptMin.x), MmToPts(tr->b.y - ptMin.y), + MmToPts(tr->c.x - ptMin.x), MmToPts(tr->c.y - ptMin.y)); +} + +void PdfFileWriter::Bezier(SBezier *sb) { + if(sb->deg == 1) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[1]); + fprintf(f, +"%.3f %.3f l\r\n", + MmToPts(sb->ctrl[1].x - ptMin.x), MmToPts(sb->ctrl[1].y - ptMin.y)); + } else if(sb->deg == 3 && !sb->IsRational()) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[3]); + fprintf(f, +"%.3f %.3f %.3f %.3f %.3f %.3f c\r\n", + MmToPts(sb->ctrl[1].x - ptMin.x), MmToPts(sb->ctrl[1].y - ptMin.y), + MmToPts(sb->ctrl[2].x - ptMin.x), MmToPts(sb->ctrl[2].y - ptMin.y), + MmToPts(sb->ctrl[3].x - ptMin.x), MmToPts(sb->ctrl[3].y - ptMin.y)); + } else { + BezierAsNonrationalCubic(sb); + } +} + +//----------------------------------------------------------------------------- +// Routines for SVG output +//----------------------------------------------------------------------------- +void SvgFileWriter::StartFile() { + fprintf(f, +"\r\n" +"\r\n" +"\r\n" +"Exported SVG\r\n" +"\r\n", + (ptMax.x - ptMin.x), (ptMax.y - ptMin.y), + (ptMax.x - ptMin.x), (ptMax.y - ptMin.y)); + + fprintf(f, "\r\n"); +} + +void SvgFileWriter::Background(RgbaColor color) { + fprintf(f, +"\r\n", + color.red, color.green, color.blue); +} + +void SvgFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ + fprintf(f, "\r\n", cls.c_str(), fill.c_str()); +} + +void SvgFileWriter::MaybeMoveTo(Vector st, Vector fi) { + // SVG uses a coordinate system with the origin at top left, +y down + if(!prevPt.Equals(st)) { + fprintf(f, "M%.3f %.3f ", (st.x - ptMin.x), (ptMax.y - st.y)); + } + prevPt = fi; +} + +void SvgFileWriter::Triangle(STriangle *tr) { + fprintf(f, +"\r\n", + (tr->a.x - ptMin.x), (ptMax.y - tr->a.y), + (tr->b.x - ptMin.x), (ptMax.y - tr->b.y), + (tr->c.x - ptMin.x), (ptMax.y - tr->c.y), + tr->meta.color.red, tr->meta.color.green, tr->meta.color.blue, + tr->meta.color.red, tr->meta.color.green, tr->meta.color.blue); +} + +void SvgFileWriter::Bezier(SBezier *sb) { + Vector c, n = Vector::From(0, 0, 1); + double r; + if(sb->deg == 1) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[1]); + fprintf(f, "L%.3f,%.3f ", + (sb->ctrl[1].x - ptMin.x), (ptMax.y - sb->ctrl[1].y)); + } else if(sb->IsCircle(n, &c, &r)) { + Vector p0 = sb->ctrl[0], p1 = sb->ctrl[2]; + double theta0 = atan2(p0.y - c.y, p0.x - c.x), + theta1 = atan2(p1.y - c.y, p1.x - c.x), + dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI); + // The arc must be less than 180 degrees, or else it couldn't have + // been represented as a single rational Bezier. So large-arc-flag + // must be false. sweep-flag is determined by the sign of dtheta. + // Note that clockwise and counter-clockwise are backwards in SVG's + // mirrored csys. + MaybeMoveTo(p0, p1); + fprintf(f, "A%.3f,%.3f 0 0,%d %.3f,%.3f ", + r, r, + (dtheta < 0) ? 1 : 0, + p1.x - ptMin.x, ptMax.y - p1.y); + } else if(!sb->IsRational()) { + if(sb->deg == 2) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[2]); + fprintf(f, "Q%.3f,%.3f %.3f,%.3f ", + sb->ctrl[1].x - ptMin.x, ptMax.y - sb->ctrl[1].y, + sb->ctrl[2].x - ptMin.x, ptMax.y - sb->ctrl[2].y); + } else if(sb->deg == 3) { + MaybeMoveTo(sb->ctrl[0], sb->ctrl[3]); + fprintf(f, "C%.3f,%.3f %.3f,%.3f %.3f,%.3f ", + sb->ctrl[1].x - ptMin.x, ptMax.y - sb->ctrl[1].y, + sb->ctrl[2].x - ptMin.x, ptMax.y - sb->ctrl[2].y, + sb->ctrl[3].x - ptMin.x, ptMax.y - sb->ctrl[3].y); + } + } else { + BezierAsNonrationalCubic(sb); + } +} + +void SvgFileWriter::FinishAndCloseFile() { + fprintf(f, "\r\n\r\n"); + fclose(f); +} + +//----------------------------------------------------------------------------- +// Routines for HPGL output +//----------------------------------------------------------------------------- +double HpglFileWriter::MmToHpglUnits(double mm) { + return mm*40; +} + +void HpglFileWriter::StartFile() { + fprintf(f, "IN;\r\n"); + fprintf(f, "SP1;\r\n"); +} + +void HpglFileWriter::Background(RgbaColor color) { +} + +void HpglFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} +void HpglFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} + +void HpglFileWriter::Triangle(STriangle *tr) { +} + +void HpglFileWriter::Bezier(SBezier *sb) { + if(sb->deg == 1) { + fprintf(f, "PU%d,%d;\r\n", + (int)MmToHpglUnits(sb->ctrl[0].x), + (int)MmToHpglUnits(sb->ctrl[0].y)); + fprintf(f, "PD%d,%d;\r\n", + (int)MmToHpglUnits(sb->ctrl[1].x), + (int)MmToHpglUnits(sb->ctrl[1].y)); + } else { + BezierAsPwl(sb); + } +} + +void HpglFileWriter::FinishAndCloseFile() { + fclose(f); +} + +//----------------------------------------------------------------------------- +// Routines for G Code output. Slightly complicated by our ability to generate +// multiple passes, and to specify the feeds and depth; those parameters get +// set in the configuration screen. +//----------------------------------------------------------------------------- +void GCodeFileWriter::StartFile() { + sel = {}; +} +void GCodeFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} +void GCodeFileWriter::Background(RgbaColor color) { +} +void GCodeFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} +void GCodeFileWriter::Triangle(STriangle *tr) { +} + +void GCodeFileWriter::Bezier(SBezier *sb) { + if(sb->deg == 1) { + sel.AddEdge(sb->ctrl[0], sb->ctrl[1]); + } else { + BezierAsPwl(sb); + } +} + +void GCodeFileWriter::FinishAndCloseFile() { + SPolygon sp = {}; + sel.AssemblePolygon(&sp, NULL); + + int i; + for(i = 0; i < SS.gCode.passes; i++) { + double depth = (SS.gCode.depth / SS.gCode.passes)*(i+1); + + SContour *sc; + for(sc = sp.l.First(); sc; sc = sp.l.NextAfter(sc)) { + if(sc->l.n < 2) continue; + + SPoint *pt = sc->l.First(); + fprintf(f, "G00 X%s Y%s\r\n", + SS.MmToString(pt->p.x).c_str(), SS.MmToString(pt->p.y).c_str()); + fprintf(f, "G01 Z%s F%s\r\n", + SS.MmToString(depth).c_str(), SS.MmToString(SS.gCode.plungeFeed).c_str()); + + pt = sc->l.NextAfter(pt); + for(; pt; pt = sc->l.NextAfter(pt)) { + fprintf(f, "G01 X%s Y%s F%s\r\n", + SS.MmToString(pt->p.x).c_str(), SS.MmToString(pt->p.y).c_str(), + SS.MmToString(SS.gCode.feed).c_str()); + } + // Move up to a clearance plane above the work. + fprintf(f, "G00 Z%s\r\n", + SS.MmToString(SS.gCode.safeHeight).c_str()); + } + } + + sp.Clear(); + sel.Clear(); + fclose(f); +} + + +//----------------------------------------------------------------------------- +// Routine for STEP output; just a wrapper around the general STEP stuff that +// can also be used for surfaces or 3d curves. +//----------------------------------------------------------------------------- +void Step2dFileWriter::StartFile() { + sfw = {}; + sfw.f = f; + sfw.WriteHeader(); +} + +void Step2dFileWriter::Background(RgbaColor color) { +} + +void Step2dFileWriter::Triangle(STriangle *tr) { +} + +void Step2dFileWriter::StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} +void Step2dFileWriter::FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) +{ +} + +void Step2dFileWriter::Bezier(SBezier *sb) { + int c = sfw.ExportCurve(sb); + sfw.curves.Add(&c); +} + +void Step2dFileWriter::FinishAndCloseFile() { + sfw.WriteWireframe(); + sfw.WriteFooter(); + fclose(f); +} + +} // namespace SolveSpace diff --git a/src/expr.cpp b/src/expr.cpp new file mode 100644 index 0000000..6b077fa --- /dev/null +++ b/src/expr.cpp @@ -0,0 +1,963 @@ +//----------------------------------------------------------------------------- +// The symbolic algebra system used to write our constraint equations; +// routines to build expressions in software or from a user-provided string, +// and to compute the partial derivatives that we'll use when write our +// Jacobian matrix. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +static inline Expr *AllocExpr() { + return (Expr *)Platform::AllocTemporary(sizeof(Expr)); +} + +ExprVector ExprVector::From(Expr *x, Expr *y, Expr *z) { + ExprVector r = { x, y, z}; + return r; +} + +ExprVector ExprVector::From(Vector vn) { + ExprVector ve; + ve.x = Expr::From(vn.x); + ve.y = Expr::From(vn.y); + ve.z = Expr::From(vn.z); + return ve; +} + +ExprVector ExprVector::From(hParam x, hParam y, hParam z) { + ExprVector ve; + ve.x = Expr::From(x); + ve.y = Expr::From(y); + ve.z = Expr::From(z); + return ve; +} + +ExprVector ExprVector::From(double x, double y, double z) { + ExprVector ve; + ve.x = Expr::From(x); + ve.y = Expr::From(y); + ve.z = Expr::From(z); + return ve; +} + +ExprVector ExprVector::Minus(ExprVector b) const { + ExprVector r; + r.x = x->Minus(b.x); + r.y = y->Minus(b.y); + r.z = z->Minus(b.z); + return r; +} + +ExprVector ExprVector::Plus(ExprVector b) const { + ExprVector r; + r.x = x->Plus(b.x); + r.y = y->Plus(b.y); + r.z = z->Plus(b.z); + return r; +} + +Expr *ExprVector::Dot(ExprVector b) const { + Expr *r; + r = x->Times(b.x); + r = r->Plus(y->Times(b.y)); + r = r->Plus(z->Times(b.z)); + return r; +} + +ExprVector ExprVector::Cross(ExprVector b) const { + ExprVector r; + r.x = (y->Times(b.z))->Minus(z->Times(b.y)); + r.y = (z->Times(b.x))->Minus(x->Times(b.z)); + r.z = (x->Times(b.y))->Minus(y->Times(b.x)); + return r; +} + +ExprVector ExprVector::ScaledBy(Expr *s) const { + ExprVector r; + r.x = x->Times(s); + r.y = y->Times(s); + r.z = z->Times(s); + return r; +} + +ExprVector ExprVector::WithMagnitude(Expr *s) const { + Expr *m = Magnitude(); + return ScaledBy(s->Div(m)); +} + +Expr *ExprVector::Magnitude() const { + Expr *r; + r = x->Square(); + r = r->Plus(y->Square()); + r = r->Plus(z->Square()); + return r->Sqrt(); +} + +Vector ExprVector::Eval() const { + Vector r; + r.x = x->Eval(); + r.y = y->Eval(); + r.z = z->Eval(); + return r; +} + +ExprQuaternion ExprQuaternion::From(hParam w, hParam vx, hParam vy, hParam vz) { + ExprQuaternion q; + q.w = Expr::From(w); + q.vx = Expr::From(vx); + q.vy = Expr::From(vy); + q.vz = Expr::From(vz); + return q; +} + +ExprQuaternion ExprQuaternion::From(Expr *w, Expr *vx, Expr *vy, Expr *vz) +{ + ExprQuaternion q; + q.w = w; + q.vx = vx; + q.vy = vy; + q.vz = vz; + return q; +} + +ExprQuaternion ExprQuaternion::From(Quaternion qn) { + ExprQuaternion qe; + qe.w = Expr::From(qn.w); + qe.vx = Expr::From(qn.vx); + qe.vy = Expr::From(qn.vy); + qe.vz = Expr::From(qn.vz); + return qe; +} + +ExprVector ExprQuaternion::RotationU() const { + ExprVector u; + Expr *two = Expr::From(2); + + u.x = w->Square(); + u.x = (u.x)->Plus(vx->Square()); + u.x = (u.x)->Minus(vy->Square()); + u.x = (u.x)->Minus(vz->Square()); + + u.y = two->Times(w->Times(vz)); + u.y = (u.y)->Plus(two->Times(vx->Times(vy))); + + u.z = two->Times(vx->Times(vz)); + u.z = (u.z)->Minus(two->Times(w->Times(vy))); + + return u; +} + +ExprVector ExprQuaternion::RotationV() const { + ExprVector v; + Expr *two = Expr::From(2); + + v.x = two->Times(vx->Times(vy)); + v.x = (v.x)->Minus(two->Times(w->Times(vz))); + + v.y = w->Square(); + v.y = (v.y)->Minus(vx->Square()); + v.y = (v.y)->Plus(vy->Square()); + v.y = (v.y)->Minus(vz->Square()); + + v.z = two->Times(w->Times(vx)); + v.z = (v.z)->Plus(two->Times(vy->Times(vz))); + + return v; +} + +ExprVector ExprQuaternion::RotationN() const { + ExprVector n; + Expr *two = Expr::From(2); + + n.x = two->Times( w->Times(vy)); + n.x = (n.x)->Plus (two->Times(vx->Times(vz))); + + n.y = two->Times(vy->Times(vz)); + n.y = (n.y)->Minus(two->Times( w->Times(vx))); + + n.z = w->Square(); + n.z = (n.z)->Minus(vx->Square()); + n.z = (n.z)->Minus(vy->Square()); + n.z = (n.z)->Plus (vz->Square()); + + return n; +} + +ExprVector ExprQuaternion::Rotate(ExprVector p) const { + // Express the point in the new basis + return (RotationU().ScaledBy(p.x)).Plus( + RotationV().ScaledBy(p.y)).Plus( + RotationN().ScaledBy(p.z)); +} + +ExprQuaternion ExprQuaternion::Times(ExprQuaternion b) const { + Expr *sa = w, *sb = b.w; + ExprVector va = { vx, vy, vz }; + ExprVector vb = { b.vx, b.vy, b.vz }; + + ExprQuaternion r; + r.w = (sa->Times(sb))->Minus(va.Dot(vb)); + ExprVector vr = vb.ScaledBy(sa).Plus( + va.ScaledBy(sb).Plus( + va.Cross(vb))); + r.vx = vr.x; + r.vy = vr.y; + r.vz = vr.z; + return r; +} + +Expr *ExprQuaternion::Magnitude() const { + return ((w ->Square())->Plus( + (vx->Square())->Plus( + (vy->Square())->Plus( + (vz->Square())))))->Sqrt(); +} + + +Expr *Expr::From(hParam p) { + Expr *r = AllocExpr(); + r->op = Op::PARAM; + r->parh = p; + return r; +} + +Expr *Expr::From(double v) { + // Statically allocate common constants. + // Note: this is only valid because AllocExpr() uses AllocTemporary(), + // and Expr* is never explicitly freed. + + if(v == 0.0) { + static Expr zero(0.0); + return &zero; + } + + if(v == 1.0) { + static Expr one(1.0); + return &one; + } + + if(v == -1.0) { + static Expr mone(-1.0); + return &mone; + } + + if(v == 0.5) { + static Expr half(0.5); + return ½ + } + + if(v == -0.5) { + static Expr mhalf(-0.5); + return &mhalf; + } + + Expr *r = AllocExpr(); + r->op = Op::CONSTANT; + r->v = v; + return r; +} + +Expr *Expr::AnyOp(Op newOp, Expr *b) { + Expr *r = AllocExpr(); + r->op = newOp; + r->a = this; + r->b = b; + return r; +} + +int Expr::Children() const { + switch(op) { + case Op::PARAM: + case Op::PARAM_PTR: + case Op::CONSTANT: + case Op::VARIABLE: + return 0; + + case Op::PLUS: + case Op::MINUS: + case Op::TIMES: + case Op::DIV: + return 2; + + case Op::NEGATE: + case Op::SQRT: + case Op::SQUARE: + case Op::SIN: + case Op::COS: + case Op::ASIN: + case Op::ACOS: + return 1; + } + ssassert(false, "Unexpected operation"); +} + +int Expr::Nodes() const { + switch(Children()) { + case 0: return 1; + case 1: return 1 + a->Nodes(); + case 2: return 1 + a->Nodes() + b->Nodes(); + default: ssassert(false, "Unexpected children count"); + } +} + +Expr *Expr::DeepCopy() const { + Expr *n = AllocExpr(); + *n = *this; + int c = n->Children(); + if(c > 0) n->a = a->DeepCopy(); + if(c > 1) n->b = b->DeepCopy(); + return n; +} + +Expr *Expr::DeepCopyWithParamsAsPointers(ParamList *firstTry, ParamList *thenTry, + bool foldConstants) const { + Expr *n = AllocExpr(); + if(op == Op::PARAM) { + // A param that is referenced by its hParam gets rewritten to go + // straight in to the parameter table with a pointer, or simply + // into a constant if it's already known. + Param *p = firstTry->FindByIdNoOops(parh); + if(!p) p = thenTry->FindById(parh); + if(p->known) { + n->op = Op::CONSTANT; + n->v = p->val; + } else { + n->op = Op::PARAM_PTR; + n->parp = p; + } + return n; + } + + *n = *this; + int c = n->Children(); + if(c > 0) { + n->a = a->DeepCopyWithParamsAsPointers(firstTry, thenTry, foldConstants); + bool hasConstants = n->a->op == Op::CONSTANT; + if(c > 1) { + n->b = b->DeepCopyWithParamsAsPointers(firstTry, thenTry, foldConstants); + hasConstants |= n->b->op == Op::CONSTANT; + } + if(hasConstants && foldConstants) { + n = n->FoldConstants(false, 0); + } + } + return n; +} + +double Expr::Eval() const { + switch(op) { + case Op::PARAM: return SK.GetParam(parh)->val; + case Op::PARAM_PTR: return parp->val; + + case Op::CONSTANT: return v; + case Op::VARIABLE: ssassert(false, "Not supported yet"); + + case Op::PLUS: return a->Eval() + b->Eval(); + case Op::MINUS: return a->Eval() - b->Eval(); + case Op::TIMES: return a->Eval() * b->Eval(); + case Op::DIV: return a->Eval() / b->Eval(); + + case Op::NEGATE: return -(a->Eval()); + case Op::SQRT: return sqrt(a->Eval()); + case Op::SQUARE: { double r = a->Eval(); return r*r; } + case Op::SIN: return sin(a->Eval()); + case Op::COS: return cos(a->Eval()); + case Op::ACOS: return acos(a->Eval()); + case Op::ASIN: return asin(a->Eval()); + } + ssassert(false, "Unexpected operation"); +} + +Expr *Expr::PartialWrt(hParam p) const { + Expr *da, *db; + + switch(op) { + case Op::PARAM_PTR: return From(p == parp->h ? 1 : 0); + case Op::PARAM: return From(p == parh ? 1 : 0); + + case Op::CONSTANT: return From(0.0); + case Op::VARIABLE: ssassert(false, "Not supported yet"); + + case Op::PLUS: return (a->PartialWrt(p))->Plus(b->PartialWrt(p)); + case Op::MINUS: return (a->PartialWrt(p))->Minus(b->PartialWrt(p)); + + case Op::TIMES: + da = a->PartialWrt(p); + db = b->PartialWrt(p); + return (a->Times(db))->Plus(b->Times(da)); + + case Op::DIV: + da = a->PartialWrt(p); + db = b->PartialWrt(p); + return ((da->Times(b))->Minus(a->Times(db)))->Div(b->Square()); + + case Op::SQRT: + return (From(0.5)->Div(a->Sqrt()))->Times(a->PartialWrt(p)); + + case Op::SQUARE: + return (From(2.0)->Times(a))->Times(a->PartialWrt(p)); + + case Op::NEGATE: return (a->PartialWrt(p))->Negate(); + case Op::SIN: return (a->Cos())->Times(a->PartialWrt(p)); + case Op::COS: return ((a->Sin())->Times(a->PartialWrt(p)))->Negate(); + + case Op::ASIN: + return (From(1)->Div((From(1)->Minus(a->Square()))->Sqrt())) + ->Times(a->PartialWrt(p)); + case Op::ACOS: + return (From(-1)->Div((From(1)->Minus(a->Square()))->Sqrt())) + ->Times(a->PartialWrt(p)); + } + ssassert(false, "Unexpected operation"); +} + +void Expr::ParamsUsedList(ParamSet *list) const { + if(op == Op::PARAM || op == Op::PARAM_PTR) { + // leaf: just add ourselves if we aren't already there + hParam param = (op == Op::PARAM) ? parh : parp->h; + list->insert(param); + return; + } + + int c = Children(); + if(c >= 1) { + a->ParamsUsedList(list); + if(c >= 2) b->ParamsUsedList(list); + } +} + +bool Expr::DependsOn(hParam p) const { + if(op == Op::PARAM) return (parh == p); + if(op == Op::PARAM_PTR) return (parp->h == p); + + int c = Children(); + if(c == 1) return a->DependsOn(p); + if(c == 2) return a->DependsOn(p) || b->DependsOn(p); + return false; +} + +bool Expr::Tol(double a, double b) { + return fabs(a - b) < 0.001; +} + +bool Expr::IsZeroConst() const { + return op == Op::CONSTANT && EXACT(v == 0.0); +} + +Expr *Expr::FoldConstants(bool allocCopy, size_t depth) { + Expr *n; + + if(!allocCopy) { + n = this; + } else { + n = AllocExpr(); + *n = *this; + } + + switch(op) { + case Op::PARAM_PTR: + case Op::PARAM: + case Op::CONSTANT: + case Op::VARIABLE: + break; + + case Op::MINUS: + case Op::TIMES: + case Op::DIV: + case Op::PLUS: + if(depth > 0) { + n->a = a->FoldConstants(allocCopy, depth - 1); + n->b = b->FoldConstants(allocCopy, depth - 1); + } + + // If both ops are known, then we can evaluate immediately + if(n->a->op == Op::CONSTANT && n->b->op == Op::CONSTANT) { + double nv = n->Eval(); + n->op = Op::CONSTANT; + n->v = nv; + break; + } + // x + 0 = 0 + x = x + if(op == Op::PLUS && n->b->op == Op::CONSTANT && Tol(n->b->v, 0)) { + *n = *(n->a); break; + } + if(op == Op::PLUS && n->a->op == Op::CONSTANT && Tol(n->a->v, 0)) { + *n = *(n->b); break; + } + // 1*x = x*1 = x + if(op == Op::TIMES && n->b->op == Op::CONSTANT && Tol(n->b->v, 1)) { + *n = *(n->a); break; + } + if(op == Op::TIMES && n->a->op == Op::CONSTANT && Tol(n->a->v, 1)) { + *n = *(n->b); break; + } + // 0*x = x*0 = 0 + if(op == Op::TIMES && n->b->op == Op::CONSTANT && Tol(n->b->v, 0)) { + n->op = Op::CONSTANT; n->v = 0; break; + } + if(op == Op::TIMES && n->a->op == Op::CONSTANT && Tol(n->a->v, 0)) { + n->op = Op::CONSTANT; n->v = 0; break; + } + + break; + + case Op::SQRT: + case Op::SQUARE: + case Op::NEGATE: + case Op::SIN: + case Op::COS: + case Op::ASIN: + case Op::ACOS: + if(depth > 0) { + n->a = a->FoldConstants(allocCopy, depth - 1); + } + + if(n->a->op == Op::CONSTANT) { + double nv = n->Eval(); + n->op = Op::CONSTANT; + n->v = nv; + } + break; + } + return n; +} + +void Expr::Substitute(const SubstitutionMap &subMap) { + ssassert(op != Op::PARAM_PTR, "Expected an expression that refer to params via handles"); + + if(op == Op::PARAM) { + auto it = subMap.find(parh); + if(it != subMap.end()) { + parh = it->second->h; + } + } else { + int c = Children(); + if(c >= 1) { + a->Substitute(subMap); + if(c >= 2) b->Substitute(subMap); + } + } +} + +//----------------------------------------------------------------------------- +// If the expression references only one parameter that appears in pl, then +// return that parameter. If no param is referenced, then return NO_PARAMS. +// If multiple params are referenced, then return MULTIPLE_PARAMS. +//----------------------------------------------------------------------------- +const hParam Expr::NO_PARAMS = { 0 }; +const hParam Expr::MULTIPLE_PARAMS = { std::numeric_limits::max() }; +hParam Expr::ReferencedParams(ParamList *pl) const { + if(op == Op::PARAM) { + if(pl->FindByIdNoOops(parh)) { + return parh; + } else { + return NO_PARAMS; + } + } + ssassert(op != Op::PARAM_PTR, "Expected an expression that refer to params via handles"); + + int c = Children(); + if(c == 0) { + return NO_PARAMS; + } else if(c == 1) { + return a->ReferencedParams(pl); + } else if(c == 2) { + hParam pa, pb; + pa = a->ReferencedParams(pl); + pb = b->ReferencedParams(pl); + if(pa == NO_PARAMS) { + return pb; + } else if(pb == NO_PARAMS) { + return pa; + } else if(pa == pb) { + return pa; // either, doesn't matter + } else { + return MULTIPLE_PARAMS; + } + } else ssassert(false, "Unexpected children count"); +} + + +//----------------------------------------------------------------------------- +// Routines to pretty-print an expression. Mostly for debugging. +//----------------------------------------------------------------------------- + +std::string Expr::Print() const { + char c; + switch(op) { + case Op::PARAM: return ssprintf("param(%08x)", parh.v); + case Op::PARAM_PTR: return ssprintf("param(p%08x)", parp->h.v); + + case Op::CONSTANT: return ssprintf("%.3f", v); + case Op::VARIABLE: return "(var)"; + + case Op::PLUS: c = '+'; goto p; + case Op::MINUS: c = '-'; goto p; + case Op::TIMES: c = '*'; goto p; + case Op::DIV: c = '/'; goto p; +p: + return "(" + a->Print() + " " + c + " " + b->Print() + ")"; + break; + + case Op::NEGATE: return "(- " + a->Print() + ")"; + case Op::SQRT: return "(sqrt " + a->Print() + ")"; + case Op::SQUARE: return "(square " + a->Print() + ")"; + case Op::SIN: return "(sin " + a->Print() + ")"; + case Op::COS: return "(cos " + a->Print() + ")"; + case Op::ASIN: return "(asin " + a->Print() + ")"; + case Op::ACOS: return "(acos " + a->Print() + ")"; + } + ssassert(false, "Unexpected operation"); +} + + +//----------------------------------------------------------------------------- +// A parser; convert a string to an expression. Infix notation, with the +// usual shift/reduce approach. I had great hopes for user-entered eq +// constraints, but those don't seem very useful, so right now this is just +// to provide calculator type functionality wherever numbers are entered. +//----------------------------------------------------------------------------- + +class ExprParser { +public: + enum class TokenType { + ERROR = 0, + + PAREN_LEFT, + PAREN_RIGHT, + BINARY_OP, + UNARY_OP, + OPERAND, + + END, + }; + + class Token { + public: + TokenType type; + Expr *expr; + + static Token From(TokenType type = TokenType::ERROR, Expr *expr = NULL); + static Token From(TokenType type, Expr::Op op); + bool IsError() const { return type == TokenType::ERROR; } + }; + + std::string::const_iterator it, end; + std::vector stack; + + char ReadChar(); + char PeekChar(); + + std::string ReadWord(); + void SkipSpace(); + + Token PopOperator(std::string *error); + Token PopOperand(std::string *error); + + int Precedence(Token token); + Token LexNumber(std::string *error); + Token Lex(std::string *error); + bool Reduce(std::string *error); + bool Parse(std::string *error, size_t reduceUntil = 0); + + static Expr *Parse(const std::string &input, std::string *error); +}; + +ExprParser::Token ExprParser::Token::From(TokenType type, Expr *expr) { + Token t; + t.type = type; + t.expr = expr; + return t; +} + +ExprParser::Token ExprParser::Token::From(TokenType type, Expr::Op op) { + Token t; + t.type = type; + t.expr = AllocExpr(); + t.expr->op = op; + return t; +} + +char ExprParser::ReadChar() { + return *it++; +} + +char ExprParser::PeekChar() { + if(it == end) { + return '\0'; + } else { + return *it; + } +} + +std::string ExprParser::ReadWord() { + std::string s; + + while(char c = PeekChar()) { + if(!isalnum(c)) break; + s.push_back(ReadChar()); + } + + return s; +} + +void ExprParser::SkipSpace() { + while(char c = PeekChar()) { + if(!isspace(c)) break; + ReadChar(); + } +} + +ExprParser::Token ExprParser::LexNumber(std::string *error) { + std::string s; + + while(char c = PeekChar()) { + if(!((c >= '0' && c <= '9') || c == 'e' || c == 'E' || c == '.' || c == '_')) break; + if(c == '_') { + ReadChar(); + continue; + } + s.push_back(ReadChar()); + } + + char *endptr; + double d = strtod(s.c_str(), &endptr); + + Token t = Token::From(); + if(endptr == s.c_str() + s.size()) { + t = Token::From(TokenType::OPERAND, Expr::Op::CONSTANT); + t.expr->v = d; + } else { + *error = "'" + s + "' is not a valid number"; + } + return t; +} + +ExprParser::Token ExprParser::Lex(std::string *error) { + SkipSpace(); + + Token t = Token::From(); + char c = PeekChar(); + if(isupper(c)) { + std::string n = ReadWord(); + t = Token::From(TokenType::OPERAND, Expr::Op::VARIABLE); + } else if(isalpha(c)) { + std::string s = ReadWord(); + if(s == "sqrt") { + t = Token::From(TokenType::UNARY_OP, Expr::Op::SQRT); + } else if(s == "square") { + t = Token::From(TokenType::UNARY_OP, Expr::Op::SQUARE); + } else if(s == "sin") { + t = Token::From(TokenType::UNARY_OP, Expr::Op::SIN); + } else if(s == "cos") { + t = Token::From(TokenType::UNARY_OP, Expr::Op::COS); + } else if(s == "asin") { + t = Token::From(TokenType::UNARY_OP, Expr::Op::ASIN); + } else if(s == "acos") { + t = Token::From(TokenType::UNARY_OP, Expr::Op::ACOS); + } else if(s == "pi") { + t = Token::From(TokenType::OPERAND, Expr::Op::CONSTANT); + t.expr->v = PI; + } else { + *error = "'" + s + "' is not a valid variable, function or constant"; + } + } else if(isdigit(c) || c == '.') { + return LexNumber(error); + } else if(ispunct(c)) { + ReadChar(); + if(c == '+') { + t = Token::From(TokenType::BINARY_OP, Expr::Op::PLUS); + } else if(c == '-') { + t = Token::From(TokenType::BINARY_OP, Expr::Op::MINUS); + } else if(c == '*') { + t = Token::From(TokenType::BINARY_OP, Expr::Op::TIMES); + } else if(c == '/') { + t = Token::From(TokenType::BINARY_OP, Expr::Op::DIV); + } else if(c == '(') { + t = Token::From(TokenType::PAREN_LEFT); + } else if(c == ')') { + t = Token::From(TokenType::PAREN_RIGHT); + } else { + *error = "'" + std::string(1, c) + "' is not a valid operator"; + } + } else if(c == '\0') { + t = Token::From(TokenType::END); + } else { + *error = "Unexpected character '" + std::string(1, c) + "'"; + } + + return t; +} + +ExprParser::Token ExprParser::PopOperand(std::string *error) { + Token t = Token::From(); + if(stack.empty() || stack.back().type != TokenType::OPERAND) { + *error = "Expected an operand"; + } else { + t = stack.back(); + stack.pop_back(); + } + return t; +} + +ExprParser::Token ExprParser::PopOperator(std::string *error) { + Token t = Token::From(); + if(stack.empty() || (stack.back().type != TokenType::UNARY_OP && + stack.back().type != TokenType::BINARY_OP)) { + *error = "Expected an operator"; + } else { + t = stack.back(); + stack.pop_back(); + } + return t; +} + +int ExprParser::Precedence(Token t) { + ssassert(t.type == TokenType::BINARY_OP || + t.type == TokenType::UNARY_OP || + t.type == TokenType::OPERAND, + "Unexpected token type"); + + if(t.type == TokenType::UNARY_OP) { + return 30; + } else if(t.expr->op == Expr::Op::TIMES || + t.expr->op == Expr::Op::DIV) { + return 20; + } else if(t.expr->op == Expr::Op::PLUS || + t.expr->op == Expr::Op::MINUS) { + return 10; + } else if(t.type == TokenType::OPERAND) { + return 0; + } else ssassert(false, "Unexpected operator"); +} + +bool ExprParser::Reduce(std::string *error) { + Token a = PopOperand(error); + if(a.IsError()) return false; + + Token op = PopOperator(error); + if(op.IsError()) return false; + + Token r = Token::From(TokenType::OPERAND); + switch(op.type) { + case TokenType::BINARY_OP: { + Token b = PopOperand(error); + if(b.IsError()) return false; + r.expr = b.expr->AnyOp(op.expr->op, a.expr); + break; + } + + case TokenType::UNARY_OP: { + Expr *e = a.expr; + switch(op.expr->op) { + case Expr::Op::NEGATE: e = e->Negate(); break; + case Expr::Op::SQRT: e = e->Sqrt(); break; + case Expr::Op::SQUARE: e = e->Times(e); break; + case Expr::Op::SIN: e = e->Times(Expr::From(PI/180))->Sin(); break; + case Expr::Op::COS: e = e->Times(Expr::From(PI/180))->Cos(); break; + case Expr::Op::ASIN: e = e->ASin()->Times(Expr::From(180/PI)); break; + case Expr::Op::ACOS: e = e->ACos()->Times(Expr::From(180/PI)); break; + default: ssassert(false, "Unexpected unary operator"); + } + r.expr = e; + break; + } + + default: ssassert(false, "Unexpected operator"); + } + stack.push_back(r); + + return true; +} + +bool ExprParser::Parse(std::string *error, size_t reduceUntil) { + while(true) { + Token t = Lex(error); + switch(t.type) { + case TokenType::ERROR: + return false; + + case TokenType::END: + case TokenType::PAREN_RIGHT: + while(stack.size() > 1 + reduceUntil) { + if(!Reduce(error)) return false; + } + + if(t.type == TokenType::PAREN_RIGHT) { + stack.push_back(t); + } + return true; + + case TokenType::PAREN_LEFT: { + // sub-expression + if(!Parse(error, /*reduceUntil=*/stack.size())) return false; + + if(stack.empty() || stack.back().type != TokenType::PAREN_RIGHT) { + *error = "Expected ')'"; + return false; + } + stack.pop_back(); + break; + } + + case TokenType::BINARY_OP: + if((stack.size() > reduceUntil && stack.back().type != TokenType::OPERAND) || + stack.size() == reduceUntil) { + if(t.expr->op == Expr::Op::MINUS) { + t.type = TokenType::UNARY_OP; + t.expr->op = Expr::Op::NEGATE; + stack.push_back(t); + break; + } + } + + while(stack.size() > 1 + reduceUntil && + Precedence(t) <= Precedence(stack[stack.size() - 2])) { + if(!Reduce(error)) return false; + } + + stack.push_back(t); + break; + + case TokenType::UNARY_OP: + case TokenType::OPERAND: + stack.push_back(t); + break; + } + } + + return true; +} + +Expr *ExprParser::Parse(const std::string &input, std::string *error) { + ExprParser parser; + parser.it = input.cbegin(); + parser.end = input.cend(); + if(!parser.Parse(error)) return NULL; + + Token r = parser.PopOperand(error); + if(r.IsError()) return NULL; + return r.expr; +} + +Expr *Expr::Parse(const std::string &input, std::string *error) { + return ExprParser::Parse(input, error); +} + +Expr *Expr::From(const std::string &input, bool popUpError) { + std::string error; + Expr *e = ExprParser::Parse(input, &error); + if(!e) { + dbp("Parse/lex error: %s", error.c_str()); + if(popUpError) { + Error("Not a valid number or expression: '%s'.\n%s.", + input.c_str(), error.c_str()); + } + } + return e; +} + +} // namespace SolveSpace diff --git a/src/expr.h b/src/expr.h new file mode 100644 index 0000000..eb01917 --- /dev/null +++ b/src/expr.h @@ -0,0 +1,154 @@ +//----------------------------------------------------------------------------- +// An expression in our symbolic algebra system, used to write, linearize, +// and solve our constraint equations. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#ifndef SOLVESPACE_EXPR_H +#define SOLVESPACE_EXPR_H + +#include +#include +#include +#include + +#include "dsc.h" +#include "param.h" + +namespace SolveSpace { + +using SubstitutionMap = std::unordered_map>; + +class Expr { +public: + + enum class Op : uint32_t { + // A parameter, by the hParam handle + PARAM = 0, + // A parameter, by a pointer straight in to the param table (faster, + // if we know that the param table won't move around) + PARAM_PTR = 1, + + // Operands + CONSTANT = 20, + VARIABLE = 21, + + // Binary ops + PLUS = 100, + MINUS = 101, + TIMES = 102, + DIV = 103, + // Unary ops + NEGATE = 104, + SQRT = 105, + SQUARE = 106, + SIN = 107, + COS = 108, + ASIN = 109, + ACOS = 110, + }; + + Op op; + Expr *a; + union { + double v; + hParam parh; + Param *parp; + Expr *b; + }; + + Expr() = default; + Expr(double val) : op(Op::CONSTANT) { v = val; } + + static Expr *From(hParam p); + static Expr *From(double v); + + Expr *AnyOp(Op op, Expr *b); + inline Expr *Plus (Expr *b_) { return AnyOp(Op::PLUS, b_); } + inline Expr *Minus(Expr *b_) { return AnyOp(Op::MINUS, b_); } + inline Expr *Times(Expr *b_) { return AnyOp(Op::TIMES, b_); } + inline Expr *Div (Expr *b_) { return AnyOp(Op::DIV, b_); } + + inline Expr *Negate() { return AnyOp(Op::NEGATE, NULL); } + inline Expr *Sqrt () { return AnyOp(Op::SQRT, NULL); } + inline Expr *Square() { return AnyOp(Op::SQUARE, NULL); } + inline Expr *Sin () { return AnyOp(Op::SIN, NULL); } + inline Expr *Cos () { return AnyOp(Op::COS, NULL); } + inline Expr *ASin () { return AnyOp(Op::ASIN, NULL); } + inline Expr *ACos () { return AnyOp(Op::ACOS, NULL); } + + Expr *PartialWrt(hParam p) const; + double Eval() const; + void ParamsUsedList(ParamSet *list) const; + bool DependsOn(hParam p) const; + static bool Tol(double a, double b); + bool IsZeroConst() const; + Expr *FoldConstants(bool allocCopy = true, size_t depth = std::numeric_limits::max()); + void Substitute(const SubstitutionMap &subMap); + + static const hParam NO_PARAMS, MULTIPLE_PARAMS; + hParam ReferencedParams(ParamList *pl) const; + + void ParamsToPointers(); + + std::string Print() const; + + // number of child nodes: 0 (e.g. constant), 1 (sqrt), or 2 (+) + int Children() const; + // total number of nodes in the tree + int Nodes() const; + + // Make a simple copy + Expr *DeepCopy() const; + // Make a copy, with the parameters (usually referenced by hParam) + // resolved to pointers to the actual value. This speeds things up + // considerably. + Expr *DeepCopyWithParamsAsPointers(ParamList *firstTry, + ParamList *thenTry, + bool foldConstants = false) const; + + static Expr *Parse(const std::string &input, std::string *error); + static Expr *From(const std::string &input, bool popUpError); +}; + +class ExprVector { +public: + Expr *x, *y, *z; + + static ExprVector From(Expr *x, Expr *y, Expr *z); + static ExprVector From(Vector vn); + static ExprVector From(hParam x, hParam y, hParam z); + static ExprVector From(double x, double y, double z); + + ExprVector Plus(ExprVector b) const; + ExprVector Minus(ExprVector b) const; + Expr *Dot(ExprVector b) const; + ExprVector Cross(ExprVector b) const; + ExprVector ScaledBy(Expr *s) const; + ExprVector WithMagnitude(Expr *s) const; + Expr *Magnitude() const; + + Vector Eval() const; +}; + +class ExprQuaternion { +public: + Expr *w, *vx, *vy, *vz; + + static ExprQuaternion From(Expr *w, Expr *vx, Expr *vy, Expr *vz); + static ExprQuaternion From(Quaternion qn); + static ExprQuaternion From(hParam w, hParam vx, hParam vy, hParam vz); + + ExprVector RotationU() const; + ExprVector RotationV() const; + ExprVector RotationN() const; + + ExprVector Rotate(ExprVector p) const; + ExprQuaternion Times(ExprQuaternion b) const; + + Expr *Magnitude() const; +}; + +} // namespace SolveSpace + +#endif diff --git a/src/file.cpp b/src/file.cpp new file mode 100644 index 0000000..86da16b --- /dev/null +++ b/src/file.cpp @@ -0,0 +1,1030 @@ +//----------------------------------------------------------------------------- +// Routines to write and read our .slvs file format. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +#define VERSION_STRING "\261\262\263" "SolveSpaceREVa" + +static int StrStartsWith(const char *str, const char *start) { + return memcmp(str, start, strlen(start)) == 0; +} + +//----------------------------------------------------------------------------- +// Clear and free all the dynamic memory associated with our currently-loaded +// sketch. This does not leave the program in an acceptable state (with the +// references created, and so on), so anyone calling this must fix that later. +//----------------------------------------------------------------------------- +void SolveSpaceUI::ClearExisting() { + UndoClearStack(&redo); + UndoClearStack(&undo); + + for(hGroup hg : SK.groupOrder) { + Group *g = SK.GetGroup(hg); + g->Clear(); + } + + SK.constraint.Clear(); + SK.request.Clear(); + SK.group.Clear(); + SK.groupOrder.Clear(); + SK.style.Clear(); + + SK.entity.Clear(); + SK.param.Clear(); + images.clear(); +} + +hGroup SolveSpaceUI::CreateDefaultDrawingGroup() { + Group g = {}; + + // And an empty group, for the first stuff the user draws. + g.visible = true; + g.name = C_("group-name", "sketch-in-plane"); + g.type = Group::Type::DRAWING_WORKPLANE; + g.subtype = Group::Subtype::WORKPLANE_BY_POINT_ORTHO; + g.order = 1; + g.predef.q = Quaternion::From(1, 0, 0, 0); + hRequest hr = Request::HREQUEST_REFERENCE_XY; + g.predef.origin = hr.entity(1); + SK.group.AddAndAssignId(&g); + SK.GetGroup(g.h)->activeWorkplane = g.h.entity(0); + return g.h; +} + +void SolveSpaceUI::NewFile() { + ClearExisting(); + + // Our initial group, that contains the references. + Group g = {}; + g.visible = true; + g.name = C_("group-name", "#references"); + g.type = Group::Type::DRAWING_3D; + g.order = 0; + g.h = Group::HGROUP_REFERENCES; + SK.group.Add(&g); + + // Let's create three two-d coordinate systems, for the coordinate + // planes; these are our references, present in every sketch. + Request r = {}; + r.type = Request::Type::WORKPLANE; + r.group = Group::HGROUP_REFERENCES; + r.workplane = Entity::FREE_IN_3D; + + r.h = Request::HREQUEST_REFERENCE_XY; + SK.request.Add(&r); + + r.h = Request::HREQUEST_REFERENCE_YZ; + SK.request.Add(&r); + + r.h = Request::HREQUEST_REFERENCE_ZX; + SK.request.Add(&r); + + CreateDefaultDrawingGroup(); +} + +const SolveSpaceUI::SaveTable SolveSpaceUI::SAVED[] = { + { 'g', "Group.h.v", 'x', &(SS.sv.g.h.v) }, + { 'g', "Group.type", 'd', &(SS.sv.g.type) }, + { 'g', "Group.order", 'd', &(SS.sv.g.order) }, + { 'g', "Group.name", 'S', &(SS.sv.g.name) }, + { 'g', "Group.activeWorkplane.v", 'x', &(SS.sv.g.activeWorkplane.v) }, + { 'g', "Group.opA.v", 'x', &(SS.sv.g.opA.v) }, + { 'g', "Group.opB.v", 'x', &(SS.sv.g.opB.v) }, + { 'g', "Group.valA", 'f', &(SS.sv.g.valA) }, + { 'g', "Group.valB", 'f', &(SS.sv.g.valB) }, + { 'g', "Group.valC", 'f', &(SS.sv.g.valB) }, + { 'g', "Group.color", 'c', &(SS.sv.g.color) }, + { 'g', "Group.subtype", 'd', &(SS.sv.g.subtype) }, + { 'g', "Group.skipFirst", 'b', &(SS.sv.g.skipFirst) }, + { 'g', "Group.meshCombine", 'd', &(SS.sv.g.meshCombine) }, + { 'g', "Group.forceToMesh", 'd', &(SS.sv.g.forceToMesh) }, + { 'g', "Group.predef.q.w", 'f', &(SS.sv.g.predef.q.w) }, + { 'g', "Group.predef.q.vx", 'f', &(SS.sv.g.predef.q.vx) }, + { 'g', "Group.predef.q.vy", 'f', &(SS.sv.g.predef.q.vy) }, + { 'g', "Group.predef.q.vz", 'f', &(SS.sv.g.predef.q.vz) }, + { 'g', "Group.predef.origin.v", 'x', &(SS.sv.g.predef.origin.v) }, + { 'g', "Group.predef.entityB.v", 'x', &(SS.sv.g.predef.entityB.v) }, + { 'g', "Group.predef.entityC.v", 'x', &(SS.sv.g.predef.entityC.v) }, + { 'g', "Group.predef.swapUV", 'b', &(SS.sv.g.predef.swapUV) }, + { 'g', "Group.predef.negateU", 'b', &(SS.sv.g.predef.negateU) }, + { 'g', "Group.predef.negateV", 'b', &(SS.sv.g.predef.negateV) }, + { 'g', "Group.visible", 'b', &(SS.sv.g.visible) }, + { 'g', "Group.suppress", 'b', &(SS.sv.g.suppress) }, + { 'g', "Group.relaxConstraints", 'b', &(SS.sv.g.relaxConstraints) }, + { 'g', "Group.allowRedundant", 'b', &(SS.sv.g.allowRedundant) }, + { 'g', "Group.allDimsReference", 'b', &(SS.sv.g.allDimsReference) }, + { 'g', "Group.scale", 'f', &(SS.sv.g.scale) }, + { 'g', "Group.remap", 'M', &(SS.sv.g.remap) }, + { 'g', "Group.impFile", 'i', NULL }, + { 'g', "Group.impFileRel", 'P', &(SS.sv.g.linkFile) }, + + { 'p', "Param.h.v.", 'x', &(SS.sv.p.h.v) }, + { 'p', "Param.val", 'f', &(SS.sv.p.val) }, + + { 'r', "Request.h.v", 'x', &(SS.sv.r.h.v) }, + { 'r', "Request.type", 'd', &(SS.sv.r.type) }, + { 'r', "Request.extraPoints", 'd', &(SS.sv.r.extraPoints) }, + { 'r', "Request.workplane.v", 'x', &(SS.sv.r.workplane.v) }, + { 'r', "Request.group.v", 'x', &(SS.sv.r.group.v) }, + { 'r', "Request.construction", 'b', &(SS.sv.r.construction) }, + { 'r', "Request.style", 'x', &(SS.sv.r.style) }, + { 'r', "Request.str", 'S', &(SS.sv.r.str) }, + { 'r', "Request.font", 'S', &(SS.sv.r.font) }, + { 'r', "Request.file", 'P', &(SS.sv.r.file) }, + { 'r', "Request.aspectRatio", 'f', &(SS.sv.r.aspectRatio) }, + + { 'e', "Entity.h.v", 'x', &(SS.sv.e.h.v) }, + { 'e', "Entity.type", 'd', &(SS.sv.e.type) }, + { 'e', "Entity.construction", 'b', &(SS.sv.e.construction) }, + { 'e', "Entity.style", 'x', &(SS.sv.e.style) }, + { 'e', "Entity.str", 'S', &(SS.sv.e.str) }, + { 'e', "Entity.font", 'S', &(SS.sv.e.font) }, + { 'e', "Entity.file", 'P', &(SS.sv.e.file) }, + { 'e', "Entity.point[0].v", 'x', &(SS.sv.e.point[0].v) }, + { 'e', "Entity.point[1].v", 'x', &(SS.sv.e.point[1].v) }, + { 'e', "Entity.point[2].v", 'x', &(SS.sv.e.point[2].v) }, + { 'e', "Entity.point[3].v", 'x', &(SS.sv.e.point[3].v) }, + { 'e', "Entity.point[4].v", 'x', &(SS.sv.e.point[4].v) }, + { 'e', "Entity.point[5].v", 'x', &(SS.sv.e.point[5].v) }, + { 'e', "Entity.point[6].v", 'x', &(SS.sv.e.point[6].v) }, + { 'e', "Entity.point[7].v", 'x', &(SS.sv.e.point[7].v) }, + { 'e', "Entity.point[8].v", 'x', &(SS.sv.e.point[8].v) }, + { 'e', "Entity.point[9].v", 'x', &(SS.sv.e.point[9].v) }, + { 'e', "Entity.point[10].v", 'x', &(SS.sv.e.point[10].v) }, + { 'e', "Entity.point[11].v", 'x', &(SS.sv.e.point[11].v) }, + { 'e', "Entity.extraPoints", 'd', &(SS.sv.e.extraPoints) }, + { 'e', "Entity.normal.v", 'x', &(SS.sv.e.normal.v) }, + { 'e', "Entity.distance.v", 'x', &(SS.sv.e.distance.v) }, + { 'e', "Entity.workplane.v", 'x', &(SS.sv.e.workplane.v) }, + { 'e', "Entity.actPoint.x", 'f', &(SS.sv.e.actPoint.x) }, + { 'e', "Entity.actPoint.y", 'f', &(SS.sv.e.actPoint.y) }, + { 'e', "Entity.actPoint.z", 'f', &(SS.sv.e.actPoint.z) }, + { 'e', "Entity.actNormal.w", 'f', &(SS.sv.e.actNormal.w) }, + { 'e', "Entity.actNormal.vx", 'f', &(SS.sv.e.actNormal.vx) }, + { 'e', "Entity.actNormal.vy", 'f', &(SS.sv.e.actNormal.vy) }, + { 'e', "Entity.actNormal.vz", 'f', &(SS.sv.e.actNormal.vz) }, + { 'e', "Entity.actDistance", 'f', &(SS.sv.e.actDistance) }, + { 'e', "Entity.actVisible", 'b', &(SS.sv.e.actVisible), }, + + + { 'c', "Constraint.h.v", 'x', &(SS.sv.c.h.v) }, + { 'c', "Constraint.type", 'd', &(SS.sv.c.type) }, + { 'c', "Constraint.group.v", 'x', &(SS.sv.c.group.v) }, + { 'c', "Constraint.workplane.v", 'x', &(SS.sv.c.workplane.v) }, + { 'c', "Constraint.valA", 'f', &(SS.sv.c.valA) }, + { 'c', "Constraint.valP.v", 'x', &(SS.sv.c.valP.v) }, + { 'c', "Constraint.ptA.v", 'x', &(SS.sv.c.ptA.v) }, + { 'c', "Constraint.ptB.v", 'x', &(SS.sv.c.ptB.v) }, + { 'c', "Constraint.entityA.v", 'x', &(SS.sv.c.entityA.v) }, + { 'c', "Constraint.entityB.v", 'x', &(SS.sv.c.entityB.v) }, + { 'c', "Constraint.entityC.v", 'x', &(SS.sv.c.entityC.v) }, + { 'c', "Constraint.entityD.v", 'x', &(SS.sv.c.entityD.v) }, + { 'c', "Constraint.other", 'b', &(SS.sv.c.other) }, + { 'c', "Constraint.other2", 'b', &(SS.sv.c.other2) }, + { 'c', "Constraint.reference", 'b', &(SS.sv.c.reference) }, + { 'c', "Constraint.comment", 'S', &(SS.sv.c.comment) }, + { 'c', "Constraint.disp.offset.x", 'f', &(SS.sv.c.disp.offset.x) }, + { 'c', "Constraint.disp.offset.y", 'f', &(SS.sv.c.disp.offset.y) }, + { 'c', "Constraint.disp.offset.z", 'f', &(SS.sv.c.disp.offset.z) }, + { 'c', "Constraint.disp.style", 'x', &(SS.sv.c.disp.style) }, + + { 's', "Style.h.v", 'x', &(SS.sv.s.h.v) }, + { 's', "Style.name", 'S', &(SS.sv.s.name) }, + { 's', "Style.width", 'f', &(SS.sv.s.width) }, + { 's', "Style.widthAs", 'd', &(SS.sv.s.widthAs) }, + { 's', "Style.textHeight", 'f', &(SS.sv.s.textHeight) }, + { 's', "Style.textHeightAs", 'd', &(SS.sv.s.textHeightAs) }, + { 's', "Style.textAngle", 'f', &(SS.sv.s.textAngle) }, + { 's', "Style.textOrigin", 'x', &(SS.sv.s.textOrigin) }, + { 's', "Style.color", 'c', &(SS.sv.s.color) }, + { 's', "Style.fillColor", 'c', &(SS.sv.s.fillColor) }, + { 's', "Style.filled", 'b', &(SS.sv.s.filled) }, + { 's', "Style.visible", 'b', &(SS.sv.s.visible) }, + { 's', "Style.exportable", 'b', &(SS.sv.s.exportable) }, + { 's', "Style.stippleType", 'd', &(SS.sv.s.stippleType) }, + { 's', "Style.stippleScale", 'f', &(SS.sv.s.stippleScale) }, + + { 0, NULL, 0, NULL } +}; + +struct SAVEDptr { + EntityMap &M() { return *((EntityMap *)this); } + std::string &S() { return *((std::string *)this); } + Platform::Path &P() { return *((Platform::Path *)this); } + bool &b() { return *((bool *)this); } + RgbaColor &c() { return *((RgbaColor *)this); } + int &d() { return *((int *)this); } + double &f() { return *((double *)this); } + uint32_t &x() { return *((uint32_t *)this); } +}; + +void SolveSpaceUI::SaveUsingTable(const Platform::Path &filename, int type) { + int i; + for(i = 0; SAVED[i].type != 0; i++) { + if(SAVED[i].type != type) continue; + + int fmt = SAVED[i].fmt; + SAVEDptr *p = (SAVEDptr *)SAVED[i].ptr; + // Any items that aren't specified are assumed to be zero + if(fmt == 'S' && p->S().empty()) continue; + if(fmt == 'P' && p->P().IsEmpty()) continue; + if(fmt == 'd' && p->d() == 0) continue; + if(fmt == 'f' && EXACT(p->f() == 0.0)) continue; + if(fmt == 'x' && p->x() == 0) continue; + if(fmt == 'i') continue; + + fprintf(fh, "%s=", SAVED[i].desc); + switch(fmt) { + case 'S': fprintf(fh, "%s", p->S().c_str()); break; + case 'b': fprintf(fh, "%d", p->b() ? 1 : 0); break; + case 'c': fprintf(fh, "%08x", p->c().ToPackedInt()); break; + case 'd': fprintf(fh, "%d", p->d()); break; + case 'f': fprintf(fh, "%.20f", p->f()); break; + case 'x': fprintf(fh, "%08x", p->x()); break; + + case 'P': { + if(!p->P().IsEmpty()) { + Platform::Path relativePath = p->P().Expand(/*fromCurrentDirectory=*/true).RelativeTo(filename.Expand(/*fromCurrentDirectory=*/true).Parent()); + ssassert(!relativePath.IsEmpty(), "Cannot relativize path"); + fprintf(fh, "%s", relativePath.ToPortable().c_str()); + } + break; + } + + case 'M': { + fprintf(fh, "{\n"); + // Sort the mapping, since EntityMap is not deterministic. + std::vector> sorted(p->M().begin(), p->M().end()); + std::sort(sorted.begin(), sorted.end(), + [](std::pair &a, std::pair &b) { + return a.second.v < b.second.v; + }); + for(const auto &it : sorted) { + fprintf(fh, " %d %08x %d\n", + it.second.v, it.first.input.v, it.first.copyNumber); + } + fprintf(fh, "}"); + break; + } + + case 'i': break; + + default: ssassert(false, "Unexpected value format"); + } + fprintf(fh, "\n"); + } +} + +bool SolveSpaceUI::SaveToFile(const Platform::Path &filename) { + // Make sure all the entities are regenerated up to date, since they will be exported. + SS.ScheduleShowTW(); + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + + for(Group &g : SK.group) { + if(g.type != Group::Type::LINKED) continue; + + // Expand for "filename" below is needed on Linux when the file was opened with a relative + // path on the command line. dialog->RunModal() in SolveSpaceUI::GetFilenameAndSave will + // convert the file name to full path on Windows but not on GTK. + if(g.linkFile.Expand(/*fromCurrentDirectory=*/true) + .RelativeTo(filename.Expand(/*fromCurrentDirectory=*/true)) + .IsEmpty()) { + Error("This sketch links the sketch '%s'; it can only be saved " + "on the same volume.", g.linkFile.raw.c_str()); + return false; + } + } + + fh = OpenFile(filename, "wb"); + if(!fh) { + Error("Couldn't write to file '%s'", filename.raw.c_str()); + return false; + } + + fprintf(fh, "%s\n\n\n", VERSION_STRING); + + int i, j; + for(auto &g : SK.group) { + sv.g = g; + SaveUsingTable(filename, 'g'); + fprintf(fh, "AddGroup\n\n"); + } + + for(auto &p : SK.param) { + sv.p = p; + SaveUsingTable(filename, 'p'); + fprintf(fh, "AddParam\n\n"); + } + + for(auto &r : SK.request) { + sv.r = r; + SaveUsingTable(filename, 'r'); + fprintf(fh, "AddRequest\n\n"); + } + + for(auto &e : SK.entity) { + e.CalculateNumerical(/*forExport=*/true); + sv.e = e; + SaveUsingTable(filename, 'e'); + fprintf(fh, "AddEntity\n\n"); + } + + for(auto &c : SK.constraint) { + sv.c = c; + SaveUsingTable(filename, 'c'); + fprintf(fh, "AddConstraint\n\n"); + } + + for(auto &s : SK.style) { + sv.s = s; + if(sv.s.h.v >= Style::FIRST_CUSTOM) { + SaveUsingTable(filename, 's'); + fprintf(fh, "AddStyle\n\n"); + } + } + + // A group will have either a mesh or a shell, but not both; but the code + // to print either of those just does nothing if the mesh/shell is empty. + + Group *g = SK.GetGroup(*SK.groupOrder.Last()); + SMesh *m = &g->runningMesh; + for(i = 0; i < m->l.n; i++) { + STriangle *tr = &(m->l[i]); + fprintf(fh, "Triangle %08x %08x " + "%.20f %.20f %.20f %.20f %.20f %.20f %.20f %.20f %.20f\n", + tr->meta.face, tr->meta.color.ToPackedInt(), + CO(tr->a), CO(tr->b), CO(tr->c)); + } + + SShell *s = &g->runningShell; + for(SSurface &srf : s->surface) { + fprintf(fh, "Surface %08x %08x %08x %d %d\n", + srf.h.v, srf.color.ToPackedInt(), srf.face, srf.degm, srf.degn); + for(i = 0; i <= srf.degm; i++) { + for(j = 0; j <= srf.degn; j++) { + fprintf(fh, "SCtrl %d %d %.20f %.20f %.20f Weight %20.20f\n", + i, j, CO(srf.ctrl[i][j]), srf.weight[i][j]); + } + } + + STrimBy *stb; + for(stb = srf.trim.First(); stb; stb = srf.trim.NextAfter(stb)) { + fprintf(fh, "TrimBy %08x %d %.20f %.20f %.20f %.20f %.20f %.20f\n", + stb->curve.v, stb->backwards ? 1 : 0, + CO(stb->start), CO(stb->finish)); + } + + fprintf(fh, "AddSurface\n"); + } + for(SCurve &sc : s->curve) { + fprintf(fh, "Curve %08x %d %d %08x %08x\n", + sc.h.v, + sc.isExact ? 1 : 0, sc.exact.deg, + sc.surfA.v, sc.surfB.v); + + if(sc.isExact) { + for(i = 0; i <= sc.exact.deg; i++) { + fprintf(fh, "CCtrl %d %.20f %.20f %.20f Weight %.20f\n", + i, CO(sc.exact.ctrl[i]), sc.exact.weight[i]); + } + } + SCurvePt *scpt; + for(scpt = sc.pts.First(); scpt; scpt = sc.pts.NextAfter(scpt)) { + fprintf(fh, "CurvePt %d %.20f %.20f %.20f\n", + scpt->vertex ? 1 : 0, CO(scpt->p)); + } + + fprintf(fh, "AddCurve\n"); + } + + fclose(fh); + + return true; +} + +void SolveSpaceUI::LoadUsingTable(const Platform::Path &filename, char *key, char *val) { + int i; + for(i = 0; SAVED[i].type != 0; i++) { + if(strcmp(SAVED[i].desc, key)==0) { + SAVEDptr *p = (SAVEDptr *)SAVED[i].ptr; + unsigned int u = 0; + switch(SAVED[i].fmt) { + case 'S': p->S() = val; break; + case 'b': p->b() = (atoi(val) != 0); break; + case 'd': p->d() = atoi(val); break; + case 'f': p->f() = atof(val); break; + case 'x': sscanf(val, "%x", &u); p->x()= u; break; + + case 'P': { + Platform::Path path = Platform::Path::FromPortable(val); + if(!path.IsEmpty()) { + p->P() = filename.Parent().Join(path).Expand(); + } + break; + } + + case 'c': + sscanf(val, "%x", &u); + p->c() = RgbaColor::FromPackedInt(u); + break; + + case 'M': { + p->M().clear(); + for(;;) { + EntityKey ek; + EntityId ei; + char line2[1024]; + if (fgets(line2, (int)sizeof(line2), fh) == NULL) + break; + if(sscanf(line2, "%d %x %d", &(ei.v), &(ek.input.v), + &(ek.copyNumber)) == 3) { + if(ei.v == Entity::NO_ENTITY.v) { + // Commit bd84bc1a mistakenly introduced code that would remap + // some entities to NO_ENTITY. This was fixed in commit bd84bc1a, + // but files created meanwhile are corrupt, and can cause crashes. + // + // To fix this, we skip any such remaps when loading; they will be + // recreated on the next regeneration. Any resulting orphans will + // be pruned in the usual way, recovering to a well-defined state. + continue; + } + p->M().insert({ ek, ei }); + } else { + break; + } + } + break; + } + + case 'i': break; + + default: ssassert(false, "Unexpected value format"); + } + break; + } + } + if(SAVED[i].type == 0) { + fileLoadError = true; + } +} + +bool SolveSpaceUI::LoadFromFile(const Platform::Path &filename, bool canCancel) { + bool fileIsEmpty = true; + allConsistent = false; + fileLoadError = false; + + fh = OpenFile(filename, "rb"); + if(!fh) { + Error("Couldn't read from file '%s'", filename.raw.c_str()); + return false; + } + + ClearExisting(); + + sv = {}; + sv.g.scale = 1; // default is 1, not 0; so legacy files need this + Style::FillDefaultStyle(&sv.s); + + char line[1024]; + while(fgets(line, (int)sizeof(line), fh)) { + fileIsEmpty = false; + + char *s = strchr(line, '\n'); + if(s) *s = '\0'; + // We should never get files with \r characters in them, but mailers + // will sometimes mangle attachments. + s = strchr(line, '\r'); + if(s) *s = '\0'; + + if(*line == '\0') continue; + + char *e = strchr(line, '='); + if(e) { + *e = '\0'; + char *key = line, *val = e+1; + LoadUsingTable(filename, key, val); + } else if(strcmp(line, "AddGroup")==0) { + // legacy files have a spurious dependency between linked groups + // and their parent groups, remove + if(sv.g.type == Group::Type::LINKED) + sv.g.opA.v = 0; + + SK.group.Add(&(sv.g)); + sv.g = {}; + sv.g.scale = 1; // default is 1, not 0; so legacy files need this + } else if(strcmp(line, "AddParam")==0) { + // params are regenerated, but we want to preload the values + // for initial guesses + SK.param.Add(&(sv.p)); + sv.p = {}; + } else if(strcmp(line, "AddEntity")==0) { + // entities are regenerated + } else if(strcmp(line, "AddRequest")==0) { + SK.request.Add(&(sv.r)); + sv.r = {}; + } else if(strcmp(line, "AddConstraint")==0) { + SK.constraint.Add(&(sv.c)); + sv.c = {}; + } else if(strcmp(line, "AddStyle")==0) { + SK.style.Add(&(sv.s)); + sv.s = {}; + Style::FillDefaultStyle(&sv.s); + } else if(strcmp(line, VERSION_STRING)==0) { + // do nothing, version string + } else if(StrStartsWith(line, "Triangle ") || + StrStartsWith(line, "Surface ") || + StrStartsWith(line, "SCtrl ") || + StrStartsWith(line, "TrimBy ") || + StrStartsWith(line, "Curve ") || + StrStartsWith(line, "CCtrl ") || + StrStartsWith(line, "CurvePt ") || + strcmp(line, "AddSurface")==0 || + strcmp(line, "AddCurve")==0) + { + // ignore the mesh or shell, since we regenerate that + } else { + fileLoadError = true; + } + } + + fclose(fh); + + if(fileIsEmpty) { + Error(_("The file is empty. It may be corrupt.")); + NewFile(); + } + + if(fileLoadError) { + Error(_("Unrecognized data in file. This file may be corrupt, or " + "from a newer version of the program.")); + // At least leave the program in a non-crashing state. + if(SK.group.IsEmpty()) { + NewFile(); + } + } + if(!ReloadAllLinked(filename, canCancel)) { + return false; + } + UpgradeLegacyData(); + + return true; +} + +void SolveSpaceUI::UpgradeLegacyData() { + for(Request &r : SK.request) { + switch(r.type) { + // TTF text requests saved in versions prior to 3.0 only have two + // reference points (origin and origin plus v); version 3.0 adds two + // more points, and if we don't do anything, then they will appear + // at workplane origin, and the solver will mess up the sketch if + // it is not fully constrained. + case Request::Type::TTF_TEXT: { + EntityList entity = {}; + ParamList param = {}; + r.Generate(&entity, ¶m); + + // If we didn't load all of the entities and params that this + // request would generate, then add them now, so that we can + // force them to their appropriate positions. + for(Param &p : param) { + if(SK.param.FindByIdNoOops(p.h) != NULL) continue; + SK.param.Add(&p); + } + bool allPointsExist = true; + for(Entity &e : entity) { + if(SK.entity.FindByIdNoOops(e.h) != NULL) continue; + SK.entity.Add(&e); + allPointsExist = false; + } + + if(!allPointsExist) { + Entity *text = entity.FindById(r.h.entity(0)); + Entity *b = entity.FindById(text->point[2]); + Entity *c = entity.FindById(text->point[3]); + ExprVector bex, cex; + text->RectGetPointsExprs(&bex, &cex); + b->PointForceParamTo(bex.Eval()); + c->PointForceParamTo(cex.Eval()); + } + entity.Clear(); + param.Clear(); + break; + } + + default: + break; + } + } + + // Constraints saved in versions prior to 3.0 never had any params; + // version 3.0 introduced params to constraints to avoid the hairy ball problem, + // so force them where they belong. + ParamList oldParam = {}; + SK.param.DeepCopyInto(&oldParam); + SS.GenerateAll(SolveSpaceUI::Generate::REGEN); + + auto AllParamsExistFor = [&](Constraint &c) { + ParamList param = {}; + c.Generate(¶m); + bool allParamsExist = true; + for(Param &p : param) { + if(oldParam.FindByIdNoOops(p.h) != NULL) continue; + allParamsExist = false; + break; + } + param.Clear(); + return allParamsExist; + }; + + for(Constraint &c : SK.constraint) { + switch(c.type) { + case Constraint::Type::PT_ON_LINE: { + if(AllParamsExistFor(c)) continue; + + EntityBase *eln = SK.GetEntity(c.entityA); + EntityBase *ea = SK.GetEntity(eln->point[0]); + EntityBase *eb = SK.GetEntity(eln->point[1]); + EntityBase *ep = SK.GetEntity(c.ptA); + + ExprVector exp = ep->PointGetExprsInWorkplane(c.workplane); + ExprVector exa = ea->PointGetExprsInWorkplane(c.workplane); + ExprVector exb = eb->PointGetExprsInWorkplane(c.workplane); + ExprVector exba = exb.Minus(exa); + Param *p = SK.GetParam(c.h.param(0)); + p->val = exba.Dot(exp.Minus(exa))->Eval() / exba.Dot(exba)->Eval(); + break; + } + + case Constraint::Type::CUBIC_LINE_TANGENT: { + if(AllParamsExistFor(c)) continue; + + EntityBase *cubic = SK.GetEntity(c.entityA); + EntityBase *line = SK.GetEntity(c.entityB); + + ExprVector a; + if(c.other) { + a = cubic->CubicGetFinishTangentExprs(); + } else { + a = cubic->CubicGetStartTangentExprs(); + } + + ExprVector b = line->VectorGetExprs(); + + Param *param = SK.GetParam(c.h.param(0)); + param->val = a.Dot(b)->Eval() / b.Dot(b)->Eval(); + break; + } + + case Constraint::Type::SAME_ORIENTATION: { + if(AllParamsExistFor(c)) continue; + + EntityBase *an = SK.GetEntity(c.entityA); + EntityBase *bn = SK.GetEntity(c.entityB); + + ExprVector a = an->NormalExprsN(); + ExprVector b = bn->NormalExprsN(); + + Param *param = SK.GetParam(c.h.param(0)); + param->val = a.Dot(b)->Eval() / b.Dot(b)->Eval(); + break; + } + + case Constraint::Type::PARALLEL: { + if(AllParamsExistFor(c)) continue; + + EntityBase *ea = SK.GetEntity(c.entityA), + *eb = SK.GetEntity(c.entityB); + ExprVector a = ea->VectorGetExprsInWorkplane(c.workplane); + ExprVector b = eb->VectorGetExprsInWorkplane(c.workplane); + + Param *param = SK.GetParam(c.h.param(0)); + param->val = a.Dot(b)->Eval() / b.Dot(b)->Eval(); + break; + } + + default: + break; + } + } + oldParam.Clear(); +} + +bool SolveSpaceUI::LoadEntitiesFromFile(const Platform::Path &filename, EntityList *le, + SMesh *m, SShell *sh) +{ + if(strcmp(filename.Extension().c_str(), "emn")==0) { + return LinkIDF(filename, le, m, sh); + } else if(strcmp(filename.Extension().c_str(), "EMN")==0) { + return LinkIDF(filename, le, m, sh); + } else if(strcmp(filename.Extension().c_str(), "stl")==0) { + return LinkStl(filename, le, m, sh); + } else if(strcmp(filename.Extension().c_str(), "STL")==0) { + return LinkStl(filename, le, m, sh); + } else { + return LoadEntitiesFromSlvs(filename, le, m, sh); + } +} + +bool SolveSpaceUI::LoadEntitiesFromSlvs(const Platform::Path &filename, EntityList *le, + SMesh *m, SShell *sh) +{ + SSurface srf = {}; + SCurve crv = {}; + + fh = OpenFile(filename, "rb"); + if(!fh) return false; + + le->Clear(); + sv = {}; + + char line[1024]; + while(fgets(line, (int)sizeof(line), fh)) { + char *s = strchr(line, '\n'); + if(s) *s = '\0'; + // We should never get files with \r characters in them, but mailers + // will sometimes mangle attachments. + s = strchr(line, '\r'); + if(s) *s = '\0'; + + if(*line == '\0') continue; + + char *e = strchr(line, '='); + if(e) { + *e = '\0'; + char *key = line, *val = e+1; + LoadUsingTable(filename, key, val); + } else if(strcmp(line, "AddGroup")==0) { + // These get allocated whether we want them or not. + sv.g.remap.clear(); + } else if(strcmp(line, "AddParam")==0) { + + } else if(strcmp(line, "AddEntity")==0) { + le->Add(&(sv.e)); + sv.e = {}; + } else if(strcmp(line, "AddRequest")==0) { + + } else if(strcmp(line, "AddConstraint")==0) { + + } else if(strcmp(line, "AddStyle")==0) { + // Linked file contains a style that we don't have yet, + // so import it. + if (SK.style.FindByIdNoOops(sv.s.h) == nullptr) { + SK.style.Add(&(sv.s)); + } + sv.s = {}; + Style::FillDefaultStyle(&sv.s); + } else if(strcmp(line, VERSION_STRING)==0) { + + } else if(StrStartsWith(line, "Triangle ")) { + STriangle tr = {}; + unsigned int rgba = 0; + if(sscanf(line, "Triangle %x %x " + "%lf %lf %lf %lf %lf %lf %lf %lf %lf", + &(tr.meta.face), &rgba, + &(tr.a.x), &(tr.a.y), &(tr.a.z), + &(tr.b.x), &(tr.b.y), &(tr.b.z), + &(tr.c.x), &(tr.c.y), &(tr.c.z)) != 11) { + ssassert(false, "Unexpected Triangle format"); + } + tr.meta.color = RgbaColor::FromPackedInt((uint32_t)rgba); + m->AddTriangle(&tr); + } else if(StrStartsWith(line, "Surface ")) { + unsigned int rgba = 0; + if(sscanf(line, "Surface %x %x %x %d %d", + &(srf.h.v), &rgba, &(srf.face), + &(srf.degm), &(srf.degn)) != 5) { + ssassert(false, "Unexpected Surface format"); + } + srf.color = RgbaColor::FromPackedInt((uint32_t)rgba); + } else if(StrStartsWith(line, "SCtrl ")) { + int i, j; + Vector c; + double w; + if(sscanf(line, "SCtrl %d %d %lf %lf %lf Weight %lf", + &i, &j, &(c.x), &(c.y), &(c.z), &w) != 6) + { + ssassert(false, "Unexpected SCtrl format"); + } + srf.ctrl[i][j] = c; + srf.weight[i][j] = w; + } else if(StrStartsWith(line, "TrimBy ")) { + STrimBy stb = {}; + int backwards; + if(sscanf(line, "TrimBy %x %d %lf %lf %lf %lf %lf %lf", + &(stb.curve.v), &backwards, + &(stb.start.x), &(stb.start.y), &(stb.start.z), + &(stb.finish.x), &(stb.finish.y), &(stb.finish.z)) != 8) + { + ssassert(false, "Unexpected TrimBy format"); + } + stb.backwards = (backwards != 0); + srf.trim.Add(&stb); + } else if(strcmp(line, "AddSurface")==0) { + sh->surface.Add(&srf); + srf = {}; + } else if(StrStartsWith(line, "Curve ")) { + int isExact; + if(sscanf(line, "Curve %x %d %d %x %x", + &(crv.h.v), + &(isExact), + &(crv.exact.deg), + &(crv.surfA.v), &(crv.surfB.v)) != 5) + { + ssassert(false, "Unexpected Curve format"); + } + crv.isExact = (isExact != 0); + } else if(StrStartsWith(line, "CCtrl ")) { + int i; + Vector c; + double w; + if(sscanf(line, "CCtrl %d %lf %lf %lf Weight %lf", + &i, &(c.x), &(c.y), &(c.z), &w) != 5) + { + ssassert(false, "Unexpected CCtrl format"); + } + crv.exact.ctrl[i] = c; + crv.exact.weight[i] = w; + } else if(StrStartsWith(line, "CurvePt ")) { + SCurvePt scpt; + int vertex; + if(sscanf(line, "CurvePt %d %lf %lf %lf", + &vertex, + &(scpt.p.x), &(scpt.p.y), &(scpt.p.z)) != 4) + { + ssassert(false, "Unexpected CurvePt format"); + } + scpt.vertex = (vertex != 0); + crv.pts.Add(&scpt); + } else if(strcmp(line, "AddCurve")==0) { + sh->curve.Add(&crv); + crv = {}; + } else ssassert(false, "Unexpected operation"); + } + + fclose(fh); + return true; +} + +static Platform::MessageDialog::Response LocateImportedFile(const Platform::Path &filename, + bool canCancel) { + Platform::MessageDialogRef dialog = CreateMessageDialog(SS.GW.window); + + using Platform::MessageDialog; + dialog->SetType(MessageDialog::Type::QUESTION); + dialog->SetTitle(C_("title", "Missing File")); + dialog->SetMessage(ssprintf(C_("dialog", "The linked file “%s” is not present."), + filename.raw.c_str())); + dialog->SetDescription(C_("dialog", "Do you want to locate it manually?\n\n" + "If you decline, any geometry that depends on " + "the missing file will be permanently removed.")); + dialog->AddButton(C_("button", "&Yes"), MessageDialog::Response::YES, + /*isDefault=*/true); + dialog->AddButton(C_("button", "&No"), MessageDialog::Response::NO); + if(canCancel) { + dialog->AddButton(C_("button", "&Cancel"), MessageDialog::Response::CANCEL); + } + + // FIXME(async): asyncify this call + return dialog->RunModal(); +} + +bool SolveSpaceUI::ReloadAllLinked(const Platform::Path &saveFile, bool canCancel) { + Platform::SettingsRef settings = Platform::GetSettings(); + + std::map linkMap; + + allConsistent = false; + + for(Group &g : SK.group) { + if(g.type != Group::Type::LINKED) continue; + + g.impEntity.Clear(); + g.impMesh.Clear(); + g.impShell.Clear(); + + // If we prompted for this specific file before, don't ask again. + if(linkMap.count(g.linkFile)) { + g.linkFile = linkMap[g.linkFile]; + } + +try_again: + if(LoadEntitiesFromFile(g.linkFile, &g.impEntity, &g.impMesh, &g.impShell)) { + // We loaded the data, good. Now import its dependencies as well. + for(Entity &e : g.impEntity) { + if(e.type != Entity::Type::IMAGE) continue; + if(!ReloadLinkedImage(g.linkFile, &e.file, canCancel)) { + return false; + } + } + if(g.IsTriangleMeshAssembly()) + g.forceToMesh = true; + } else if(linkMap.count(g.linkFile) == 0) { + dbp("Missing file for group: %s", g.name.c_str()); + // The file was moved; prompt the user for its new location. + const auto linkFileRelative = g.linkFile.RelativeTo(saveFile); + switch(LocateImportedFile(linkFileRelative, canCancel)) { + case Platform::MessageDialog::Response::YES: { + Platform::FileDialogRef dialog = Platform::CreateOpenFileDialog(SS.GW.window); + dialog->AddFilters(Platform::SolveSpaceLinkFileFilters); + dialog->ThawChoices(settings, "LinkSketch"); + dialog->SuggestFilename(linkFileRelative); + if(dialog->RunModal()) { + dialog->FreezeChoices(settings, "LinkSketch"); + linkMap[g.linkFile] = dialog->GetFilename(); + g.linkFile = dialog->GetFilename(); + goto try_again; + } else { + if(canCancel) return false; + break; + } + } + + case Platform::MessageDialog::Response::NO: + linkMap[g.linkFile].Clear(); + // Geometry will be pruned by GenerateAll(). + break; + + case Platform::MessageDialog::Response::CANCEL: + return false; + + default: + ssassert(false, "Unexpected dialog response"); + } + } else { + // User was already asked to and refused to locate a missing linked file. + } + } + + for(Request &r : SK.request) { + if(r.type != Request::Type::IMAGE) continue; + + if(!ReloadLinkedImage(saveFile, &r.file, canCancel)) { + return false; + } + } + + return true; +} + +bool SolveSpaceUI::ReloadLinkedImage(const Platform::Path &saveFile, + Platform::Path *filename, bool canCancel) { + Platform::SettingsRef settings = Platform::GetSettings(); + + std::shared_ptr pixmap; + bool promptOpenFile = false; + if(filename->IsEmpty()) { + // We're prompting the user for a new image. + promptOpenFile = true; + } else { + auto image = SS.images.find(*filename); + if(image != SS.images.end()) return true; + + pixmap = Pixmap::ReadPng(*filename); + if(pixmap == NULL) { + // The file was moved; prompt the user for its new location. + switch(LocateImportedFile(filename->RelativeTo(saveFile), canCancel)) { + case Platform::MessageDialog::Response::YES: + promptOpenFile = true; + break; + + case Platform::MessageDialog::Response::NO: + // We don't know where the file is, record it as absent. + break; + + case Platform::MessageDialog::Response::CANCEL: + return false; + + default: + ssassert(false, "Unexpected dialog response"); + } + } + } + + if(promptOpenFile) { + Platform::FileDialogRef dialog = Platform::CreateOpenFileDialog(SS.GW.window); + dialog->AddFilters(Platform::RasterFileFilters); + dialog->ThawChoices(settings, "LinkImage"); + dialog->SuggestFilename(filename->RelativeTo(saveFile)); + if(dialog->RunModal()) { + dialog->FreezeChoices(settings, "LinkImage"); + *filename = dialog->GetFilename(); + pixmap = Pixmap::ReadPng(*filename); + if(pixmap == NULL) { + Error("The image '%s' is corrupted.", filename->raw.c_str()); + } + // We know where the file is now, good. + } else if(canCancel) { + return false; + } + } + + // We loaded the data, good. + SS.images[*filename] = pixmap; + return true; +} + +} // namespace SolveSpace diff --git a/src/generate.cpp b/src/generate.cpp new file mode 100644 index 0000000..4d38a52 --- /dev/null +++ b/src/generate.cpp @@ -0,0 +1,594 @@ +//----------------------------------------------------------------------------- +// Generate our model based on its parametric description, by solving each +// sketch, generating surfaces from the resulting entities, performing any +// requested surface operations (e.g. Booleans) with our model so far, and +// then repeating this process for each subsequent group. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void SolveSpaceUI::MarkGroupDirtyByEntity(hEntity he) { + Entity *e = SK.GetEntity(he); + MarkGroupDirty(e->group); +} + +void SolveSpaceUI::MarkGroupDirty(hGroup hg, bool onlyThis) { + bool go = false; + for(auto const &gh : SK.groupOrder) { + Group *g = SK.GetGroup(gh); + if(g->h == hg) { + go = true; + } + if(go) { + g->clean = false; + if(onlyThis) break; + } + } + unsaved = true; + ScheduleGenerateAll(); +} + +bool SolveSpaceUI::PruneOrphans() { + const int requests = SK.request.n; + for(Request &r : SK.request) { + if(!GroupExists(r.group)) + r.tag = 1; + } + SK.request.RemoveTagged(); + deleted.requests += requests - SK.request.n; + + const int constraints = SK.constraint.n; + for(Constraint &c : SK.constraint) { + if(!GroupExists(c.group)) + c.tag = 1; + } + SK.constraint.RemoveTagged(); + deleted.constraints += constraints - SK.constraint.n; + deleted.nonTrivialConstraints += constraints - SK.constraint.n; + + return (requests > SK.request.n) || (constraints > SK.constraint.n); +} + +bool SolveSpaceUI::GroupsInOrder(hGroup before, hGroup after) { + if(before.v == 0) return true; + if(after.v == 0) return true; + if(!GroupExists(before)) return false; + if(!GroupExists(after)) return false; + int beforep = SK.GetGroup(before)->order; + int afterp = SK.GetGroup(after)->order; + if(beforep >= afterp) return false; + return true; +} + +bool SolveSpaceUI::GroupExists(hGroup hg) { + // A nonexistent group is not acceptable + return SK.group.FindByIdNoOops(hg) ? true : false; +} +bool SolveSpaceUI::EntityExists(hEntity he) { + // A nonexstient entity is acceptable, though, usually just means it + // doesn't apply. + if(he == Entity::NO_ENTITY) return true; + return SK.entity.FindByIdNoOops(he) ? true : false; +} + +bool SolveSpaceUI::PruneGroups(hGroup hg) { + Group *g = SK.GetGroup(hg); + if(GroupsInOrder(g->opA, hg) && + EntityExists(g->predef.origin) && + EntityExists(g->predef.entityB) && + EntityExists(g->predef.entityC)) + { + return false; + } + (deleted.groups)++; + SK.group.RemoveById(g->h); + return true; +} + +bool SolveSpaceUI::PruneRequestsAndConstraints(hGroup hg) { + auto entityRequestExists = [](hEntity he, bool checkEntity = false) { + if(he == Entity::NO_ENTITY) { + return true; + } + + if(he.isFromRequest()) { + if(SK.request.FindByIdNoOops(he.request()) != nullptr) { + return true; + } + } else if(!checkEntity || SK.entity.FindByIdNoOops(he) != nullptr) { + return true; + } + + return false; + }; + + const int requests = SK.request.n; + for(Request &r : SK.request) { + if(r.group != hg) { + continue; + } + + if(entityRequestExists(r.workplane)) { + continue; + } + + r.tag = 1; + } + SK.request.RemoveTagged(); + deleted.requests += requests - SK.request.n; + + const int constraints = SK.constraint.n; + for(Constraint &c : SK.constraint) { + if(c.group != hg) + continue; + + if(entityRequestExists(c.workplane, true) && + entityRequestExists(c.ptA, true) && + entityRequestExists(c.ptB, true) && + entityRequestExists(c.entityA, true) && + entityRequestExists(c.entityB, true) && + entityRequestExists(c.entityC, true) && + entityRequestExists(c.entityD, true)) { + continue; + } + + if(c.type != Constraint::Type::POINTS_COINCIDENT && + c.type != Constraint::Type::HORIZONTAL && + c.type != Constraint::Type::VERTICAL) { + (deleted.nonTrivialConstraints)++; + } + + c.tag = 1; + } + SK.constraint.RemoveTagged(); + deleted.constraints += constraints - SK.constraint.n; + + return (requests > SK.request.n) || (constraints > SK.constraint.n); +} + +void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox) { + int first = 0, last = 0, i; + + uint64_t startMillis = GetMilliseconds(), + endMillis; + + SK.groupOrder.Clear(); + for(auto &g : SK.group) { SK.groupOrder.Add(&g.h); } + std::sort(SK.groupOrder.begin(), SK.groupOrder.end(), + [](const hGroup &ha, const hGroup &hb) { + return SK.GetGroup(ha)->order < SK.GetGroup(hb)->order; + }); + + switch(type) { + case Generate::DIRTY: { + first = INT_MAX; + last = 0; + + // Start from the first dirty group, and solve until the active group, + // since all groups after the active group are hidden. + // Not using range-for because we're tracking the indices. + for(i = 0; i < SK.groupOrder.n; i++) { + Group *g = SK.GetGroup(SK.groupOrder[i]); + if((!g->clean) || !g->IsSolvedOkay()) { + first = min(first, i); + } + if(g->h == SS.GW.activeGroup) { + last = i; + } + } + if(first == INT_MAX || last == 0) { + // All clean; so just regenerate the entities, and don't solve anything. + first = -1; + last = -1; + } else { + SS.nakedEdges.Clear(); + } + break; + } + + case Generate::ALL: + first = 0; + last = INT_MAX; + break; + + case Generate::REGEN: + first = -1; + last = -1; + break; + + case Generate::UNTIL_ACTIVE: { + for(i = 0; i < SK.groupOrder.n; i++) { + if(SK.groupOrder[i] == SS.GW.activeGroup) + break; + } + + first = 0; + last = i; + break; + } + } + + // If we're generating entities for display, first we need to find + // the bounding box to turn relative chord tolerance to absolute. + if(!SS.exportMode && !genForBBox) { + GenerateAll(type, andFindFree, /*genForBBox=*/true); + BBox box = SK.CalculateEntityBBox(/*includeInvisibles=*/true); + Vector size = box.maxp.Minus(box.minp); + double maxSize = std::max({ size.x, size.y, size.z }); + chordTolCalculated = maxSize * chordTol / 100.0; + } + + // Remove any requests or constraints that refer to a nonexistent + // group; can check those immediately, since we know what the list + // of groups should be. + PruneOrphans(); + + // Don't lose our numerical guesses when we regenerate. + ParamList prev = {}; + SK.param.MoveSelfInto(&prev); + SK.param.ReserveMore(prev.n); + int oldEntityCount = SK.entity.n; + SK.entity.Clear(); + SK.entity.ReserveMore(oldEntityCount); + + // Not using range-for because we're using the index inside the loop. + for(i = 0; i < SK.groupOrder.n; i++) { + hGroup hg = SK.groupOrder[i]; + + // The group may depend on entities or other groups, to define its + // workplane geometry or for its operands. Those must already exist + // in a previous group, so check them before generating. + if(PruneGroups(hg)) + goto pruned; + + int groupRequestIndex = 0; + for(auto &req : SK.request) { + Request *r = &req; + if(r->group != hg) continue; + r->groupRequestIndex = groupRequestIndex++; + + r->Generate(&(SK.entity), &(SK.param)); + } + for(auto &con : SK.constraint) { + Constraint *c = &con; + if(c->group != hg) continue; + + c->Generate(&(SK.param)); + } + SK.GetGroup(hg)->Generate(&(SK.entity), &(SK.param)); + + // The requests and constraints depend on stuff in this or the + // previous group, so check them after generating. + if(PruneRequestsAndConstraints(hg)) + goto pruned; + + // Use the previous values for params that we've seen before, as + // initial guesses for the solver. + for(auto &p : SK.param) { + Param *newp = &p; + if(newp->known) continue; + + Param *prevp = prev.FindByIdNoOops(newp->h); + if(prevp) { + newp->val = prevp->val; + newp->free = prevp->free; + } + } + + if(hg == Group::HGROUP_REFERENCES) { + ForceReferences(); + Group *g = SK.GetGroup(hg); + g->solved.how = SolveResult::OKAY; + g->clean = true; + } else { + // this i is an index in groupOrder + if(i >= first && i <= last) { + // The group falls inside the range, so really solve it, + // and then regenerate the mesh based on the solved stuff. + Group *g = SK.GetGroup(hg); + if(genForBBox) { + SolveGroupAndReport(hg, andFindFree); + g->GenerateLoops(); + } else { + g->GenerateShellAndMesh(); + g->clean = true; + } + } else { + // The group falls outside the range, so just assume that + // it's good wherever we left it. The mesh is unchanged, + // and the parameters must be marked as known. + for(auto &p : SK.param) { + Param *newp = &p; + + Param *prevp = prev.FindByIdNoOops(newp->h); + if(prevp) newp->known = true; + } + } + } + } + + // And update any reference dimensions with their new values + for(auto &con : SK.constraint) { + Constraint *c = &con; + if(c->reference) { + c->ModifyToSatisfy(); + } + } + + // Make sure the point that we're tracing exists. + if(traced.point.v && !SK.entity.FindByIdNoOops(traced.point)) { + traced.point = Entity::NO_ENTITY; + } + // And if we're tracing a point, add its new value to the path + if(traced.point.v) { + Entity *pt = SK.GetEntity(traced.point); + traced.path.AddPoint(pt->PointGetNum()); + } + + prev.Clear(); + GW.Invalidate(); + + // Remove nonexistent selection items, for same reason we waited till + // the end to put up a dialog box. + GW.ClearNonexistentSelectionItems(); + + if(deleted.requests > 0 || deleted.constraints > 0 || deleted.groups > 0) { + // All sorts of interesting things could have happened; for example, + // the active group or active workplane could have been deleted. So + // clear all that out. + if(deleted.groups > 0) { + SS.TW.ClearSuper(); + } + ScheduleShowTW(); + GW.ClearSuper(); + + auto deletedStat = deleted; + deleted = {}; + + // People get annoyed if I complain whenever they delete any request, + // and I otherwise will, since those always come with pt-coincident + // constraints. + if(deletedStat.requests > 0 || deletedStat.nonTrivialConstraints > 0 || + deletedStat.groups > 0) + { + // Don't display any errors until we've regenerated fully. The + // sketch is not necessarily in a consistent state until we've + // pruned any orphaned etc. objects, and the message loop for the + // messagebox could allow us to repaint and crash. But now we must + // be fine. + Message("Additional sketch elements were deleted, because they " + "depend on the element that was just deleted explicitly. " + "These include: \n" + " %d request%s\n" + " %d constraint%s\n" + " %d group%s" + "%s", + deletedStat.requests, deletedStat.requests == 1 ? "" : "s", + deletedStat.constraints, deletedStat.constraints == 1 ? "" : "s", + deletedStat.groups, deletedStat.groups == 1 ? "" : "s", + undo.cnt > 0 ? "\n\nChoose Edit -> Undo to undelete all elements." : ""); + } + } + + Platform::FreeAllTemporary(); + allConsistent = true; + SS.GW.persistentDirty = true; + SS.centerOfMass.dirty = true; + + endMillis = GetMilliseconds(); + + if(endMillis - startMillis > 30) { + const char *typeStr = ""; + switch(type) { + case Generate::DIRTY: typeStr = "DIRTY"; break; + case Generate::ALL: typeStr = "ALL"; break; + case Generate::REGEN: typeStr = "REGEN"; break; + case Generate::UNTIL_ACTIVE: typeStr = "UNTIL_ACTIVE"; break; + } + if(endMillis) + dbp("Generate::%s%s took %lld ms", + typeStr, + (genForBBox ? " (for bounding box)" : ""), + GetMilliseconds() - startMillis); + } + + return; + +pruned: + // Restore the numerical guesses + SK.param.Clear(); + prev.MoveSelfInto(&(SK.param)); + // Try again + GenerateAll(type, andFindFree, genForBBox); +} + +void SolveSpaceUI::ForceReferences() { + // Force the values of the parameters that define the three reference + // coordinate systems. + static const struct { + hRequest hr; + Quaternion q; + } Quat[] = { + { Request::HREQUEST_REFERENCE_XY, { 1, 0, 0, 0, } }, + { Request::HREQUEST_REFERENCE_YZ, { 0.5, 0.5, 0.5, 0.5, } }, + { Request::HREQUEST_REFERENCE_ZX, { 0.5, -0.5, -0.5, -0.5, } }, + }; + for(int i = 0; i < 3; i++) { + hRequest hr = Quat[i].hr; + Entity *wrkpl = SK.GetEntity(hr.entity(0)); + // The origin for our coordinate system, always zero + Entity *origin = SK.GetEntity(wrkpl->point[0]); + origin->PointForceTo(Vector::From(0, 0, 0)); + origin->construction = true; + SK.GetParam(origin->param[0])->known = true; + SK.GetParam(origin->param[1])->known = true; + SK.GetParam(origin->param[2])->known = true; + // The quaternion that defines the rotation, from the table. + Entity *normal = SK.GetEntity(wrkpl->normal); + normal->NormalForceTo(Quat[i].q); + SK.GetParam(normal->param[0])->known = true; + SK.GetParam(normal->param[1])->known = true; + SK.GetParam(normal->param[2])->known = true; + SK.GetParam(normal->param[3])->known = true; + } +} + +void SolveSpaceUI::UpdateCenterOfMass() { + SMesh *m = &(SK.GetGroup(SS.GW.activeGroup)->displayMesh); + SS.centerOfMass.position = m->GetCenterOfMass(); + SS.centerOfMass.dirty = false; +} + +void SolveSpaceUI::MarkDraggedParams() { + sys.dragged.clear(); + + for(int i = -1; i < SS.GW.pending.points.n; i++) { + hEntity hp; + if(i == -1) { + hp = SS.GW.pending.point; + } else { + hp = SS.GW.pending.points[i]; + } + if(!hp.v) continue; + + // The pending point could be one in a group that has not yet + // been processed, in which case the lookup will fail; but + // that's not an error. + Entity *pt = SK.entity.FindByIdNoOops(hp); + if(pt) { + switch(pt->type) { + case Entity::Type::POINT_N_TRANS: + case Entity::Type::POINT_IN_3D: + case Entity::Type::POINT_N_ROT_AXIS_TRANS: + sys.dragged.insert(pt->param[0]); + sys.dragged.insert(pt->param[1]); + sys.dragged.insert(pt->param[2]); + break; + + case Entity::Type::POINT_IN_2D: + sys.dragged.insert(pt->param[0]); + sys.dragged.insert(pt->param[1]); + break; + + default: // Only the entities above can be dragged. + break; + } + } + } + if(SS.GW.pending.circle.v) { + Entity *circ = SK.entity.FindByIdNoOops(SS.GW.pending.circle); + if(circ) { + Entity *dist = SK.GetEntity(circ->distance); + switch(dist->type) { + case Entity::Type::DISTANCE: + sys.dragged.insert(dist->param[0]); + break; + + default: // Only the entities above can be dragged. + break; + } + } + } + if(SS.GW.pending.normal.v) { + Entity *norm = SK.entity.FindByIdNoOops(SS.GW.pending.normal); + if(norm) { + switch(norm->type) { + case Entity::Type::NORMAL_IN_3D: + sys.dragged.insert(norm->param[0]); + sys.dragged.insert(norm->param[1]); + sys.dragged.insert(norm->param[2]); + sys.dragged.insert(norm->param[3]); + break; + + default: // Only the entities above can be dragged. + break; + } + } + } +} + +void SolveSpaceUI::SolveGroupAndReport(hGroup hg, bool andFindFree) { + SolveGroup(hg, andFindFree); + + Group *g = SK.GetGroup(hg); + bool isOkay = g->solved.how == SolveResult::OKAY || + (g->allowRedundant && g->solved.how == SolveResult::REDUNDANT_OKAY); + if(!isOkay || (isOkay && !g->IsSolvedOkay())) { + TextWindow::ReportHowGroupSolved(g->h); + } +} + +void SolveSpaceUI::WriteEqSystemForGroup(hGroup hg) { + // Clear out the system to be solved. + sys.entity.Clear(); + sys.param.Clear(); + sys.eq.Clear(); + // And generate all the params for requests in this group + for(auto &req : SK.request) { + Request *r = &req; + if(r->group != hg) continue; + + r->Generate(&(sys.entity), &(sys.param)); + } + for(auto &con : SK.constraint) { + Constraint *c = &con; + if(c->group != hg) continue; + + c->Generate(&(sys.param)); + } + // And for the group itself + Group *g = SK.GetGroup(hg); + g->Generate(&(sys.entity), &(sys.param)); + // Set the initial guesses for all the params + for(auto ¶m : sys.param) { + Param *p = ¶m; + p->known = false; + p->val = SK.GetParam(p->h)->val; + } + + MarkDraggedParams(); +} + +void SolveSpaceUI::SolveGroup(hGroup hg, bool andFindFree) { + WriteEqSystemForGroup(hg); + Group *g = SK.GetGroup(hg); + g->solved.remove.Clear(); + g->solved.findToFixTimeout = SS.timeoutRedundantConstr; + SolveResult how = sys.Solve(g, &(g->solved.dof), + &(g->solved.remove), + /*andFindBad=*/!g->allowRedundant, + /*andFindFree=*/andFindFree, + /*forceDofCheck=*/!g->dofCheckOk); + if(how == SolveResult::OKAY) { + g->dofCheckOk = true; + } + g->solved.how = how; + Platform::FreeAllTemporary(); +} + +SolveResult SolveSpaceUI::TestRankForGroup(hGroup hg, int *rank) { + Group *g = SK.GetGroup(hg); + // If we don't calculate dof or redundant is allowed, there is + // no point to solve rank because this result is not meaningful + if(g->suppressDofCalculation || g->allowRedundant) return SolveResult::OKAY; + WriteEqSystemForGroup(hg); + SolveResult result = sys.SolveRank(g, rank); + Platform::FreeAllTemporary(); + return result; +} + +bool SolveSpaceUI::ActiveGroupsOkay() { + for(int i = 0; i < SK.groupOrder.n; i++) { + Group *g = SK.GetGroup(SK.groupOrder[i]); + if(!g->IsSolvedOkay()) + return false; + if(g->h == SS.GW.activeGroup) + break; + } + return true; +} + +} // namespace SolveSpace diff --git a/src/graphicswin.cpp b/src/graphicswin.cpp new file mode 100644 index 0000000..98ceb73 --- /dev/null +++ b/src/graphicswin.cpp @@ -0,0 +1,1481 @@ +//----------------------------------------------------------------------------- +// Top-level implementation of the program's main window, in which a graphical +// representation of the model is drawn and edited by the user. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +typedef void MenuHandler(Command id); +using MenuKind = Platform::MenuItem::Indicator; +struct MenuEntry { + int level; // 0 == on menu bar, 1 == one level down + const char *label; // or NULL for a separator + Command cmd; // command ID + int accel; // keyboard accelerator + MenuKind kind; + MenuHandler *fn; +}; + +#define mView (&GraphicsWindow::MenuView) +#define mEdit (&GraphicsWindow::MenuEdit) +#define mClip (&GraphicsWindow::MenuClipboard) +#define mReq (&GraphicsWindow::MenuRequest) +#define mCon (&Constraint::MenuConstrain) +#define mFile (&SolveSpaceUI::MenuFile) +#define mGrp (&Group::MenuGroup) +#define mAna (&SolveSpaceUI::MenuAnalyze) +#define mHelp (&SolveSpaceUI::MenuHelp) +#define SHIFT_MASK 0x100 +#define CTRL_MASK 0x200 +#define FN_MASK 0x400 + +#define S SHIFT_MASK +#define C CTRL_MASK +#define F FN_MASK +#define KN MenuKind::NONE +#define KC MenuKind::CHECK_MARK +#define KR MenuKind::RADIO_MARK +const MenuEntry Menu[] = { +//lv label cmd accel kind +{ 0, N_("&File"), Command::NONE, 0, KN, NULL }, +{ 1, N_("&New"), Command::NEW, C|'n', KN, mFile }, +{ 1, N_("&Open..."), Command::OPEN, C|'o', KN, mFile }, +{ 1, N_("Open &Recent"), Command::OPEN_RECENT, 0, KN, mFile }, +{ 1, N_("&Save"), Command::SAVE, C|'s', KN, mFile }, +{ 1, N_("Save &As..."), Command::SAVE_AS, C|S|'s', KN, mFile }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Export &Image..."), Command::EXPORT_IMAGE, 0, KN, mFile }, +{ 1, N_("Export 2d &View..."), Command::EXPORT_VIEW, 0, KN, mFile }, +{ 1, N_("Export 2d &Section..."), Command::EXPORT_SECTION, 0, KN, mFile }, +{ 1, N_("Export 3d &Wireframe..."), Command::EXPORT_WIREFRAME, 0, KN, mFile }, +{ 1, N_("Export Triangle &Mesh..."), Command::EXPORT_MESH, 0, KN, mFile }, +{ 1, N_("Export &Surfaces..."), Command::EXPORT_SURFACES, 0, KN, mFile }, +{ 1, N_("Im&port..."), Command::IMPORT, 0, KN, mFile }, +#ifndef __APPLE__ +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("E&xit"), Command::EXIT, C|'q', KN, mFile }, +#endif + +{ 0, N_("&Edit"), Command::NONE, 0, KN, NULL }, +{ 1, N_("&Undo"), Command::UNDO, C|'z', KN, mEdit }, +{ 1, N_("&Redo"), Command::REDO, C|'y', KN, mEdit }, +{ 1, N_("Re&generate All"), Command::REGEN_ALL, ' ', KN, mEdit }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Snap Selection to &Grid"), Command::SNAP_TO_GRID, '.', KN, mEdit }, +{ 1, N_("Rotate Imported &90°"), Command::ROTATE_90, '9', KN, mEdit }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Cu&t"), Command::CUT, C|'x', KN, mClip }, +{ 1, N_("&Copy"), Command::COPY, C|'c', KN, mClip }, +{ 1, N_("&Paste"), Command::PASTE, C|'v', KN, mClip }, +{ 1, N_("Paste &Transformed..."), Command::PASTE_TRANSFORM, C|'t', KN, mClip }, +{ 1, N_("&Delete"), Command::DELETE, '\x7f', KN, mClip }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Select &Edge Chain"), Command::SELECT_CHAIN, C|'e', KN, mEdit }, +{ 1, N_("Select &All"), Command::SELECT_ALL, C|'a', KN, mEdit }, +{ 1, N_("&Unselect All"), Command::UNSELECT_ALL, '\x1b', KN, mEdit }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("&Line Styles..."), Command::EDIT_LINE_STYLES, 0, KN, mEdit }, +{ 1, N_("&View Projection..."), Command::VIEW_PROJECTION, 0, KN, mEdit }, +#ifndef __APPLE__ +{ 1, N_("Con&figuration..."), Command::CONFIGURATION, 0, KN, mEdit }, +#endif + +{ 0, N_("&View"), Command::NONE, 0, KN, mView }, +{ 1, N_("Zoom &In"), Command::ZOOM_IN, '+', KN, mView }, +{ 1, N_("Zoom &Out"), Command::ZOOM_OUT, '-', KN, mView }, +{ 1, N_("Zoom To &Fit"), Command::ZOOM_TO_FIT, 'f', KN, mView }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Align View to &Workplane"), Command::ONTO_WORKPLANE, 'w', KN, mView }, +{ 1, N_("Nearest &Ortho View"), Command::NEAREST_ORTHO, F|2, KN, mView }, +{ 1, N_("Nearest &Isometric View"), Command::NEAREST_ISO, F|3, KN, mView }, +{ 1, N_("&Center View At Point"), Command::CENTER_VIEW, F|4, KN, mView }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Show Snap &Grid"), Command::SHOW_GRID, '>', KC, mView }, +{ 1, N_("Darken Inactive Solids"), Command::DIM_SOLID_MODEL, 0, KC, mView }, +{ 1, N_("Use &Perspective Projection"), Command::PERSPECTIVE_PROJ, '`', KC, mView }, +{ 1, N_("Show E&xploded View"), Command::EXPLODE_SKETCH, '\\', KC, mView }, +{ 1, N_("Dimension &Units"), Command::NONE, 0, KN, NULL }, +{ 2, N_("Dimensions in &Millimeters"), Command::UNITS_MM, 0, KR, mView }, +{ 2, N_("Dimensions in M&eters"), Command::UNITS_METERS, 0, KR, mView }, +{ 2, N_("Dimensions in &Inches"), Command::UNITS_INCHES, 0, KR, mView }, +{ 2, N_("Dimensions in &Feet and Inches"), Command::UNITS_FEET_INCHES, 0, KR, mView }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Show &Toolbar"), Command::SHOW_TOOLBAR, C|'\t', KC, mView }, +{ 1, N_("Show Property Bro&wser"), Command::SHOW_TEXT_WND, '\t', KC, mView }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("&Full Screen"), Command::FULL_SCREEN, C|F|11, KC, mView }, + +{ 0, N_("&New Group"), Command::NONE, 0, KN, mGrp }, +{ 1, N_("Sketch In &3d"), Command::GROUP_3D, S|'3', KN, mGrp }, +{ 1, N_("Sketch In New &Workplane"), Command::GROUP_WRKPL, S|'w', KN, mGrp }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Step &Translating"), Command::GROUP_TRANS, S|'t', KN, mGrp }, +{ 1, N_("Step &Rotating"), Command::GROUP_ROT, S|'r', KN, mGrp }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("E&xtrude"), Command::GROUP_EXTRUDE, S|'x', KN, mGrp }, +{ 1, N_("&Helix"), Command::GROUP_HELIX, S|'h', KN, mGrp }, +{ 1, N_("&Lathe"), Command::GROUP_LATHE, S|'l', KN, mGrp }, +{ 1, N_("Re&volve"), Command::GROUP_REVOLVE, S|'v', KN, mGrp }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Link / Assemble..."), Command::GROUP_LINK, S|'i', KN, mGrp }, +{ 1, N_("Link Recent"), Command::GROUP_RECENT, 0, KN, mGrp }, + +{ 0, N_("&Sketch"), Command::NONE, 0, KN, mReq }, +{ 1, N_("In &Workplane"), Command::SEL_WORKPLANE, '2', KR, mReq }, +{ 1, N_("Anywhere In &3d"), Command::FREE_IN_3D, '3', KR, mReq }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Datum &Point"), Command::DATUM_POINT, 'p', KN, mReq }, +{ 1, N_("Wor&kplane"), Command::WORKPLANE, 0, KN, mReq }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Line &Segment"), Command::LINE_SEGMENT, 's', KN, mReq }, +{ 1, N_("C&onstruction Line Segment"), Command::CONSTR_SEGMENT, S|'s', KN, mReq }, +{ 1, N_("&Rectangle"), Command::RECTANGLE, 'r', KN, mReq }, +{ 1, N_("&Circle"), Command::CIRCLE, 'c', KN, mReq }, +{ 1, N_("&Arc of a Circle"), Command::ARC, 'a', KN, mReq }, +{ 1, N_("&Bezier Cubic Spline"), Command::CUBIC, 'b', KN, mReq }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("&Text in TrueType Font"), Command::TTF_TEXT, 't', KN, mReq }, +{ 1, N_("I&mage"), Command::IMAGE, 0, KN, mReq }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("To&ggle Construction"), Command::CONSTRUCTION, 'g', KN, mReq }, +{ 1, N_("Ta&ngent Arc at Point"), Command::TANGENT_ARC, S|'a', KN, mReq }, +{ 1, N_("Split Curves at &Intersection"), Command::SPLIT_CURVES, 'i', KN, mReq }, + +{ 0, N_("&Constrain"), Command::NONE, 0, KN, mCon }, +{ 1, N_("&Distance / Diameter"), Command::DISTANCE_DIA, 'd', KN, mCon }, +{ 1, N_("Re&ference Dimension"), Command::REF_DISTANCE, S|'d', KN, mCon }, +{ 1, N_("A&ngle / Equal Angle"), Command::ANGLE, 'n', KN, mCon }, +{ 1, N_("Reference An&gle"), Command::REF_ANGLE, S|'n', KN, mCon }, +{ 1, N_("Other S&upplementary Angle"), Command::OTHER_ANGLE, 'u', KN, mCon }, +{ 1, N_("Toggle R&eference Dim"), Command::REFERENCE, 'e', KN, mCon }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("&Horizontal"), Command::HORIZONTAL, 'h', KN, mCon }, +{ 1, N_("&Vertical"), Command::VERTICAL, 'v', KN, mCon }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("&On Point / Curve / Plane"), Command::ON_ENTITY, 'o', KN, mCon }, +{ 1, N_("E&qual Length / Radius"), Command::EQUAL, 'q', KN, mCon }, +{ 1, N_("Length / Arc Ra&tio"), Command::RATIO, 'z', KN, mCon }, +{ 1, N_("Length / Arc Diff&erence"), Command::DIFFERENCE, 'j', KN, mCon }, +{ 1, N_("At &Midpoint"), Command::AT_MIDPOINT, 'm', KN, mCon }, +{ 1, N_("S&ymmetric"), Command::SYMMETRIC, 'y', KN, mCon }, +{ 1, N_("Para&llel / Tangent"), Command::PARALLEL, 'l', KN, mCon }, +{ 1, N_("&Perpendicular"), Command::PERPENDICULAR, '[', KN, mCon }, +{ 1, N_("Same Orient&ation"), Command::ORIENTED_SAME, 'x', KN, mCon }, +{ 1, N_("Lock Point Where &Dragged"), Command::WHERE_DRAGGED, ']', KN, mCon }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Comment"), Command::COMMENT, ';', KN, mCon }, + +{ 0, N_("&Analyze"), Command::NONE, 0, KN, mAna }, +{ 1, N_("Measure &Volume"), Command::VOLUME, C|S|'v', KN, mAna }, +{ 1, N_("Measure A&rea"), Command::AREA, C|S|'a', KN, mAna }, +{ 1, N_("Measure &Perimeter"), Command::PERIMETER, C|S|'p', KN, mAna }, +{ 1, N_("Show &Interfering Parts"), Command::INTERFERENCE, C|S|'i', KN, mAna }, +{ 1, N_("Show &Naked Edges"), Command::NAKED_EDGES, C|S|'n', KN, mAna }, +{ 1, N_("Show &Center of Mass"), Command::CENTER_OF_MASS, C|S|'c', KN, mAna }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("Show &Underconstrained Points"), Command::SHOW_DOF, C|S|'f', KN, mAna }, +{ 1, NULL, Command::NONE, 0, KN, NULL }, +{ 1, N_("&Trace Point"), Command::TRACE_PT, C|S|'t', KN, mAna }, +{ 1, N_("&Stop Tracing..."), Command::STOP_TRACING, C|S|'s', KN, mAna }, +{ 1, N_("Step &Dimension..."), Command::STEP_DIM, C|S|'d', KN, mAna }, + +{ 0, N_("&Help"), Command::NONE, 0, KN, mHelp }, +{ 1, N_("&Language"), Command::LOCALE, 0, KN, mHelp }, +{ 1, N_("&Website / Manual"), Command::WEBSITE, 0, KN, mHelp }, +{ 1, N_("&Go to GitHub commit"), Command::GITHUB, 0, KN, mHelp }, +#ifndef __APPLE__ +{ 1, N_("&About"), Command::ABOUT, 0, KN, mHelp }, +#endif +{ -1, 0, Command::NONE, 0, KN, NULL } +}; +#undef S +#undef C +#undef F +#undef KN +#undef KC +#undef KR + +void GraphicsWindow::ActivateCommand(Command cmd) { + for(int i = 0; Menu[i].level >= 0; i++) { + if(cmd == Menu[i].cmd) { + (Menu[i].fn)((Command)Menu[i].cmd); + break; + } + } +} + +Platform::KeyboardEvent GraphicsWindow::AcceleratorForCommand(Command cmd) { + int rawAccel = 0; + for(int i = 0; Menu[i].level >= 0; i++) { + if(cmd == Menu[i].cmd) { + rawAccel = Menu[i].accel; + break; + } + } + + Platform::KeyboardEvent accel = {}; + accel.type = Platform::KeyboardEvent::Type::PRESS; + if(rawAccel & SHIFT_MASK) { + accel.shiftDown = true; + } + if(rawAccel & CTRL_MASK) { + accel.controlDown = true; + } + if(rawAccel & FN_MASK) { + accel.key = Platform::KeyboardEvent::Key::FUNCTION; + accel.num = rawAccel & 0xff; + } else { + accel.key = Platform::KeyboardEvent::Key::CHARACTER; + accel.chr = (char)(rawAccel & 0xff); + } + + return accel; +} + +bool GraphicsWindow::KeyboardEvent(Platform::KeyboardEvent event) { + using Platform::KeyboardEvent; + + if(event.type == KeyboardEvent::Type::RELEASE) + return true; + + if(event.key == KeyboardEvent::Key::CHARACTER) { + if(event.chr == '\b') { + // Treat backspace identically to escape. + MenuEdit(Command::UNSELECT_ALL); + return true; + } else if(event.chr == '=') { + // Treat = as +. This is specific to US (and US-compatible) keyboard layouts, + // but makes zooming from keyboard much more usable on these. + // Ideally we'd have a platform-independent way of binding to a particular + // physical key regardless of shift status... + MenuView(Command::ZOOM_IN); + return true; + } + } + + // On some platforms, the OS does not handle some or all keyboard accelerators, + // so handle them here. + for(int i = 0; Menu[i].level >= 0; i++) { + if(AcceleratorForCommand(Menu[i].cmd).Equals(event)) { + ActivateCommand(Menu[i].cmd); + return true; + } + } + + return false; +} + +void GraphicsWindow::PopulateMainMenu() { + bool unique = false; + Platform::MenuBarRef mainMenu = Platform::GetOrCreateMainMenu(&unique); + if(unique) mainMenu->Clear(); + + Platform::MenuRef currentSubMenu; + std::vector subMenuStack; + for(int i = 0; Menu[i].level >= 0; i++) { + while(Menu[i].level > 0 && Menu[i].level <= (int)subMenuStack.size()) { + currentSubMenu = subMenuStack.back(); + subMenuStack.pop_back(); + } + + if(Menu[i].label == NULL) { + currentSubMenu->AddSeparator(); + continue; + } + + std::string label = Translate(Menu[i].label); + if(Menu[i].level == 0) { + currentSubMenu = mainMenu->AddSubMenu(label); + } else if(Menu[i].cmd == Command::OPEN_RECENT) { + openRecentMenu = currentSubMenu->AddSubMenu(label); + } else if(Menu[i].cmd == Command::GROUP_RECENT) { + linkRecentMenu = currentSubMenu->AddSubMenu(label); + } else if(Menu[i].cmd == Command::LOCALE) { + Platform::MenuRef localeMenu = currentSubMenu->AddSubMenu(label); + for(const Locale &locale : Locales()) { + localeMenu->AddItem(locale.displayName, [&]() { + SetLocale(locale.Culture()); + Platform::GetSettings()->FreezeString("Locale", locale.Culture()); + + SS.UpdateWindowTitles(); + PopulateMainMenu(); + SS.GW.EnsureValidActives(); + }); + } + } else if(Menu[i].fn == NULL) { + subMenuStack.push_back(currentSubMenu); + currentSubMenu = currentSubMenu->AddSubMenu(label); + } else { + Platform::MenuItemRef menuItem = currentSubMenu->AddItem(label); + menuItem->SetIndicator(Menu[i].kind); + if(Menu[i].accel != 0) { + menuItem->SetAccelerator(AcceleratorForCommand(Menu[i].cmd)); + } + menuItem->onTrigger = std::bind(Menu[i].fn, Menu[i].cmd); + + if(Menu[i].cmd == Command::SHOW_GRID) { + showGridMenuItem = menuItem; + } else if(Menu[i].cmd == Command::DIM_SOLID_MODEL) { + dimSolidModelMenuItem = menuItem; + } else if(Menu[i].cmd == Command::PERSPECTIVE_PROJ) { + perspectiveProjMenuItem = menuItem; + } else if(Menu[i].cmd == Command::EXPLODE_SKETCH) { + explodeMenuItem = menuItem; + } else if(Menu[i].cmd == Command::SHOW_TOOLBAR) { + showToolbarMenuItem = menuItem; + } else if(Menu[i].cmd == Command::SHOW_TEXT_WND) { + showTextWndMenuItem = menuItem; + } else if(Menu[i].cmd == Command::FULL_SCREEN) { + fullScreenMenuItem = menuItem; + } else if(Menu[i].cmd == Command::UNITS_MM) { + unitsMmMenuItem = menuItem; + } else if(Menu[i].cmd == Command::UNITS_METERS) { + unitsMetersMenuItem = menuItem; + } else if(Menu[i].cmd == Command::UNITS_INCHES) { + unitsInchesMenuItem = menuItem; + } else if(Menu[i].cmd == Command::UNITS_FEET_INCHES) { + unitsFeetInchesMenuItem = menuItem; + } else if(Menu[i].cmd == Command::SEL_WORKPLANE) { + inWorkplaneMenuItem = menuItem; + } else if(Menu[i].cmd == Command::FREE_IN_3D) { + in3dMenuItem = menuItem; + } else if(Menu[i].cmd == Command::UNDO) { + undoMenuItem = menuItem; + } else if(Menu[i].cmd == Command::REDO) { + redoMenuItem = menuItem; + } + } + } + + PopulateRecentFiles(); + SS.UndoEnableMenus(); + + window->SetMenuBar(mainMenu); +} + +static void PopulateMenuWithPathnames(Platform::MenuRef menu, + std::vector pathnames, + std::function onTrigger) { + menu->Clear(); + if(pathnames.empty()) { + Platform::MenuItemRef menuItem = menu->AddItem(_("(no recent files)")); + menuItem->SetEnabled(false); + } else { + for(Platform::Path pathname : pathnames) { + Platform::MenuItemRef menuItem = menu->AddItem(pathname.raw, [=]() { + if(FileExists(pathname)) { + onTrigger(pathname); + } else { + Error(_("File '%s' does not exist."), pathname.raw.c_str()); + } + }, /*mnemonics=*/false); + } + } +} + +void GraphicsWindow::PopulateRecentFiles() { + PopulateMenuWithPathnames(openRecentMenu, SS.recentFiles, [](const Platform::Path &path) { + // OkayToStartNewFile could mutate recentFiles, which will invalidate path (which is a + // reference into the recentFiles vector), so take a copy of it here. + Platform::Path pathCopy(path); + if(!SS.OkayToStartNewFile()) return; + SS.Load(pathCopy); + }); + + PopulateMenuWithPathnames(linkRecentMenu, SS.recentFiles, [](const Platform::Path &path) { + Group::MenuGroup(Command::GROUP_LINK, path); + }); +} + +void GraphicsWindow::Init() { + scale = 5; + offset = Vector::From(0, 0, 0); + projRight = Vector::From(1, 0, 0); + projUp = Vector::From(0, 1, 0); + + // Make sure those are valid; could get a mouse move without a mouse + // down if someone depresses the button, then drags into our window. + orig.projRight = projRight; + orig.projUp = projUp; + + // And with the last group active + ssassert(!SK.groupOrder.IsEmpty(), + "Group order can't be empty since we will activate the last group."); + activeGroup = *SK.groupOrder.Last(); + SK.GetGroup(activeGroup)->Activate(); + + showWorkplanes = false; + showNormals = true; + showPoints = true; + showConstruction = true; + showConstraints = ShowConstraintMode::SCM_SHOW_ALL; + showShaded = true; + showEdges = true; + showMesh = false; + showOutlines = false; + showFacesDrawing = false; + showFacesNonDrawing = true; + drawOccludedAs = DrawOccludedAs::INVISIBLE; + + showTextWindow = true; + + showSnapGrid = false; + dimSolidModel = true; + context.active = false; + toolbarHovered = Command::NONE; + + if(!window) { + window = Platform::CreateWindow(); + if(window) { + using namespace std::placeholders; + // Do this first, so that if it causes an onRender event we don't try to paint without + // a canvas. + window->SetMinContentSize(720, /*ToolbarDrawOrHitTest 636*/ 32 * 18 + 3 * 16 + 8 + 4); + window->onClose = std::bind(&SolveSpaceUI::MenuFile, Command::EXIT); + window->onContextLost = [&] { + canvas = NULL; + persistentCanvas = NULL; + persistentDirty = true; + }; + window->onRender = std::bind(&GraphicsWindow::Paint, this); + window->onKeyboardEvent = std::bind(&GraphicsWindow::KeyboardEvent, this, _1); + window->onMouseEvent = std::bind(&GraphicsWindow::MouseEvent, this, _1); + window->onSixDofEvent = std::bind(&GraphicsWindow::SixDofEvent, this, _1); + window->onEditingDone = std::bind(&GraphicsWindow::EditControlDone, this, _1); + PopulateMainMenu(); + } + } + + if(window) { + canvas = CreateRenderer(); + if(canvas) { + persistentCanvas = canvas->CreateBatch(); + persistentDirty = true; + } + } + + // Do this last, so that all the menus get updated correctly. + ClearSuper(); +} + +void GraphicsWindow::AnimateOntoWorkplane() { + if(!LockedInWorkplane()) return; + + Entity *w = SK.GetEntity(ActiveWorkplane()); + Quaternion quatf = w->Normal()->NormalGetNum(); + + // Get Z pointing vertical, if we're on turntable nav mode: + if(SS.turntableNav) { + Vector normalRight = quatf.RotationU(); + Vector normalUp = quatf.RotationV(); + Vector normal = normalRight.Cross(normalUp); + if(normalRight.z != 0) { + double theta = atan2(normalUp.z, normalRight.z); + theta -= atan2(1, 0); + normalRight = normalRight.RotatedAbout(normal, theta); + normalUp = normalUp.RotatedAbout(normal, theta); + quatf = Quaternion::From(normalRight, normalUp); + } + } + + Vector offsetf = (SK.GetEntity(w->point[0])->PointGetNum()).ScaledBy(-1); + + // If the view screen is open, then we need to refresh it. + SS.ScheduleShowTW(); + + AnimateOnto(quatf, offsetf); +} + +void GraphicsWindow::AnimateOnto(Quaternion quatf, Vector offsetf) { + // Get our initial orientation and translation. + Quaternion quat0 = Quaternion::From(projRight, projUp); + Vector offset0 = offset; + + // Make sure we take the shorter of the two possible paths. + double mp = (quatf.Minus(quat0)).Magnitude(); + double mm = (quatf.Plus(quat0)).Magnitude(); + if(mp > mm) { + quatf = quatf.ScaledBy(-1); + mp = mm; + } + double mo = (offset0.Minus(offsetf)).Magnitude()*scale; + + // Animate transition, unless it's a tiny move. + int64_t t0 = GetMilliseconds(); + int32_t dt = (mp < 0.01 && mo < 10) ? 0 : + (int32_t)(SS.animationSpeed*0.75*mp + SS.animationSpeed*0.0005*mo); + // Apply a minimum animation time, for small moves. This gets overridden by the maximum setting + // so setting the animation speed to 0 disables animations entirely. + dt = std::max(dt, 100 /* ms */); + // Don't ever animate for longer than animationSpeed ms; we can get absurdly + // long translations (as measured in pixels) if the user zooms out, moves, + // and then zooms in again. + dt = std::min(dt, SS.animationSpeed); + // If the resulting animation time is very short, disable it completely. + if (dt < 10) dt = -20; + + Quaternion dq = quatf.Times(quat0.Inverse()); + + if(!animateTimer) { + animateTimer = Platform::CreateTimer(); + } + animateTimer->onTimeout = [=] { + int64_t tn = GetMilliseconds(); + if((tn - t0) < dt) { + animateTimer->RunAfterNextFrame(); + + double s = (tn - t0)/((double)dt); + offset = (offset0.ScaledBy(1 - s)).Plus(offsetf.ScaledBy(s)); + Quaternion quat = (dq.ToThe(s)).Times(quat0).WithMagnitude(1); + + projRight = quat.RotationU(); + projUp = quat.RotationV(); + } else { + projRight = quatf.RotationU(); + projUp = quatf.RotationV(); + offset = offsetf; + } + window->Invalidate(); + }; + animateTimer->RunAfterNextFrame(); +} + +void GraphicsWindow::HandlePointForZoomToFit(Vector p, Point2d *pmax, Point2d *pmin, + double *wmin, bool usePerspective, + const Camera &camera) +{ + double w; + Vector pp = camera.ProjectPoint4(p, &w); + // If usePerspective is true, then we calculate a perspective projection of the point. + // If not, then we do a parallel projection regardless of the current + // scale factor. + if(usePerspective) { + pp = pp.ScaledBy(1.0/w); + } + + pmax->x = max(pmax->x, pp.x); + pmax->y = max(pmax->y, pp.y); + pmin->x = min(pmin->x, pp.x); + pmin->y = min(pmin->y, pp.y); + *wmin = min(*wmin, w); +} +void GraphicsWindow::LoopOverPoints(const std::vector &entities, + const std::vector &constraints, + const std::vector &faces, + Point2d *pmax, Point2d *pmin, double *wmin, + bool usePerspective, bool includeMesh, + const Camera &camera) { + + for(Entity *e : entities) { + if(e->IsPoint()) { + HandlePointForZoomToFit(e->PointGetNum(), pmax, pmin, wmin, usePerspective, camera); + } else if(e->type == Entity::Type::CIRCLE) { + // Lots of entities can extend outside the bbox of their points, + // but circles are particularly bad. We want to get things halfway + // reasonable without the mesh, because a zoom to fit is used to + // set the zoom level to set the chord tol. + double r = e->CircleGetRadiusNum(); + Vector c = SK.GetEntity(e->point[0])->PointGetNum(); + Quaternion q = SK.GetEntity(e->normal)->NormalGetNum(); + for(int j = 0; j < 4; j++) { + Vector p = (j == 0) ? (c.Plus(q.RotationU().ScaledBy( r))) : + (j == 1) ? (c.Plus(q.RotationU().ScaledBy(-r))) : + (j == 2) ? (c.Plus(q.RotationV().ScaledBy( r))) : + (c.Plus(q.RotationV().ScaledBy(-r))); + HandlePointForZoomToFit(p, pmax, pmin, wmin, usePerspective, camera); + } + } else { + // We have to iterate children points, because we can select entities without points + for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) { + if(e->point[i].v == 0) break; + Vector p = SK.GetEntity(e->point[i])->PointGetNum(); + HandlePointForZoomToFit(p, pmax, pmin, wmin, usePerspective, camera); + } + } + } + + for(Constraint *c : constraints) { + std::vector refs; + c->GetReferencePoints(camera, &refs); + for(const Vector &p : refs) { + HandlePointForZoomToFit(p, pmax, pmin, wmin, usePerspective, camera); + } + } + + if(!includeMesh && faces.empty()) return; + + Group *g = SK.GetGroup(activeGroup); + g->GenerateDisplayItems(); + for(int i = 0; i < g->displayMesh.l.n; i++) { + STriangle *tr = &(g->displayMesh.l[i]); + if(!includeMesh) { + bool found = false; + for(const hEntity &face : faces) { + if(face.v != tr->meta.face) continue; + found = true; + break; + } + if(!found) continue; + } + HandlePointForZoomToFit(tr->a, pmax, pmin, wmin, usePerspective, camera); + HandlePointForZoomToFit(tr->b, pmax, pmin, wmin, usePerspective, camera); + HandlePointForZoomToFit(tr->c, pmax, pmin, wmin, usePerspective, camera); + } + if(!includeMesh) return; + for(int i = 0; i < g->polyLoops.l.n; i++) { + SContour *sc = &(g->polyLoops.l[i]); + for(int j = 0; j < sc->l.n; j++) { + HandlePointForZoomToFit(sc->l[j].p, pmax, pmin, wmin, usePerspective, camera); + } + } +} +void GraphicsWindow::ZoomToFit(bool includingInvisibles, bool useSelection) { + if(!window) return; + + scale = ZoomToFit(GetCamera(), includingInvisibles, useSelection); +} +double GraphicsWindow::ZoomToFit(const Camera &camera, + bool includingInvisibles, bool useSelection) { + std::vector entities; + std::vector constraints; + std::vector faces; + + if(useSelection) { + for(int i = 0; i < selection.n; i++) { + Selection *s = &selection[i]; + if(s->entity.v != 0) { + Entity *e = SK.entity.FindById(s->entity); + if(e->IsFace()) { + faces.push_back(e->h); + continue; + } + entities.push_back(e); + } + if(s->constraint.v != 0) { + Constraint *c = SK.constraint.FindById(s->constraint); + constraints.push_back(c); + } + } + } + + bool selectionUsed = !entities.empty() || !constraints.empty() || !faces.empty(); + + if(!selectionUsed) { + for(Entity &e : SK.entity) { + // we don't want to handle separate points, because we will iterate them inside entities. + if(e.IsPoint()) continue; + if(!includingInvisibles && !e.IsVisible()) continue; + entities.push_back(&e); + } + + for(Constraint &c : SK.constraint) { + if(!c.IsVisible()) continue; + constraints.push_back(&c); + } + } + + // On the first run, ignore perspective. + Point2d pmax = { -1e12, -1e12 }, pmin = { 1e12, 1e12 }; + double wmin = 1; + LoopOverPoints(entities, constraints, faces, &pmax, &pmin, &wmin, + /*usePerspective=*/false, /*includeMesh=*/!selectionUsed, + camera); + + double xm = (pmax.x + pmin.x)/2, ym = (pmax.y + pmin.y)/2; + double dx = pmax.x - pmin.x, dy = pmax.y - pmin.y; + + offset = offset.Plus(projRight.ScaledBy(-xm)).Plus( + projUp. ScaledBy(-ym)); + + // And based on this, we calculate the scale and offset + double scale; + if(EXACT(dx == 0 && dy == 0)) { + scale = 5; + } else { + double scalex = 1e12, scaley = 1e12; + if(EXACT(dx != 0)) scalex = 0.9*camera.width /dx; + if(EXACT(dy != 0)) scaley = 0.9*camera.height/dy; + scale = min(scalex, scaley); + + scale = min(300.0, scale); + scale = max(0.003, scale); + } + + // Then do another run, considering the perspective. + pmax.x = -1e12; pmax.y = -1e12; + pmin.x = 1e12; pmin.y = 1e12; + wmin = 1; + LoopOverPoints(entities, constraints, faces, &pmax, &pmin, &wmin, + /*usePerspective=*/true, /*includeMesh=*/!selectionUsed, + camera); + + // Adjust the scale so that no points are behind the camera + if(wmin < 0.1) { + double k = camera.tangent; + // w = 1+k*scale*z + double zmin = (wmin - 1)/(k*scale); + // 0.1 = 1 + k*scale*zmin + // (0.1 - 1)/(k*zmin) = scale + scale = min(scale, (0.1 - 1)/(k*zmin)); + } + + return scale; +} + + +void GraphicsWindow::ZoomToMouse(double zoomMultiplyer) { + double offsetRight = offset.Dot(projRight); + double offsetUp = offset.Dot(projUp); + + double width, height; + window->GetContentSize(&width, &height); + + double righti = currentMousePosition.x / scale - offsetRight; + double upi = currentMousePosition.y / scale - offsetUp; + + // zoomMultiplyer of 1 gives a default zoom factor of 1.2x: zoomMultiplyer * 1.2 + // zoom = adjusted zoom negative zoomMultiplyer will zoom out, positive will zoom in + // + + scale *= exp(0.1823216 * zoomMultiplyer); // ln(1.2) = 0.1823216 + + double rightf = currentMousePosition.x / scale - offsetRight; + double upf = currentMousePosition.y / scale - offsetUp; + + offset = offset.Plus(projRight.ScaledBy(rightf - righti)); + offset = offset.Plus(projUp.ScaledBy(upf - upi)); + + if(SS.TW.shown.screen == TextWindow::Screen::EDIT_VIEW) { + if(havePainted) { + SS.ScheduleShowTW(); + } + } + havePainted = false; + Invalidate(); +} + + +void GraphicsWindow::MenuView(Command id) { + switch(id) { + case Command::ZOOM_IN: + SS.GW.ZoomToMouse(1); + break; + + case Command::ZOOM_OUT: + SS.GW.ZoomToMouse(-1); + break; + + case Command::ZOOM_TO_FIT: + SS.GW.ZoomToFit(/*includingInvisibles=*/false, /*useSelection=*/true); + SS.ScheduleShowTW(); + break; + + case Command::SHOW_GRID: + SS.GW.showSnapGrid = !SS.GW.showSnapGrid; + SS.GW.EnsureValidActives(); + SS.GW.Invalidate(); + if(SS.GW.showSnapGrid && !SS.GW.LockedInWorkplane()) { + Message(_("No workplane is active, so the grid will not appear.")); + } + break; + + case Command::DIM_SOLID_MODEL: + SS.GW.dimSolidModel = !SS.GW.dimSolidModel; + SS.GW.EnsureValidActives(); + SS.GW.Invalidate(/*clearPersistent=*/true); + break; + + case Command::PERSPECTIVE_PROJ: + SS.usePerspectiveProj = !SS.usePerspectiveProj; + SS.GW.EnsureValidActives(); + SS.GW.Invalidate(); + if(SS.cameraTangent < 1e-6) { + Error(_("The perspective factor is set to zero, so the view will " + "always be a parallel projection.\n\n" + "For a perspective projection, modify the perspective " + "factor in the configuration screen. A value around 0.3 " + "is typical.")); + } + break; + + case Command::EXPLODE_SKETCH: + SS.explode = !SS.explode; + SS.GW.EnsureValidActives(); + SS.MarkGroupDirty(SS.GW.activeGroup, true); + break; + + case Command::ONTO_WORKPLANE: + if(SS.GW.LockedInWorkplane()) { + SS.GW.AnimateOntoWorkplane(); + break; + } // if not in 2d mode use ORTHO logic + // fallthrough + case Command::NEAREST_ORTHO: + case Command::NEAREST_ISO: { + static const Vector ortho[3] = { + Vector::From(1, 0, 0), + Vector::From(0, 1, 0), + Vector::From(0, 0, 1) + }; + double sqrt2 = sqrt(2.0), sqrt6 = sqrt(6.0); + Quaternion quat0 = Quaternion::From(SS.GW.projRight, SS.GW.projUp); + Quaternion quatf = quat0; + double dmin = 1e10; + + // There are 24 possible views (3*2*2*2), if all are + // allowed. If the user is in turn-table mode, the + // isometric view must have the z-axis facing up, leaving + // 8 possible views (2*1*2*2). + + bool require_turntable = (id==Command::NEAREST_ISO && SS.turntableNav); + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 3; j++) { + if(i == j) continue; + if(require_turntable && (j!=2)) continue; + for(int negi = 0; negi < 2; negi++) { + for(int negj = 0; negj < 2; negj++) { + Vector ou = ortho[i], ov = ortho[j]; + if(negi) ou = ou.ScaledBy(-1); + if(negj) ov = ov.ScaledBy(-1); + Vector on = ou.Cross(ov); + + Vector u, v; + if(id == Command::NEAREST_ORTHO || id == Command::ONTO_WORKPLANE) { + u = ou; + v = ov; + } else { + u = + ou.ScaledBy(1/sqrt2).Plus( + on.ScaledBy(-1/sqrt2)); + v = + ou.ScaledBy(-1/sqrt6).Plus( + ov.ScaledBy(2/sqrt6).Plus( + on.ScaledBy(-1/sqrt6))); + } + + Quaternion quatt = Quaternion::From(u, v); + double d = min( + (quatt.Minus(quat0)).Magnitude(), + (quatt.Plus(quat0)).Magnitude()); + if(d < dmin) { + dmin = d; + quatf = quatt; + } + } + } + } + } + + SS.GW.AnimateOnto(quatf, SS.GW.offset); + break; + } + + case Command::CENTER_VIEW: + SS.GW.GroupSelection(); + if(SS.GW.gs.n == 1 && SS.GW.gs.points == 1) { + Quaternion quat0; + // Offset is the selected point, quaternion is same as before + Vector pt = SK.GetEntity(SS.GW.gs.point[0])->PointGetNum(); + quat0 = Quaternion::From(SS.GW.projRight, SS.GW.projUp); + SS.GW.ClearSelection(); + SS.GW.AnimateOnto(quat0, pt.ScaledBy(-1)); + } else { + Error(_("Select a point; this point will become the center " + "of the view on screen.")); + } + break; + + case Command::SHOW_TOOLBAR: + SS.showToolbar = !SS.showToolbar; + SS.GW.EnsureValidActives(); + SS.GW.Invalidate(); + break; + + case Command::SHOW_TEXT_WND: + SS.GW.showTextWindow = !SS.GW.showTextWindow; + SS.GW.EnsureValidActives(); + break; + + case Command::UNITS_INCHES: + SS.viewUnits = Unit::INCHES; + SS.ScheduleShowTW(); + SS.GW.EnsureValidActives(); + break; + + case Command::UNITS_FEET_INCHES: + SS.viewUnits = Unit::FEET_INCHES; + SS.ScheduleShowTW(); + SS.GW.EnsureValidActives(); + break; + + case Command::UNITS_MM: + SS.viewUnits = Unit::MM; + SS.ScheduleShowTW(); + SS.GW.EnsureValidActives(); + break; + + case Command::UNITS_METERS: + SS.viewUnits = Unit::METERS; + SS.ScheduleShowTW(); + SS.GW.EnsureValidActives(); + break; + + case Command::FULL_SCREEN: + SS.GW.window->SetFullScreen(!SS.GW.window->IsFullScreen()); + SS.GW.EnsureValidActives(); + break; + + default: ssassert(false, "Unexpected menu ID"); + } + SS.GW.Invalidate(); +} + +void GraphicsWindow::EnsureValidActives() { + bool change = false; + // The active group must exist, and not be the references. + Group *g = SK.group.FindByIdNoOops(activeGroup); + if((!g) || (g->h == Group::HGROUP_REFERENCES)) { + // Not using range-for because this is used to find an index. + int i; + for(i = 0; i < SK.groupOrder.n; i++) { + if(SK.groupOrder[i] != Group::HGROUP_REFERENCES) { + break; + } + } + if(i >= SK.groupOrder.n) { + // This can happen if the user deletes all the groups in the + // sketch. It's difficult to prevent that, because the last + // group might have been deleted automatically, because it failed + // a dependency. There needs to be something, so create a plane + // drawing group and activate that. They should never be able + // to delete the references, though. + activeGroup = SS.CreateDefaultDrawingGroup(); + // We've created the default group, but not the workplane entity; + // do it now so that drawing mode isn't switched to "Free in 3d". + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + } else { + activeGroup = SK.groupOrder[i]; + } + SK.GetGroup(activeGroup)->Activate(); + change = true; + } + + // The active coordinate system must also exist. + if(LockedInWorkplane()) { + Entity *e = SK.entity.FindByIdNoOops(ActiveWorkplane()); + if(e) { + hGroup hgw = e->group; + if(hgw != activeGroup && SS.GroupsInOrder(activeGroup, hgw)) { + // The active workplane is in a group that comes after the + // active group; so any request or constraint will fail. + SetWorkplaneFreeIn3d(); + change = true; + } + } else { + SetWorkplaneFreeIn3d(); + change = true; + } + } + + if(!window) return; + + // And update the checked state for various menus + bool locked = LockedInWorkplane(); + in3dMenuItem->SetActive(!locked); + inWorkplaneMenuItem->SetActive(locked); + + SS.UndoEnableMenus(); + + switch(SS.viewUnits) { + case Unit::MM: + case Unit::METERS: + case Unit::INCHES: + case Unit::FEET_INCHES: + break; + default: + SS.viewUnits = Unit::MM; + break; + } + unitsMmMenuItem->SetActive(SS.viewUnits == Unit::MM); + unitsMetersMenuItem->SetActive(SS.viewUnits == Unit::METERS); + unitsInchesMenuItem->SetActive(SS.viewUnits == Unit::INCHES); + unitsFeetInchesMenuItem->SetActive(SS.viewUnits == Unit::FEET_INCHES); + + if(SS.TW.window) SS.TW.window->SetVisible(SS.GW.showTextWindow); + showTextWndMenuItem->SetActive(SS.GW.showTextWindow); + + showGridMenuItem->SetActive(SS.GW.showSnapGrid); + dimSolidModelMenuItem->SetActive(SS.GW.dimSolidModel); + perspectiveProjMenuItem->SetActive(SS.usePerspectiveProj); + explodeMenuItem->SetActive(SS.explode); + showToolbarMenuItem->SetActive(SS.showToolbar); + fullScreenMenuItem->SetActive(SS.GW.window->IsFullScreen()); + + if(change) SS.ScheduleShowTW(); +} + +void GraphicsWindow::SetWorkplaneFreeIn3d() { + SK.GetGroup(activeGroup)->activeWorkplane = Entity::FREE_IN_3D; +} +hEntity GraphicsWindow::ActiveWorkplane() { + Group *g = SK.group.FindByIdNoOops(activeGroup); + if(g) { + return g->activeWorkplane; + } else { + return Entity::FREE_IN_3D; + } +} +bool GraphicsWindow::LockedInWorkplane() { + return (SS.GW.ActiveWorkplane() != Entity::FREE_IN_3D); +} + +void GraphicsWindow::ForceTextWindowShown() { + if(!showTextWindow) { + showTextWindow = true; + showTextWndMenuItem->SetActive(true); + SS.TW.window->SetVisible(true); + } +} + +void GraphicsWindow::DeleteTaggedRequests() { + // Rewrite any point-coincident constraints that were affected by this + // deletion. + for(Request &r : SK.request) { + if(!r.tag) continue; + FixConstraintsForRequestBeingDeleted(r.h); + } + // and then delete the tagged requests. + SK.request.RemoveTagged(); + + // An edit might be in progress for the just-deleted item. So + // now it's not. + window->HideEditor(); + SS.TW.HideEditControl(); + // And clear out the selection, which could contain that item. + ClearSuper(); + // And regenerate to get rid of what it generates, plus anything + // that references it (since the regen code checks for that). + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + EnsureValidActives(); + SS.ScheduleShowTW(); +} + +Vector GraphicsWindow::SnapToGrid(Vector p) { + if(!LockedInWorkplane()) return p; + + EntityBase *wrkpl = SK.GetEntity(ActiveWorkplane()), + *norm = wrkpl->Normal(); + Vector wo = SK.GetEntity(wrkpl->point[0])->PointGetNum(), + wu = norm->NormalU(), + wv = norm->NormalV(), + wn = norm->NormalN(); + + Vector pp = (p.Minus(wo)).DotInToCsys(wu, wv, wn); + pp.x = floor((pp.x / SS.gridSpacing) + 0.5)*SS.gridSpacing; + pp.y = floor((pp.y / SS.gridSpacing) + 0.5)*SS.gridSpacing; + pp.z = 0; + + return pp.ScaleOutOfCsys(wu, wv, wn).Plus(wo); +} + +void GraphicsWindow::MenuEdit(Command id) { + switch(id) { + case Command::UNSELECT_ALL: + SS.GW.GroupSelection(); + // If there's nothing selected to de-select, and no operation + // to cancel, then perhaps they want to return to the home + // screen in the text window. + if(SS.GW.gs.n == 0 && + SS.GW.gs.constraints == 0 && + SS.GW.pending.operation == Pending::NONE) + { + if(!(SS.TW.window->IsEditorVisible() || + SS.GW.window->IsEditorVisible())) + { + if(SS.TW.shown.screen == TextWindow::Screen::STYLE_INFO) { + SS.TW.GoToScreen(TextWindow::Screen::LIST_OF_STYLES); + } else { + SS.TW.ClearSuper(); + } + } + } + // some pending operations need an Undo to properly clean up on ESC + if ( (SS.GW.pending.operation == Pending::DRAGGING_NEW_POINT) + || (SS.GW.pending.operation == Pending::DRAGGING_NEW_LINE_POINT) + || (SS.GW.pending.operation == Pending::DRAGGING_NEW_ARC_POINT) + || (SS.GW.pending.operation == Pending::DRAGGING_NEW_RADIUS) ) + { + SS.GW.ClearSuper(); + SS.UndoUndo(); + } + SS.GW.ClearSuper(); + SS.TW.HideEditControl(); + SS.nakedEdges.Clear(); + SS.justExportedInfo.draw = false; + SS.centerOfMass.draw = false; + // This clears the marks drawn to indicate which points are + // still free to drag. + for(Param &p : SK.param) { + p.free = false; + } + if(SS.exportMode) { + SS.exportMode = false; + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + } + SS.GW.persistentDirty = true; + break; + + case Command::SELECT_ALL: { + for(Entity &e : SK.entity) { + if(e.group != SS.GW.activeGroup) continue; + if(e.IsFace() || e.IsDistance()) continue; + if(!e.IsVisible()) continue; + + SS.GW.MakeSelected(e.h); + } + SS.GW.Invalidate(); + SS.ScheduleShowTW(); + break; + } + + case Command::SELECT_CHAIN: { + int newlySelected = 0; + bool didSomething; + do { + didSomething = false; + for(Entity &e : SK.entity) { + if(e.group != SS.GW.activeGroup) continue; + if(!e.HasEndpoints()) continue; + if(!e.IsVisible()) continue; + + Vector st = e.EndpointStart(), + fi = e.EndpointFinish(); + + bool onChain = false, alreadySelected = false; + List *ls = &(SS.GW.selection); + for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) { + if(!s->entity.v) continue; + if(s->entity == e.h) { + alreadySelected = true; + continue; + } + Entity *se = SK.GetEntity(s->entity); + if(!se->HasEndpoints()) continue; + + Vector sst = se->EndpointStart(), + sfi = se->EndpointFinish(); + + if(sst.Equals(st) || sst.Equals(fi) || + sfi.Equals(st) || sfi.Equals(fi)) + { + onChain = true; + } + } + if(onChain && !alreadySelected) { + SS.GW.MakeSelected(e.h); + newlySelected++; + didSomething = true; + } + } + } while(didSomething); + SS.GW.Invalidate(); + SS.ScheduleShowTW(); + if(newlySelected == 0) { + Error(_("No additional entities share endpoints with the selected entities.")); + } + break; + } + + case Command::ROTATE_90: { + SS.GW.GroupSelection(); + Entity *e = NULL; + if(SS.GW.gs.n == 1 && SS.GW.gs.points == 1) { + e = SK.GetEntity(SS.GW.gs.point[0]); + } else if(SS.GW.gs.n == 1 && SS.GW.gs.entities == 1) { + e = SK.GetEntity(SS.GW.gs.entity[0]); + } + SS.GW.ClearSelection(); + + hGroup hg = e ? e->group : SS.GW.activeGroup; + Group *g = SK.GetGroup(hg); + if(g->type != Group::Type::LINKED) { + Error(_("To use this command, select a point or other " + "entity from an linked part, or make a link " + "group the active group.")); + break; + } + + SS.UndoRemember(); + // Rotate by ninety degrees about the coordinate axis closest + // to the screen normal. + Vector norm = SS.GW.projRight.Cross(SS.GW.projUp); + norm = norm.ClosestOrtho(); + norm = norm.WithMagnitude(1); + Quaternion qaa = Quaternion::From(norm, PI/2); + + g->TransformImportedBy(Vector::From(0, 0, 0), qaa); + + // and regenerate as necessary. + SS.MarkGroupDirty(hg); + break; + } + + case Command::SNAP_TO_GRID: { + if(!SS.GW.LockedInWorkplane()) { + Error(_("No workplane is active. Activate a workplane " + "(with Sketch -> In Workplane) to define the plane " + "for the snap grid.")); + break; + } + SS.GW.GroupSelection(); + if(SS.GW.gs.points == 0 && SS.GW.gs.constraintLabels == 0) { + Error(_("Can't snap these items to grid; select points, " + "text comments, or constraints with a label. " + "To snap a line, select its endpoints.")); + break; + } + SS.UndoRemember(); + + List *ls = &(SS.GW.selection); + for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) { + if(s->entity.v) { + hEntity hp = s->entity; + Entity *ep = SK.GetEntity(hp); + if(!ep->IsPoint()) continue; + + Vector p = ep->PointGetNum(); + ep->PointForceTo(SS.GW.SnapToGrid(p)); + SS.GW.pending.points.Add(&hp); + SS.MarkGroupDirty(ep->group); + } else if(s->constraint.v) { + Constraint *c = SK.GetConstraint(s->constraint); + std::vector refs; + c->GetReferencePoints(SS.GW.GetCamera(), &refs); + c->disp.offset = c->disp.offset.Plus(SS.GW.SnapToGrid(refs[0]).Minus(refs[0])); + } + } + // Regenerate, with these points marked as dragged so that they + // get placed as close as possible to our snap grid. + SS.GW.ClearSelection(); + break; + } + + case Command::UNDO: + SS.UndoUndo(); + break; + + case Command::REDO: + SS.UndoRedo(); + break; + + case Command::REGEN_ALL: + SS.images.clear(); + SS.ReloadAllLinked(SS.saveFile); + SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE); + SS.ScheduleShowTW(); + break; + + case Command::EDIT_LINE_STYLES: + SS.TW.GoToScreen(TextWindow::Screen::LIST_OF_STYLES); + SS.GW.ForceTextWindowShown(); + SS.ScheduleShowTW(); + break; + case Command::VIEW_PROJECTION: + SS.TW.GoToScreen(TextWindow::Screen::EDIT_VIEW); + SS.GW.ForceTextWindowShown(); + SS.ScheduleShowTW(); + break; + case Command::CONFIGURATION: + SS.TW.GoToScreen(TextWindow::Screen::CONFIGURATION); + SS.GW.ForceTextWindowShown(); + SS.ScheduleShowTW(); + break; + + default: ssassert(false, "Unexpected menu ID"); + } +} + +void GraphicsWindow::MenuRequest(Command id) { + const char *s; + switch(id) { + case Command::SEL_WORKPLANE: { + SS.GW.GroupSelection(); + Group *g = SK.GetGroup(SS.GW.activeGroup); + + if(SS.GW.gs.n == 1 && SS.GW.gs.workplanes == 1) { + // A user-selected workplane + g->activeWorkplane = SS.GW.gs.entity[0]; + SS.GW.EnsureValidActives(); + SS.ScheduleShowTW(); + } else if(g->type == Group::Type::DRAWING_WORKPLANE) { + // The group's default workplane + g->activeWorkplane = g->h.entity(0); + MessageAndRun([] { + // Align the view with the selected workplane + SS.GW.ClearSuper(); + SS.GW.AnimateOntoWorkplane(); + }, _("No workplane selected. Activating default workplane " + "for this group.")); + } else { + Error(_("No workplane is selected, and the active group does " + "not have a default workplane. Try selecting a " + "workplane, or activating a sketch-in-new-workplane " + "group.")); + //update checkboxes in the menus + SS.GW.EnsureValidActives(); + } + break; + } + case Command::FREE_IN_3D: + SS.GW.SetWorkplaneFreeIn3d(); + SS.GW.EnsureValidActives(); + SS.ScheduleShowTW(); + SS.GW.Invalidate(); + break; + + case Command::TANGENT_ARC: + SS.GW.GroupSelection(); + if(SS.GW.gs.n == 1 && SS.GW.gs.points == 1) { + SS.GW.MakeTangentArc(); + } else if(SS.GW.gs.n != 0) { + Error(_("Bad selection for tangent arc at point. Select a " + "single point, or select nothing to set up arc " + "parameters.")); + } else { + SS.TW.GoToScreen(TextWindow::Screen::TANGENT_ARC); + SS.GW.ForceTextWindowShown(); + SS.ScheduleShowTW(); + SS.GW.Invalidate(); // repaint toolbar + } + break; + + case Command::ARC: s = _("click point on arc (draws anti-clockwise)"); goto c; + case Command::DATUM_POINT: s = _("click to place datum point"); goto c; + case Command::LINE_SEGMENT: s = _("click first point of line segment"); goto c; + case Command::CONSTR_SEGMENT: + s = _("click first point of construction line segment"); goto c; + case Command::CUBIC: s = _("click first point of cubic segment"); goto c; + case Command::CIRCLE: s = _("click center of circle"); goto c; + case Command::WORKPLANE: s = _("click origin of workplane"); goto c; + case Command::RECTANGLE: s = _("click one corner of rectangle"); goto c; + case Command::TTF_TEXT: s = _("click top left of text"); goto c; + case Command::IMAGE: + if(!SS.ReloadLinkedImage(SS.saveFile, &SS.GW.pending.filename, + /*canCancel=*/true)) { + return; + } + s = _("click top left of image"); goto c; +c: + SS.GW.pending.operation = GraphicsWindow::Pending::COMMAND; + SS.GW.pending.command = id; + SS.GW.pending.description = s; + SS.ScheduleShowTW(); + SS.GW.Invalidate(); // repaint toolbar + break; + + case Command::CONSTRUCTION: { + // if we are drawing + if(SS.GW.pending.operation == Pending::DRAGGING_NEW_POINT || + SS.GW.pending.operation == Pending::DRAGGING_NEW_LINE_POINT || + SS.GW.pending.operation == Pending::DRAGGING_NEW_ARC_POINT || + SS.GW.pending.operation == Pending::DRAGGING_NEW_CUBIC_POINT || + SS.GW.pending.operation == Pending::DRAGGING_NEW_RADIUS) { + for(auto &hr : SS.GW.pending.requests) { + Request* r = SK.GetRequest(hr); + r->construction = !(r->construction); + SS.MarkGroupDirty(r->group); + } + SS.GW.Invalidate(); + break; + } + SS.GW.GroupSelection(); + if(SS.GW.gs.entities == 0) { + Error(_("No entities are selected. Select entities before " + "trying to toggle their construction state.")); + break; + } + SS.UndoRemember(); + int i; + for(i = 0; i < SS.GW.gs.entities; i++) { + hEntity he = SS.GW.gs.entity[i]; + if(!he.isFromRequest()) continue; + Request *r = SK.GetRequest(he.request()); + r->construction = !(r->construction); + SS.MarkGroupDirty(r->group); + } + SS.GW.ClearSelection(); + break; + } + + case Command::SPLIT_CURVES: + SS.GW.SplitLinesOrCurves(); + break; + + default: ssassert(false, "Unexpected menu ID"); + } +} + +void GraphicsWindow::ClearSuper() { + if(window) window->HideEditor(); + ClearPending(); + ClearSelection(); + hover.Clear(); + EnsureValidActives(); +} + +void GraphicsWindow::ToggleBool(bool *v) { + *v = !*v; + + // The faces are shown as special stippling on the shaded triangle mesh, + // so not meaningful to show them and hide the shaded. + if(!showShaded) showFaces = false; + + // If the mesh or edges were previously hidden, they haven't been generated, + // and if we are going to show them, we need to generate them first. + Group *g = SK.GetGroup(SS.GW.activeGroup); + if(*v && (g->displayOutlines.l.IsEmpty() && (v == &showEdges || v == &showOutlines))) { + SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE); + } + + if(v == &showFaces) { + if(g->type == Group::Type::DRAWING_WORKPLANE || g->type == Group::Type::DRAWING_3D) { + showFacesDrawing = showFaces; + } else { + showFacesNonDrawing = showFaces; + } + } + + Invalidate(/*clearPersistent=*/true); + SS.ScheduleShowTW(); +} + +bool GraphicsWindow::SuggestLineConstraint(hRequest request, Constraint::Type *type) { + if(!(LockedInWorkplane() && SS.automaticLineConstraints)) + return false; + + Entity *ptA = SK.GetEntity(request.entity(1)), + *ptB = SK.GetEntity(request.entity(2)); + + Expr *au, *av, *bu, *bv; + + ptA->PointGetExprsInWorkplane(ActiveWorkplane(), &au, &av); + ptB->PointGetExprsInWorkplane(ActiveWorkplane(), &bu, &bv); + + double du = au->Minus(bu)->Eval(); + double dv = av->Minus(bv)->Eval(); + + const double TOLERANCE_RATIO = 0.02; + if(fabs(dv) > LENGTH_EPS && fabs(du / dv) < TOLERANCE_RATIO) { + *type = Constraint::Type::VERTICAL; + return true; + } else if(fabs(du) > LENGTH_EPS && fabs(dv / du) < TOLERANCE_RATIO) { + *type = Constraint::Type::HORIZONTAL; + return true; + } + return false; +} + +} // namespace SolveSpace diff --git a/src/group.cpp b/src/group.cpp new file mode 100644 index 0000000..0b9cd2f --- /dev/null +++ b/src/group.cpp @@ -0,0 +1,1227 @@ +//----------------------------------------------------------------------------- +// Implementation of the Group class, which represents a set of entities and +// constraints that are solved together, in some cases followed by another +// operation, like to extrude surfaces from the entities or to step and +// repeat them parametrically. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +const hParam Param::NO_PARAM = { 0 }; +#define NO_PARAM (Param::NO_PARAM) + +const hGroup Group::HGROUP_REFERENCES = { 1 }; + +//----------------------------------------------------------------------------- +// The group structure includes pointers to other dynamically-allocated +// memory. This clears and frees them all. +//----------------------------------------------------------------------------- +void Group::Clear() { + polyLoops.Clear(); + bezierLoops.Clear(); + bezierOpens.Clear(); + thisMesh.Clear(); + runningMesh.Clear(); + thisShell.Clear(); + runningShell.Clear(); + displayMesh.Clear(); + displayOutlines.Clear(); + impMesh.Clear(); + impShell.Clear(); + impEntity.Clear(); + // remap is the only one that doesn't get recreated when we regen + remap.clear(); +} + +void Group::AddParam(ParamList *param, hParam hp, double v) { + Param pa = {}; + pa.h = hp; + pa.val = v; + + param->Add(&pa); +} + +bool Group::IsVisible() { + if(!visible) return false; + Group *active = SK.GetGroup(SS.GW.activeGroup); + if(order > active->order) return false; + return true; +} + +size_t Group::GetNumConstraints() { + return std::count_if(SK.constraint.begin(), SK.constraint.end(), + [&](Constraint const &c) { return c.group == h; }); +} + +Vector Group::ExtrusionGetVector() { + return Vector::From(h.param(0), h.param(1), h.param(2)); +} + +void Group::ExtrusionForceVectorTo(const Vector &v) { + SK.GetParam(h.param(0))->val = v.x; + SK.GetParam(h.param(1))->val = v.y; + SK.GetParam(h.param(2))->val = v.z; +} + +void Group::MenuGroup(Command id) { + MenuGroup(id, Platform::Path()); +} + +void Group::MenuGroup(Command id, Platform::Path linkFile) { + Platform::SettingsRef settings = Platform::GetSettings(); + + Group g = {}; + g.visible = true; + g.color = RGBi(100, 100, 100); + g.scale = 1; + g.linkFile = linkFile; + + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + + switch(id) { + case Command::GROUP_3D: + g.type = Type::DRAWING_3D; + g.name = C_("group-name", "sketch-in-3d"); + break; + + case Command::GROUP_WRKPL: + g.type = Type::DRAWING_WORKPLANE; + g.name = C_("group-name", "sketch-in-plane"); + if(gs.points == 1 && gs.n == 1) { + g.subtype = Subtype::WORKPLANE_BY_POINT_ORTHO; + + Vector u = SS.GW.projRight, v = SS.GW.projUp; + u = u.ClosestOrtho(); + v = v.Minus(u.ScaledBy(v.Dot(u))); + v = v.ClosestOrtho(); + + g.predef.q = Quaternion::From(u, v); + g.predef.origin = gs.point[0]; + } else if(gs.points == 1 && gs.lineSegments == 2 && gs.n == 3) { + g.subtype = Subtype::WORKPLANE_BY_LINE_SEGMENTS; + + g.predef.origin = gs.point[0]; + g.predef.entityB = gs.entity[0]; + g.predef.entityC = gs.entity[1]; + + Vector ut = SK.GetEntity(g.predef.entityB)->VectorGetNum(); + Vector vt = SK.GetEntity(g.predef.entityC)->VectorGetNum(); + ut = ut.WithMagnitude(1); + vt = vt.WithMagnitude(1); + + if(fabs(SS.GW.projUp.Dot(vt)) < fabs(SS.GW.projUp.Dot(ut))) { + swap(ut, vt); + g.predef.swapUV = true; + } + if(SS.GW.projRight.Dot(ut) < 0) g.predef.negateU = true; + if(SS.GW.projUp. Dot(vt) < 0) g.predef.negateV = true; + } else if(gs.workplanes == 1 && gs.n == 1) { + if(gs.entity[0].isFromRequest()) { + Entity *wrkpl = SK.GetEntity(gs.entity[0]); + Entity *normal = SK.GetEntity(wrkpl->normal); + g.subtype = Subtype::WORKPLANE_BY_POINT_ORTHO; + g.predef.origin = wrkpl->point[0]; + g.predef.q = normal->NormalGetNum(); + } else { + Group *wrkplg = SK.GetGroup(gs.entity[0].group()); + g.subtype = wrkplg->subtype; + g.predef.origin = wrkplg->predef.origin; + if(wrkplg->subtype == Subtype::WORKPLANE_BY_LINE_SEGMENTS) { + g.predef.entityB = wrkplg->predef.entityB; + g.predef.entityC = wrkplg->predef.entityC; + g.predef.swapUV = wrkplg->predef.swapUV; + g.predef.negateU = wrkplg->predef.negateU; + g.predef.negateV = wrkplg->predef.negateV; + } else if(wrkplg->subtype == Subtype::WORKPLANE_BY_POINT_ORTHO) { + g.predef.q = wrkplg->predef.q; + } else if(wrkplg->subtype == Subtype::WORKPLANE_BY_POINT_NORMAL) { + g.predef.q = wrkplg->predef.q; + g.predef.entityB = wrkplg->predef.entityB; + } else ssassert(false, "Unexpected workplane subtype"); + } + } else if(gs.anyNormals == 1 && gs.points == 1 && gs.n == 2) { + g.subtype = Subtype::WORKPLANE_BY_POINT_NORMAL; + g.predef.entityB = gs.anyNormal[0]; + g.predef.q = SK.GetEntity(gs.anyNormal[0])->NormalGetNum(); + g.predef.origin = gs.point[0]; + //} else if(gs.faces == 1 && gs.points == 1 && gs.n == 2) { + // g.subtype = Subtype::WORKPLANE_BY_POINT_FACE; + // g.predef.q = SK.GetEntity(gs.face[0])->NormalGetNum(); + // g.predef.origin = gs.point[0]; + } else { + Error(_("Bad selection for new sketch in workplane. This " + "group can be created with:\n\n" + " * a point (through the point, orthogonal to coordinate axes)\n" + " * a point and two line segments (through the point, " + "parallel to the lines)\n" + " * a point and a normal (through the point, " + "orthogonal to the normal)\n" + /*" * a point and a face (through the point, " + "parallel to the face)\n"*/ + " * a workplane (copy of the workplane)\n")); + return; + } + break; + + case Command::GROUP_EXTRUDE: + if(!SS.GW.LockedInWorkplane()) { + Error(_("Activate a workplane (Sketch -> In Workplane) before " + "extruding. The sketch will be extruded normal to the " + "workplane.")); + return; + } + g.type = Type::EXTRUDE; + g.opA = SS.GW.activeGroup; + g.predef.entityB = SS.GW.ActiveWorkplane(); + g.subtype = Subtype::ONE_SIDED; + g.name = C_("group-name", "extrude"); + break; + + case Command::GROUP_LATHE: + if(!SS.GW.LockedInWorkplane()) { + Error(_("Lathe operation can only be applied to planar sketches.")); + return; + } + if(gs.points == 1 && gs.vectors == 1 && gs.n == 2) { + g.predef.origin = gs.point[0]; + g.predef.entityB = gs.vector[0]; + } else if(gs.lineSegments == 1 && gs.n == 1) { + g.predef.origin = SK.GetEntity(gs.entity[0])->point[0]; + g.predef.entityB = gs.entity[0]; + // since a line segment is a vector + } else { + Error(_("Bad selection for new lathe group. This group can " + "be created with:\n\n" + " * a point and a line segment or normal " + "(revolved about an axis parallel to line / " + "normal, through point)\n" + " * a line segment (revolved about line segment)\n")); + return; + } + g.type = Type::LATHE; + g.opA = SS.GW.activeGroup; + g.name = C_("group-name", "lathe"); + break; + + case Command::GROUP_REVOLVE: + if(!SS.GW.LockedInWorkplane()) { + Error(_("Revolve operation can only be applied to planar sketches.")); + return; + } + if(gs.points == 1 && gs.vectors == 1 && gs.n == 2) { + g.predef.origin = gs.point[0]; + g.predef.entityB = gs.vector[0]; + } else if(gs.lineSegments == 1 && gs.n == 1) { + g.predef.origin = SK.GetEntity(gs.entity[0])->point[0]; + g.predef.entityB = gs.entity[0]; + // since a line segment is a vector + } else { + Error(_("Bad selection for new revolve group. This group can " + "be created with:\n\n" + " * a point and a line segment or normal " + "(revolved about an axis parallel to line / " + "normal, through point)\n" + " * a line segment (revolved about line segment)\n")); + return; + } + g.type = Type::REVOLVE; + g.opA = SS.GW.activeGroup; + g.valA = 2; + g.subtype = Subtype::ONE_SIDED; + g.name = C_("group-name", "revolve"); + break; + + case Command::GROUP_HELIX: + if(!SS.GW.LockedInWorkplane()) { + Error(_("Helix operation can only be applied to planar sketches.")); + return; + } + if(gs.points == 1 && gs.vectors == 1 && gs.n == 2) { + g.predef.origin = gs.point[0]; + g.predef.entityB = gs.vector[0]; + } else if(gs.lineSegments == 1 && gs.n == 1) { + g.predef.origin = SK.GetEntity(gs.entity[0])->point[0]; + g.predef.entityB = gs.entity[0]; + // since a line segment is a vector + } else { + Error(_("Bad selection for new helix group. This group can " + "be created with:\n\n" + " * a point and a line segment or normal " + "(revolved about an axis parallel to line / " + "normal, through point)\n" + " * a line segment (revolved about line segment)\n")); + return; + } + g.type = Type::HELIX; + g.opA = SS.GW.activeGroup; + g.valA = 2; + g.subtype = Subtype::ONE_SIDED; + g.name = C_("group-name", "helix"); + break; + + case Command::GROUP_ROT: { + if(gs.points == 1 && gs.n == 1 && SS.GW.LockedInWorkplane()) { + g.predef.origin = gs.point[0]; + Entity *w = SK.GetEntity(SS.GW.ActiveWorkplane()); + g.predef.entityB = w->Normal()->h; + g.activeWorkplane = w->h; + } else if(gs.points == 1 && gs.vectors == 1 && gs.n == 2) { + g.predef.origin = gs.point[0]; + g.predef.entityB = gs.vector[0]; + } else { + Error(_("Bad selection for new rotation. This group can " + "be created with:\n\n" + " * a point, while locked in workplane (rotate " + "in plane, about that point)\n" + " * a point and a line or a normal (rotate about " + "an axis through the point, and parallel to " + "line / normal)\n")); + return; + } + g.type = Type::ROTATE; + g.opA = SS.GW.activeGroup; + g.valA = 3; + g.subtype = Subtype::ONE_SIDED; + g.name = C_("group-name", "rotate"); + break; + } + + case Command::GROUP_TRANS: + g.type = Type::TRANSLATE; + g.opA = SS.GW.activeGroup; + g.valA = 3; + g.subtype = Subtype::ONE_SIDED; + g.predef.entityB = SS.GW.ActiveWorkplane(); + g.activeWorkplane = SS.GW.ActiveWorkplane(); + g.name = C_("group-name", "translate"); + break; + + case Command::GROUP_LINK: { + g.type = Type::LINKED; + g.meshCombine = CombineAs::ASSEMBLE; + if(g.linkFile.IsEmpty()) { + Platform::FileDialogRef dialog = Platform::CreateOpenFileDialog(SS.GW.window); + dialog->AddFilters(Platform::SolveSpaceLinkFileFilters); + dialog->ThawChoices(settings, "LinkSketch"); + if(!dialog->RunModal()) return; + dialog->FreezeChoices(settings, "LinkSketch"); + g.linkFile = dialog->GetFilename(); + } + + // Assign the default name of the group based on the name of + // the linked file. + g.name = g.linkFile.FileStem(); + for(size_t i = 0; i < g.name.length(); i++) { + if(!(isalnum(g.name[i]) || (unsigned)g.name[i] >= 0x80)) { + // convert punctuation to dashes + g.name[i] = '-'; + } + } + break; + } + + default: ssassert(false, "Unexpected menu ID"); + } + + // Copy color from the previous mesh-contributing group. + if(g.IsMeshGroup() && !SK.groupOrder.IsEmpty()) { + Group *running = SK.GetRunningMeshGroupFor(SS.GW.activeGroup); + if(running != NULL) { + g.color = running->color; + } + } + + SS.GW.ClearSelection(); + SS.UndoRemember(); + + bool afterActive = false; + for(hGroup hg : SK.groupOrder) { + Group *gi = SK.GetGroup(hg); + if(afterActive) + gi->order += 1; + if(gi->h == SS.GW.activeGroup) { + g.order = gi->order + 1; + afterActive = true; + } + } + + SK.group.AddAndAssignId(&g); + Group *gg = SK.GetGroup(g.h); + + if(gg->type == Type::LINKED) { + SS.ReloadAllLinked(SS.saveFile); + } + gg->clean = false; + SS.GW.activeGroup = gg->h; + SS.GenerateAll(); + if(gg->type == Type::DRAWING_WORKPLANE) { + // Can't set the active workplane for this one until after we've + // regenerated, because the workplane doesn't exist until then. + gg->activeWorkplane = gg->h.entity(0); + } + gg->Activate(); + TextWindow::ScreenSelectGroup(0, gg->h.v); + SS.GW.AnimateOntoWorkplane(); +} + +void Group::TransformImportedBy(Vector t, Quaternion q) { + ssassert(type == Type::LINKED, "Expected a linked group"); + + hParam tx, ty, tz, qw, qx, qy, qz; + tx = h.param(0); + ty = h.param(1); + tz = h.param(2); + qw = h.param(3); + qx = h.param(4); + qy = h.param(5); + qz = h.param(6); + + Quaternion qg = Quaternion::From(qw, qx, qy, qz); + qg = q.Times(qg); + + Vector tg = Vector::From(tx, ty, tz); + tg = tg.Plus(t); + + SK.GetParam(tx)->val = tg.x; + SK.GetParam(ty)->val = tg.y; + SK.GetParam(tz)->val = tg.z; + + SK.GetParam(qw)->val = qg.w; + SK.GetParam(qx)->val = qg.vx; + SK.GetParam(qy)->val = qg.vy; + SK.GetParam(qz)->val = qg.vz; +} + +bool Group::IsForcedToMeshBySource() const { + const Group *srcg = this; + if(type == Type::TRANSLATE || type == Type::ROTATE) { + // A step and repeat gets merged against the group's previous group, + // not our own previous group. + srcg = SK.GetGroup(opA); + if(srcg->forceToMesh) return true; + } + Group *g = srcg->RunningMeshGroup(); + if(g == NULL) return false; + return g->forceToMesh || g->IsForcedToMeshBySource(); +} + +bool Group::IsForcedToMesh() const { + return forceToMesh || IsTriangleMeshAssembly() || IsForcedToMeshBySource(); +} + +bool Group::IsTriangleMeshAssembly() const { + if (type != Type::LINKED) return false; + if (!impMesh.IsEmpty() && impShell.IsEmpty()) return true; + return false; +} + +std::string Group::DescriptionString() { + if(name.empty()) { + return ssprintf("g%03x-%s", h.v, _("(unnamed)")); + } else { + return ssprintf("g%03x-%s", h.v, name.c_str()); + } +} + +void Group::Activate() { + if(type == Type::DRAWING_WORKPLANE || type == Type::DRAWING_3D) { + SS.GW.showFaces = SS.GW.showFacesDrawing; + } else { + SS.GW.showFaces = SS.GW.showFacesNonDrawing; + } + SS.MarkGroupDirty(h); // for good measure; shouldn't be needed + SS.ScheduleShowTW(); +} + +void Group::Generate(EntityList *entity, ParamList *param) +{ + Vector gn = (SS.GW.projRight).Cross(SS.GW.projUp); + Vector gp = SS.GW.projRight.Plus(SS.GW.projUp); + Vector gc = (SS.GW.offset).ScaledBy(-1); + gn = gn.WithMagnitude(200/SS.GW.scale); + gp = gp.WithMagnitude(200/SS.GW.scale); + int a, i; + switch(type) { + case Type::DRAWING_3D: + return; + + case Type::DRAWING_WORKPLANE: { + Quaternion q; + if(subtype == Subtype::WORKPLANE_BY_LINE_SEGMENTS) { + Vector u = SK.GetEntity(predef.entityB)->VectorGetNum(); + Vector v = SK.GetEntity(predef.entityC)->VectorGetNum(); + u = u.WithMagnitude(1); + Vector n = u.Cross(v); + v = (n.Cross(u)).WithMagnitude(1); + + if(predef.swapUV) swap(u, v); + if(predef.negateU) u = u.ScaledBy(-1); + if(predef.negateV) v = v.ScaledBy(-1); + q = Quaternion::From(u, v); + } else if(subtype == Subtype::WORKPLANE_BY_POINT_ORTHO) { + // Already given, numerically. + q = predef.q; + } else if(subtype == Subtype::WORKPLANE_BY_POINT_NORMAL) { + q = SK.GetEntity(predef.entityB)->NormalGetNum(); + } else ssassert(false, "Unexpected workplane subtype"); + + Entity normal = {}; + normal.type = Entity::Type::NORMAL_N_COPY; + normal.numNormal = q; + + normal.point[0] = h.entity(2); + normal.group = h; + normal.h = h.entity(1); + entity->Add(&normal); + + Entity point = {}; + point.type = Entity::Type::POINT_N_COPY; + point.numPoint = SK.GetEntity(predef.origin)->PointGetNum(); + point.construction = true; + point.group = h; + point.h = h.entity(2); + entity->Add(&point); + + Entity wp = {}; + wp.type = Entity::Type::WORKPLANE; + wp.normal = normal.h; + wp.point[0] = point.h; + wp.group = h; + wp.h = h.entity(0); + entity->Add(&wp); + return; + } + + case Type::EXTRUDE: { + AddParam(param, h.param(0), gn.x); + AddParam(param, h.param(1), gn.y); + AddParam(param, h.param(2), gn.z); + int ai, af; + if((subtype == Subtype::ONE_SIDED) || (subtype == Subtype::ONE_SKEWED)) { + ai = 0; af = 2; + } else if((subtype == Subtype::TWO_SIDED) || (subtype == Subtype::TWO_SKEWED)) { + ai = -1; af = 1; + } else ssassert(false, "Unexpected extrusion subtype"); + + // Get some arbitrary point in the sketch, that will be used + // as a reference when defining top and bottom faces. + hEntity pt = { 0 }; + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < entity->n; i++) { + Entity *e = &(entity->Get(i)); + if(e->group != opA) continue; + + if(e->IsPoint()) pt = e->h; + + e->CalculateNumerical(/*forExport=*/false); + hEntity he = e->h; e = NULL; + // As soon as I call CopyEntity, e may become invalid! That + // adds entities, which may cause a realloc. + CopyEntity(entity, SK.GetEntity(he), ai, REMAP_BOTTOM, + h.param(0), h.param(1), h.param(2), + NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, + CopyAs::N_TRANS); + CopyEntity(entity, SK.GetEntity(he), af, REMAP_TOP, + h.param(0), h.param(1), h.param(2), + NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, + CopyAs::N_TRANS); + MakeExtrusionLines(entity, he); + } + // Remapped versions of that arbitrary point will be used to + // provide points on the plane faces. + MakeExtrusionTopBottomFaces(entity, pt); + return; + } + + case Type::LATHE: { + Vector axis_pos = SK.GetEntity(predef.origin)->PointGetNum(); + Vector axis_dir = SK.GetEntity(predef.entityB)->VectorGetNum(); + + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < entity->n; i++) { + Entity *e = &(entity->Get(i)); + if(e->group != opA) continue; + + e->CalculateNumerical(/*forExport=*/false); + hEntity he = e->h; + + // As soon as I call CopyEntity, e may become invalid! That + // adds entities, which may cause a realloc. + + // this is the regular copy of all entities + CopyEntity(entity, SK.GetEntity(he), 0, REMAP_LATHE_START, + NO_PARAM, NO_PARAM, NO_PARAM, + NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, + CopyAs::NUMERIC); + + e = &(entity->Get(i)); // because we copied. + if (e->IsPoint()) { + // for points this copy is used for the circle centers + CopyEntity(entity, SK.GetEntity(he), 0, REMAP_LATHE_ARC_CENTER, + NO_PARAM, NO_PARAM, NO_PARAM, + NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, + CopyAs::NUMERIC); + MakeLatheCircles(entity, param, he, axis_pos, axis_dir); + }; + MakeLatheSurfacesSelectable(entity, he, axis_dir); + } + return; + } + + case Type::REVOLVE: { + // this was borrowed from LATHE and ROTATE + Vector axis_pos = SK.GetEntity(predef.origin)->PointGetNum(); + Vector axis_dir = SK.GetEntity(predef.entityB)->VectorGetNum(); + + // The center of rotation + AddParam(param, h.param(0), axis_pos.x); + AddParam(param, h.param(1), axis_pos.y); + AddParam(param, h.param(2), axis_pos.z); + // The rotation quaternion + AddParam(param, h.param(3), 30 * PI / 180); + AddParam(param, h.param(4), axis_dir.x); + AddParam(param, h.param(5), axis_dir.y); + AddParam(param, h.param(6), axis_dir.z); + + // Get some arbitrary point in the sketch, that will be used + // as a reference when defining end faces. + hEntity pt = { 0 }; + + int ai = 0, af = 2; + if (subtype == Subtype::TWO_SIDED) + { + ai = -1; + af = 1; + } + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < entity->n; i++) { + Entity *e = &(entity->Get(i)); + if(e->group != opA) + continue; + + if(e->IsPoint()) pt = e->h; + + e->CalculateNumerical(/*forExport=*/false); + hEntity he = e->h; + // one copy for each end of the revolved surface + CopyEntity(entity, e, ai, REMAP_LATHE_START, h.param(0), + h.param(1), h.param(2), h.param(3), h.param(4), h.param(5), + h.param(6), NO_PARAM, CopyAs::N_ROT_AA); + + e = &(entity->Get(i)); // because we copied. + CopyEntity(entity, e, af, REMAP_LATHE_END, h.param(0), + h.param(1), h.param(2), h.param(3), h.param(4), h.param(5), + h.param(6), NO_PARAM, CopyAs::N_ROT_AA); + + // Arcs are not generated for revolve groups, for now, because our current arc + // entity is not chiral, and dragging a revolve may break the arc by inverting it. + // MakeLatheCircles(entity, param, he, axis_pos, axis_dir); + MakeLatheSurfacesSelectable(entity, he, axis_dir); + } + MakeRevolveEndFaces(entity, pt, ai, af); + return; + } + + case Type::HELIX: { + Vector axis_pos = SK.GetEntity(predef.origin)->PointGetNum(); + Vector axis_dir = SK.GetEntity(predef.entityB)->VectorGetNum(); + + // The center of rotation + AddParam(param, h.param(0), axis_pos.x); + AddParam(param, h.param(1), axis_pos.y); + AddParam(param, h.param(2), axis_pos.z); + // The rotation quaternion + AddParam(param, h.param(3), 30 * PI / 180); + AddParam(param, h.param(4), axis_dir.x); + AddParam(param, h.param(5), axis_dir.y); + AddParam(param, h.param(6), axis_dir.z); + // distance to translate along the rotation axis + AddParam(param, h.param(7), 20); + + // Get some arbitrary point in the sketch, that will be used + // as a reference when defining end faces. + hEntity pt = { 0 }; + + int ai = 0, af = 2; // initial and final number of transformations + if (subtype != Subtype::ONE_SIDED) + { + ai = -1; + af = 1; + } + + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < entity->n; i++) { + Entity *e = &(entity->Get(i)); + if((e->group.v != opA.v) && !(e->h == predef.origin)) + continue; + + if(e->IsPoint()) pt = e->h; + + e->CalculateNumerical(/*forExport=*/false); + + // one copy for each end of the helix + CopyEntity(entity, e, ai, REMAP_LATHE_START, h.param(0), + h.param(1), h.param(2), h.param(3), h.param(4), h.param(5), + h.param(6), h.param(7), CopyAs::N_ROT_AXIS_TRANS); + + e = &(entity->Get(i)); // because we copied. + CopyEntity(entity, e, af, REMAP_LATHE_END, h.param(0), + h.param(1), h.param(2), h.param(3), h.param(4), h.param(5), + h.param(6), h.param(7), CopyAs::N_ROT_AXIS_TRANS); + + // For point entities on the axis, create a construction line + e = &(entity->Get(i)); + if(e->IsPoint()) { + Vector check = e->PointGetNum().Minus(axis_pos).Cross(axis_dir); + if (check.Dot(check) < LENGTH_EPS) { + //! @todo isn't this the same as &(ent[i])? + Entity *ep = SK.GetEntity(e->h); + Entity en = {}; + // A point gets extruded to form a line segment + en.point[0] = Remap(ep->h, REMAP_LATHE_START); + en.point[1] = Remap(ep->h, REMAP_LATHE_END); + en.group = h; + en.construction = ep->construction; + en.style = ep->style; + en.h = Remap(ep->h, REMAP_PT_TO_LINE); + en.type = Entity::Type::LINE_SEGMENT; + entity->Add(&en); + } + } + } + MakeRevolveEndFaces(entity, pt, ai, af); + return; + } + + case Type::TRANSLATE: { + // inherit meshCombine from source group + Group *srcg = SK.GetGroup(opA); + meshCombine = srcg->meshCombine; + // The translation vector + AddParam(param, h.param(0), gp.x); + AddParam(param, h.param(1), gp.y); + AddParam(param, h.param(2), gp.z); + + int n = (int)valA, a0 = 0; + if(subtype == Subtype::ONE_SIDED && skipFirst) { + a0++; n++; + } + + for(a = a0; a < n; a++) { + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < entity->n; i++) { + Entity *e = &(entity->Get(i)); + if(e->group != opA) continue; + + e->CalculateNumerical(/*forExport=*/false); + CopyEntity(entity, e, + a*2 - (subtype == Subtype::ONE_SIDED ? 0 : (n-1)), + (a == (n - 1)) ? REMAP_LAST : a, + h.param(0), h.param(1), h.param(2), + NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, NO_PARAM, + CopyAs::N_TRANS); + } + } + return; + } + case Type::ROTATE: { + // inherit meshCombine from source group + Group *srcg = SK.GetGroup(opA); + meshCombine = srcg->meshCombine; + // The center of rotation + AddParam(param, h.param(0), gc.x); + AddParam(param, h.param(1), gc.y); + AddParam(param, h.param(2), gc.z); + // The rotation quaternion + AddParam(param, h.param(3), 30*PI/180); + AddParam(param, h.param(4), gn.x); + AddParam(param, h.param(5), gn.y); + AddParam(param, h.param(6), gn.z); + + int n = (int)valA, a0 = 0; + if(subtype == Subtype::ONE_SIDED && skipFirst) { + a0++; n++; + } + + for(a = a0; a < n; a++) { + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < entity->n; i++) { + Entity *e = &(entity->Get(i)); + if(e->group != opA) continue; + + e->CalculateNumerical(/*forExport=*/false); + CopyEntity(entity, e, + a*2 - (subtype == Subtype::ONE_SIDED ? 0 : (n-1)), + (a == (n - 1)) ? REMAP_LAST : a, + h.param(0), h.param(1), h.param(2), + h.param(3), h.param(4), h.param(5), h.param(6), NO_PARAM, + CopyAs::N_ROT_AA); + } + } + return; + } + case Type::LINKED: + // The translation vector + AddParam(param, h.param(0), gp.x); + AddParam(param, h.param(1), gp.y); + AddParam(param, h.param(2), gp.z); + // The rotation quaternion + AddParam(param, h.param(3), 1); + AddParam(param, h.param(4), 0); + AddParam(param, h.param(5), 0); + AddParam(param, h.param(6), 0); + + // Not using range-for here because we're changing the size of entity in the loop. + for(i = 0; i < impEntity.n; i++) { + Entity *ie = &(impEntity[i]); + CopyEntity(entity, ie, 0, 0, + h.param(0), h.param(1), h.param(2), + h.param(3), h.param(4), h.param(5), h.param(6), NO_PARAM, + CopyAs::N_ROT_TRANS); + } + return; + } + ssassert(false, "Unexpected group type"); +} + +bool Group::IsSolvedOkay() { + return this->solved.how == SolveResult::OKAY || + (this->allowRedundant && this->solved.how == SolveResult::REDUNDANT_OKAY); +} + +void Group::AddEq(IdList *l, Expr *expr, int index) { + Equation eq; + eq.e = expr; + eq.h = h.equation(index); + l->Add(&eq); +} + +void Group::GenerateEquations(IdList *l) { + if(type == Type::LINKED) { + // Normalize the quaternion + ExprQuaternion q = { + Expr::From(h.param(3)), + Expr::From(h.param(4)), + Expr::From(h.param(5)), + Expr::From(h.param(6)) }; + AddEq(l, (q.Magnitude())->Minus(Expr::From(1)), 0); + } else if(type == Type::ROTATE || type == Type::REVOLVE || type == Type::HELIX) { + // The axis and center of rotation are specified numerically +#define EC(x) (Expr::From(x)) +#define EP(x) (Expr::From(h.param(x))) + ExprVector orig = SK.GetEntity(predef.origin)->PointGetExprs(); + AddEq(l, (orig.x)->Minus(EP(0)), 0); + AddEq(l, (orig.y)->Minus(EP(1)), 1); + AddEq(l, (orig.z)->Minus(EP(2)), 2); + // param 3 is the angle, which is free + Vector axis = SK.GetEntity(predef.entityB)->VectorGetNum(); + axis = axis.WithMagnitude(1); + AddEq(l, (EC(axis.x))->Minus(EP(4)), 3); + AddEq(l, (EC(axis.y))->Minus(EP(5)), 4); + AddEq(l, (EC(axis.z))->Minus(EP(6)), 5); +#undef EC +#undef EP + if(type == Type::HELIX) { + if(valB != 0.0) { + AddEq(l, Expr::From(h.param(7))->Times(Expr::From(PI))-> + Minus(Expr::From(h.param(3))->Times(Expr::From(valB))), 6); + } + } + } else if((type == Type::EXTRUDE) && (subtype != Subtype::ONE_SKEWED) && + (subtype != Subtype::TWO_SKEWED)) { + if(predef.entityB != Entity::FREE_IN_3D) { + // The extrusion path is locked along a line, normal to the + // specified workplane. Don't constrain for skewed extrusions. + Entity *w = SK.GetEntity(predef.entityB); + ExprVector u = w->Normal()->NormalExprsU(); + ExprVector v = w->Normal()->NormalExprsV(); + ExprVector extruden = { + Expr::From(h.param(0)), + Expr::From(h.param(1)), + Expr::From(h.param(2)) }; + + AddEq(l, u.Dot(extruden), 0); + AddEq(l, v.Dot(extruden), 1); + } + } else if(type == Type::TRANSLATE) { + if(predef.entityB != Entity::FREE_IN_3D) { + Entity *w = SK.GetEntity(predef.entityB); + ExprVector n = w->Normal()->NormalExprsN(); + ExprVector trans; + trans = ExprVector::From(h.param(0), h.param(1), h.param(2)); + + // The translation vector is parallel to the workplane + AddEq(l, trans.Dot(n), 0); + } + } +} + +hEntity Group::Remap(hEntity in, int copyNumber) { + auto it = remap.find({ in, copyNumber }); + if(it == remap.end()) { + // Due to the way the remap value is combined with the group handle into a 32-bit + // handle value to generate an entity handle, the mapped value must fit in a 16-bit + // variable. + // This limit can be lifted once the handle values are extended to 64-bit. + ssassert(remap.size() < (1 << 16) - 1, "Too many entities in group"); + std::tie(it, std::ignore) = + remap.insert({ { in, copyNumber }, { (uint32_t)remap.size() + 1 } }); + } + return h.entity(it->second.v); +} + +void Group::MakeExtrusionLines(EntityList *el, hEntity in) { + Entity *ep = SK.GetEntity(in); + + Entity en = {}; + if(ep->IsPoint()) { + // A point gets extruded to form a line segment + en.point[0] = Remap(ep->h, REMAP_TOP); + en.point[1] = Remap(ep->h, REMAP_BOTTOM); + en.group = h; + en.construction = ep->construction; + en.style = ep->style; + en.h = Remap(ep->h, REMAP_PT_TO_LINE); + en.type = Entity::Type::LINE_SEGMENT; + el->Add(&en); + } else if(ep->type == Entity::Type::LINE_SEGMENT) { + // A line gets extruded to form a plane face; an endpoint of the + // original line is a point in the plane, and the line is in the plane. + Vector a = SK.GetEntity(ep->point[0])->PointGetNum(); + Vector b = SK.GetEntity(ep->point[1])->PointGetNum(); + Vector ab = b.Minus(a); + + en.param[0] = h.param(0); + en.param[1] = h.param(1); + en.param[2] = h.param(2); + en.numPoint = a; + // we need a point somewhere on the face, and it must be from the current group. + en.point[0] = Remap(ep->point[0], REMAP_TOP); + en.numNormal = Quaternion::From(0, ab.x, ab.y, ab.z); + + en.group = h; + en.construction = ep->construction; + en.style = ep->style; + en.h = Remap(ep->h, REMAP_LINE_TO_FACE); + en.type = Entity::Type::FACE_XPROD; + el->Add(&en); + } +} + +void Group::MakeLatheCircles(EntityList *el, ParamList *param, hEntity in, Vector pt, Vector axis) { + Entity *ep = SK.GetEntity(in); + + Entity en = {}; + if(ep->IsPoint()) { + // A point gets revolved to form an arc. + en.point[0] = Remap(ep->h, REMAP_LATHE_ARC_CENTER); + en.point[1] = Remap(ep->h, REMAP_LATHE_START); + en.point[2] = en.point[1]; //Remap(ep->h, REMAP_LATHE_END); + + // Get arc center and point on arc. + Entity *pc = SK.GetEntity(en.point[0]); + Entity *pp = SK.GetEntity(en.point[1]); + + // Project arc point to the revolution axis and use it for arc center. + double k = pp->numPoint.Minus(pt).Dot(axis) / axis.Dot(axis); + pc->numPoint = pt.Plus(axis.ScaledBy(k)); + + // Create arc entity. + en.group = h; + en.construction = ep->construction; + en.style = ep->style; + en.h = Remap(ep->h, REMAP_PT_TO_ARC); + en.type = Entity::Type::ARC_OF_CIRCLE; + + // Generate a normal. + Entity n = {}; + n.workplane = en.workplane; + n.h = Remap(ep->h, REMAP_PT_TO_NORMAL); + n.group = en.group; + n.style = en.style; + n.type = Entity::Type::NORMAL_N_COPY; + + // Create basis for the normal. + Vector nu = pp->numPoint.Minus(pc->numPoint).WithMagnitude(1.0); + Vector nv = nu.Cross(axis).WithMagnitude(1.0); + n.numNormal = Quaternion::From(nv, nu); + + // The point determines where the normal gets displayed on-screen; + // it's entirely cosmetic. + n.point[0] = en.point[0]; + el->Add(&n); + en.normal = n.h; + el->Add(&en); + } +} + +void Group::MakeLatheSurfacesSelectable(EntityList *el, hEntity in, Vector axis) { + Entity *ep = SK.GetEntity(in); + + Entity en = {}; + if(ep->type == Entity::Type::LINE_SEGMENT) { + // An axis-perpendicular line gets revolved to form a face. + Vector a = SK.GetEntity(ep->point[0])->PointGetNum(); + Vector b = SK.GetEntity(ep->point[1])->PointGetNum(); + Vector u = b.Minus(a).WithMagnitude(1.0); + + // Check for perpendicularity: calculate cosine of the angle + // between axis and line direction and check that + // cos(angle) == 0 <-> angle == +-90 deg. + if(fabs(u.Dot(axis) / axis.Magnitude()) < ANGLE_COS_EPS) { + en.param[0] = h.param(0); + en.param[1] = h.param(1); + en.param[2] = h.param(2); + Vector v = axis.Cross(u).WithMagnitude(1.0); + Vector n = u.Cross(v); + en.numNormal = Quaternion::From(0, n.x, n.y, n.z); + + en.group = h; + en.construction = ep->construction; + en.style = ep->style; + en.h = Remap(ep->h, REMAP_LINE_TO_FACE); + en.type = Entity::Type::FACE_NORMAL_PT; + en.point[0] = Remap(ep->point[0], REMAP_LATHE_START); + el->Add(&en); + } + } +} + +// For Revolve and Helix groups the end faces are remapped from an arbitrary +// point on the sketch. We reference the transformed point but there is +// no existing normal so we need to define the rotation and timesApplied. +void Group::MakeRevolveEndFaces(EntityList *el, hEntity pt, int ai, int af) +{ + if(pt.v == 0) return; + Group *src = SK.GetGroup(opA); + Vector n = src->polyLoops.normal; + + // When there is no loop normal (e.g. if the loop is broken), use normal of workplane + // as fallback, to avoid breaking constraints depending on the faces. + if(n.Equals(Vector::From(0.0, 0.0, 0.0)) && src->type == Group::Type::DRAWING_WORKPLANE) { + n = SK.GetEntity(src->h.entity(0))->Normal()->NormalN(); + } + + Entity en = {}; + en.type = Entity::Type::FACE_ROT_NORMAL_PT; + en.group = h; + // The center of rotation + en.param[0] = h.param(0); + en.param[1] = h.param(1); + en.param[2] = h.param(2); + // The rotation quaternion + en.param[3] = h.param(3); + en.param[4] = h.param(4); + en.param[5] = h.param(5); + en.param[6] = h.param(6); + + en.numNormal = Quaternion::From(0, n.x, n.y, n.z); + en.point[0] = Remap(pt, REMAP_LATHE_START); + en.timesApplied = ai; + en.h = Remap(Entity::NO_ENTITY, REMAP_LATHE_START); + el->Add(&en); + + en.point[0] = Remap(pt, REMAP_LATHE_END); + en.timesApplied = af; + en.h = Remap(Entity::NO_ENTITY, REMAP_LATHE_END); + el->Add(&en); +} + +void Group::MakeExtrusionTopBottomFaces(EntityList *el, hEntity pt) +{ + if(pt.v == 0) return; + Group *src = SK.GetGroup(opA); + Vector n = src->polyLoops.normal; + + // When there is no loop normal (e.g. if the loop is broken), use normal of workplane + // as fallback, to avoid breaking constraints depending on the faces. + if(n.Equals(Vector::From(0.0, 0.0, 0.0)) && src->type == Group::Type::DRAWING_WORKPLANE) { + n = SK.GetEntity(src->h.entity(0))->Normal()->NormalN(); + } + + Entity en = {}; + en.type = Entity::Type::FACE_NORMAL_PT; + en.group = h; + + en.numNormal = Quaternion::From(0, n.x, n.y, n.z); + en.point[0] = Remap(pt, REMAP_TOP); + en.h = Remap(Entity::NO_ENTITY, REMAP_TOP); + el->Add(&en); + + en.point[0] = Remap(pt, REMAP_BOTTOM); + en.h = Remap(Entity::NO_ENTITY, REMAP_BOTTOM); + el->Add(&en); +} + +void Group::CopyEntity(EntityList *el, + Entity *ep, int timesApplied, int remap, + hParam dx, hParam dy, hParam dz, + hParam qw, hParam qvx, hParam qvy, hParam qvz, hParam dist, + CopyAs as) +{ + Entity en = {}; + en.type = ep->type; + en.extraPoints = ep->extraPoints; + en.h = Remap(ep->h, remap); + en.timesApplied = timesApplied; + en.group = h; + en.construction = ep->construction; + en.style = ep->style; + en.str = ep->str; + en.font = ep->font; + en.file = ep->file; + + switch(ep->type) { + case Entity::Type::WORKPLANE: + // Don't copy these. + return; + + case Entity::Type::POINT_N_COPY: + case Entity::Type::POINT_N_TRANS: + case Entity::Type::POINT_N_ROT_TRANS: + case Entity::Type::POINT_N_ROT_AA: + case Entity::Type::POINT_N_ROT_AXIS_TRANS: + case Entity::Type::POINT_IN_3D: + case Entity::Type::POINT_IN_2D: + if(as == CopyAs::N_TRANS) { + en.type = Entity::Type::POINT_N_TRANS; + en.param[0] = dx; + en.param[1] = dy; + en.param[2] = dz; + } else if(as == CopyAs::NUMERIC) { + en.type = Entity::Type::POINT_N_COPY; + } else { + if(as == CopyAs::N_ROT_AA) { + en.type = Entity::Type::POINT_N_ROT_AA; + } else if (as == CopyAs::N_ROT_AXIS_TRANS) { + en.type = Entity::Type::POINT_N_ROT_AXIS_TRANS; + } else { + en.type = Entity::Type::POINT_N_ROT_TRANS; + } + en.param[0] = dx; + en.param[1] = dy; + en.param[2] = dz; + en.param[3] = qw; + en.param[4] = qvx; + en.param[5] = qvy; + en.param[6] = qvz; + if (as == CopyAs::N_ROT_AXIS_TRANS) { + en.param[7] = dist; + } + } + en.numPoint = (ep->actPoint).ScaledBy(scale); + break; + + case Entity::Type::NORMAL_N_COPY: + case Entity::Type::NORMAL_N_ROT: + case Entity::Type::NORMAL_N_ROT_AA: + case Entity::Type::NORMAL_IN_3D: + case Entity::Type::NORMAL_IN_2D: + if(as == CopyAs::N_TRANS || as == CopyAs::NUMERIC) { + en.type = Entity::Type::NORMAL_N_COPY; + } else { // N_ROT_AXIS_TRANS probably doesn't warrant a new entity Type + if(as == CopyAs::N_ROT_AA || as == CopyAs::N_ROT_AXIS_TRANS) { + en.type = Entity::Type::NORMAL_N_ROT_AA; + } else { + en.type = Entity::Type::NORMAL_N_ROT; + } + en.param[0] = qw; + en.param[1] = qvx; + en.param[2] = qvy; + en.param[3] = qvz; + } + en.numNormal = ep->actNormal; + if(scale < 0) en.numNormal = en.numNormal.Mirror(); + + en.point[0] = Remap(ep->point[0], remap); + break; + + case Entity::Type::DISTANCE_N_COPY: + case Entity::Type::DISTANCE: + en.type = Entity::Type::DISTANCE_N_COPY; + en.numDistance = ep->actDistance*fabs(scale); + break; + + case Entity::Type::FACE_NORMAL_PT: + case Entity::Type::FACE_XPROD: + case Entity::Type::FACE_N_ROT_TRANS: + case Entity::Type::FACE_N_TRANS: + case Entity::Type::FACE_N_ROT_AA: + case Entity::Type::FACE_ROT_NORMAL_PT: + case Entity::Type::FACE_N_ROT_AXIS_TRANS: + if(as == CopyAs::N_TRANS) { + en.type = Entity::Type::FACE_N_TRANS; + en.param[0] = dx; + en.param[1] = dy; + en.param[2] = dz; + } else if (as == CopyAs::NUMERIC) { + en.type = Entity::Type::FACE_NORMAL_PT; + } else if (as == CopyAs::N_ROT_AXIS_TRANS) { + en.type = Entity::Type::FACE_N_ROT_AXIS_TRANS; + en.param[0] = dx; + en.param[1] = dy; + en.param[2] = dz; + en.param[3] = qw; + en.param[4] = qvx; + en.param[5] = qvy; + en.param[6] = qvz; + en.param[7] = dist; + } else { + if(as == CopyAs::N_ROT_AA) { + en.type = Entity::Type::FACE_N_ROT_AA; + } else { + en.type = Entity::Type::FACE_N_ROT_TRANS; + } + en.param[0] = dx; + en.param[1] = dy; + en.param[2] = dz; + en.param[3] = qw; + en.param[4] = qvx; + en.param[5] = qvy; + en.param[6] = qvz; + } + en.numPoint = (ep->actPoint).ScaledBy(scale); + en.numNormal = (ep->actNormal).ScaledBy(scale); + // the new face needs an associated point (old files may not have one) + if(ep->point[0].v != 0) { + en.point[0] = Remap(ep->point[0], remap); + } + break; + + default: { + if((Entity::Type::IMAGE == ep->type) && (true == ep->construction)) { + // Do not copy image entities if they are construction. + return; + } + + int i, points; + bool hasNormal, hasDistance; + ssassert(EntReqTable::GetEntityInfo(ep->type, ep->extraPoints, + NULL, &points, &hasNormal, &hasDistance), "No entity info"); + for(i = 0; i < points; i++) { + en.point[i] = Remap(ep->point[i], remap); + } + if(hasNormal) en.normal = Remap(ep->normal, remap); + if(hasDistance) en.distance = Remap(ep->distance, remap); + break; + } + } + + // If the entity came from an linked file where it was invisible then + // ep->actiVisble will be false, and we should hide it. Or if the entity + // came from a copy (e.g. step and repeat) of a force-hidden linked + // entity, then we also want to hide it. + en.forceHidden = (!ep->actVisible) || ep->forceHidden; + + el->Add(&en); +} + +bool Group::ShouldDrawExploded() const { + return SS.explode && h == SS.GW.activeGroup && type == Type::DRAWING_WORKPLANE && !SS.exportMode; +} + +} // namespace SolveSpace diff --git a/src/groupmesh.cpp b/src/groupmesh.cpp new file mode 100644 index 0000000..785817b --- /dev/null +++ b/src/groupmesh.cpp @@ -0,0 +1,803 @@ +//----------------------------------------------------------------------------- +// Routines to generate our watertight brep shells from the operations +// and entities specified by the user in each group; templated to work either +// on an SShell of ratpoly surfaces or on an SMesh of triangles. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void Group::AssembleLoops(bool *allClosed, + bool *allCoplanar, + bool *allNonZeroLen) +{ + SBezierList sbl = {}; + + int i; + for(auto &e : SK.entity) { + if(e.group != h) + continue; + if(e.construction) + continue; + if(e.forceHidden) + continue; + + e.GenerateBezierCurves(&sbl); + } + + SBezier *sb; + *allNonZeroLen = true; + for(sb = sbl.l.First(); sb; sb = sbl.l.NextAfter(sb)) { + for(i = 1; i <= sb->deg; i++) { + if(!(sb->ctrl[i]).Equals(sb->ctrl[0])) { + break; + } + } + if(i > sb->deg) { + // This is a zero-length edge. + *allNonZeroLen = false; + polyError.errorPointAt = sb->ctrl[0]; + goto done; + } + } + + // Try to assemble all these Beziers into loops. The closed loops go into + // bezierLoops, with the outer loops grouped with their holes. The + // leftovers, if any, go in bezierOpens. + bezierLoops.FindOuterFacesFrom(&sbl, &polyLoops, NULL, + SS.ChordTolMm(), + allClosed, &(polyError.notClosedAt), + allCoplanar, &(polyError.errorPointAt), + &bezierOpens); + done: + sbl.Clear(); +} + +void Group::GenerateLoops() { + polyLoops.Clear(); + bezierLoops.Clear(); + bezierOpens.Clear(); + + if(type == Type::DRAWING_3D || type == Type::DRAWING_WORKPLANE || + type == Type::ROTATE || type == Type::TRANSLATE || type == Type::LINKED) + { + bool allClosed = false, allCoplanar = false, allNonZeroLen = false; + AssembleLoops(&allClosed, &allCoplanar, &allNonZeroLen); + if(!allNonZeroLen) { + polyError.how = PolyError::ZERO_LEN_EDGE; + } else if(!allCoplanar) { + polyError.how = PolyError::NOT_COPLANAR; + } else if(!allClosed) { + polyError.how = PolyError::NOT_CLOSED; + } else { + polyError.how = PolyError::GOOD; + // The self-intersecting check is kind of slow, so don't run it + // unless requested. + if(SS.checkClosedContour) { + if(polyLoops.SelfIntersecting(&(polyError.errorPointAt))) { + polyError.how = PolyError::SELF_INTERSECTING; + } + } + } + } +} + +void SShell::RemapFaces(Group *g, int remap) { + for(SSurface &ss : surface){ + hEntity face = { ss.face }; + if(face == Entity::NO_ENTITY) continue; + + face = g->Remap(face, remap); + ss.face = face.v; + } +} + +void SMesh::RemapFaces(Group *g, int remap) { + STriangle *tr; + for(tr = l.First(); tr; tr = l.NextAfter(tr)) { + hEntity face = { tr->meta.face }; + if(face == Entity::NO_ENTITY) continue; + + face = g->Remap(face, remap); + tr->meta.face = face.v; + } +} + +template +void Group::GenerateForStepAndRepeat(T *steps, T *outs, Group::CombineAs forWhat) { + + int n = (int)valA, a0 = 0; + if(subtype == Subtype::ONE_SIDED && skipFirst) { + a0++; n++; + } + + int a; + // create all the transformed copies + std::vector transd(n); + std::vector workA(n); + workA[0] = {}; + // first generate a shell/mesh with each transformed copy +#pragma omp parallel for + for(a = a0; a < n; a++) { + transd[a] = {}; + workA[a] = {}; + int ap = a*2 - (subtype == Subtype::ONE_SIDED ? 0 : (n-1)); + + if(type == Type::TRANSLATE) { + Vector trans = Vector::From(h.param(0), h.param(1), h.param(2)); + trans = trans.ScaledBy(ap); + transd[a].MakeFromTransformationOf(steps, + trans, Quaternion::IDENTITY, 1.0); + } else { + Vector trans = Vector::From(h.param(0), h.param(1), h.param(2)); + double theta = ap * SK.GetParam(h.param(3))->val; + double c = cos(theta), s = sin(theta); + Vector axis = Vector::From(h.param(4), h.param(5), h.param(6)); + Quaternion q = Quaternion::From(c, s*axis.x, s*axis.y, s*axis.z); + // Rotation is centered at t; so A(x - t) + t = Ax + (t - At) + transd[a].MakeFromTransformationOf(steps, + trans.Minus(q.Rotate(trans)), q, 1.0); + } + } + for(a = a0; a < n; a++) { + // We need to rewrite any plane face entities to the transformed ones. + int remap = (a == (n - 1)) ? REMAP_LAST : a; + transd[a].RemapFaces(this, remap); + } + + std::vector *soFar = &transd; + std::vector *scratch = &workA; + // do the boolean operations on pairs of equal size + while(n > 1) { + for(a = 0; a < n; a+=2) { + scratch->at(a/2).Clear(); + // combine a pair of shells + if((a==0) && (a0==1)) { // if the first was skipped just copy the 2nd + scratch->at(a/2).MakeFromCopyOf(&(soFar->at(a+1))); + (soFar->at(a+1)).Clear(); + a0 = 0; + } else if (a == n-1) { // for an odd number just copy the last one + scratch->at(a/2).MakeFromCopyOf(&(soFar->at(a))); + (soFar->at(a)).Clear(); + } else if(forWhat == CombineAs::ASSEMBLE) { + scratch->at(a/2).MakeFromAssemblyOf(&(soFar->at(a)), &(soFar->at(a+1))); + (soFar->at(a)).Clear(); + (soFar->at(a+1)).Clear(); + } else { + scratch->at(a/2).MakeFromUnionOf(&(soFar->at(a)), &(soFar->at(a+1))); + (soFar->at(a)).Clear(); + (soFar->at(a+1)).Clear(); + } + } + swap(scratch, soFar); + n = (n+1)/2; + } + outs->Clear(); + *outs = soFar->at(0); +} + +template +void Group::GenerateForBoolean(T *prevs, T *thiss, T *outs, Group::CombineAs how) { + // If this group contributes no new mesh, then our running mesh is the + // same as last time, no combining required. Likewise if we have a mesh + // but it's suppressed. + if(thiss->IsEmpty() || suppress) { + outs->MakeFromCopyOf(prevs); + return; + } + + // So our group's shell appears in thisShell. Combine this with the + // previous group's shell, using the requested operation. + switch(how) { + case CombineAs::UNION: + outs->MakeFromUnionOf(prevs, thiss); + break; + + case CombineAs::DIFFERENCE: + outs->MakeFromDifferenceOf(prevs, thiss); + break; + + case CombineAs::INTERSECTION: + outs->MakeFromIntersectionOf(prevs, thiss); + break; + + case CombineAs::ASSEMBLE: + outs->MakeFromAssemblyOf(prevs, thiss); + break; + } +} + +void Group::GenerateShellAndMesh() { + bool prevBooleanFailed = booleanFailed; + booleanFailed = false; + + Group *srcg = this; + + thisShell.Clear(); + thisMesh.Clear(); + runningShell.Clear(); + runningMesh.Clear(); + + // Don't attempt a lathe or extrusion unless the source section is good: + // planar and not self-intersecting. + bool haveSrc = true; + if(type == Type::EXTRUDE || type == Type::LATHE || type == Type::REVOLVE) { + Group *src = SK.GetGroup(opA); + if(src->polyError.how != PolyError::GOOD) { + haveSrc = false; + } + } + + if(type == Type::TRANSLATE || type == Type::ROTATE) { + // A step and repeat gets merged against the group's previous group, + // not our own previous group. + srcg = SK.GetGroup(opA); + + if(!srcg->suppress) { + if(!IsForcedToMesh()) { + GenerateForStepAndRepeat(&(srcg->thisShell), &thisShell, srcg->meshCombine); + } else { + SMesh prevm = {}; + prevm.MakeFromCopyOf(&srcg->thisMesh); + srcg->thisShell.TriangulateInto(&prevm); + GenerateForStepAndRepeat (&prevm, &thisMesh, srcg->meshCombine); + } + } + } else if(type == Type::EXTRUDE && haveSrc) { + Group *src = SK.GetGroup(opA); + Vector translate = Vector::From(h.param(0), h.param(1), h.param(2)); + + Vector tbot, ttop; + if(subtype == Subtype::ONE_SIDED || subtype == Subtype::ONE_SKEWED) { + tbot = Vector::From(0, 0, 0); ttop = translate.ScaledBy(2); + } else { + tbot = translate.ScaledBy(-1); ttop = translate.ScaledBy(1); + } + + SBezierLoopSetSet *sblss = &(src->bezierLoops); + SBezierLoopSet *sbls; + for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) { + int is = thisShell.surface.n; + // Extrude this outer contour (plus its inner contours, if present) + thisShell.MakeFromExtrusionOf(sbls, tbot, ttop, color); + + // And for any plane faces, annotate the model with the entity for + // that face, so that the user can select them with the mouse. + Vector onOrig = sbls->point; + int i; + // Not using range-for here because we're starting at a different place and using + // indices for meaning. + for(i = is; i < thisShell.surface.n; i++) { + SSurface *ss = &(thisShell.surface[i]); + hEntity face = Entity::NO_ENTITY; + + Vector p = ss->PointAt(0, 0), + n = ss->NormalAt(0, 0).WithMagnitude(1); + double d = n.Dot(p); + + if(i == is || i == (is + 1)) { + // These are the top and bottom of the shell. + if(fabs((onOrig.Plus(ttop)).Dot(n) - d) < LENGTH_EPS) { + face = Remap(Entity::NO_ENTITY, REMAP_TOP); + ss->face = face.v; + } + if(fabs((onOrig.Plus(tbot)).Dot(n) - d) < LENGTH_EPS) { + face = Remap(Entity::NO_ENTITY, REMAP_BOTTOM); + ss->face = face.v; + } + continue; + } + + // So these are the sides + if(ss->degm != 1 || ss->degn != 1) continue; + + for(Entity &e : SK.entity) { + if(e.group != opA) continue; + if(e.type != Entity::Type::LINE_SEGMENT) continue; + + Vector a = SK.GetEntity(e.point[0])->PointGetNum(), + b = SK.GetEntity(e.point[1])->PointGetNum(); + a = a.Plus(ttop); + b = b.Plus(ttop); + // Could get taken backwards, so check all cases. + if((a.Equals(ss->ctrl[0][0]) && b.Equals(ss->ctrl[1][0])) || + (b.Equals(ss->ctrl[0][0]) && a.Equals(ss->ctrl[1][0])) || + (a.Equals(ss->ctrl[0][1]) && b.Equals(ss->ctrl[1][1])) || + (b.Equals(ss->ctrl[0][1]) && a.Equals(ss->ctrl[1][1]))) + { + face = Remap(e.h, REMAP_LINE_TO_FACE); + ss->face = face.v; + break; + } + } + } + } + } else if(type == Type::LATHE && haveSrc) { + Group *src = SK.GetGroup(opA); + + Vector pt = SK.GetEntity(predef.origin)->PointGetNum(), + axis = SK.GetEntity(predef.entityB)->VectorGetNum(); + axis = axis.WithMagnitude(1); + + SBezierLoopSetSet *sblss = &(src->bezierLoops); + SBezierLoopSet *sbls; + for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) { + thisShell.MakeFromRevolutionOf(sbls, pt, axis, color, this); + } + } else if(type == Type::REVOLVE && haveSrc) { + Group *src = SK.GetGroup(opA); + double anglef = SK.GetParam(h.param(3))->val * 4; // why the 4 is needed? + double dists = 0, distf = 0; + double angles = 0.0; + if(subtype != Subtype::ONE_SIDED) { + anglef *= 0.5; + angles = -anglef; + } + Vector pt = SK.GetEntity(predef.origin)->PointGetNum(), + axis = SK.GetEntity(predef.entityB)->VectorGetNum(); + axis = axis.WithMagnitude(1); + + SBezierLoopSetSet *sblss = &(src->bezierLoops); + SBezierLoopSet *sbls; + for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) { + if(fabs(anglef - angles) < 2 * PI) { + thisShell.MakeFromHelicalRevolutionOf(sbls, pt, axis, color, this, + angles, anglef, dists, distf); + } else { + thisShell.MakeFromRevolutionOf(sbls, pt, axis, color, this); + } + } + } else if(type == Type::HELIX && haveSrc) { + Group *src = SK.GetGroup(opA); + double anglef = SK.GetParam(h.param(3))->val * 4; // why the 4 is needed? + double dists = 0, distf = 0; + double angles = 0.0; + distf = SK.GetParam(h.param(7))->val * 2; // dist is applied twice + if(subtype != Subtype::ONE_SIDED) { + anglef *= 0.5; + angles = -anglef; + distf *= 0.5; + dists = -distf; + } + Vector pt = SK.GetEntity(predef.origin)->PointGetNum(), + axis = SK.GetEntity(predef.entityB)->VectorGetNum(); + axis = axis.WithMagnitude(1); + + SBezierLoopSetSet *sblss = &(src->bezierLoops); + SBezierLoopSet *sbls; + for(sbls = sblss->l.First(); sbls; sbls = sblss->l.NextAfter(sbls)) { + thisShell.MakeFromHelicalRevolutionOf(sbls, pt, axis, color, this, + angles, anglef, dists, distf); + } + } else if(type == Type::LINKED) { + // The imported shell or mesh are copied over, with the appropriate + // transformation applied. We also must remap the face entities. + Vector offset = { + SK.GetParam(h.param(0))->val, + SK.GetParam(h.param(1))->val, + SK.GetParam(h.param(2))->val }; + Quaternion q = { + SK.GetParam(h.param(3))->val, + SK.GetParam(h.param(4))->val, + SK.GetParam(h.param(5))->val, + SK.GetParam(h.param(6))->val }; + + thisMesh.MakeFromTransformationOf(&impMesh, offset, q, scale); + thisMesh.RemapFaces(this, 0); + + thisShell.MakeFromTransformationOf(&impShell, offset, q, scale); + thisShell.RemapFaces(this, 0); + } + + if(srcg->meshCombine != CombineAs::ASSEMBLE) { + thisShell.MergeCoincidentSurfaces(); + } + + // So now we've got the mesh or shell for this group. Combine it with + // the previous group's mesh or shell with the requested Boolean, and + // we're done. + + Group *prevg = srcg->RunningMeshGroup(); + + if(!IsForcedToMesh()) { + SShell *prevs = &(prevg->runningShell); + GenerateForBoolean(prevs, &thisShell, &runningShell, + srcg->meshCombine); + + if(srcg->meshCombine != CombineAs::ASSEMBLE) { + runningShell.MergeCoincidentSurfaces(); + } + + // If the Boolean failed, then we should note that in the text screen + // for this group. + booleanFailed = runningShell.booleanFailed; + if(booleanFailed != prevBooleanFailed) { + SS.ScheduleShowTW(); + } + } else { + SMesh prevm, thism; + prevm = {}; + thism = {}; + + prevm.MakeFromCopyOf(&(prevg->runningMesh)); + prevg->runningShell.TriangulateInto(&prevm); + + thism.MakeFromCopyOf(&thisMesh); + thisShell.TriangulateInto(&thism); + + SMesh outm = {}; + GenerateForBoolean(&prevm, &thism, &outm, srcg->meshCombine); + + // Remove degenerate triangles; if we don't, they'll get split in SnapToMesh + // in every generated group, resulting in polynomial increase in triangle count, + // and corresponding slowdown. + outm.RemoveDegenerateTriangles(); + + if(srcg->meshCombine != CombineAs::ASSEMBLE) { + // And make sure that the output mesh is vertex-to-vertex. + SKdNode *root = SKdNode::From(&outm); + root->SnapToMesh(&outm); + root->MakeMeshInto(&runningMesh); + } else { + runningMesh.MakeFromCopyOf(&outm); + } + + outm.Clear(); + thism.Clear(); + prevm.Clear(); + } + + displayDirty = true; +} + +void Group::GenerateDisplayItems() { + // This is potentially slow (since we've got to triangulate a shell, or + // to find the emphasized edges for a mesh), so we will run it only + // if its inputs have changed. + if(displayDirty) { + Group *pg = RunningMeshGroup(); + if(pg && thisMesh.IsEmpty() && thisShell.IsEmpty()) { + // We don't contribute any new solid model in this group, so our + // display items are identical to the previous group's; which means + // that we can just display those, and stop ourselves from + // recalculating for those every time we get a change in this group. + // + // Note that this can end up recursing multiple times (if multiple + // groups that contribute no solid model exist in sequence), but + // that's okay. + pg->GenerateDisplayItems(); + + displayMesh.Clear(); + displayMesh.MakeFromCopyOf(&(pg->displayMesh)); + + displayOutlines.Clear(); + if(SS.GW.showEdges || SS.GW.showOutlines) { + displayOutlines.MakeFromCopyOf(&pg->displayOutlines); + } + } else { + // We do contribute new solid model, so we have to triangulate the + // shell, and edge-find the mesh. + displayMesh.Clear(); + runningShell.TriangulateInto(&displayMesh); + STriangle *t; + for(t = runningMesh.l.First(); t; t = runningMesh.l.NextAfter(t)) { + STriangle trn = *t; + Vector n = trn.Normal(); + trn.an = n; + trn.bn = n; + trn.cn = n; + displayMesh.AddTriangle(&trn); + } + + displayOutlines.Clear(); + + if(SS.GW.showEdges || SS.GW.showOutlines) { + SOutlineList rawOutlines = {}; + if(!runningMesh.l.IsEmpty()) { + // Triangle mesh only; no shell or emphasized edges. + runningMesh.MakeOutlinesInto(&rawOutlines, EdgeKind::EMPHASIZED); + } else { + displayMesh.MakeOutlinesInto(&rawOutlines, EdgeKind::SHARP); + } + + PolylineBuilder builder; + builder.MakeFromOutlines(rawOutlines); + builder.GenerateOutlines(&displayOutlines); + rawOutlines.Clear(); + } + } + + // If we render this mesh, we need to know whether it's transparent, + // and we'll want all transparent triangles last, to make the depth test + // work correctly. + displayMesh.PrecomputeTransparency(); + + // Recalculate mass center if needed + if(SS.centerOfMass.draw && SS.centerOfMass.dirty && h == SS.GW.activeGroup) { + SS.UpdateCenterOfMass(); + } + displayDirty = false; + } +} + +Group *Group::PreviousGroup() const { + Group *prev = nullptr; + for(auto const &gh : SK.groupOrder) { + Group *g = SK.GetGroup(gh); + if(g->h == h) { + return prev; + } + prev = g; + } + return nullptr; +} + +Group *Group::RunningMeshGroup() const { + if(type == Type::TRANSLATE || type == Type::ROTATE) { + return SK.GetGroup(opA)->RunningMeshGroup(); + } else { + return PreviousGroup(); + } +} + +bool Group::IsMeshGroup() { + switch(type) { + case Group::Type::EXTRUDE: + case Group::Type::LATHE: + case Group::Type::REVOLVE: + case Group::Type::HELIX: + case Group::Type::ROTATE: + case Group::Type::TRANSLATE: + return true; + + default: + return false; + } +} + +void Group::DrawMesh(DrawMeshAs how, Canvas *canvas) { + if(!(SS.GW.showShaded || + SS.GW.drawOccludedAs != GraphicsWindow::DrawOccludedAs::VISIBLE)) return; + + switch(how) { + case DrawMeshAs::DEFAULT: { + // Force the shade color to something dim to not distract from + // the sketch. + Canvas::Fill fillFront = {}; + if(!SS.GW.showShaded) { + fillFront.layer = Canvas::Layer::DEPTH_ONLY; + } + if((type == Type::DRAWING_3D || type == Type::DRAWING_WORKPLANE) + && SS.GW.dimSolidModel) { + fillFront.color = Style::Color(Style::DIM_SOLID); + } + Canvas::hFill hcfFront = canvas->GetFill(fillFront); + + // The back faces are drawn in red; should never seem them, since we + // draw closed shells, so that's a debugging aid. + Canvas::hFill hcfBack = {}; + if(SS.drawBackFaces && !displayMesh.isTransparent) { + Canvas::Fill fillBack = {}; + fillBack.layer = fillFront.layer; + fillBack.color = RgbaColor::FromFloat(1.0f, 0.1f, 0.1f); + hcfBack = canvas->GetFill(fillBack); + } else { + hcfBack = hcfFront; + } + + // Draw the shaded solid into the depth buffer for hidden line removal, + // and if we're actually going to display it, to the color buffer too. + canvas->DrawMesh(displayMesh, hcfFront, hcfBack); + + // Draw mesh edges, for debugging. + if(SS.GW.showMesh) { + Canvas::Stroke strokeTriangle = {}; + strokeTriangle.zIndex = 1; + strokeTriangle.color = RgbaColor::FromFloat(0.0f, 1.0f, 0.0f); + strokeTriangle.width = 1; + strokeTriangle.unit = Canvas::Unit::PX; + Canvas::hStroke hcsTriangle = canvas->GetStroke(strokeTriangle); + SEdgeList edges = {}; + for(const STriangle &t : displayMesh.l) { + edges.AddEdge(t.a, t.b); + edges.AddEdge(t.b, t.c); + edges.AddEdge(t.c, t.a); + } + canvas->DrawEdges(edges, hcsTriangle); + edges.Clear(); + } + break; + } + + case DrawMeshAs::HOVERED: { + Canvas::Fill fill = {}; + fill.color = Style::Color(Style::HOVERED); + fill.pattern = Canvas::FillPattern::CHECKERED_A; + fill.zIndex = 2; + Canvas::hFill hcf = canvas->GetFill(fill); + + std::vector faces; + hEntity he = SS.GW.hover.entity; + if(he.v != 0 && SK.GetEntity(he)->IsFace()) { + faces.push_back(he.v); + } + canvas->DrawFaces(displayMesh, faces, hcf); + break; + } + + case DrawMeshAs::SELECTED: { + Canvas::Fill fill = {}; + fill.color = Style::Color(Style::SELECTED); + fill.pattern = Canvas::FillPattern::CHECKERED_B; + fill.zIndex = 1; + Canvas::hFill hcf = canvas->GetFill(fill); + + std::vector faces; + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + // See also GraphicsWindow::MakeSelected "if(c >= MAX_SELECTABLE_FACES)" + // and GraphicsWindow::GroupSelection "if(e->IsFace())" + for(auto &fc : gs.face) { + faces.push_back(fc.v); + } + canvas->DrawFaces(displayMesh, faces, hcf); + break; + } + } +} + +void Group::Draw(Canvas *canvas) { + // Everything here gets drawn whether or not the group is hidden; we + // can control this stuff independently, with show/hide solids, edges, + // mesh, etc. + + GenerateDisplayItems(); + DrawMesh(DrawMeshAs::DEFAULT, canvas); + + if(SS.GW.showEdges) { + Canvas::Stroke strokeEdge = Style::Stroke(Style::SOLID_EDGE); + strokeEdge.zIndex = 1; + Canvas::hStroke hcsEdge = canvas->GetStroke(strokeEdge); + + canvas->DrawOutlines(displayOutlines, hcsEdge, + SS.GW.showOutlines + ? Canvas::DrawOutlinesAs::EMPHASIZED_WITHOUT_CONTOUR + : Canvas::DrawOutlinesAs::EMPHASIZED_AND_CONTOUR); + + if(SS.GW.drawOccludedAs != GraphicsWindow::DrawOccludedAs::INVISIBLE) { + Canvas::Stroke strokeHidden = Style::Stroke(Style::HIDDEN_EDGE); + if(SS.GW.drawOccludedAs == GraphicsWindow::DrawOccludedAs::VISIBLE) { + strokeHidden.stipplePattern = StipplePattern::CONTINUOUS; + } + strokeHidden.layer = Canvas::Layer::OCCLUDED; + Canvas::hStroke hcsHidden = canvas->GetStroke(strokeHidden); + + canvas->DrawOutlines(displayOutlines, hcsHidden, + Canvas::DrawOutlinesAs::EMPHASIZED_AND_CONTOUR); + } + } + + if(SS.GW.showOutlines) { + Canvas::Stroke strokeOutline = Style::Stroke(Style::OUTLINE); + strokeOutline.zIndex = 1; + Canvas::hStroke hcsOutline = canvas->GetStroke(strokeOutline); + + canvas->DrawOutlines(displayOutlines, hcsOutline, + Canvas::DrawOutlinesAs::CONTOUR_ONLY); + } +} + +void Group::DrawPolyError(Canvas *canvas) { + const Camera &camera = canvas->GetCamera(); + + Canvas::Stroke strokeUnclosed = Style::Stroke(Style::DRAW_ERROR); + strokeUnclosed.color = strokeUnclosed.color.WithAlpha(50); + Canvas::hStroke hcsUnclosed = canvas->GetStroke(strokeUnclosed); + + Canvas::Stroke strokeError = Style::Stroke(Style::DRAW_ERROR); + strokeError.layer = Canvas::Layer::FRONT; + strokeError.width = 1.0f; + Canvas::hStroke hcsError = canvas->GetStroke(strokeError); + + double textHeight = Style::DefaultTextHeight() / camera.scale; + + // And finally show the polygons too, and any errors if it's not possible + // to assemble the lines into closed polygons. + if(polyError.how == PolyError::NOT_CLOSED) { + // Report this error only in sketch-in-workplane groups; otherwise + // it's just a nuisance. + if(type == Type::DRAWING_WORKPLANE) { + canvas->DrawVectorText(_("not closed contour, or not all same style!"), + textHeight, + polyError.notClosedAt.b, camera.projRight, camera.projUp, + hcsError); + canvas->DrawLine(polyError.notClosedAt.a, polyError.notClosedAt.b, hcsUnclosed); + } + } else if(polyError.how == PolyError::NOT_COPLANAR || + polyError.how == PolyError::SELF_INTERSECTING || + polyError.how == PolyError::ZERO_LEN_EDGE) { + // These errors occur at points, not lines + if(type == Type::DRAWING_WORKPLANE) { + const char *msg; + if(polyError.how == PolyError::NOT_COPLANAR) { + msg = _("points not all coplanar!"); + } else if(polyError.how == PolyError::SELF_INTERSECTING) { + msg = _("contour is self-intersecting!"); + } else { + msg = _("zero-length edge!"); + } + canvas->DrawVectorText(msg, textHeight, + polyError.errorPointAt, camera.projRight, camera.projUp, + hcsError); + } + } else { + // The contours will get filled in DrawFilledPaths. + } +} + +void Group::DrawFilledPaths(Canvas *canvas) { + for(const SBezierLoopSet &sbls : bezierLoops.l) { + if(sbls.l.IsEmpty() || sbls.l[0].l.IsEmpty()) + continue; + + // In an assembled loop, all the styles should be the same; so doesn't + // matter which one we grab. + const SBezier *sb = &(sbls.l[0].l[0]); + Style *s = Style::Get({ (uint32_t)sb->auxA }); + + Canvas::Fill fill = {}; + fill.zIndex = 1; + if(s->filled) { + // This is a filled loop, where the user specified a fill color. + fill.color = s->fillColor; + } else if(h == SS.GW.activeGroup && SS.checkClosedContour && + polyError.how == PolyError::GOOD) { + // If this is the active group, and we are supposed to check + // for closed contours, and we do indeed have a closed and + // non-intersecting contour, then fill it dimly. + fill.color = Style::Color(Style::CONTOUR_FILL).WithAlpha(127); + } else continue; + Canvas::hFill hcf = canvas->GetFill(fill); + + SPolygon sp = {}; + sbls.MakePwlInto(&sp); + canvas->DrawPolygon(sp, hcf); + sp.Clear(); + } +} + +void Group::DrawContourAreaLabels(Canvas *canvas) { + const Camera &camera = canvas->GetCamera(); + Vector gr = camera.projRight.ScaledBy(1 / camera.scale); + Vector gu = camera.projUp.ScaledBy(1 / camera.scale); + + for(SBezierLoopSet &sbls : bezierLoops.l) { + if(sbls.l.IsEmpty() || sbls.l[0].l.IsEmpty()) + continue; + + Vector min = sbls.l[0].l[0].ctrl[0]; + Vector max = min; + Vector zero = Vector::From(0.0, 0.0, 0.0); + sbls.GetBoundingProjd(Vector::From(1.0, 0.0, 0.0), zero, &min.x, &max.x); + sbls.GetBoundingProjd(Vector::From(0.0, 1.0, 0.0), zero, &min.y, &max.y); + sbls.GetBoundingProjd(Vector::From(0.0, 0.0, 1.0), zero, &min.z, &max.z); + + Vector mid = min.Plus(max).ScaledBy(0.5); + + hStyle hs = { Style::CONSTRAINT }; + Canvas::Stroke stroke = Style::Stroke(hs); + stroke.layer = Canvas::Layer::FRONT; + + std::string label = SS.MmToStringSI(fabs(sbls.SignedArea()), /*dim=*/2); + double fontHeight = Style::TextHeight(hs); + double textWidth = VectorFont::Builtin()->GetWidth(fontHeight, label), + textHeight = VectorFont::Builtin()->GetCapHeight(fontHeight); + Vector pos = mid.Minus(gr.ScaledBy(textWidth / 2.0)) + .Minus(gu.ScaledBy(textHeight / 2.0)); + canvas->DrawVectorText(label, fontHeight, pos, gr, gu, canvas->GetStroke(stroke)); + } +} + +} // namespace SolveSpace diff --git a/src/handle.h b/src/handle.h new file mode 100644 index 0000000..e247e60 --- /dev/null +++ b/src/handle.h @@ -0,0 +1,47 @@ +#ifndef SOVLESPACE_HANDLE_H +#define SOVLESPACE_HANDLE_H + +#include +#include + +namespace SolveSpace { + +/// Trait indicating which types are handle types and should get the associated operators. +/// Specialize for each handle type and inherit from std::true_type. +template +struct IsHandleOracle : std::false_type {}; + +// Equality-compare any two instances of a handle type. +template +static inline typename std::enable_if::value, bool>::type +operator==(T const &lhs, T const &rhs) { + return lhs.v == rhs.v; +} + +// Inequality-compare any two instances of a handle type. +template +static inline typename std::enable_if::value, bool>::type +operator!=(T const &lhs, T const &rhs) { + return !(lhs == rhs); +} + +// Less-than-compare any two instances of a handle type. +template +static inline typename std::enable_if::value, bool>::type +operator<(T const &lhs, T const &rhs) { + return lhs.v < rhs.v; +} + +template +struct HandleHasher { + static_assert(IsHandleOracle::value, "Not a valid handle type"); + + inline size_t operator()(const T &h) const { + using Hasher = std::hash; + return Hasher{}(h.v); + } +}; + +} // namespace SolveSpace + +#endif // !SOVLESPACE_HANDLE_H diff --git a/src/importdxf.cpp b/src/importdxf.cpp new file mode 100644 index 0000000..ce80280 --- /dev/null +++ b/src/importdxf.cpp @@ -0,0 +1,1199 @@ +#include "solvespace.h" +#include "libdxfrw.h" +#include "libdwgr.h" + +namespace SolveSpace { + +static std::string ToUpper(std::string str) { + std::transform(str.begin(), str.end(), str.begin(), ::toupper); + return str; +} + +static Quaternion NormalFromExtPoint(Vector extPoint) { + // DXF arbitrary axis algorithm for transforming a Z-vector into a rotated + // coordinate system + Vector ax, ay; + Vector az = extPoint.WithMagnitude(1.0); + + if ((fabs(az.x) < 1/64.) && (fabs(az.y) < 1/64.)) { + ax = Vector::From(0, 1, 0).Cross(az).WithMagnitude(1.0); + } else { + ax = Vector::From(0, 0, 1).Cross(az).WithMagnitude(1.0); + } + ay = az.Cross(ax).WithMagnitude(1.0); + return Quaternion::From(ax, ay); +} + +class DxfImport : public DRW_Interface { +public: + Vector blockX; + Vector blockY; + Vector blockZ; + Vector blockT; + + void invertXTransform() { + blockX.x = -blockX.x; + blockY.x = -blockY.x; + blockT.x = -blockT.x; + } + + void multBlockTransform(double x, double y, double sx, double sy, double angle) { + Vector oldX = blockX; + Vector oldY = blockY; + Vector oldT = blockT; + + Vector newX = Vector::From(sx, 0.0, 0.0).RotatedAbout(Vector::From(0.0, 0.0, 1.0), angle); + Vector newY = Vector::From(0.0, sy, 0.0).RotatedAbout(Vector::From(0.0, 0.0, 1.0), angle); + Vector newT = Vector::From(x, y, 0.0); + + blockX = oldX.ScaledBy(newX.x).Plus( + oldY.ScaledBy(newX.y)); + + blockY = oldX.ScaledBy(newY.x).Plus( + oldY.ScaledBy(newY.y)); + + blockT = oldX.ScaledBy(newT.x).Plus( + oldY.ScaledBy(newT.y)).Plus(oldT); + } + + void clearBlockTransform() { + blockX = Vector::From(1.0, 0.0, 0.0); + blockY = Vector::From(0.0, 1.0, 0.0); + blockZ = Vector::From(0.0, 0.0, 1.0); + blockT = Vector::From(0.0, 0.0, 0.0); + } + + Vector blockTransform(Vector v) { + Vector r = blockT; + r = r.Plus(blockX.ScaledBy(v.x)); + r = r.Plus(blockY.ScaledBy(v.y)); + r = r.Plus(blockZ.ScaledBy(v.z)); + return r; + } + + void blockTransformArc(Vector *c, Vector *p0, Vector *p1) { + bool oldSign = p0->Minus(*c).Cross(p1->Minus(*c)).z > 0.0; + + *c = blockTransform(*c); + *p0 = blockTransform(*p0); + *p1 = blockTransform(*p1); + + bool newSign = p0->Minus(*c).Cross(p1->Minus(*c)).z > 0.0; + if(oldSign != newSign) std::swap(*p0, *p1); + } + + Vector toVector(const DRW_Coord &c, bool transform = true) { + Vector result = Vector::From(c.x, c.y, c.z); + if(transform) return blockTransform(result); + return result; + } + + Vector toVector(const DRW_Vertex2D &c) { + Vector result = Vector::From(c.x, c.y, 0.0); + return blockTransform(result); + } + + Vector toVector(const DRW_Vertex &c) { + Vector result = Vector::From(c.basePoint.x, c.basePoint.y, c.basePoint.z); + return blockTransform(result); + } + + double angleTo(Vector v0, Vector v1) { + Vector d = v1.Minus(v0); + double a = atan2(d.y, d.x); + return M_PI + remainder(a - M_PI, 2 * M_PI); + } + + Vector polar(double radius, double angle) { + return Vector::From(radius * cos(angle), radius * sin(angle), 0.0); + } + + hRequest createBulge(Vector p0, Vector p1, double bulge) { + bool reversed = bulge < 0.0; + double alpha = atan(bulge) * 4.0; + + Vector middle = p1.Plus(p0).ScaledBy(0.5); + double dist = p1.Minus(p0).Magnitude() / 2.0; + double angle = angleTo(p0, p1); + + // alpha can't be 0.0 at this point + double radius = fabs(dist / sin(alpha / 2.0)); + double wu = fabs(radius * radius - dist * dist); + double h = sqrt(wu); + + if(bulge > 0.0) { + angle += M_PI_2; + } else { + angle -= M_PI_2; + } + + if (fabs(alpha) > M_PI) { + h *= -1.0; + } + + Vector center = polar(h, angle); + center = center.Plus(middle); + + if(reversed) std::swap(p0, p1); + blockTransformArc(¢er, &p0, &p1); + + hRequest hr = SS.GW.AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false); + SK.GetEntity(hr.entity(1))->PointForceTo(center); + SK.GetEntity(hr.entity(2))->PointForceTo(p0); + SK.GetEntity(hr.entity(3))->PointForceTo(p1); + processPoint(hr.entity(1)); + processPoint(hr.entity(2)); + processPoint(hr.entity(3)); + return hr; + } + + struct Block { + std::vector> entities; + DRW_Block data; + }; + + bool asConstruction = false; + unsigned unknownEntities = 0; + std::map styles; + std::map blocks; + std::map layers; + Block *readBlock = NULL; + const DRW_Insert *insertInsert = NULL; + + template + bool addPendingBlockEntity(const T &e) { + if(readBlock == NULL) return false; + readBlock->entities.emplace_back(new T(e)); + return true; + } + + void addEntity(DRW_Entity *e) { + switch(e->eType) { + case DRW::POINT: + addPoint(*static_cast(e)); + break; + case DRW::LINE: + addLine(*static_cast(e)); + break; + case DRW::ARC: + addArc(*static_cast(e)); + break; + case DRW::CIRCLE: + addCircle(*static_cast(e)); + break; + case DRW::POLYLINE: + addPolyline(*static_cast(e)); + break; + case DRW::LWPOLYLINE: + addLWPolyline(*static_cast(e)); + break; + case DRW::SPLINE: + addSpline(static_cast(e)); + break; + case DRW::INSERT: + addInsert(*static_cast(e)); + break; + case DRW::TEXT: + addText(*static_cast(e)); + break; + case DRW::MTEXT: + addMText(*static_cast(e)); + break; + case DRW::DIMALIGNED: + addDimAlign(static_cast(e)); + break; + case DRW::DIMLINEAR: + addDimLinear(static_cast(e)); + break; + case DRW::DIMRADIAL: + addDimRadial(static_cast(e)); + break; + case DRW::DIMDIAMETRIC: + addDimDiametric(static_cast(e)); + break; + case DRW::DIMANGULAR: + addDimAngular(static_cast(e)); + break; + default: + unknownEntities++; + } + } + + Style::TextOrigin dxfAlignToOrigin(DRW_Text::HAlign alignH, DRW_Text::VAlign alignV) { + uint32_t origin = 0; + switch(alignH) { + case DRW_Text::HLeft: + origin |= (uint32_t)Style::TextOrigin::LEFT; + break; + + case DRW_Text::HMiddle: + case DRW_Text::HCenter: + break; + + case DRW_Text::HRight: + origin |= (uint32_t)Style::TextOrigin::RIGHT; + break; + + case DRW_Text::HAligned: + case DRW_Text::HFit: + default: + origin |= (uint32_t)Style::TextOrigin::LEFT; + break; + } + + switch(alignV) { + case DRW_Text::VBaseLine: + case DRW_Text::VBottom: + origin |= (uint32_t)Style::TextOrigin::BOT; + break; + + case DRW_Text::VMiddle: + break; + + case DRW_Text::VTop: + origin |= (uint32_t)Style::TextOrigin::TOP; + break; + + default: + origin |= (uint32_t)Style::TextOrigin::BOT; + break; + } + + return (Style::TextOrigin)origin; + } + + DRW_Layer *getSourceLayer(const DRW_Entity *e) { + DRW_Layer *layer = NULL; + if(insertInsert != NULL) { + std::string l = insertInsert->layer; + auto bi = layers.find(l); + if(bi != layers.end()) layer = &bi->second; + } else { + std::string l = e->layer; + auto bi = layers.find(l); + if(bi != layers.end()) layer = &bi->second; + } + return layer; + } + + int getColor(const DRW_Entity *e) { + int col = e->color; + if(col == DRW::ColorByBlock) { + if(insertInsert != NULL) { + col = insertInsert->color; + } else { + col = 7; + } + } + if(col == DRW::ColorByLayer) { + DRW_Layer *layer = getSourceLayer(e); + if(layer != NULL) { + col = layer->color; + } else { + col = 7; + } + } + return col; + } + + DRW_LW_Conv::lineWidth getLineWidth(const DRW_Entity *e) { + DRW_LW_Conv::lineWidth result = e->lWeight; + if(result == DRW_LW_Conv::widthByBlock) { + if(insertInsert != NULL) { + result = insertInsert->lWeight; + } else { + result = DRW_LW_Conv::widthDefault; + } + } + if(result == DRW_LW_Conv::widthByLayer) { + DRW_Layer *layer = getSourceLayer(e); + if(layer != NULL) { + result = layer->lWeight; + } else { + result = DRW_LW_Conv::widthDefault; + } + } + return result; + } + + std::string getLineType(const DRW_Entity *e) { + std::string result = e->lineType; + if(result == "BYBLOCK") { + if(insertInsert != NULL) { + result = ToUpper(insertInsert->lineType); + } else { + result = "CONTINUOUS"; + } + } + if(result == "BYLAYER") { + DRW_Layer *layer = getSourceLayer(e); + if(layer != NULL) { + result = ToUpper(layer->lineType); + } else { + result = "CONTINUOUS"; + } + } + return result; + } + + hStyle invisibleStyle() { + std::string id = "@dxf-invisible"; + + auto si = styles.find(id); + if(si != styles.end()) { + return si->second; + } + + hStyle hs = { Style::CreateCustomStyle(/*rememberForUndo=*/false) }; + Style *s = Style::Get(hs); + s->name = id; + s->visible = false; + + styles.emplace(id, hs); + return hs; + } + + hStyle styleFor(const DRW_Entity *e) { + // Color. + //! @todo which color to choose: index or RGB one? + int col = getColor(e); + RgbaColor c = RgbaColor::From(DRW::dxfColors[col][0], + DRW::dxfColors[col][1], + DRW::dxfColors[col][2]); + + // Line width. + DRW_LW_Conv::lineWidth lw = getLineWidth(e); + double width = DRW_LW_Conv::lineWidth2dxfInt(e->lWeight) / 100.0; + if(width < 0.0) width = 1.0; + + // Line stipple. + //! @todo Probably, we can load default autocad patterns and match it with ours. + std::string lineType = getLineType(e); + StipplePattern stipple = StipplePattern::CONTINUOUS; + for(uint32_t i = 0; i <= (uint32_t)StipplePattern::LAST; i++) { + StipplePattern st = (StipplePattern)i; + if(lineType == DxfFileWriter::lineTypeName(st)) { + stipple = st; + break; + } + } + + // Text properties. + DRW_Text::HAlign alignH = DRW_Text::HLeft; + DRW_Text::VAlign alignV = DRW_Text::VBaseLine; + double textAngle = 0.0; + double textHeight = Style::DefaultTextHeight(); + + if(e->eType == DRW::TEXT || e->eType == DRW::MTEXT) { + const DRW_Text *text = static_cast(e); + alignH = text->alignH; + alignV = text->alignV; + textHeight = text->height; + textAngle = text->angle; + // I have no idea why, but works + if(alignH == DRW_Text::HMiddle) { + alignV = DRW_Text::VMiddle; + } + } + + // Unique identifier based on style properties. + std::string id = "@dxf"; + if(lw != DRW_LW_Conv::widthDefault) + id += ssprintf("-w%.4g", width); + if(lineType != "CONTINUOUS") + id += ssprintf("-%s", lineType.c_str()); + if(c.red != 0 || c.green != 0 || c.blue != 0) + id += ssprintf("-#%02x%02x%02x", c.red, c.green, c.blue); + if(textHeight != Style::DefaultTextHeight()) + id += ssprintf("-h%.4g", textHeight); + if(textAngle != 0.0) + id += ssprintf("-a%.5g", textAngle); + if(alignH != DRW_Text::HLeft) + id += ssprintf("-oh%d", alignH); + if(alignV != DRW_Text::VBaseLine) + id += ssprintf("-ov%d", alignV); + + auto si = styles.find(id); + if(si != styles.end()) { + return si->second; + } + + hStyle hs = { Style::CreateCustomStyle(/*rememberForUndo=*/false) }; + Style *s = Style::Get(hs); + if(lw != DRW_LW_Conv::widthDefault) { + s->widthAs = Style::UnitsAs::MM; + s->width = width; + s->stippleScale = 1.0 + width * 2.0; + } + s->name = id; + s->stippleType = stipple; + if(c.red != 0 || c.green != 0 || c.blue != 0) s->color = c; + s->textHeightAs = Style::UnitsAs::MM; + s->textHeight = textHeight; + s->textAngle = textAngle; + s->textOrigin = dxfAlignToOrigin(alignH, alignV); + + styles.emplace(id, hs); + return hs; + } + + void configureRequest(hRequest hr, hStyle hs) { + Request *r = SK.GetRequest(hr); + r->construction = asConstruction; + r->style = hs; + } + + struct VectorHash { + size_t operator()(const Vector &v) const { + static const size_t size = std::numeric_limits::max() / 2 - 1; + static const double eps = (4.0 * LENGTH_EPS); + + double x = fabs(v.x) / eps; + double y = fabs(v.y) / eps; + + size_t xs = size_t(fmod(x, double(size))); + size_t ys = size_t(fmod(y, double(size))); + + return ys * size + xs; + } + }; + + struct VectorPred { + bool operator()(Vector a, Vector b) const { + return a.Equals(b, LENGTH_EPS); + } + }; + + std::unordered_map points; + + void processPoint(hEntity he, bool constrain = true) { + Entity *e = SK.GetEntity(he); + Vector pos = e->PointGetNum(); + hEntity p = findPoint(pos); + if(p == he) return; + if(p != Entity::NO_ENTITY) { + if(constrain) { + Constraint::ConstrainCoincident(he, p); + } + // We don't add point because we already + // have point in this position + return; + } + points.emplace(pos, he); + } + + hEntity findPoint(const Vector &p) { + auto it = points.find(p); + if(it == points.end()) return Entity::NO_ENTITY; + return it->second; + } + + hEntity createOrGetPoint(const Vector &p) { + hEntity he = findPoint(p); + if(he != Entity::NO_ENTITY) return he; + + hRequest hr = SS.GW.AddRequest(Request::Type::DATUM_POINT, /*rememberForUndo=*/false); + he = hr.entity(0); + SK.GetEntity(he)->PointForceTo(p); + points.emplace(p, he); + return he; + } + + hEntity createLine(Vector p0, Vector p1, hStyle style, bool constrainHV = false) { + if(p0.Equals(p1)) return Entity::NO_ENTITY; + hRequest hr = SS.GW.AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false); + SK.GetEntity(hr.entity(1))->PointForceTo(p0); + SK.GetEntity(hr.entity(2))->PointForceTo(p1); + processPoint(hr.entity(1)); + processPoint(hr.entity(2)); + + if(constrainHV && SS.GW.LockedInWorkplane()) { + bool hasConstraint = false; + Constraint::Type cType; + if(fabs(p0.x - p1.x) < LENGTH_EPS) { + hasConstraint = true; + cType = Constraint::Type::VERTICAL; + } else if(fabs(p0.y - p1.y) < LENGTH_EPS) { + hasConstraint = true; + cType = Constraint::Type::HORIZONTAL; + } + if(hasConstraint) { + Constraint::Constrain( + cType, + Entity::NO_ENTITY, + Entity::NO_ENTITY, + hr.entity(0) + ); + } + } + + configureRequest(hr, style); + return hr.entity(0); + } + + hEntity createWorkplane(const Vector &p, const Quaternion &q) { + hRequest hr = SS.GW.AddRequest(Request::Type::WORKPLANE, /*rememberForUndo=*/false); + SK.GetEntity(hr.entity(1))->PointForceTo(p); + processPoint(hr.entity(1)); + SK.GetEntity(hr.entity(32))->NormalForceTo(q); + return hr.entity(0); + } + + hEntity findOrCreateWorkplane(const Vector &p, const Quaternion &q) { + Vector z = q.RotationN(); + for(auto &r : SK.request) { + if((r.type == Request::Type::WORKPLANE) && (r.group == SS.GW.activeGroup)) { + Vector wp = SK.GetEntity(r.h.entity(1))->PointGetNum(); + Vector wz = SK.GetEntity(r.h.entity(32))->NormalN(); + + if ((p.DistanceToPlane(wz, wp) < LENGTH_EPS) && z.Equals(wz)) { + return r.h.entity(0); + } + } + } + + return createWorkplane(p, q); + } + + static void activateWorkplane(hEntity he) { + Group *g = SK.GetGroup(SS.GW.activeGroup); + g->activeWorkplane = he; + } + + hEntity createCircle(const Vector &c, const Quaternion &q, double r, hStyle style) { + hRequest hr = SS.GW.AddRequest(Request::Type::CIRCLE, /*rememberForUndo=*/false); + SK.GetEntity(hr.entity(1))->PointForceTo(c); + processPoint(hr.entity(1)); + SK.GetEntity(hr.entity(32))->NormalForceTo(q); + SK.GetEntity(hr.entity(64))->DistanceForceTo(r); + configureRequest(hr, style); + return hr.entity(0); + } + + void addLayer(const DRW_Layer &data) override { + layers.emplace(data.name, data); + } + + void addBlock(const DRW_Block &data) override { + readBlock = &blocks[data.name]; + readBlock->data = data; + } + + void endBlock() override { + readBlock = NULL; + } + + void addPoint(const DRW_Point &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + hRequest hr = SS.GW.AddRequest(Request::Type::DATUM_POINT, /*rememberForUndo=*/false); + SK.GetEntity(hr.entity(0))->PointForceTo(toVector(data.basePoint)); + processPoint(hr.entity(0)); + } + + void addLine(const DRW_Line &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + createLine(toVector(data.basePoint), toVector(data.secPoint), styleFor(&data), + /*constrainHV=*/true); + } + + void addArc(const DRW_Arc &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + double r = data.radious; + double sa = data.staangle; + double ea = data.endangle; + Vector c = toVector(data.basePoint); + Vector nz = toVector(data.extPoint); + Quaternion q = NormalFromExtPoint(nz); + + bool planar = q.RotationN().Equals(Vector::From(0, 0, 1)); + bool onPlane = c.z < LENGTH_EPS; + + hEntity oldWorkplane = SS.GW.ActiveWorkplane(); + if (!planar || !onPlane) { + activateWorkplane(findOrCreateWorkplane(c, q)); + } + + hRequest hr = SS.GW.AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false); + Vector u = q.RotationU(), v = q.RotationV(); + Vector rvs = c.Plus(u.ScaledBy(r * cos(sa))).Plus(v.ScaledBy(r * sin(sa))); + Vector rve = c.Plus(u.ScaledBy(r * cos(ea))).Plus(v.ScaledBy(r * sin(ea))); + + if(data.extPoint.z == -1.0) { + c.x = -c.x; + rvs.x = - rvs.x; + rve.x = - rve.x; + std::swap(rvs, rve); + } + + blockTransformArc(&c, &rvs, &rve); + + SK.GetEntity(hr.entity(1))->PointForceTo(c); + SK.GetEntity(hr.entity(2))->PointForceTo(rvs); + SK.GetEntity(hr.entity(3))->PointForceTo(rve); + processPoint(hr.entity(1)); + processPoint(hr.entity(2)); + processPoint(hr.entity(3)); + configureRequest(hr, styleFor(&data)); + activateWorkplane(oldWorkplane); + } + + void addCircle(const DRW_Circle &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + Vector nz = toVector(data.extPoint); + Quaternion normal = NormalFromExtPoint(nz); + createCircle(toVector(data.basePoint), normal, data.radious, styleFor(&data)); + } + + void addLWPolyline(const DRW_LWPolyline &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + size_t vNum = data.vertlist.size(); + + // Check for closed polyline. + if((data.flags & 1) != 1) vNum--; + + // Correct coordinate system for the case where z=-1, as described in + // http://paulbourke.net/dataformats/dxf/dxf10.html. + bool needSwapX = data.extPoint.z == -1.0; + + for(size_t i = 0; i < vNum; i++) { + DRW_Vertex2D c0 = *data.vertlist[i]; + DRW_Vertex2D c1 = *data.vertlist[(i + 1) % data.vertlist.size()]; + + if(needSwapX) { + c0.x = -c0.x; + c1.x = -c1.x; + c0.bulge = -c0.bulge; + } + + Vector p0 = Vector::From(c0.x, c0.y, 0.0); + Vector p1 = Vector::From(c1.x, c1.y, 0.0); + hStyle hs = styleFor(&data); + + if(EXACT(data.vertlist[i]->bulge == 0.0)) { + createLine(blockTransform(p0), blockTransform(p1), hs, /*constrainHV=*/true); + } else { + hRequest hr = createBulge(p0, p1, c0.bulge); + configureRequest(hr, hs); + } + } + } + + void addPolyline(const DRW_Polyline &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + size_t vNum = data.vertlist.size(); + + // Check for closed polyline. + if((data.flags & 1) != 1) vNum--; + + // Correct coordinate system for the case where z=-1, as described in + // http://paulbourke.net/dataformats/dxf/dxf10.html. + bool needSwapX = (data.extPoint.z == -1.0); + + for(size_t i = 0; i < vNum; i++) { + DRW_Coord c0 = data.vertlist[i]->basePoint; + DRW_Coord c1 = data.vertlist[(i + 1) % data.vertlist.size()]->basePoint; + + double bulge = data.vertlist[i]->bulge; + if(needSwapX) { + c0.x = -c0.x; + c1.x = -c1.x; + bulge = -bulge; + } + + Vector p0 = Vector::From(c0.x, c0.y, c0.z); + Vector p1 = Vector::From(c1.x, c1.y, c1.z); + hStyle hs = styleFor(&data); + + if(EXACT(bulge == 0.0)) { + createLine(blockTransform(p0), blockTransform(p1), hs, /*constrainHV=*/true); + } else { + hRequest hr = createBulge(p0, p1, bulge); + configureRequest(hr, hs); + } + } + } + + void addSpline(const DRW_Spline *data) override { + if(data->space != DRW::ModelSpace) return; + if(data->degree != 3) return; + if(addPendingBlockEntity(*data)) return; + + hRequest hr = SS.GW.AddRequest(Request::Type::CUBIC, /*rememberForUndo=*/false); + for(int i = 0; i < 4; i++) { + SK.GetEntity(hr.entity(i + 1))->PointForceTo(toVector(*data->controllist[i])); + processPoint(hr.entity(i + 1)); + } + configureRequest(hr, styleFor(data)); + } + + void addInsert(const DRW_Insert &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + auto bi = blocks.find(data.name); + ssassert(bi != blocks.end(), "Inserted block does not exist"); + Block *block = &bi->second; + + // Push transform. + Vector x = blockX; + Vector y = blockY; + Vector t = blockT; + + const DRW_Insert *oldInsert = insertInsert; + insertInsert = &data; + + if(data.extPoint.z == -1.0) invertXTransform(); + multBlockTransform(data.basePoint.x, data.basePoint.y, data.xscale, data.yscale, + data.angle); + for(auto &e : block->entities) { + addEntity(&*e); + } + + insertInsert = oldInsert; + + // Pop transform. + blockX = x; + blockY = y; + blockT = t; + } + + void addMText(const DRW_MText &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + DRW_MText text = data; + text.secPoint = text.basePoint; + addText(text); + } + + void addText(const DRW_Text &data) override { + if(data.space != DRW::ModelSpace) return; + if(addPendingBlockEntity(data)) return; + + Constraint c = {}; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + c.type = Constraint::Type::COMMENT; + if(data.alignH == DRW_Text::HLeft && data.alignV == DRW_Text::VBaseLine) { + c.disp.offset = toVector(data.basePoint); + } else { + c.disp.offset = toVector(data.secPoint); + } + c.comment = data.text; + c.disp.style = styleFor(&data); + Constraint::AddConstraint(&c, /*rememberForUndo=*/false); + } + + void addDimAlign(const DRW_DimAligned *data) override { + if(data->space != DRW::ModelSpace) return; + if(addPendingBlockEntity(*data)) return; + + Vector p0 = toVector(data->getDef1Point()); + Vector p1 = toVector(data->getDef2Point()); + Vector p2 = toVector(data->getTextPoint()); + hConstraint hc = Constraint::Constrain( + Constraint::Type::PT_PT_DISTANCE, + createOrGetPoint(p0), + createOrGetPoint(p1), + Entity::NO_ENTITY + ); + + Constraint *c = SK.GetConstraint(hc); + if(data->hasActualMeasurement()) { + c->valA = data->getActualMeasurement(); + } else { + c->ModifyToSatisfy(); + } + c->disp.offset = p2.Minus(p0.Plus(p1).ScaledBy(0.5)); + } + + void addDimLinear(const DRW_DimLinear *data) override { + if(data->space != DRW::ModelSpace) return; + if(addPendingBlockEntity(*data)) return; + + Vector p0 = toVector(data->getDef1Point(), /*transform=*/false); + Vector p1 = toVector(data->getDef2Point(), /*transform=*/false); + Vector p2 = toVector(data->getTextPoint(), /*transform=*/false); + + double angle = data->getAngle() * PI / 180.0; + Vector dir = Vector::From(cos(angle), sin(angle), 0.0); + Vector p3 = p1.Minus(p1.ClosestPointOnLine(p2, dir)).Plus(p1); + if(p1.Minus(p3).Magnitude() < LENGTH_EPS) { + p3 = p0.Minus(p0.ClosestPointOnLine(p2, dir)).Plus(p1); + } + + Vector p4 = p0.ClosestPointOnLine(p1, p3.Minus(p1)).Plus(p0).ScaledBy(0.5); + + p0 = blockTransform(p0); + p1 = blockTransform(p1); + p2 = blockTransform(p2); + p3 = blockTransform(p3); + p4 = blockTransform(p4); + + hConstraint hc = Constraint::Constrain( + Constraint::Type::PT_LINE_DISTANCE, + createOrGetPoint(p0), + Entity::NO_ENTITY, + createLine(p1, p3, invisibleStyle()) + ); + + Constraint *c = SK.GetConstraint(hc); + if(data->hasActualMeasurement()) { + c->valA = data->getActualMeasurement(); + } else { + c->ModifyToSatisfy(); + } + c->disp.offset = p2.Minus(p4); + } + + void addDimAngular(const DRW_DimAngular *data) override { + if(data->space != DRW::ModelSpace) return; + if(addPendingBlockEntity(*data)) return; + + Vector l0p0 = toVector(data->getFirstLine1()); + Vector l0p1 = toVector(data->getFirstLine2()); + Vector l1p0 = toVector(data->getSecondLine1()); + Vector l1p1 = toVector(data->getSecondLine2()); + + hConstraint hc = Constraint::Constrain( + Constraint::Type::ANGLE, + Entity::NO_ENTITY, + Entity::NO_ENTITY, + createLine(l0p0, l0p1, invisibleStyle()), + createLine(l1p1, l1p0, invisibleStyle()), + /*other=*/false, + /*other2=*/false + ); + + Constraint *c = SK.GetConstraint(hc); + c->ModifyToSatisfy(); + if(data->hasActualMeasurement()) { + double actual = data->getActualMeasurement() / PI * 180.0; + if(fabs(180.0 - actual - c->valA) < fabs(actual - c->valA)) { + c->other = true; + } + c->valA = actual; + } + + bool skew = false; + Vector pi = Vector::AtIntersectionOfLines(l0p0, l0p1, l1p0, l1p1, &skew); + if(!skew) { + c->disp.offset = toVector(data->getTextPoint()).Minus(pi); + } + } + + hConstraint createDiametric(Vector cp, Quaternion q, double r, Vector tp, + double actual, bool asRadius = false) { + hEntity he = createCircle(cp, q, r, invisibleStyle()); + + hConstraint hc = Constraint::Constrain( + Constraint::Type::DIAMETER, + Entity::NO_ENTITY, + Entity::NO_ENTITY, + he + ); + + Constraint *c = SK.GetConstraint(hc); + if(actual > 0.0) { + c->valA = asRadius ? actual * 2.0 : actual; + } else { + c->ModifyToSatisfy(); + } + c->disp.offset = tp.Minus(cp); + if(asRadius) c->other = true; + return hc; + } + + void addDimRadial(const DRW_DimRadial *data) override { + if(data->space != DRW::ModelSpace) return; + if(addPendingBlockEntity(*data)) return; + + Vector cp = toVector(data->getCenterPoint()); + Vector dp = toVector(data->getDiameterPoint()); + Vector tp = toVector(data->getTextPoint()); + double actual = -1.0; + if(data->hasActualMeasurement()) { + actual = data->getActualMeasurement(); + } + + Vector nz = toVector(data->getExtrusion()); + Quaternion q = NormalFromExtPoint(nz); + createDiametric(cp, q, cp.Minus(dp).Magnitude(), tp, actual, /*asRadius=*/true); + } + + void addDimDiametric(const DRW_DimDiametric *data) override { + if(data->space != DRW::ModelSpace) return; + if(addPendingBlockEntity(*data)) return; + + Vector dp1 = toVector(data->getDiameter1Point()); + Vector dp2 = toVector(data->getDiameter2Point()); + + Vector cp = dp1.Plus(dp2).ScaledBy(0.5); + Vector tp = toVector(data->getTextPoint()); + double actual = -1.0; + if(data->hasActualMeasurement()) { + actual = data->getActualMeasurement(); + } + + Vector nz = toVector(data->getExtrusion()); + Quaternion q = NormalFromExtPoint(nz); + createDiametric(cp, q, cp.Minus(dp1).Magnitude(), tp, actual, /*asRadius=*/false); + } + + void addDimAngular3P(const DRW_DimAngular3p *data) override { + if(data->space != DRW::ModelSpace) return; + if(addPendingBlockEntity(*data)) return; + + DRW_DimAngular dim = *static_cast(data); + dim.setFirstLine1(data->getVertexPoint()); + dim.setFirstLine2(data->getFirstLine()); + dim.setSecondLine1(data->getVertexPoint()); + dim.setSecondLine2(data->getSecondLine()); + addDimAngular(&dim); + } +}; + +class DxfCheck3D : public DRW_Interface { +public: + bool is3d; + + void addEntity(DRW_Entity *e) { + switch(e->eType) { + case DRW::POINT: + addPoint(*static_cast(e)); + break; + case DRW::LINE: + addLine(*static_cast(e)); + break; + case DRW::ARC: + addArc(*static_cast(e)); + break; + case DRW::CIRCLE: + addCircle(*static_cast(e)); + break; + case DRW::POLYLINE: + addPolyline(*static_cast(e)); + break; + case DRW::LWPOLYLINE: + addLWPolyline(*static_cast(e)); + break; + case DRW::SPLINE: + addSpline(static_cast(e)); + break; + case DRW::INSERT: + addInsert(*static_cast(e)); + break; + case DRW::TEXT: + addText(*static_cast(e)); + break; + case DRW::MTEXT: + addMText(*static_cast(e)); + break; + case DRW::DIMALIGNED: + addDimAlign(static_cast(e)); + break; + case DRW::DIMLINEAR: + addDimLinear(static_cast(e)); + break; + case DRW::DIMRADIAL: + addDimRadial(static_cast(e)); + break; + case DRW::DIMDIAMETRIC: + addDimDiametric(static_cast(e)); + break; + case DRW::DIMANGULAR: + addDimAngular(static_cast(e)); + break; + default: + break; + } + } + + void addPoint(const DRW_Point &data) override { + if(data.space != DRW::ModelSpace) return; + checkCoord(data.basePoint); + } + + void addLine(const DRW_Line &data) override { + if(data.space != DRW::ModelSpace) return; + checkCoord(data.basePoint); + checkCoord(data.secPoint); + } + + void addArc(const DRW_Arc &data) override { + if(data.space != DRW::ModelSpace) return; + checkCoord(data.basePoint); + checkExt(data.extPoint); + } + + void addCircle(const DRW_Circle &data) override { + if(data.space != DRW::ModelSpace) return; + checkCoord(data.basePoint); + checkExt(data.extPoint); + } + + void addPolyline(const DRW_Polyline &data) override { + if(data.space != DRW::ModelSpace) return; + for(size_t i = 0; i < data.vertlist.size(); i++) { + checkCoord(data.vertlist[i]->basePoint); + } + } + + void addSpline(const DRW_Spline *data) override { + if(data->space != DRW::ModelSpace) return; + if(data->degree != 3) return; + for(int i = 0; i < 4; i++) { + checkCoord(*data->controllist[i]); + } + } + + void addInsert(const DRW_Insert &data) override { + if(data.space != DRW::ModelSpace) return; + checkCoord(data.basePoint); + } + + void addMText(const DRW_MText &data) override { + if(data.space != DRW::ModelSpace) return; + + DRW_MText text = data; + text.secPoint = text.basePoint; + addText(text); + } + + void addText(const DRW_Text &data) override { + if(data.space != DRW::ModelSpace) return; + checkCoord(data.basePoint); + checkCoord(data.secPoint); + } + + void addDimAlign(const DRW_DimAligned *data) override { + if(data->space != DRW::ModelSpace) return; + checkCoord(data->getDef1Point()); + checkCoord(data->getDef2Point()); + checkCoord(data->getTextPoint()); + } + + void addDimLinear(const DRW_DimLinear *data) override { + if(data->space != DRW::ModelSpace) return; + checkCoord(data->getDef1Point()); + checkCoord(data->getDef2Point()); + checkCoord(data->getTextPoint()); + } + + void addDimAngular(const DRW_DimAngular *data) override { + if(data->space != DRW::ModelSpace) return; + checkCoord(data->getFirstLine1()); + checkCoord(data->getFirstLine2()); + checkCoord(data->getSecondLine1()); + checkCoord(data->getSecondLine2()); + checkCoord(data->getTextPoint()); + } + + void addDimRadial(const DRW_DimRadial *data) override { + if(data->space != DRW::ModelSpace) return; + checkCoord(data->getCenterPoint()); + checkCoord(data->getDiameterPoint()); + checkCoord(data->getTextPoint()); + checkExt(data->getExtrusion()); + } + + void addDimDiametric(const DRW_DimDiametric *data) override { + if(data->space != DRW::ModelSpace) return; + checkCoord(data->getDiameter1Point()); + checkCoord(data->getDiameter2Point()); + checkCoord(data->getTextPoint()); + checkExt(data->getExtrusion()); + } + + void addDimAngular3P(const DRW_DimAngular3p *data) override { + if(data->space != DRW::ModelSpace) return; + DRW_DimAngular dim = *static_cast(data); + + dim.setFirstLine1(data->getVertexPoint()); + dim.setFirstLine2(data->getFirstLine()); + dim.setSecondLine1(data->getVertexPoint()); + dim.setSecondLine2(data->getSecondLine()); + addDimAngular(&dim); + } + + void checkCoord(const DRW_Coord &coord) { + if(fabs(coord.z) > LENGTH_EPS) { + is3d = true; + } + } + + void checkExt(const DRW_Coord &coord) { + if ((fabs(coord.x) > 1/64.) || (fabs(coord.y) > 1/64.)) { + is3d = true; + } + } +}; + +static void +ImportDwgDxf(const Platform::Path &filename, + const std::function &read) { + std::string fileType = ToUpper(filename.Extension()); + + std::string data; + if(!ReadFile(filename, &data)) { + Error("Couldn't read from '%s'", filename.raw.c_str()); + return; + } + + bool asConstruction = true; + if(SS.GW.LockedInWorkplane()) { + DxfCheck3D checker = {}; + read(data, &checker); + if(checker.is3d) { + Message("This %s file contains entities with non-zero Z coordinate; " + "the entire file will be imported as construction entities in 3d.", + fileType.c_str()); + SS.GW.SetWorkplaneFreeIn3d(); + SS.GW.EnsureValidActives(); + } else { + asConstruction = false; + } + } + + SS.UndoRemember(); + + DxfImport importer = {}; + importer.asConstruction = asConstruction; + importer.clearBlockTransform(); + if(!read(data, &importer)) { + Error("Corrupted %s file.", fileType.c_str()); + return; + } + if(importer.unknownEntities > 0) { + Message("%u %s entities of unknown type were ignored.", + importer.unknownEntities, fileType.c_str()); + } +} + +void ImportDxf(const Platform::Path &filename) { + ImportDwgDxf(filename, [](const std::string &data, DRW_Interface *intf) { + std::stringstream stream(data); + return dxfRW().read(stream, intf, /*ext=*/true); + }); +} + +void ImportDwg(const Platform::Path &filename) { + ImportDwgDxf(filename, [](const std::string &data, DRW_Interface *intf) { + std::stringstream stream(data); + return dwgR().read(stream, intf, /*ext=*/true); + }); +} + +} diff --git a/src/importidf.cpp b/src/importidf.cpp new file mode 100644 index 0000000..5523cab --- /dev/null +++ b/src/importidf.cpp @@ -0,0 +1,536 @@ +//----------------------------------------------------------------------------- +// Intermediate Data Format (IDF) file reader. Reads an IDF file for PCB outlines and creates +// an equivalent SovleSpace sketch/extrusion. Supports only Linking, not import. +// Part placement is not currently supported. +// +// Copyright 2020 Paul Kahler. +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include "sketch.h" + +namespace SolveSpace { + +// Split a string into substrings separated by spaces. +// Allow quotes to enclose spaces within a string +static std::vector splitString(const std::string line) { + std::vector v = {}; + + if(line.length() == 0) return v; + + std::string s = ""; + bool inString = false; + bool inQuotes = false; + + for (size_t i=0; i 0) + v.push_back(s); + + return v; +} + +static bool isHoleDuplicate(EntityList *el, double x, double y, double r) { + bool duplicate = false; + for(int i = 0; i < el->n && !duplicate; i++) { + Entity &en = el->Get(i); + if(en.type != Entity::Type::CIRCLE) + continue; + Entity *distance = el->FindById(en.distance); + Entity *center = el->FindById(en.point[0]); + duplicate = + center->actPoint.x == x && center->actPoint.y == y && distance->actDistance == r; + } + return duplicate; +} + +////////////////////////////////////////////////////////////////////////////// +// Functions for linking an IDF file - we need to create entities that +// get remapped into a linked group similar to linking .slvs files +////////////////////////////////////////////////////////////////////////////// + +// Make a new point - type doesn't matter since we will make a copy later +static hEntity newPoint(EntityList *el, int *id, Vector p, bool visible = true) { + Entity en = {}; + en.type = Entity::Type::POINT_N_COPY; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 462; + en.actPoint = p; + en.construction = false; + en.style.v = Style::DATUM; + en.actVisible = visible; + en.forceHidden = false; + + *id = *id+1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static hEntity newLine(EntityList *el, int *id, hEntity p0, hEntity p1, bool keepout) { + Entity en = {}; + en.type = Entity::Type::LINE_SEGMENT; + en.point[0] = p0; + en.point[1] = p1; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 493; + en.construction = keepout; + en.style.v = keepout? Style::CONSTRUCTION : Style::ACTIVE_GRP; + en.actVisible = true; + en.forceHidden = false; + + *id = *id+1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static hEntity newNormal(EntityList *el, int *id, Quaternion normal) { + // normals have parameters, but we don't need them to make a NORMAL_N_COPY from this + Entity en = {}; + en.type = Entity::Type::NORMAL_N_COPY; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 472; + en.actNormal = normal; + en.construction = false; + en.style.v = Style::ACTIVE_GRP; + // to be visible we need to add a point. + en.point[0] = newPoint(el, id, Vector::From(0,0,3), /*visible=*/ true); + en.actVisible = true; + en.forceHidden = false; + + *id = *id+1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static hEntity newArc(EntityList *el, int *id, hEntity p0, hEntity p1, hEntity pc, hEntity hnorm, bool keepout) { + Entity en = {}; + en.type = Entity::Type::ARC_OF_CIRCLE; + en.point[0] = pc; + en.point[1] = p0; + en.point[2] = p1; + en.normal = hnorm; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 403; + en.construction = keepout; + en.style.v = keepout? Style::CONSTRUCTION : Style::ACTIVE_GRP; + en.actVisible = true; + en.forceHidden = false; *id = *id+1; + + *id = *id + 1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static hEntity newDistance(EntityList *el, int *id, double distance) { + // normals have parameters, but we don't need them to make a NORMAL_N_COPY from this + Entity en = {}; + en.type = Entity::Type::DISTANCE; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 472; + en.actDistance = distance; + en.construction = false; + en.style.v = Style::ACTIVE_GRP; + // to be visible we'll need to add a point? + en.actVisible = false; + en.forceHidden = false; + + *id = *id+1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static hEntity newCircle(EntityList *el, int *id, hEntity p0, hEntity hdist, hEntity hnorm, bool keepout) { + Entity en = {}; + en.type = Entity::Type::CIRCLE; + en.point[0] = p0; + en.normal = hnorm; + en.distance = hdist; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 399; + en.construction = keepout; + en.style.v = keepout? Style::CONSTRUCTION : Style::ACTIVE_GRP; + en.actVisible = true; + en.forceHidden = false; + + *id = *id+1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static Vector ArcCenter(Vector p0, Vector p1, double angle) { + // locate the center of an arc + Vector m = p0.Plus(p1).ScaledBy(0.5); + Vector perp = Vector::From(p1.y-p0.y, p0.x-p1.x, 0.0).WithMagnitude(1.0); + double dist = 0; + if (angle != 180) { + dist = (p1.Minus(m).Magnitude())/tan(0.5*angle*3.141592653589793/180.0); + } else { + dist = 0.0; + } + Vector c = m.Minus(perp.ScaledBy(dist)); + return c; +} + +// Add an IDF line or arc to the entity list. According to spec, zero angle indicates a line. +// Positive angles are counter clockwise, negative are clockwise. An angle of 360 +// indicates a circle centered at x1,y1 passing through x2,y2 and is a complete loop. +static void CreateEntity(EntityList *el, int *id, hEntity h0, hEntity h1, hEntity hnorm, + Vector p0, Vector p1, double angle, bool keepout) { + if (fabs(angle) < 0.1) { + //line + if(p0.Equals(p1)) return; + + newLine(el, id, h0, h1, keepout); + + } else if(angle == 360.0) { + // circle + double d = p1.Minus(p0).Magnitude(); + hEntity hd = newDistance(el, id, d); + newCircle(el, id, h1, hd, hnorm, keepout); + + } else { + // arc + if(angle < 0.0) { + swap(p0,p1); + swap(h0,h1); + angle = fabs(angle); + } + // locate the center of the arc + Vector m = p0.Plus(p1).ScaledBy(0.5); + Vector perp = Vector::From(p1.y-p0.y, p0.x-p1.x, 0.0).WithMagnitude(1.0); + // half angle in radians + double theta = 0.5*angle*PI/180.0; + double dist = (p1.Minus(m).Magnitude())*cos(theta)/sin(theta); + Vector c = m.Minus(perp.ScaledBy(dist)); + hEntity hc = newPoint(el, id, c, /*visible=*/false); + newArc(el, id, h0, h1, hc, hnorm, keepout); + } +} + +// borrowed from Entity::GenerateBezierCurves because we don't have parameters. +static void MakeBeziersForArcs(SBezierList *sbl, Vector center, Vector pa, Vector pb, + Quaternion q, double angle) { + + Vector u = q.RotationU(), v = q.RotationV(); + double r = pa.Minus(center).Magnitude(); + double theta, dtheta; + + if(angle == 360.0) { + theta = 0; + } else { + Point2d c2 = center.Project2d(u, v); + Point2d pa2 = (pa.Project2d(u, v)).Minus(c2); + + theta = atan2(pa2.y, pa2.x); + } + dtheta = angle * PI/180; + + int i, n; + if(dtheta > (3*PI/2 + 0.01)) { + n = 4; + } else if(dtheta > (PI + 0.01)) { + n = 3; + } else if(dtheta > (PI/2 + 0.01)) { + n = 2; + } else { + n = 1; + } + dtheta /= n; + + for(i = 0; i < n; i++) { + double s, c; + + c = cos(theta); + s = sin(theta); + // The start point of the curve, and the tangent vector at + // that start point. + Vector p0 = center.Plus(u.ScaledBy( r*c)).Plus(v.ScaledBy(r*s)), + t0 = u.ScaledBy(-r*s). Plus(v.ScaledBy(r*c)); + + theta += dtheta; + + c = cos(theta); + s = sin(theta); + Vector p2 = center.Plus(u.ScaledBy( r*c)).Plus(v.ScaledBy(r*s)), + t2 = u.ScaledBy(-r*s). Plus(v.ScaledBy(r*c)); + + // The control point must lie on both tangents. + Vector p1 = Vector::AtIntersectionOfLines(p0, p0.Plus(t0), + p2, p2.Plus(t2), + NULL); + + SBezier sb = SBezier::From(p0, p1, p2); + sb.weight[1] = cos(dtheta/2); + sbl->l.Add(&sb); + } +} + +// Here we read the important section of an IDF file. SolveSpace Entities are directly created by +// the functions above, which is only OK because of the way linking works. For example points do +// not have handles for solver parameters (coordinates), they only have their actPoint values +// set (or actNormal or actDistance). These are incomplete entities and would be a problem if +// they were part of the sketch, but they are not. After making a list of them here, a new group +// gets created from copies of these. Those copies are complete and part of the sketch group. +bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *sh) { + dbp("\nLink IDF board outline."); + el->Clear(); + std::string data; + if(!ReadFile(filename, &data)) { + Error("Couldn't read from '%s'", filename.raw.c_str()); + return false; + } + + enum IDF_SECTION { + none, + header, + board_outline, + other_outline, + routing_outline, + placement_outline, + routing_keepout, + via_keepout, + placement_group, + drilled_holes, + notes, + component_placement + } section; + + section = IDF_SECTION::none; + int record_number = 0; + int curve = -1; + int entityCount = 0; + + hEntity hprev; + hEntity hprevTop; + Vector pprev = Vector::From(0,0,0); + Vector pprevTop = Vector::From(0,0,0); + + double board_thickness = 10.0; + double scale = 1.0; //mm + bool topEntities = false; + bool bottomEntities = false; + + Quaternion normal = Quaternion::From(Vector::From(1,0,0), Vector::From(0,1,0)); + hEntity hnorm = newNormal(el, &entityCount, normal); + + // to create the extursion we will need to collect a set of bezier curves defined + // by the perimeter, cutouts, and holes. + SBezierList sbl = {}; + + std::stringstream stream(data); + for(std::string line; getline( stream, line ); ) { + if (line.find(".END_") == 0) { + section = none; + curve = -1; + } + switch (section) { + case none: + if(line.find(".HEADER") == 0) { + section = header; + record_number = 1; + } else if (line.find(".BOARD_OUTLINE") == 0) { + section = board_outline; + record_number = 1; + } else if (line.find(".ROUTE_KEEPOUT") == 0) { + section = routing_keepout; + record_number = 1; + } else if(line.find(".DRILLED_HOLES") == 0) { + section = drilled_holes; + record_number = 1; + } + break; + + case header: + if(record_number == 3) { + if(line.find("MM") != std::string::npos) { + dbp("IDF units are MM"); + scale = 1.0; + } else if(line.find("THOU") != std::string::npos) { + dbp("IDF units are thousandths of an inch"); + scale = 0.0254; + } else { + dbp("IDF import, no units found in file."); + } + } + break; + + case routing_keepout: + case board_outline: + if (record_number == 2) { + if(section == board_outline) { + topEntities = true; + bottomEntities = true; + board_thickness = std::stod(line) * scale; + dbp("IDF board thickness: %lf", board_thickness); + } else if (section == routing_keepout) { + topEntities = false; + bottomEntities = false; + if(line.find("TOP") == 0 || line.find("BOTH") == 0) + topEntities = true; + if(line.find("BOTTOM") == 0 || line.find("BOTH") == 0) + bottomEntities = true; + } + } else { // records 3+ are lines, arcs, and circles + std::vector values = splitString(line); + if(values.size() != 4) continue; + int c = stoi(values[0]); + double x = stof(values[1]) * scale; + double y = stof(values[2]) * scale; + double ang = stof(values[3]); + Vector point = Vector::From(x,y,0.0); + Vector pTop = Vector::From(x,y,board_thickness); + if(c != curve) { // start a new curve + curve = c; + if (bottomEntities) + hprev = newPoint(el, &entityCount, point, /*visible=*/false); + if (topEntities) + hprevTop = newPoint(el, &entityCount, pTop, /*visible=*/false); + pprev = point; + pprevTop = pTop; + } else { + if(section == board_outline) { + // create a bezier for the extrusion + if (ang == 0) { + // straight lines + SBezier sb = SBezier::From(pprev, point); + sbl.l.Add(&sb); + } else if (ang != 360.0) { + // Arcs + Vector c = ArcCenter(pprev, point, ang); + MakeBeziersForArcs(&sbl, c, pprev, point, normal, ang); + } else { + // circles + MakeBeziersForArcs(&sbl, point, pprev, pprev, normal, ang); + } + } + // next create the entities + // only curves and points at circle centers will be visible + bool vis = (ang == 360.0); + if (bottomEntities) { + hEntity hp = newPoint(el, &entityCount, point, /*visible=*/vis); + CreateEntity(el, &entityCount, hprev, hp, hnorm, pprev, point, ang, + (section == routing_keepout) ); + pprev = point; + hprev = hp; + } + if (topEntities) { + hEntity hp = newPoint(el, &entityCount, pTop, /*visible=*/vis); + CreateEntity(el, &entityCount, hprevTop, hp, hnorm, pprevTop, pTop, + ang, (section == routing_keepout) ); + pprevTop = pTop; + hprevTop = hp; + } + } + } + break; + + case other_outline: + case routing_outline: + case placement_outline: + case via_keepout: + case placement_group: + break; + + case drilled_holes: { + std::vector values = splitString(line); + if(values.size() < 6) continue; + double d = stof(values[0]) * scale; + double x = stof(values[1]) * scale; + double y = stof(values[2]) * scale; + bool duplicate = isHoleDuplicate(el, x, y, d / 2); + // Only show holes likely to be useful in MCAD to reduce complexity. + if(((d > 1.7) || (values[5].compare(0,3,"PIN") == 0) + || (values[5].compare(0,3,"MTG") == 0)) && !duplicate) { + // create the entity + Vector cent = Vector::From(x,y,0.0); + hEntity hcent = newPoint(el, &entityCount, cent); + hEntity hdist = newDistance(el, &entityCount, d/2); + newCircle(el, &entityCount, hcent, hdist, hnorm, false); + // and again for the top + Vector cTop = Vector::From(x,y,board_thickness); + hcent = newPoint(el, &entityCount, cTop); + hdist = newDistance(el, &entityCount, d/2); + newCircle(el, &entityCount, hcent, hdist, hnorm, false); + // create the curves for the extrusion + Vector pt = Vector::From(x+d/2, y, 0.0); + MakeBeziersForArcs(&sbl, cent, pt, pt, normal, 360.0); + } + + break; + } + case notes: + case component_placement: + break; + + default: + section = none; + break; + } + record_number++; + } + // now we can create an extrusion from all the Bezier curves. We can skip things + // like checking for a coplanar sketch because everything is at z=0. + SPolygon polyLoops = {}; + bool allClosed; + bool allCoplanar; + Vector errorPointAt = Vector::From(0,0,0); + SEdge errorAt = {}; + + SBezierLoopSetSet sblss = {}; + sblss.FindOuterFacesFrom(&sbl, &polyLoops, NULL, + 100.0, &allClosed, &errorAt, + &allCoplanar, &errorPointAt, NULL); + + //hack for when there is no sketch yet and the first group is a linked IDF + double ctc = SS.chordTolCalculated; + if(ctc == 0.0) SS.chordTolCalculated = 0.1; //mm + // there should only by one sbls in the sblss unless a board has disjointed parts... + sh->MakeFromExtrusionOf(sblss.l.First(), Vector::From(0.0, 0.0, 0.0), + Vector::From(0.0, 0.0, board_thickness), + RgbaColor::From(0, 180, 0) ); + SS.chordTolCalculated = ctc; + sblss.Clear(); + sbl.Clear(); + sh->booleanFailed = false; + + return true; +} + +} // namespace SolveSpace diff --git a/src/importmesh.cpp b/src/importmesh.cpp new file mode 100644 index 0000000..fc1a4ff --- /dev/null +++ b/src/importmesh.cpp @@ -0,0 +1,258 @@ +//----------------------------------------------------------------------------- +// Triangle mesh file reader. Reads an STL file triangle mesh and creates +// a SovleSpace SMesh from it. Supports only Linking, not import. +// +// Copyright 2020 Paul Kahler. +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include "sketch.h" +#include +#include + +#define MIN_POINT_DISTANCE 0.001 + +namespace SolveSpace { + +// we will check for duplicate vertices and keep all their normals +class vertex { +public: + Vector p; + std::vector normal; +}; + +static bool isEdgeVertex(vertex &v) { + unsigned int i,j; + bool result = false; + for(i=0;i &lv, Vector &p, Vector &n) { + unsigned int i; + for(i=0; iAdd(&en); + return en.h; +} + +// check if a vertex is unique and add it via newPoint if it is. +static void addVertex(EntityList *el, Vector v) { + if(el->n < 15000) { + int id = el->n; + newPoint(el, &id, v); + } +} + +static hEntity newNormal(EntityList *el, int *id, Quaternion normal, hEntity p) { + // normals have parameters, but we don't need them to make a NORMAL_N_COPY from this + Entity en = {}; + en.type = Entity::Type::NORMAL_N_COPY; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 472; + en.actNormal = normal; + en.construction = false; + en.style.v = Style::NORMALS; + // to be visible we need to add a point. +// en.point[0] = newPoint(el, id, Vector::From(0,0,0)); + en.point[0] = p; + en.actVisible = true; + en.forceHidden = false; + + *id = *id+1; + en.h.v = *id + en.group.v*65536; + el->Add(&en); + return en.h; +} + +static hEntity newLine(EntityList *el, int *id, hEntity p0, hEntity p1) { + Entity en = {}; + en.type = Entity::Type::LINE_SEGMENT; + en.point[0] = p0; + en.point[1] = p1; + en.extraPoints = 0; + en.timesApplied = 0; + en.group.v = 493; + en.construction = true; + en.style.v = Style::CONSTRUCTION; + en.actVisible = true; + en.forceHidden = false; + + en.h.v = *id + en.group.v*65536; + *id = *id + 1; + el->Add(&en); + return en.h; +} + +bool LinkStl(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *sh) { + dbp("\nLink STL triangle mesh."); + el->Clear(); + std::string data; + if(!ReadFile(filename, &data)) { + Error("Couldn't read from '%s'", filename.raw.c_str()); + return false; + } + + std::stringstream f(data); + + char str[80] = {}; + f.read(str, 80); + + if(0==memcmp("solid", str, 5)) { + // just returning false will trigger the warning that linked file is not present + // best solution is to add an importer for text STL. + Message(_("Text-formated STL files are not currently supported")); + return false; + } + + uint32_t n; + uint32_t color; + + f.read((char*)&n, 4); + dbp("%d triangles", n); + + float x,y,z; + float xn,yn,zn; + + std::vector verts = {}; + + for(uint32_t i = 0; i> 7) & 0xf8; + tr.meta.color.green = (color >> 2) & 0xf8; + tr.meta.color.blue = (color << 3); + tr.meta.color.alpha = 255; + } else { + tr.meta.color.red = 90; + tr.meta.color.green = 120; + tr.meta.color.blue = 140; + tr.meta.color.alpha = 255; + } + + m->AddTriangle(&tr); + Vector normal = tr.Normal().WithMagnitude(1.0); + addUnique(verts, tr.a, normal); + addUnique(verts, tr.b, normal); + addUnique(verts, tr.c, normal); + } + dbp("%d vertices", verts.size()); + + int id = 1; + + //add the STL origin and normals + hEntity origin = newPoint(el, &id, Vector::From(0.0, 0.0, 0.0)); + newNormal(el, &id, Quaternion::From(Vector::From(1,0,0),Vector::From(0,1,0)), origin); + newNormal(el, &id, Quaternion::From(Vector::From(0,1,0),Vector::From(0,0,1)), origin); + newNormal(el, &id, Quaternion::From(Vector::From(0,0,1),Vector::From(1,0,0)), origin); + + BBox box = {}; + box.minp = verts[0].p; + box.maxp = verts[0].p; + + // determine the bounding box for all vertexes + for(unsigned int i=1; i + +namespace SolveSpace { + +void SMesh::Clear() { + l.Clear(); +} + +void SMesh::AddTriangle(STriMeta meta, Vector n, Vector a, Vector b, Vector c) { + Vector ab = b.Minus(a), bc = c.Minus(b); + Vector np = ab.Cross(bc); + if(np.Magnitude() < 1e-10) { + // ugh; gl sometimes tessellates to collinear triangles + return; + } + if(np.Dot(n) > 0) { + AddTriangle(meta, a, b, c); + } else { + AddTriangle(meta, c, b, a); + } +} +void SMesh::AddTriangle(STriMeta meta, Vector a, Vector b, Vector c) { + STriangle t = {}; + t.meta = meta; + t.a = a; + t.b = b; + t.c = c; + AddTriangle(&t); +} +void SMesh::AddTriangle(const STriangle *st) { + l.Add(st); +} + +void SMesh::DoBounding(Vector v, Vector *vmax, Vector *vmin) const { + vmax->x = max(vmax->x, v.x); + vmax->y = max(vmax->y, v.y); + vmax->z = max(vmax->z, v.z); + + vmin->x = min(vmin->x, v.x); + vmin->y = min(vmin->y, v.y); + vmin->z = min(vmin->z, v.z); +} +void SMesh::GetBounding(Vector *vmax, Vector *vmin) const { + int i; + *vmin = Vector::From( 1e12, 1e12, 1e12); + *vmax = Vector::From(-1e12, -1e12, -1e12); + for(i = 0; i < l.n; i++) { + const STriangle *st = &(l[i]); + DoBounding(st->a, vmax, vmin); + DoBounding(st->b, vmax, vmin); + DoBounding(st->c, vmax, vmin); + } +} + +//---------------------------------------------------------------------------- +// Report the edges of the boundary of the region(s) of our mesh that lie +// within the plane n dot p = d. +//---------------------------------------------------------------------------- +void SMesh::MakeEdgesInPlaneInto(SEdgeList *sel, Vector n, double d) { + SMesh m = {}; + m.MakeFromCopyOf(this); + + // Delete all triangles in the mesh that do not lie in our export plane. + m.l.ClearTags(); + int i; + for(i = 0; i < m.l.n; i++) { + STriangle *tr = &(m.l[i]); + + if((fabs(n.Dot(tr->a) - d) >= LENGTH_EPS) || + (fabs(n.Dot(tr->b) - d) >= LENGTH_EPS) || + (fabs(n.Dot(tr->c) - d) >= LENGTH_EPS)) + { + tr->tag = 1; + } + } + m.l.RemoveTagged(); + + // Select the naked edges in our resulting open mesh. + SKdNode *root = SKdNode::From(&m); + root->SnapToMesh(&m); + root->MakeCertainEdgesInto(sel, EdgeKind::NAKED_OR_SELF_INTER, + /*coplanarIsInter=*/false, NULL, NULL); + + m.Clear(); +} + +void SMesh::MakeOutlinesInto(SOutlineList *sol, EdgeKind edgeKind) { + SKdNode *root = SKdNode::From(this); + root->MakeOutlinesInto(sol, edgeKind); +} + +//----------------------------------------------------------------------------- +// When we are called, all of the triangles from l[start] to the end must +// be coplanar. So we try to find a set of fewer triangles that covers the +// exact same area, in order to reduce the number of triangles in the mesh. +// We use this after a triangle has been split against the BSP. +// +// This is really ugly code; basically it just pastes things together to +// form convex polygons, merging collinear edges when possible, then +// triangulates the convex poly. +//----------------------------------------------------------------------------- +void SMesh::Simplify(int start) { + int maxTriangles = (l.n - start) + 10; + + STriMeta meta = l[start].meta; + + STriangle *tout = new STriangle[maxTriangles]; + int toutc = 0; + + Vector n = Vector::From(0, 0, 0); + Vector *conv = new Vector[maxTriangles * 3]; + int convc = 0; + + int start0 = start; + + int i, j; + for(i = start; i < l.n; i++) { + STriangle *tr = &(l[i]); + if(tr->MinAltitude() < LENGTH_EPS) { + tr->tag = 1; + } else { + tr->tag = 0; + } + } + + for(;;) { + bool didAdd; + convc = 0; + for(i = start; i < l.n; i++) { + STriangle *tr = &(l[i]); + if(tr->tag) continue; + + tr->tag = 1; + n = (tr->Normal()).WithMagnitude(1); + conv[convc++] = tr->a; + conv[convc++] = tr->b; + conv[convc++] = tr->c; + + start = i+1; + break; + } + if(i >= l.n) break; + + do { + didAdd = false; + + for(j = 0; j < convc; j++) { + Vector a = conv[WRAP((j-1), convc)], + b = conv[j], + d = conv[WRAP((j+1), convc)], + e = conv[WRAP((j+2), convc)]; + + Vector c; + for(i = start; i < l.n; i++) { + STriangle *tr = &(l[i]); + if(tr->tag) continue; + + if((tr->a).Equals(d) && (tr->b).Equals(b)) { + c = tr->c; + } else if((tr->b).Equals(d) && (tr->c).Equals(b)) { + c = tr->a; + } else if((tr->c).Equals(d) && (tr->a).Equals(b)) { + c = tr->b; + } else { + continue; + } + // The vertex at C must be convex; but the others must + // be tested + Vector ab = b.Minus(a); + Vector bc = c.Minus(b); + Vector cd = d.Minus(c); + Vector de = e.Minus(d); + + double bDot = (ab.Cross(bc)).Dot(n); + double dDot = (cd.Cross(de)).Dot(n); + + bDot /= min(ab.Magnitude(), bc.Magnitude()); + dDot /= min(cd.Magnitude(), de.Magnitude()); + + if(fabs(bDot) < LENGTH_EPS && fabs(dDot) < LENGTH_EPS) { + conv[WRAP((j+1), convc)] = c; + // and remove the vertex at j, which is a dup + std::move(conv+j+1, conv+convc, conv+j); + convc--; + } else if(fabs(bDot) < LENGTH_EPS && dDot > 0) { + conv[j] = c; + } else if(fabs(dDot) < LENGTH_EPS && bDot > 0) { + conv[WRAP((j+1), convc)] = c; + } else if(bDot > 0 && dDot > 0) { + // conv[j] is unchanged, conv[j+1] goes to [j+2] + std::move_backward(conv+j+1, conv+convc, conv+convc+1); + conv[j+1] = c; + convc++; + } else { + continue; + } + + didAdd = true; + tr->tag = 1; + break; + } + } + } while(didAdd); + + // I need to debug why this is required; sometimes the above code + // still generates a convex polygon + for(i = 0; i < convc; i++) { + Vector a = conv[WRAP((i-1), convc)], + b = conv[i], + c = conv[WRAP((i+1), convc)]; + Vector ab = b.Minus(a); + Vector bc = c.Minus(b); + double bDot = (ab.Cross(bc)).Dot(n); + bDot /= min(ab.Magnitude(), bc.Magnitude()); + + if(bDot < 0) return; // XXX, shouldn't happen + } + + for(i = 0; i < convc - 2; i++) { + STriangle tr = STriangle::From(meta, conv[0], conv[i+1], conv[i+2]); + if(tr.MinAltitude() > LENGTH_EPS) { + tout[toutc++] = tr; + } + } + } + + l.n = start0; + for(i = 0; i < toutc; i++) { + AddTriangle(&(tout[i])); + } + delete[] tout; + delete[] conv; +} + +void SMesh::AddAgainstBsp(SMesh *srcm, SBsp3 *bsp3) { + int i; + + for(i = 0; i < srcm->l.n; i++) { + STriangle *st = &(srcm->l[i]); + int pn = l.n; + atLeastOneDiscarded = false; + SBsp3::InsertOrCreate(bsp3, st, this); + if(!atLeastOneDiscarded && (l.n != (pn+1))) { + l.n = pn; + if(flipNormal) { + AddTriangle(st->meta, st->c, st->b, st->a); + } else { + AddTriangle(st->meta, st->a, st->b, st->c); + } + } + if(l.n - pn > 1) { + Simplify(pn); + } + } +} + +void SMesh::MakeFromUnionOf(SMesh *a, SMesh *b) { + SBsp3 *bspa = SBsp3::FromMesh(a); + SBsp3 *bspb = SBsp3::FromMesh(b); + + flipNormal = false; + keepInsideOtherShell = false; + + keepCoplanar = true; + AddAgainstBsp(b, bspa); + + keepCoplanar = false; + AddAgainstBsp(a, bspb); +} + +void SMesh::MakeFromDifferenceOf(SMesh *a, SMesh *b) { + SBsp3 *bspa = SBsp3::FromMesh(a); + SBsp3 *bspb = SBsp3::FromMesh(b); + + flipNormal = true; + keepCoplanar = true; + keepInsideOtherShell = true; + AddAgainstBsp(b, bspa); + + flipNormal = false; + keepCoplanar = false; + keepInsideOtherShell = false; + AddAgainstBsp(a, bspb); +} + +void SMesh::MakeFromIntersectionOf(SMesh *a, SMesh *b) { + SBsp3 *bspa = SBsp3::FromMesh(a); + SBsp3 *bspb = SBsp3::FromMesh(b); + + keepInsideOtherShell = true; + flipNormal = false; + + keepCoplanar = false; + AddAgainstBsp(a, bspb); + + keepCoplanar = true; + AddAgainstBsp(b, bspa); +} + +void SMesh::MakeFromCopyOf(SMesh *a) { + ssassert(this != a, "Can't make from copy of self"); + for(int i = 0; i < a->l.n; i++) { + AddTriangle(&(a->l[i])); + } +} + +void SMesh::MakeFromAssemblyOf(SMesh *a, SMesh *b) { + MakeFromCopyOf(a); + MakeFromCopyOf(b); +} + +void SMesh::MakeFromTransformationOf(SMesh *a, Vector trans, + Quaternion q, double scale) +{ + STriangle *tr; + for(tr = a->l.First(); tr; tr = a->l.NextAfter(tr)) { + STriangle tt = *tr; + tt.a = (tt.a).ScaledBy(scale); + tt.b = (tt.b).ScaledBy(scale); + tt.c = (tt.c).ScaledBy(scale); + if(scale < 0) { + // The mirroring would otherwise turn a closed mesh inside out. + swap(tt.a, tt.b); + } + tt.a = (q.Rotate(tt.a)).Plus(trans); + tt.b = (q.Rotate(tt.b)).Plus(trans); + tt.c = (q.Rotate(tt.c)).Plus(trans); + AddTriangle(&tt); + } +} + +bool SMesh::IsEmpty() const { return (l.IsEmpty()); } + +uint32_t SMesh::FirstIntersectionWith(Point2d mp) const { + Vector rayPoint = SS.GW.UnProjectPoint3(Vector::From(mp.x, mp.y, 0.0)); + Vector rayDir = SS.GW.UnProjectPoint3(Vector::From(mp.x, mp.y, 1.0)).Minus(rayPoint); + + uint32_t face = 0; + double faceT = VERY_NEGATIVE; + for(int i = 0; i < l.n; i++) { + const STriangle &tr = l[i]; + if(tr.meta.face == 0) continue; + + double t; + if(!tr.Raytrace(rayPoint, rayDir, &t, NULL)) continue; + if(t > faceT) { + face = tr.meta.face; + faceT = t; + } + } + + return face; +} + +Vector SMesh::GetCenterOfMass() const { + Vector center = {}; + double vol = 0.0; + for(int i = 0; i < l.n; i++) { + const STriangle &tr = l[i]; + double tvol = tr.SignedVolume(); + center = center.Plus(tr.a.Plus(tr.b.Plus(tr.c)).ScaledBy(tvol / 4.0)); + vol += tvol; + } + return center.ScaledBy(1.0 / vol); +} + +STriangleLl *STriangleLl::Alloc() + { return (STriangleLl *)Platform::AllocTemporary(sizeof(STriangleLl)); } +SKdNode *SKdNode::Alloc() + { return (SKdNode *)Platform::AllocTemporary(sizeof(SKdNode)); } + +SKdNode *SKdNode::From(SMesh *m) { + int i; + STriangle *tra = (STriangle *)Platform::AllocTemporary((m->l.n) * sizeof(*tra)); + + for(i = 0; i < m->l.n; i++) { + tra[i] = m->l[i]; + } + + srand(0); + int n = m->l.n; + while(n > 1) { + int k = rand() % n; + n--; + swap(tra[k], tra[n]); + } + + STriangleLl *tll = NULL; + for(i = 0; i < m->l.n; i++) { + STriangleLl *tn = STriangleLl::Alloc(); + tn->tri = &(tra[i]); + tn->next = tll; + tll = tn; + } + + return SKdNode::From(tll); +} + +SKdNode *SKdNode::From(STriangleLl *tll) { + int which = 0; + SKdNode *ret = Alloc(); + + int i; + int gtc[3] = { 0, 0, 0 }, ltc[3] = { 0, 0, 0 }, allc = 0; + double badness[3] = { 0, 0, 0 }; + double split[3] = { 0, 0, 0 }; + + if(!tll) { + goto leaf; + } + + for(i = 0; i < 3; i++) { + int tcnt = 0; + STriangleLl *ll; + for(ll = tll; ll; ll = ll->next) { + split[i] += (ll->tri->a).Element(i); + split[i] += (ll->tri->b).Element(i); + split[i] += (ll->tri->c).Element(i); + tcnt++; + } + split[i] /= (tcnt*3); + + for(ll = tll; ll; ll = ll->next) { + STriangle *tr = ll->tri; + + double a = (tr->a).Element(i), + b = (tr->b).Element(i), + c = (tr->c).Element(i); + + if(a < split[i] + KDTREE_EPS || + b < split[i] + KDTREE_EPS || + c < split[i] + KDTREE_EPS) + { + ltc[i]++; + } + if(a > split[i] - KDTREE_EPS || + b > split[i] - KDTREE_EPS || + c > split[i] - KDTREE_EPS) + { + gtc[i]++; + } + if(i == 0) allc++; + } + badness[i] = pow((double)ltc[i], 4) + pow((double)gtc[i], 4); + } + if(badness[0] < badness[1] && badness[0] < badness[2]) { + which = 0; + } else if(badness[1] < badness[2]) { + which = 1; + } else { + which = 2; + } + + if(allc < 3 || allc == gtc[which] || allc == ltc[which]) { + goto leaf; + } + + STriangleLl *ll; + STriangleLl *lgt, *llt; lgt = llt = NULL; + for(ll = tll; ll; ll = ll->next) { + STriangle *tr = ll->tri; + + double a = (tr->a).Element(which), + b = (tr->b).Element(which), + c = (tr->c).Element(which); + + if(a < split[which] + KDTREE_EPS || + b < split[which] + KDTREE_EPS || + c < split[which] + KDTREE_EPS) + { + STriangleLl *n = STriangleLl::Alloc(); + *n = *ll; + n->next = llt; + llt = n; + } + if(a > split[which] - KDTREE_EPS || + b > split[which] - KDTREE_EPS || + c > split[which] - KDTREE_EPS) + { + STriangleLl *n = STriangleLl::Alloc(); + *n = *ll; + n->next = lgt; + lgt = n; + } + } + + ret->which = which; + ret->c = split[which]; + ret->gt = SKdNode::From(lgt); + ret->lt = SKdNode::From(llt); + return ret; + +leaf: + ret->tris = tll; + return ret; +} + +void SKdNode::ClearTags() const { + if(gt && lt) { + gt->ClearTags(); + lt->ClearTags(); + } else { + STriangleLl *ll; + for(ll = tris; ll; ll = ll->next) { + ll->tri->tag = 0; + } + } +} + +void SKdNode::AddTriangle(STriangle *tr) { + if(gt && lt) { + double ta = (tr->a).Element(which), + tb = (tr->b).Element(which), + tc = (tr->c).Element(which); + if(ta < c + KDTREE_EPS || + tb < c + KDTREE_EPS || + tc < c + KDTREE_EPS) + { + lt->AddTriangle(tr); + } + if(ta > c - KDTREE_EPS || + tb > c - KDTREE_EPS || + tc > c - KDTREE_EPS) + { + gt->AddTriangle(tr); + } + } else { + STriangleLl *tn = STriangleLl::Alloc(); + tn->tri = tr; + tn->next = tris; + tris = tn; + } +} + +void SKdNode::MakeMeshInto(SMesh *m) const { + if(gt) gt->MakeMeshInto(m); + if(lt) lt->MakeMeshInto(m); + + STriangleLl *ll; + for(ll = tris; ll; ll = ll->next) { + if(ll->tri->tag) continue; + + m->AddTriangle(ll->tri); + ll->tri->tag = 1; + } +} + +void SKdNode::ListTrianglesInto(std::vector *tl) const { + if(gt) gt->ListTrianglesInto(tl); + if(lt) lt->ListTrianglesInto(tl); + + STriangleLl *ll; + for(ll = tris; ll; ll = ll->next) { + if(ll->tri->tag) continue; + + tl->push_back(ll->tri); + ll->tri->tag = 1; + } +} + +//----------------------------------------------------------------------------- +// If any triangles in the mesh have an edge that goes through v (but not +// a vertex at v), then split those triangles so that they now have a vertex +// there. The existing triangle is modified, and the new triangle appears +// in extras. +//----------------------------------------------------------------------------- +void SKdNode::SnapToVertex(Vector v, SMesh *extras) { + if(gt && lt) { + double vc = v.Element(which); + if(vc < c + KDTREE_EPS) { + lt->SnapToVertex(v, extras); + } + if(vc > c - KDTREE_EPS) { + gt->SnapToVertex(v, extras); + } + // Nothing bad happens if the triangle to be split appears in both + // branches; the first call will split the triangle, so that the + // second call will do nothing, because the modified triangle will + // already contain v + } else { + STriangleLl *ll; + for(ll = tris; ll; ll = ll->next) { + STriangle *tr = ll->tri; + + // Do a cheap bbox test first + int k; + bool mightHit = true; + + for(k = 0; k < 3; k++) { + double trA = (tr->a).Element(k); + double trB = (tr->b).Element(k); + double trC = (tr->c).Element(k); + double vk = v.Element(k); + if(trA < vk - KDTREE_EPS && + trB < vk - KDTREE_EPS && + trC < vk - KDTREE_EPS) + { + mightHit = false; + break; + } + if(trA > vk + KDTREE_EPS && + trB > vk + KDTREE_EPS && + trC > vk + KDTREE_EPS) + { + mightHit = false; + break; + } + } + if(!mightHit) continue; + + if(tr->a.Equals(v)) { tr->a = v; continue; } + if(tr->b.Equals(v)) { tr->b = v; continue; } + if(tr->c.Equals(v)) { tr->c = v; continue; } + + if(tr->IsDegenerate()) { + continue; + } + + if(v.OnLineSegment(tr->a, tr->b)) { + STriangle nt = STriangle::From(tr->meta, tr->a, v, tr->c); + extras->AddTriangle(&nt); + tr->a = v; + continue; + } + if(v.OnLineSegment(tr->b, tr->c)) { + STriangle nt = STriangle::From(tr->meta, tr->b, v, tr->a); + extras->AddTriangle(&nt); + tr->b = v; + continue; + } + if(v.OnLineSegment(tr->c, tr->a)) { + STriangle nt = STriangle::From(tr->meta, tr->c, v, tr->b); + extras->AddTriangle(&nt); + tr->c = v; + continue; + } + } + } +} + +//----------------------------------------------------------------------------- +// Snap to each vertex of each triangle of the given mesh. If the given mesh +// is identical to the mesh used to make this kd tree, then the result should +// be a vertex-to-vertex mesh. +//----------------------------------------------------------------------------- +void SKdNode::SnapToMesh(SMesh *m) { + int i, j, k; + for(i = 0; i < m->l.n; i++) { + STriangle *tr = &(m->l[i]); + if(tr->IsDegenerate()) { + continue; + } + for(j = 0; j < 3; j++) { + Vector v = tr->vertices[j]; + + SMesh extra = {}; + SnapToVertex(v, &extra); + + for(k = 0; k < extra.l.n; k++) { + STriangle *tra = (STriangle *)Platform::AllocTemporary(sizeof(*tra)); + *tra = extra.l[k]; + AddTriangle(tra); + } + extra.Clear(); + } + } +} + +//----------------------------------------------------------------------------- +// For all the edges in sel, split them against the given triangle, and test +// them for occlusion. sel is both our input and our output. tag indicates +// whether an edge is occluded. +//----------------------------------------------------------------------------- +void SKdNode::SplitLinesAgainstTriangle(SEdgeList *sel, STriangle *tr) const { + SEdgeList seln = {}; + + Vector tn = tr->Normal().WithMagnitude(1); + double td = tn.Dot(tr->a); + + // Consider front-facing triangles only. + if(tn.z > LENGTH_EPS) { + // If the edge crosses our triangle's plane, then split into above + // and below parts. Note that we must preserve auxA, which contains + // the style associated with this line, as well as the tag, which + // contains the occlusion status. + SEdge *se; + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + double da = (se->a).Dot(tn) - td, + db = (se->b).Dot(tn) - td; + if((da < -LENGTH_EPS && db > LENGTH_EPS) || + (db < -LENGTH_EPS && da > LENGTH_EPS)) + { + Vector m = Vector::AtIntersectionOfPlaneAndLine( + tn, td, + se->a, se->b, NULL); + seln.AddEdge(m, se->b, se->auxA, 0, se->tag); + se->b = m; + } + } + for(se = seln.l.First(); se; se = seln.l.NextAfter(se)) { + sel->AddEdge(se->a, se->b, se->auxA, 0, se->tag); + } + seln.Clear(); + + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + Vector pt = ((se->a).Plus(se->b)).ScaledBy(0.5); + if(pt.Dot(tn) - td > -LENGTH_EPS) { + // Edge is in front of or on our plane (remember, tn.z > 0) + // so it is exempt from further splitting + se->auxB = 1; + } else { + // Edge is behind our plane, needs further splitting + se->auxB = 0; + } + } + + // Considering only the (x, y) coordinates, split the edge against our + // triangle. + Point2d a = (tr->a).ProjectXy(), + b = (tr->b).ProjectXy(), + c = (tr->c).ProjectXy(); + + Point2d n[3] = { (b.Minus(a)).Normal().WithMagnitude(1), + (c.Minus(b)).Normal().WithMagnitude(1), + (a.Minus(c)).Normal().WithMagnitude(1) }; + + double d[3] = { n[0].Dot(b), + n[1].Dot(c), + n[2].Dot(a) }; + + // Split all of the edges where they intersect the triangle edges + int i; + for(i = 0; i < 3; i++) { + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + if(se->auxB) continue; + + Point2d ap = (se->a).ProjectXy(), + bp = (se->b).ProjectXy(); + double da = n[i].Dot(ap) - d[i], + db = n[i].Dot(bp) - d[i]; + if((da < -LENGTH_EPS && db > LENGTH_EPS) || + (db < -LENGTH_EPS && da > LENGTH_EPS)) + { + double dab = (db - da); + Vector spl = ((se->a).ScaledBy( db/dab)).Plus( + (se->b).ScaledBy(-da/dab)); + seln.AddEdge(spl, se->b, se->auxA, 0, se->tag); + se->b = spl; + } + } + for(se = seln.l.First(); se; se = seln.l.NextAfter(se)) { + // The split pieces are all behind the triangle, since only + // edges behind the triangle got split. So their auxB is 0. + sel->AddEdge(se->a, se->b, se->auxA, 0, se->tag); + } + seln.Clear(); + } + + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + bool occluded; + if(se->auxB) { + // Lies above or on the triangle plane, so triangle doesn't + // occlude it. + occluded = false; + } else { + // Test the segment to see if it lies outside the triangle + // (i.e., outside wrt at least one edge), and keep it only + // then. + Point2d pt = ((se->a).Plus(se->b).ScaledBy(0.5)).ProjectXy(); + occluded = true; + for(i = 0; i < 3; i++) { + // If the test point lies on the boundary of our triangle, + // then we still discard the edge. + if(n[i].Dot(pt) - d[i] > LENGTH_EPS) occluded = false; + } + } + + if(occluded) { + se->tag = 1; + } + } + } +} + +//----------------------------------------------------------------------------- +// Given an edge orig, occlusion test it against our mesh. We output an edge +// list in sel, where only invisible portions of the edge are tagged. +//----------------------------------------------------------------------------- +void SKdNode::OcclusionTestLine(SEdge orig, SEdgeList *sel, int cnt) const { + if(gt && lt) { + double ac = (orig.a).Element(which), + bc = (orig.b).Element(which); + // We can ignore triangles that are separated in x or y, but triangles + // that are separated in z may still contribute + if(ac < c + KDTREE_EPS || + bc < c + KDTREE_EPS || + which == 2) + { + lt->OcclusionTestLine(orig, sel, cnt); + } + if(ac > c - KDTREE_EPS || + bc > c - KDTREE_EPS || + which == 2) + { + gt->OcclusionTestLine(orig, sel, cnt); + } + } else { + STriangleLl *ll; + for(ll = tris; ll; ll = ll->next) { + STriangle *tr = ll->tri; + + if(tr->tag == cnt) continue; + + SplitLinesAgainstTriangle(sel, tr); + tr->tag = cnt; + } + } +} + +//----------------------------------------------------------------------------- +// Search the mesh for a triangle with an edge from b to a (i.e., the mate +// for the edge from a to b), and increment info->count each time that we +// find one. If a triangle is found, then report whether it is front- or +// back-facing using info->frontFacing. And regardless of whether a mate is +// found, report whether the edge intersects the mesh with info->intersectsMesh; +// if coplanarIsInter then we count the edge as intersecting if it's coplanar +// with a triangle in the mesh, otherwise not. +//----------------------------------------------------------------------------- +void SKdNode::FindEdgeOn(Vector a, Vector b, int cnt, bool coplanarIsInter, + EdgeOnInfo *info) const +{ + if(gt && lt) { + double ac = a.Element(which), + bc = b.Element(which); + if(ac < c + KDTREE_EPS || + bc < c + KDTREE_EPS) + { + lt->FindEdgeOn(a, b, cnt, coplanarIsInter, info); + } + if(ac > c - KDTREE_EPS || + bc > c - KDTREE_EPS) + { + gt->FindEdgeOn(a, b, cnt, coplanarIsInter, info); + } + return; + } + + // We are a leaf node; so we iterate over all the triangles in our + // linked list. + STriangleLl *ll; + for(ll = tris; ll; ll = ll->next) { + STriangle *tr = ll->tri; + + if(tr->tag == cnt) continue; + + // Test if this triangle matches up with the given edge + if((a.Equals(tr->b) && b.Equals(tr->a)) || + (a.Equals(tr->c) && b.Equals(tr->b)) || + (a.Equals(tr->a) && b.Equals(tr->c))) + { + info->count++; + // Record whether this triangle is front- or back-facing. + if(tr->Normal().z > LENGTH_EPS) { + info->frontFacing = true; + } else { + info->frontFacing = false; + } + // Record the triangle + info->tr = tr; + // And record which vertices a and b correspond to + info->ai = a.Equals(tr->a) ? 0 : (a.Equals(tr->b) ? 1 : 2); + info->bi = b.Equals(tr->a) ? 0 : (b.Equals(tr->b) ? 1 : 2); + } else if(((a.Equals(tr->a) && b.Equals(tr->b)) || + (a.Equals(tr->b) && b.Equals(tr->c)) || + (a.Equals(tr->c) && b.Equals(tr->a)))) + { + // It's an edge of this triangle, okay. + } else { + // Check for self-intersection + Vector n = (tr->Normal()).WithMagnitude(1); + double d = (tr->a).Dot(n); + double pa = a.Dot(n) - d, pb = b.Dot(n) - d; + // It's an intersection if neither point lies in-plane, + // and the edge crosses the plane (should handle in-plane + // intersections separately but don't yet). + if((pa < -LENGTH_EPS || pa > LENGTH_EPS) && + (pb < -LENGTH_EPS || pb > LENGTH_EPS) && + (pa*pb < 0)) + { + // The edge crosses the plane of the triangle; now see if + // it crosses inside the triangle. + if(tr->ContainsPointProjd(b.Minus(a), a)) { + if(coplanarIsInter) { + info->intersectsMesh = true; + } else { + Vector p = Vector::AtIntersectionOfPlaneAndLine( + n, d, a, b, NULL); + Vector ta = tr->a, + tb = tr->b, + tc = tr->c; + if((p.DistanceToLine(ta, tb.Minus(ta)) < LENGTH_EPS) || + (p.DistanceToLine(tb, tc.Minus(tb)) < LENGTH_EPS) || + (p.DistanceToLine(tc, ta.Minus(tc)) < LENGTH_EPS)) + { + // Intersection lies on edge. This happens when + // our edge is from a triangle coplanar with + // another triangle in the mesh. We don't test + // the edge against triangles whose plane contains + // that edge, but we do end up testing against + // the coplanar triangle's neighbours, which we + // will intersect on their edges. + } else { + info->intersectsMesh = true; + } + } + } + } + } + + // Ensure that we don't count this triangle twice if it appears + // in two buckets of the kd tree. + tr->tag = cnt; + } +} + +static bool CheckAndAddTrianglePair(std::set> *pairs, + STriangle *a, STriangle *b) +{ + if(pairs->find(std::make_pair(a, b)) != pairs->end() || + pairs->find(std::make_pair(b, a)) != pairs->end()) + return true; + + pairs->emplace(a, b); + return false; +} + +//----------------------------------------------------------------------------- +// Pick certain classes of edges out from our mesh. These might be: +// * naked edges (i.e., edges with no anti-parallel neighbor) and self- +// intersecting edges (i.e., edges that cross another triangle) +// * turning edges (i.e., edges where a front-facing triangle joins +// a back-facing triangle) +// * emphasized edges (i.e., edges where a triangle from one face joins +// a triangle from a different face) +//----------------------------------------------------------------------------- +void SKdNode::MakeCertainEdgesInto(SEdgeList *sel, EdgeKind how, bool coplanarIsInter, + bool *inter, bool *leaky, int auxA) const +{ + if(inter) *inter = false; + if(leaky) *leaky = false; + + std::vector tris; + ClearTags(); + ListTrianglesInto(&tris); + + std::set> edgeTris; + int cnt = 1234; + for(STriangle *tr : tris) { + for(int j = 0; j < 3; j++) { + Vector a = tr->vertices[j]; + Vector b = tr->vertices[(j + 1) % 3]; + + SKdNode::EdgeOnInfo info = {}; + FindEdgeOn(a, b, cnt, coplanarIsInter, &info); + + switch(how) { + case EdgeKind::NAKED_OR_SELF_INTER: + // there should be one anti-parllel edge + if(info.count != 1) { + // but there may be multiple parallel coincident edges + SKdNode::EdgeOnInfo parallelInfo = {}; + FindEdgeOn(b, a, -cnt, coplanarIsInter, ¶llelInfo); + if (info.count != parallelInfo.count) { + sel->AddEdge(a, b, auxA); + if(leaky) *leaky = true; + } + } + if(info.intersectsMesh) { + sel->AddEdge(a, b, auxA); + if(inter) *inter = true; + } + break; + + case EdgeKind::SELF_INTER: + if(info.intersectsMesh) { + sel->AddEdge(a, b, auxA); + if(inter) *inter = true; + } + break; + + case EdgeKind::TURNING: + if((tr->Normal().z < LENGTH_EPS) && + (info.count == 1) && + info.frontFacing) + { + if(CheckAndAddTrianglePair(&edgeTris, tr, info.tr)) + break; + // This triangle is back-facing (or on edge), and + // this edge has exactly one mate, and that mate is + // front-facing. So this is a turning edge. + sel->AddEdge(a, b, auxA); + } + break; + + case EdgeKind::EMPHASIZED: + if(info.count == 1 && tr->meta.face != info.tr->meta.face) { + if(CheckAndAddTrianglePair(&edgeTris, tr, info.tr)) + break; + // The two triangles that join at this edge come from + // different faces; either really different faces, + // or one is from a face and the other is zero (i.e., + // not from a face). + sel->AddEdge(a, b, auxA); + } + break; + + case EdgeKind::SHARP: + if(info.count == 1) { + Vector na0 = tr->normals[j].WithMagnitude(1.0); + Vector nb0 = tr->normals[(j + 1) % 3].WithMagnitude(1.0); + Vector na1 = info.tr->normals[info.ai].WithMagnitude(1.0); + Vector nb1 = info.tr->normals[info.bi].WithMagnitude(1.0); + if(!((na0.Equals(na1) && nb0.Equals(nb1)) || + (na0.Equals(nb1) && nb0.Equals(na1)))) { + if(CheckAndAddTrianglePair(&edgeTris, tr, info.tr)) + break; + // The two triangles that join at this edge meet at a sharp + // angle. This implies they come from different faces. + sel->AddEdge(a, b, auxA); + } + } + break; + } + + cnt++; + } + } +} + +void SKdNode::MakeOutlinesInto(SOutlineList *sol, EdgeKind edgeKind) const +{ + std::vector tris; + ClearTags(); + ListTrianglesInto(&tris); + + std::set> edgeTris; + int cnt = 1234; + for(STriangle *tr : tris) { + for(int j = 0; j < 3; j++) { + Vector a = tr->vertices[j]; + Vector b = tr->vertices[(j + 1) % 3]; + + SKdNode::EdgeOnInfo info = {}; + FindEdgeOn(a, b, cnt, /*coplanarIsInter=*/false, &info); + cnt++; + if(info.count != 1) continue; + if(CheckAndAddTrianglePair(&edgeTris, tr, info.tr)) + continue; + + int tag = 0; + switch(edgeKind) { + case EdgeKind::EMPHASIZED: + if(tr->meta.face != info.tr->meta.face) { + tag = 1; + } + break; + + case EdgeKind::SHARP: { + Vector na0 = tr->normals[j].WithMagnitude(1.0); + Vector nb0 = tr->normals[(j + 1) % 3].WithMagnitude(1.0); + Vector na1 = info.tr->normals[info.ai].WithMagnitude(1.0); + Vector nb1 = info.tr->normals[info.bi].WithMagnitude(1.0); + if(!((na0.Equals(na1) && nb0.Equals(nb1)) || + (na0.Equals(nb1) && nb0.Equals(na1)))) { + tag = 1; + } + } + break; + + default: + ssassert(false, "Unexpected edge kind"); + } + + Vector nl = tr->Normal().WithMagnitude(1.0); + Vector nr = info.tr->Normal().WithMagnitude(1.0); + + // We don't add edges with the same left and right + // normals because they can't produce outlines. + if(tag == 0 && nl.Equals(nr)) continue; + sol->AddEdge(a, b, nl, nr, tag); + } + } +} + +bool SOutline::IsVisible(Vector projDir) const { + double ldot = nl.Dot(projDir); + double rdot = nr.Dot(projDir); + return (ldot > -LENGTH_EPS) == (rdot < LENGTH_EPS) || + (rdot > -LENGTH_EPS) == (ldot < LENGTH_EPS); +} + +void SOutlineList::Clear() { + l.Clear(); +} + +void SOutlineList::AddEdge(Vector a, Vector b, Vector nl, Vector nr, int tag) { + SOutline so = {}; + so.a = a; + so.b = b; + so.nl = nl; + so.nr = nr; + so.tag = tag; + l.Add(&so); +} + +void SOutlineList::ListTaggedInto(SEdgeList *el, int auxA, int auxB) { + for(const SOutline &so : l) { + if(so.tag == 0) continue; + el->AddEdge(so.a, so.b, auxA, auxB); + } +} + +void SOutlineList::MakeFromCopyOf(SOutlineList *sol) { + for(SOutline *so = sol->l.First(); so; so = sol->l.NextAfter(so)) { + l.Add(so); + } +} + +void SMesh::PrecomputeTransparency() { + std::sort(l.begin(), l.end(), + [&](const STriangle &sta, const STriangle &stb) { + RgbaColor colora = sta.meta.color, + colorb = stb.meta.color; + bool opaquea = colora.IsEmpty() || colora.alpha == 255, + opaqueb = colorb.IsEmpty() || colorb.alpha == 255; + + if(!opaquea || !opaqueb) isTransparent = true; + return (opaquea != opaqueb && opaquea == true); + }); +} + +void SMesh::RemoveDegenerateTriangles() { + for(auto &tr : l) { + tr.tag = (int)tr.IsDegenerate(); + } + l.RemoveTagged(); +} + +double SMesh::CalculateVolume() const { + double vol = 0; + for(STriangle tr : l) { + // Translate to place vertex A at (x, y, 0) + Vector trans = Vector::From(tr.a.x, tr.a.y, 0); + tr.a = (tr.a).Minus(trans); + tr.b = (tr.b).Minus(trans); + tr.c = (tr.c).Minus(trans); + + // Rotate to place vertex B on the y-axis. Depending on + // whether the triangle is CW or CCW, C is either to the + // right or to the left of the y-axis. This handles the + // sign of our normal. + Vector u = Vector::From(-tr.b.y, tr.b.x, 0); + u = u.WithMagnitude(1); + Vector v = Vector::From(tr.b.x, tr.b.y, 0); + v = v.WithMagnitude(1); + Vector n = Vector::From(0, 0, 1); + + tr.a = (tr.a).DotInToCsys(u, v, n); + tr.b = (tr.b).DotInToCsys(u, v, n); + tr.c = (tr.c).DotInToCsys(u, v, n); + + n = tr.Normal().WithMagnitude(1); + + // Triangles on edge don't contribute + if(fabs(n.z) < LENGTH_EPS) continue; + + // The plane has equation p dot n = a dot n + double d = (tr.a).Dot(n); + // nx*x + ny*y + nz*z = d + // nz*z = d - nx*x - ny*y + double A = -n.x/n.z, B = -n.y/n.z, C = d/n.z; + + double mac = tr.c.y/tr.c.x, mbc = (tr.c.y - tr.b.y)/tr.c.x; + double xc = tr.c.x, yb = tr.b.y; + + // I asked Maple for + // int(int(A*x + B*y +C, y=mac*x..(mbc*x + yb)), x=0..xc); + double integral = + (1.0/3)*( + A*(mbc-mac)+ + (1.0/2)*B*(mbc*mbc-mac*mac) + )*(xc*xc*xc)+ + (1.0/2)*(A*yb+B*yb*mbc+C*(mbc-mac))*xc*xc+ + C*yb*xc+ + (1.0/2)*B*yb*yb*xc; + + vol += integral; + } + return vol; +} + +double SMesh::CalculateSurfaceArea(const std::vector &faces) const { + double area = 0.0; + for(uint32_t f : faces) { + for(const STriangle &t : l) { + if(f != t.meta.face) continue; + area += t.Area(); + } + } + return area; +} + +} // namespace SolveSpace diff --git a/src/modify.cpp b/src/modify.cpp new file mode 100644 index 0000000..60079df --- /dev/null +++ b/src/modify.cpp @@ -0,0 +1,751 @@ +//----------------------------------------------------------------------------- +// User-initiated (not parametric) operations to modify our sketch, by +// changing the requests, like to round a corner or split curves where they +// intersect. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Replace constraints on oldpt with the same constraints on newpt. +// Useful when splitting, tangent arcing, or removing bezier points. +//----------------------------------------------------------------------------- +void GraphicsWindow::ReplacePointInConstraints(hEntity oldpt, hEntity newpt) { + for(auto &c : SK.constraint) { + if(c.ptA == oldpt) + c.ptA = newpt; + if(c.ptB == oldpt) + c.ptB = newpt; + } +} + +//----------------------------------------------------------------------------- +// Remove constraints on hpt. Useful when removing bezier points. +//----------------------------------------------------------------------------- +void GraphicsWindow::RemoveConstraintsForPointBeingDeleted(hEntity hpt) { + SK.constraint.ClearTags(); + for(auto &c : SK.constraint) { + if(c.ptA == hpt || c.ptB == hpt) { + c.tag = 1; + (SS.deleted.constraints)++; + if(c.type != Constraint::Type::POINTS_COINCIDENT && + c.type != Constraint::Type::HORIZONTAL && + c.type != Constraint::Type::VERTICAL) + { + (SS.deleted.nonTrivialConstraints)++; + } + } + } + SK.constraint.RemoveTagged(); +} + +//----------------------------------------------------------------------------- +// Let's say that A is coincident with B, and B is coincident with C. This +// implies that A is coincident with C; but if we delete B, then both +// constraints must be deleted too (since they reference B), and A is no +// longer constrained to C. This routine adds back that constraint. +//----------------------------------------------------------------------------- +void GraphicsWindow::FixConstraintsForRequestBeingDeleted(hRequest hr) { + Request *r = SK.GetRequest(hr); + if(r->group != SS.GW.activeGroup) return; + + for(Entity &e : SK.entity) { + if(!(e.h.isFromRequest())) continue; + if(e.h.request() != hr) continue; + + if(e.type != Entity::Type::POINT_IN_2D && + e.type != Entity::Type::POINT_IN_3D) + { + continue; + } + + // This is a point generated by the request being deleted; so fix + // the constraints for that. + FixConstraintsForPointBeingDeleted(e.h); + } +} +void GraphicsWindow::FixConstraintsForPointBeingDeleted(hEntity hpt) { + List ld = {}; + + SK.constraint.ClearTags(); + for(Constraint &c : SK.constraint) { + if(c.type != Constraint::Type::POINTS_COINCIDENT) continue; + if(c.group != SS.GW.activeGroup) continue; + + if(c.ptA == hpt) { + ld.Add(&(c.ptB)); + c.tag = 1; + } + if(c.ptB == hpt) { + ld.Add(&(c.ptA)); + c.tag = 1; + } + } + // Remove constraints without waiting for regeneration; this way + // if another point takes the place of the deleted one (e.g. when + // removing control points of a bezier) the constraint doesn't + // spuriously move. Similarly, subsequent calls of this function + // (if multiple coincident points are getting deleted) will work + // correctly. + SK.constraint.RemoveTagged(); + + // If more than one point was constrained coincident with hpt, then + // those two points were implicitly coincident with each other. By + // deleting hpt (and all constraints that mention it), we will delete + // that relationship. So put it back here now. + for(int i = 1; i < ld.n; i++) { + Constraint::ConstrainCoincident(ld[i-1], ld[i]); + } + ld.Clear(); +} + +//----------------------------------------------------------------------------- +// A curve by its parametric equation, helper functions for computing tangent +// arcs by a numerical method. +//----------------------------------------------------------------------------- +void GraphicsWindow::ParametricCurve::MakeFromEntity(hEntity he, bool reverse) { + *this = {}; + Entity *e = SK.GetEntity(he); + if(e->type == Entity::Type::LINE_SEGMENT) { + isLine = true; + p0 = e->EndpointStart(), + p1 = e->EndpointFinish(); + if(reverse) { + swap(p0, p1); + } + } else if(e->type == Entity::Type::ARC_OF_CIRCLE) { + isLine = false; + p0 = SK.GetEntity(e->point[0])->PointGetNum(); + Vector pe = SK.GetEntity(e->point[1])->PointGetNum(); + r = (pe.Minus(p0)).Magnitude(); + e->ArcGetAngles(&theta0, &theta1, &dtheta); + if(reverse) { + swap(theta0, theta1); + dtheta = -dtheta; + } + EntityBase *wrkpln = SK.GetEntity(e->workplane)->Normal(); + u = wrkpln->NormalU(); + v = wrkpln->NormalV(); + } else ssassert(false, "Unexpected entity type"); +} +double GraphicsWindow::ParametricCurve::LengthForAuto() { + if(isLine) { + // Allow a third of the line to disappear with auto radius + return (p1.Minus(p0)).Magnitude() / 3; + } else { + // But only a twentieth of the arc; shorter means fewer numerical + // problems since the curve is more linear over shorter sections. + return (fabs(dtheta)*r)/20; + } +} +Vector GraphicsWindow::ParametricCurve::PointAt(double t) { + if(isLine) { + return p0.Plus((p1.Minus(p0)).ScaledBy(t)); + } else { + double theta = theta0 + dtheta*t; + return p0.Plus(u.ScaledBy(r*cos(theta)).Plus(v.ScaledBy(r*sin(theta)))); + } +} +Vector GraphicsWindow::ParametricCurve::TangentAt(double t) { + if(isLine) { + return p1.Minus(p0); + } else { + double theta = theta0 + dtheta*t; + Vector t = u.ScaledBy(-r*sin(theta)).Plus(v.ScaledBy(r*cos(theta))); + t = t.ScaledBy(dtheta); + return t; + } +} +/** Changes or copies the given entity and connects it to the arc. + * \param t Where on this parametric curve does it connect to the arc. + * \param reuseOrig Should the original entity be modified + * \param orig The original entity. + * \param arc The arc that will be connected to. + * \param arcFinish Whether to connect to the end point of the arc. + * \param pointf When changing the original entity, whether the end point should be modified. + */ +void GraphicsWindow::ParametricCurve::CreateRequestTrimmedTo(double t, + bool reuseOrig, hEntity orig, hEntity arc, bool arcFinish, bool pointf) +{ + hRequest hr; + Entity *e; + if(isLine) { + if (reuseOrig) { + e = SK.GetEntity(orig); + int i = pointf ? 1 : 0; + SK.GetEntity(e->point[i])->PointForceTo(PointAt(t)); + ConstrainPointIfCoincident(e->point[i]); + } else { + hr = SS.GW.AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false), + e = SK.GetEntity(hr.entity(0)); + SK.GetEntity(e->point[0])->PointForceTo(PointAt(t)); + SK.GetEntity(e->point[1])->PointForceTo(PointAt(1)); + ConstrainPointIfCoincident(e->point[0]); + ConstrainPointIfCoincident(e->point[1]); + Constraint::Constrain(Constraint::Type::PT_ON_LINE, + hr.entity(1), Entity::NO_ENTITY, orig); + } + Constraint::Constrain(Constraint::Type::ARC_LINE_TANGENT, + Entity::NO_ENTITY, Entity::NO_ENTITY, + arc, e->h, /*other=*/arcFinish, /*other2=*/false); + } else { + if (reuseOrig) { + e = SK.GetEntity(orig); + int i = pointf ? 2 : 1; + SK.GetEntity(e->point[i])->PointForceTo(PointAt(t)); + ConstrainPointIfCoincident(e->point[i]); + } else { + hr = SS.GW.AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false), + e = SK.GetEntity(hr.entity(0)); + SK.GetEntity(e->point[0])->PointForceTo(p0); + if(dtheta > 0) { + SK.GetEntity(e->point[1])->PointForceTo(PointAt(t)); + SK.GetEntity(e->point[2])->PointForceTo(PointAt(1)); + } else { + SK.GetEntity(e->point[2])->PointForceTo(PointAt(t)); + SK.GetEntity(e->point[1])->PointForceTo(PointAt(1)); + } + ConstrainPointIfCoincident(e->point[0]); + ConstrainPointIfCoincident(e->point[1]); + ConstrainPointIfCoincident(e->point[2]); + } + // The tangency constraint alone is enough to fully constrain it, + // so there's no need for more. + Constraint::Constrain(Constraint::Type::CURVE_CURVE_TANGENT, + Entity::NO_ENTITY, Entity::NO_ENTITY, + arc, e->h, /*other=*/arcFinish, /*other2=*/(dtheta < 0)); + } +} + +//----------------------------------------------------------------------------- +// If a point in the same group as hpt, and numerically coincident with hpt, +// happens to exist, then constrain that point coincident to hpt. +//----------------------------------------------------------------------------- +void GraphicsWindow::ParametricCurve::ConstrainPointIfCoincident(hEntity hpt) { + Entity *pt; + pt = SK.GetEntity(hpt); + Vector ev, ptv; + ptv = pt->PointGetNum(); + + for(Entity &e : SK.entity) { + if(e.h == pt->h) continue; + if(!e.IsPoint()) continue; + if(e.group != pt->group) continue; + if(e.workplane != pt->workplane) continue; + + ev = e.PointGetNum(); + if(!ev.Equals(ptv)) continue; + + Constraint::ConstrainCoincident(hpt, e.h); + break; + } +} + +//----------------------------------------------------------------------------- +// A single point must be selected when this function is called. We find two +// non-construction line segments that join at this point, and create a +// tangent arc joining them. +//----------------------------------------------------------------------------- +void GraphicsWindow::MakeTangentArc() { + if(!LockedInWorkplane()) { + Error(_("Must be sketching in workplane to create tangent arc.")); + return; + } + + // The point corresponding to the vertex to be rounded. + Vector pshared = SK.GetEntity(gs.point[0])->PointGetNum(); + ClearSelection(); + + // First, find two requests (that are not construction, and that are + // in our group and workplane) that generate entities that have an + // endpoint at our vertex to be rounded. + int i, c = 0; + Entity *ent[2]; + Request *req[2]; + hRequest hreq[2]; + hEntity hent[2]; + bool pointf[2]; + for(auto &r : SK.request) { + if(r.group != activeGroup) + continue; + if(r.workplane != ActiveWorkplane()) + continue; + if(r.construction) + continue; + if(r.type != Request::Type::LINE_SEGMENT && r.type != Request::Type::ARC_OF_CIRCLE) { + continue; + } + + Entity *e = SK.GetEntity(r.h.entity(0)); + Vector ps = e->EndpointStart(), + pf = e->EndpointFinish(); + + if(ps.Equals(pshared) || pf.Equals(pshared)) { + if(c < 2) { + // We record the entity and request and their handles, + // and whether the vertex to be rounded is the start or + // finish of this entity. + ent[c] = e; + hent[c] = e->h; + req[c] = &r; + hreq[c] = r.h; + pointf[c] = (pf.Equals(pshared)); + } + c++; + } + } + if(c != 2) { + Error(_("To create a tangent arc, select a point where two " + "non-construction lines or circles in this group and " + "workplane join.")); + return; + } + + Entity *wrkpl = SK.GetEntity(ActiveWorkplane()); + Vector wn = wrkpl->Normal()->NormalN(); + + // Based on these two entities, we make the objects that we'll use to + // numerically find the tangent arc. + ParametricCurve pc[2]; + pc[0].MakeFromEntity(ent[0]->h, pointf[0]); + pc[1].MakeFromEntity(ent[1]->h, pointf[1]); + + // And thereafter we mustn't touch the entity or req ptrs, + // because the new requests/entities we add might force a + // realloc. + memset(ent, 0, sizeof(ent)); + memset(req, 0, sizeof(req)); + + Vector pinter; + double r = 0.0, vv = 0.0; + // We now do Newton iterations to find the tangent arc, and its positions + // t back along the two curves, starting from shared point of the curves + // at t = 0. Lots of iterations helps convergence, and this is still + // ~10 ms for everything. + int iters = 1000; + double t[2] = { 0, 0 }, tp[2]; + for(i = 0; i < iters + 20; i++) { + Vector p0 = pc[0].PointAt(t[0]), + p1 = pc[1].PointAt(t[1]), + t0 = pc[0].TangentAt(t[0]), + t1 = pc[1].TangentAt(t[1]); + + pinter = Vector::AtIntersectionOfLines(p0, p0.Plus(t0), + p1, p1.Plus(t1), + NULL, NULL, NULL); + + // The sign of vv determines whether shortest distance is + // clockwise or anti-clockwise. + Vector v = (wn.Cross(t0)).WithMagnitude(1); + vv = t1.Dot(v); + + double dot = (t0.WithMagnitude(1)).Dot(t1.WithMagnitude(1)); + double theta = acos(dot); + + if(SS.tangentArcManual) { + r = SS.tangentArcRadius; + } else { + r = 200/scale; + // Set the radius so that no more than one third of the + // line segment disappears. + r = min(r, pc[0].LengthForAuto()*tan(theta/2)); + r = min(r, pc[1].LengthForAuto()*tan(theta/2));; + } + // We are source-stepping the radius, to improve convergence. So + // ramp that for most of the iterations, and then do a few at + // the end with that constant for polishing. + if(i < iters) { + r *= 0.1 + 0.9*i/((double)iters); + } + + // The distance from the intersection of the lines to the endpoint + // of the arc, along each line. + double el = r/tan(theta/2); + + // Compute the endpoints of the arc, for each curve + Vector pa0 = pinter.Plus(t0.WithMagnitude(el)), + pa1 = pinter.Plus(t1.WithMagnitude(el)); + + tp[0] = t[0]; + tp[1] = t[1]; + + // And convert those points to parameter values along the curve. + t[0] += (pa0.Minus(p0)).DivProjected(t0); + t[1] += (pa1.Minus(p1)).DivProjected(t1); + } + + // Stupid check for convergence, and for an out of range result (as + // we would get, for example, if the line is too short to fit the + // rounding arc). + if(fabs(tp[0] - t[0]) > 1e-3 || fabs(tp[1] - t[1]) > 1e-3 || + t[0] < 0.01 || t[1] < 0.01 || + t[0] > 0.99 || t[1] > 0.99 || + IsReasonable(t[0]) || IsReasonable(t[1])) + { + Error(_("Couldn't round this corner. Try a smaller radius, or try " + "creating the desired geometry by hand with tangency " + "constraints.")); + return; + } + + // Compute the location of the center of the arc + Vector center = pc[0].PointAt(t[0]), + v0inter = pinter.Minus(center); + int a, b; + if(vv < 0) { + a = 1; b = 2; + center = center.Minus(v0inter.Cross(wn).WithMagnitude(r)); + } else { + a = 2; b = 1; + center = center.Plus(v0inter.Cross(wn).WithMagnitude(r)); + } + + SS.UndoRemember(); + + if (SS.tangentArcModify) { + // Delete the coincident constraint for the removed point. + SK.constraint.ClearTags(); + for(i = 0; i < SK.constraint.n; i++) { + Constraint *cs = &(SK.constraint[i]); + if(cs->group != activeGroup) continue; + if(cs->workplane != ActiveWorkplane()) continue; + if(cs->type != Constraint::Type::POINTS_COINCIDENT) continue; + if (SK.GetEntity(cs->ptA)->PointGetNum().Equals(pshared)) { + cs->tag = 1; + } + } + SK.constraint.RemoveTagged(); + } else { + // Make the original entities construction, or delete them + // entirely, according to user preference. + SK.GetRequest(hreq[0])->construction = true; + SK.GetRequest(hreq[1])->construction = true; + } + + // Create and position the new tangent arc. + hRequest harc = AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false); + Entity *earc = SK.GetEntity(harc.entity(0)); + hEntity hearc = earc->h; + + SK.GetEntity(earc->point[0])->PointForceTo(center); + SK.GetEntity(earc->point[a])->PointForceTo(pc[0].PointAt(t[0])); + SK.GetEntity(earc->point[b])->PointForceTo(pc[1].PointAt(t[1])); + + earc = NULL; + + // Modify or duplicate the original entities and connect them to the tangent arc. + pc[0].CreateRequestTrimmedTo(t[0], SS.tangentArcModify, + hent[0], hearc, /*arcFinish=*/(b == 1), pointf[0]); + pc[1].CreateRequestTrimmedTo(t[1], SS.tangentArcModify, + hent[1], hearc, /*arcFinish=*/(a == 1), pointf[1]); +} + +hEntity GraphicsWindow::SplitLine(hEntity he, Vector pinter) { + // Save the original endpoints, since we're about to delete this entity. + Entity *e01 = SK.GetEntity(he); + hEntity hep0 = e01->point[0], hep1 = e01->point[1]; + Vector p0 = SK.GetEntity(hep0)->PointGetNum(), + p1 = SK.GetEntity(hep1)->PointGetNum(); + + if(p0.Equals(pinter)) { + return hep0; + } + + if(p1.Equals(pinter)) { + return hep1; + } + + // Add the two line segments this one gets split into. + hRequest r0i = AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false), + ri1 = AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false); + // Don't get entities till after adding, realloc issues + + Entity *e0i = SK.GetEntity(r0i.entity(0)), + *ei1 = SK.GetEntity(ri1.entity(0)); + + SK.GetEntity(e0i->point[0])->PointForceTo(p0); + SK.GetEntity(e0i->point[1])->PointForceTo(pinter); + SK.GetEntity(ei1->point[0])->PointForceTo(pinter); + SK.GetEntity(ei1->point[1])->PointForceTo(p1); + + ReplacePointInConstraints(hep0, e0i->point[0]); + ReplacePointInConstraints(hep1, ei1->point[1]); + Constraint::ConstrainCoincident(e0i->point[1], ei1->point[0]); + return e0i->point[1]; +} + +hEntity GraphicsWindow::SplitCircle(hEntity he, Vector pinter) { + Entity *circle = SK.GetEntity(he); + if(circle->type == Entity::Type::CIRCLE) { + // Start with an unbroken circle, split it into a 360 degree arc. + Vector center = SK.GetEntity(circle->point[0])->PointGetNum(); + + circle = NULL; // shortly invalid! + hRequest hr = AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false); + + Entity *arc = SK.GetEntity(hr.entity(0)); + + SK.GetEntity(arc->point[0])->PointForceTo(center); + SK.GetEntity(arc->point[1])->PointForceTo(pinter); + SK.GetEntity(arc->point[2])->PointForceTo(pinter); + + Constraint::ConstrainCoincident(arc->point[1], arc->point[2]); + return arc->point[1]; + } else { + // Start with an arc, break it in to two arcs + hEntity hc = circle->point[0], + hs = circle->point[1], + hf = circle->point[2]; + Vector center = SK.GetEntity(hc)->PointGetNum(), + start = SK.GetEntity(hs)->PointGetNum(), + finish = SK.GetEntity(hf)->PointGetNum(); + + circle = NULL; // shortly invalid! + hRequest hr0 = AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false), + hr1 = AddRequest(Request::Type::ARC_OF_CIRCLE, /*rememberForUndo=*/false); + + Entity *arc0 = SK.GetEntity(hr0.entity(0)), + *arc1 = SK.GetEntity(hr1.entity(0)); + + SK.GetEntity(arc0->point[0])->PointForceTo(center); + SK.GetEntity(arc0->point[1])->PointForceTo(start); + SK.GetEntity(arc0->point[2])->PointForceTo(pinter); + + SK.GetEntity(arc1->point[0])->PointForceTo(center); + SK.GetEntity(arc1->point[1])->PointForceTo(pinter); + SK.GetEntity(arc1->point[2])->PointForceTo(finish); + + ReplacePointInConstraints(hs, arc0->point[1]); + ReplacePointInConstraints(hf, arc1->point[2]); + Constraint::ConstrainCoincident(arc0->point[2], arc1->point[1]); + return arc0->point[2]; + } +} + +hEntity GraphicsWindow::SplitCubic(hEntity he, Vector pinter) { + // Save the original endpoints, since we're about to delete this entity. + Entity *e01 = SK.GetEntity(he); + SBezierList sbl = {}; + e01->GenerateBezierCurves(&sbl); + + hEntity hep0 = e01->point[0], + hep1 = e01->point[3+e01->extraPoints], + hep0n = Entity::NO_ENTITY, // the new start point + hep1n = Entity::NO_ENTITY, // the new finish point + hepin = Entity::NO_ENTITY; // the intersection point + + // The curve may consist of multiple cubic segments. So find which one + // contains the intersection point. + double t; + int i, j; + for(i = 0; i < sbl.l.n; i++) { + SBezier *sb = &(sbl.l[i]); + ssassert(sb->deg == 3, "Expected a cubic bezier"); + + sb->ClosestPointTo(pinter, &t, /*mustConverge=*/false); + if(pinter.Equals(sb->PointAt(t))) { + // Split that segment at the intersection. + SBezier b0i, bi1, b01 = *sb; + b01.SplitAt(t, &b0i, &bi1); + + // Add the two cubic segments this one gets split into. + hRequest r0i = AddRequest(Request::Type::CUBIC, /*rememberForUndo=*/false), + ri1 = AddRequest(Request::Type::CUBIC, /*rememberForUndo=*/false); + // Don't get entities till after adding, realloc issues + + Entity *e0i = SK.GetEntity(r0i.entity(0)), + *ei1 = SK.GetEntity(ri1.entity(0)); + + for(j = 0; j <= 3; j++) { + SK.GetEntity(e0i->point[j])->PointForceTo(b0i.ctrl[j]); + } + for(j = 0; j <= 3; j++) { + SK.GetEntity(ei1->point[j])->PointForceTo(bi1.ctrl[j]); + } + + Constraint::ConstrainCoincident(e0i->point[3], ei1->point[0]); + if(i == 0) hep0n = e0i->point[0]; + hep1n = ei1->point[3]; + hepin = e0i->point[3]; + } else { + hRequest r = AddRequest(Request::Type::CUBIC, /*rememberForUndo=*/false); + Entity *e = SK.GetEntity(r.entity(0)); + + for(j = 0; j <= 3; j++) { + SK.GetEntity(e->point[j])->PointForceTo(sb->ctrl[j]); + } + + if(i == 0) hep0n = e->point[0]; + hep1n = e->point[3]; + } + } + + sbl.Clear(); + + ReplacePointInConstraints(hep0, hep0n); + ReplacePointInConstraints(hep1, hep1n); + return hepin; +} + +hEntity GraphicsWindow::SplitEntity(hEntity he, Vector pinter) { + Entity *e = SK.GetEntity(he); + + hEntity ret; + if(e->IsCircle()) { + ret = SplitCircle(he, pinter); + } else if(e->type == Entity::Type::LINE_SEGMENT) { + ret = SplitLine(he, pinter); + } else if(e->type == Entity::Type::CUBIC || e->type == Entity::Type::CUBIC_PERIODIC) { + ret = SplitCubic(he, pinter); + } else { + Error(_("Couldn't split this entity; lines, circles, or cubics only.")); + return Entity::NO_ENTITY; + } + + // Finally, delete the request that generated the original entity. + if(he.isFromRequest() && he == he.request().entity(0)) { + hRequest hr = he.request(); + // Only delete the original request if we actually made a split + // (i.e. the split point is not from the original request) + if(hr != ret.request()) { + Request *r = SK.GetRequest(hr); + // If the user wants to keep the old entities around, they can just + // mark them construction first. + if(r->group == activeGroup && !r->construction) { + r->tag = 1; + DeleteTaggedRequests(); + } + } + } + + return ret; +} + +void GraphicsWindow::SplitLinesOrCurves() { + if(!LockedInWorkplane()) { + Error(_("Must be sketching in workplane to split.")); + return; + } + + GroupSelection(); + int n = gs.lineSegments + gs.circlesOrArcs + gs.cubics + gs.periodicCubics; + if(!((n == 2 && gs.points == 0) || (n == 1 && gs.points == 1))) { + Error(_("Select two entities that intersect each other " + "(e.g. two lines/circles/arcs or a line/circle/arc and a point).")); + return; + } + + bool splitAtPoint = (gs.points == 1); + hEntity ha = gs.entity[0], + hb = splitAtPoint ? gs.point[0] : gs.entity[1]; + + Entity *ea = SK.GetEntity(ha), + *eb = SK.GetEntity(hb); + Vector pi = Vector::From(0, 0, 0); + + // First, decide the point where we're going to make the split. + bool foundInters = false; + if(splitAtPoint) { + // One of the entities is a point, and this point must be on the other entity. + // Verify that a corresponding point-coincident constraint exists for the point/entity. + Vector p0, p1; + if(ea->type == Entity::Type::LINE_SEGMENT) { + p0 = ea->EndpointStart(); + p1 = ea->EndpointFinish(); + } + + SK.constraint.ClearTags(); + + for(Constraint &c : SK.constraint) { + if(c.ptA.request() == hb.request() && + c.entityA.request() == ha.request()) { + pi = SK.GetEntity(c.ptA)->PointGetNum(); + + if(ea->type == Entity::Type::LINE_SEGMENT && !pi.OnLineSegment(p0, p1)) { + // The point isn't between line endpoints, so there isn't an actual + // intersection. + continue; + } + + c.tag = 1; + foundInters = true; + break; + } + } + } else { + // Compute the possibly-rational Bezier curves for each of these non-point entities... + SBezierList sbla = {}, sblb = {}; + ea->GenerateBezierCurves(&sbla); + eb->GenerateBezierCurves(&sblb); + // ... and then compute the points where they intersect, based on those curves. + SPointList inters = {}; + sbla.AllIntersectionsWith(&sblb, &inters); + + // If there's multiple points, then take the one closest to the mouse pointer. + if(!inters.l.IsEmpty()) { + double dmin = VERY_POSITIVE; + for(const SPoint &sp : inters.l) { + double d = ProjectPoint(sp.p).DistanceTo(currentMousePosition); + if(d < dmin) { + dmin = d; + pi = sp.p; + } + } + + foundInters = true; + } + + inters.Clear(); + sbla.Clear(); + sblb.Clear(); + } + + // Then, actually split the entities. + if(foundInters) { + SS.UndoRemember(); + + // Remove any constraints we're going to replace. + SK.constraint.RemoveTagged(); + + hEntity hia = SplitEntity(ha, pi), + hib = {}; + // SplitEntity adds the coincident constraints to join the split halves + // of each original entity; and then we add the constraint to join + // the two entities together at the split point. + if(splitAtPoint) { + // Remove datum point, as it has now been superseded by the split point. + SK.request.ClearTags(); + for(Request &r : SK.request) { + if(r.h == hb.request()) { + if(r.type == Request::Type::DATUM_POINT) { + // Delete datum point. + r.tag = 1; + FixConstraintsForRequestBeingDeleted(r.h); + } else { + // Add constraint if not datum point, but endpoint of line/arc etc. + Constraint::ConstrainCoincident(hia, hb); + } + break; + } + } + SK.request.RemoveTagged(); + } else { + // Split second non-point entity and add constraint. + hib = SplitEntity(hb, pi); + if(hia.v && hib.v) { + Constraint::ConstrainCoincident(hia, hib); + } + } + } else { + Error(_("Can't split; no intersection found.")); + return; + } + + // All done, clean up and regenerate. + ClearSelection(); +} + +} // namespace SolveSpace diff --git a/src/mouse.cpp b/src/mouse.cpp new file mode 100644 index 0000000..6aa0c58 --- /dev/null +++ b/src/mouse.cpp @@ -0,0 +1,1599 @@ +//----------------------------------------------------------------------------- +// Anything relating to mouse, keyboard, or 6-DOF mouse input. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void GraphicsWindow::UpdateDraggedPoint(hEntity hp, double mx, double my) { + Entity *p = SK.GetEntity(hp); + Vector pos = p->PointGetNum(); + UpdateDraggedNum(&pos, mx, my); + p->PointForceTo(pos); + + SS.ScheduleShowTW(); +} + +void GraphicsWindow::UpdateDraggedNum(Vector *pos, double mx, double my) { + *pos = pos->Plus(projRight.ScaledBy((mx - orig.mouse.x)/scale)); + *pos = pos->Plus(projUp.ScaledBy((my - orig.mouse.y)/scale)); +} + +void GraphicsWindow::AddPointToDraggedList(hEntity hp) { + Entity *p = SK.GetEntity(hp); + // If an entity and its points are both selected, then its points could + // end up in the list twice. This would be bad, because it would move + // twice as far as the mouse pointer... + List *lhe = &(pending.points); + for(hEntity *hee = lhe->First(); hee; hee = lhe->NextAfter(hee)) { + if(*hee == hp) { + // Exact same point. + return; + } + Entity *pe = SK.GetEntity(*hee); + if(pe->type == p->type && + pe->type != Entity::Type::POINT_IN_2D && + pe->type != Entity::Type::POINT_IN_3D && + pe->group == p->group) + { + // Transform-type point, from the same group. So it handles the + // same unknowns. + return; + } + } + pending.points.Add(&hp); +} + +void GraphicsWindow::StartDraggingByEntity(hEntity he) { + Entity *e = SK.GetEntity(he); + if(e->IsPoint()) { + AddPointToDraggedList(e->h); + } else if(e->type == Entity::Type::LINE_SEGMENT || + e->type == Entity::Type::ARC_OF_CIRCLE || + e->type == Entity::Type::CUBIC || + e->type == Entity::Type::CUBIC_PERIODIC || + e->type == Entity::Type::CIRCLE || + e->type == Entity::Type::TTF_TEXT || + e->type == Entity::Type::IMAGE) + { + int pts; + ssassert(EntReqTable::GetEntityInfo(e->type, e->extraPoints, + NULL, &pts, NULL, NULL), "No entity info"); + for(int i = 0; i < pts; i++) { + AddPointToDraggedList(e->point[i]); + } + } else if(e->type == Entity::Type::FACE_NORMAL_PT + || e->type == Entity::Type::FACE_N_TRANS // this is for translate groups + + // rotate groups are currently unstable dragging +// || e->type == Entity::Type::FACE_N_ROT_AA + +// Revolve is unstable because the point is on axis. Helix drags in axial direction for same reason +// || e->type == Entity::Type::FACE_ROT_NORMAL_PT ) { // needed for helix and revolve + + || e->type == Entity::Type::FACE_N_ROT_TRANS) { // needed for linked objects + // Files save prior to v3.2 didn't specify point[0] + // so check existence before using it. + Entity *pt = SK.entity.FindByIdNoOops(e->point[0]); + if(pt) + { + // for some reason Revolve top/bottom faces do bad things if they can't be dragged. + // but a two sided revolve group will behave OK. + if(pt->CanBeDragged()) { + AddPointToDraggedList(e->point[0]); + } + } + } +} + +void GraphicsWindow::StartDraggingBySelection() { + List *ls = &(selection); + for(Selection *s = ls->First(); s; s = ls->NextAfter(s)) { + if(!s->entity.v) continue; + + StartDraggingByEntity(s->entity); + } + // The user might select a point, and then click it again to start + // dragging; but the point just got unselected by that click. So drag + // the hovered item too, and they'll always have it. + if(hover.entity.v) { + hEntity dragEntity = ChooseFromHoverToDrag().entity; + if(dragEntity != Entity::NO_ENTITY) { + StartDraggingByEntity(dragEntity); + } + } +} + +void GraphicsWindow::MouseMoved(double x, double y, bool leftDown, + bool middleDown, bool rightDown, bool shiftDown, bool ctrlDown) +{ + if(window->IsEditorVisible()) return; + if(context.active) return; + + SS.extraLine.draw = false; + + if(!orig.mouseDown) { + // If someone drags the mouse into our window with the left button + // already depressed, then we don't have our starting point; so + // don't try. + leftDown = false; + } + + if(rightDown) { + middleDown = true; + shiftDown = !shiftDown; + } + + // Not passing right-button and middle-button drags to the toolbar avoids + // some cosmetic issues with trackpad pans/rotates implemented with + // simulated right-button drag events causing spurious hover events. + if(SS.showToolbar && !middleDown) { + if(ToolbarMouseMoved((int)x, (int)y)) { + hover.Clear(); + return; + } + } + + if(!leftDown && (pending.operation == Pending::DRAGGING_POINTS || + pending.operation == Pending::DRAGGING_MARQUEE)) + { + ClearPending(); + Invalidate(); + } + + Point2d mp = Point2d::From(x, y); + currentMousePosition = mp; + + if(rightDown && orig.mouse.DistanceTo(mp) < 5 && !orig.startedMoving) { + // Avoid accidentally panning (or rotating if shift is down) if the + // user wants a context menu. + return; + } + orig.startedMoving = true; + + // If the middle button is down, then mouse movement is used to pan and + // rotate our view. This wins over everything else. + if(middleDown) { + hover.Clear(); + + double dx = (x - orig.mouse.x) / scale; + double dy = (y - orig.mouse.y) / scale; + + if(!(shiftDown || ctrlDown)) { + double sign = SS.cameraNav ? -1.0 : 1.0; + double s = 0.3*(PI/180)*scale*sign; // degrees per pixel + if(SS.turntableNav) { // lock the Z to vertical + projRight = orig.projRight.RotatedAbout(Vector::From(0, 0, 1), -s * dx); + projUp = orig.projUp.RotatedAbout( + Vector::From(orig.projRight.x, orig.projRight.y, orig.projRight.y), s * dy); + } else { + projRight = orig.projRight.RotatedAbout(orig.projUp, -s * dx); + projUp = orig.projUp.RotatedAbout(orig.projRight, s * dy); + } + + NormalizeProjectionVectors(); + } else if(ctrlDown) { + double theta = atan2(orig.mouse.y, orig.mouse.x); + theta -= atan2(y, x); + SS.extraLine.draw = true; + SS.extraLine.ptA = UnProjectPoint(Point2d::From(0, 0)); + SS.extraLine.ptB = UnProjectPoint(mp); + + Vector normal = orig.projRight.Cross(orig.projUp); + projRight = orig.projRight.RotatedAbout(normal, theta); + projUp = orig.projUp.RotatedAbout(normal, theta); + + NormalizeProjectionVectors(); + } else { + offset.x = orig.offset.x + dx*projRight.x + dy*projUp.x; + offset.y = orig.offset.y + dx*projRight.y + dy*projUp.y; + offset.z = orig.offset.z + dx*projRight.z + dy*projUp.z; + } + + orig.projRight = projRight; + orig.projUp = projUp; + orig.offset = offset; + orig.mouse.x = x; + orig.mouse.y = y; + + if(SS.TW.shown.screen == TextWindow::Screen::EDIT_VIEW) { + if(havePainted) { + SS.ScheduleShowTW(); + } + } + Invalidate(); + havePainted = false; + return; + } + + if(pending.operation == Pending::NONE) { + double dm = orig.mouse.DistanceTo(mp); + // If we're currently not doing anything, then see if we should + // start dragging something. + if(leftDown && dm > 3) { + Entity *e = NULL; + hEntity dragEntity = ChooseFromHoverToDrag().entity; + if(dragEntity.v) e = SK.GetEntity(dragEntity); + if(e && e->type != Entity::Type::WORKPLANE) { + if(!hoverWasSelectedOnMousedown) { + // The user clicked an unselected entity, which + // means they're dragging just the hovered thing, + // not the full selection. So clear all the selection + // except that entity. + ClearSelection(); + MakeSelected(dragEntity); + } + if(e->type == Entity::Type::CIRCLE && selection.n <= 1) { + // Drag the radius. + pending.circle = dragEntity; + pending.operation = Pending::DRAGGING_RADIUS; + } else if(e->IsNormal()) { + pending.normal = dragEntity; + pending.operation = Pending::DRAGGING_NORMAL; + } else { + StartDraggingBySelection(); + hover.Clear(); + pending.operation = Pending::DRAGGING_POINTS; + } + } else if(hover.constraint.v && + SK.GetConstraint(hover.constraint)->HasLabel()) + { + ClearSelection(); + pending.constraint = hover.constraint; + pending.operation = Pending::DRAGGING_CONSTRAINT; + } + if(pending.operation != Pending::NONE) { + // We just started a drag, so remember for the undo before + // the drag changes anything. + SS.UndoRemember(); + } else { + if(!hover.constraint.v) { + // That's just marquee selection, which should not cause + // an undo remember. + if(dm > 10) { + if(hover.entity.v) { + // Avoid accidentally selecting workplanes when + // starting drags. + MakeUnselected(hover.entity, /*coincidentPointTrick=*/false); + hover.Clear(); + } + pending.operation = Pending::DRAGGING_MARQUEE; + orig.marqueePoint = + UnProjectPoint(orig.mouseOnButtonDown); + } + } + } + } else { + // Otherwise, just hit test and give up; but don't hit test + // if the mouse is down, because then the user could hover + // a point, mouse down (thus selecting it), and drag, in an + // effort to drag the point, but instead hover a different + // entity before we move far enough to start the drag. + if(!leftDown) { + // Hit testing can potentially take a lot of time. + // If we haven't painted since last time we highlighted + // something, don't hit test again, since this just causes + // a lag. + if(!havePainted) return; + HitTestMakeSelection(mp); + } + } + return; + } + + // If the user has started an operation from the menu, but not + // completed it, then just do the selection. + if(pending.operation == Pending::COMMAND) { + HitTestMakeSelection(mp); + return; + } + + if(pending.operation == Pending::DRAGGING_POINTS && ctrlDown) { + SS.extraLine.ptA = UnProjectPoint(orig.mouseOnButtonDown); + SS.extraLine.ptB = UnProjectPoint(mp); + SS.extraLine.draw = true; + } + + // We're currently dragging something; so do that. But if we haven't + // painted since the last time we solved, do nothing, because there's + // no sense solving a frame and not displaying it. + if(!havePainted) { + return; + } + + havePainted = false; + switch(pending.operation) { + case Pending::DRAGGING_CONSTRAINT: { + Constraint *c = SK.constraint.FindById(pending.constraint); + UpdateDraggedNum(&(c->disp.offset), x, y); + orig.mouse = mp; + Invalidate(); + return; + } + + case Pending::DRAGGING_NEW_LINE_POINT: + if(!ctrlDown) { + SS.GW.pending.hasSuggestion = + SS.GW.SuggestLineConstraint(SS.GW.pending.request, &SS.GW.pending.suggestion); + } else { + SS.GW.pending.hasSuggestion = false; + } + // fallthrough + case Pending::DRAGGING_NEW_POINT: + UpdateDraggedPoint(pending.point, x, y); + HitTestMakeSelection(mp); + SS.MarkGroupDirtyByEntity(pending.point); + orig.mouse = mp; + break; + + case Pending::DRAGGING_POINTS: + if(shiftDown || ctrlDown) { + // Edit the rotation associated with a POINT_N_ROT_TRANS, + // either within (ctrlDown) or out of (shiftDown) the plane + // of the screen. So first get the rotation to apply, in qt. + Quaternion qt; + if(ctrlDown) { + double d = mp.DistanceTo(orig.mouseOnButtonDown); + if(d < 25) { + // Don't start dragging the position about the normal + // until we're a little ways out, to get a reasonable + // reference pos + qt = Quaternion::IDENTITY; + } else { + double theta = atan2(orig.mouse.y-orig.mouseOnButtonDown.y, + orig.mouse.x-orig.mouseOnButtonDown.x); + theta -= atan2(y-orig.mouseOnButtonDown.y, + x-orig.mouseOnButtonDown.x); + + Vector gn = projRight.Cross(projUp); + qt = Quaternion::From(gn, -theta); + } + } else { + double dx = -(x - orig.mouse.x); + double dy = -(y - orig.mouse.y); + double s = 0.3*(PI/180); // degrees per pixel + qt = Quaternion::From(projUp, -s*dx).Times( + Quaternion::From(projRight, s*dy)); + } + + // Now apply this rotation to the points being dragged. + List *lhe = &(pending.points); + for(hEntity *he = lhe->First(); he; he = lhe->NextAfter(he)) { + Entity *e = SK.GetEntity(*he); + if(e->type != Entity::Type::POINT_N_ROT_TRANS) { + if(ctrlDown) { + Vector p = e->PointGetNum(); + p = p.Minus(SS.extraLine.ptA); + p = qt.Rotate(p); + p = p.Plus(SS.extraLine.ptA); + e->PointForceTo(p); + } else { + UpdateDraggedPoint(*he, x, y); + } + } else { + Quaternion q = e->PointGetQuaternion(); + Vector p = e->PointGetNum(); + q = qt.Times(q); + e->PointForceQuaternionTo(q); + // Let's rotate about the selected point; so fix up the + // translation so that that point didn't move. + e->PointForceTo(p); + } + SS.MarkGroupDirtyByEntity(e->h); + } + } else { + List *lhe = &(pending.points); + for(hEntity *he = lhe->First(); he; he = lhe->NextAfter(he)) { + UpdateDraggedPoint(*he, x, y); + SS.MarkGroupDirtyByEntity(*he); + } + } + orig.mouse = mp; + break; + + case Pending::DRAGGING_NEW_CUBIC_POINT: { + UpdateDraggedPoint(pending.point, x, y); + HitTestMakeSelection(mp); + + hRequest hr = pending.point.request(); + if(pending.point == hr.entity(4)) { + // The very first segment; dragging final point drags both + // tangent points. + Vector p0 = SK.GetEntity(hr.entity(1))->PointGetNum(), + p3 = SK.GetEntity(hr.entity(4))->PointGetNum(), + p1 = p0.ScaledBy(2.0/3).Plus(p3.ScaledBy(1.0/3)), + p2 = p0.ScaledBy(1.0/3).Plus(p3.ScaledBy(2.0/3)); + SK.GetEntity(hr.entity(1+1))->PointForceTo(p1); + SK.GetEntity(hr.entity(1+2))->PointForceTo(p2); + } else { + // A subsequent segment; dragging point drags only final + // tangent point. + int i = SK.GetEntity(hr.entity(0))->extraPoints; + Vector pn = SK.GetEntity(hr.entity(4+i))->PointGetNum(), + pnm2 = SK.GetEntity(hr.entity(2+i))->PointGetNum(), + pnm1 = (pn.Plus(pnm2)).ScaledBy(0.5); + SK.GetEntity(hr.entity(3+i))->PointForceTo(pnm1); + } + + orig.mouse = mp; + SS.MarkGroupDirtyByEntity(pending.point); + break; + } + case Pending::DRAGGING_NEW_ARC_POINT: { + UpdateDraggedPoint(pending.point, x, y); + HitTestMakeSelection(mp); + + hRequest hr = pending.point.request(); + Vector ona = SK.GetEntity(hr.entity(2))->PointGetNum(); + Vector onb = SK.GetEntity(hr.entity(3))->PointGetNum(); + Vector center = (ona.Plus(onb)).ScaledBy(0.5); + + SK.GetEntity(hr.entity(1))->PointForceTo(center); + + orig.mouse = mp; + SS.MarkGroupDirtyByEntity(pending.point); + break; + } + case Pending::DRAGGING_NEW_RADIUS: + case Pending::DRAGGING_RADIUS: { + Entity *circle = SK.GetEntity(pending.circle); + Vector center = SK.GetEntity(circle->point[0])->PointGetNum(); + Point2d c2 = ProjectPoint(center); + double r = c2.DistanceTo(mp)/scale; + SK.GetEntity(circle->distance)->DistanceForceTo(r); + + SS.MarkGroupDirtyByEntity(pending.circle); + SS.ScheduleShowTW(); + break; + } + + case Pending::DRAGGING_NORMAL: { + Entity *normal = SK.GetEntity(pending.normal); + Vector p = SK.GetEntity(normal->point[0])->PointGetNum(); + Point2d p2 = ProjectPoint(p); + + Quaternion q = normal->NormalGetNum(); + Vector u = q.RotationU(), v = q.RotationV(); + + if(ctrlDown) { + double theta = atan2(orig.mouse.y-p2.y, orig.mouse.x-p2.x); + theta -= atan2(y-p2.y, x-p2.x); + + Vector normal = projRight.Cross(projUp); + u = u.RotatedAbout(normal, -theta); + v = v.RotatedAbout(normal, -theta); + } else { + double dx = -(x - orig.mouse.x); + double dy = -(y - orig.mouse.y); + double s = 0.3*(PI/180); // degrees per pixel + u = u.RotatedAbout(projUp, -s*dx); + u = u.RotatedAbout(projRight, s*dy); + v = v.RotatedAbout(projUp, -s*dx); + v = v.RotatedAbout(projRight, s*dy); + } + orig.mouse = mp; + normal->NormalForceTo(Quaternion::From(u, v)); + + SS.MarkGroupDirtyByEntity(pending.normal); + break; + } + + case Pending::DRAGGING_MARQUEE: + orig.mouse = mp; + Invalidate(); + return; + + case Pending::NONE: + case Pending::COMMAND: + ssassert(false, "Unexpected pending operation"); + } +} + +void GraphicsWindow::ClearPending(bool scheduleShowTW) { + pending.points.Clear(); + pending.requests.Clear(); + pending = {}; + if(scheduleShowTW) { + SS.ScheduleShowTW(); + } +} + +bool GraphicsWindow::IsFromPending(hRequest r) { + for(auto &req : pending.requests) { + if(req == r) return true; + } + return false; +} + +void GraphicsWindow::AddToPending(hRequest r) { + pending.requests.Add(&r); +} + +void GraphicsWindow::ReplacePending(hRequest before, hRequest after) { + for(auto &req : pending.requests) { + if(req == before) { + req = after; + } + } +} + +void GraphicsWindow::MouseMiddleOrRightDown(double x, double y) { + if(window->IsEditorVisible()) return; + + orig.offset = offset; + orig.projUp = projUp; + orig.projRight = projRight; + orig.mouse.x = x; + orig.mouse.y = y; + orig.startedMoving = false; +} + +void GraphicsWindow::MouseRightUp(double x, double y) { + SS.extraLine.draw = false; + Invalidate(); + + // Don't show a context menu if the user is right-clicking the toolbar, + // or if they are finishing a pan. + if(ToolbarMouseMoved((int)x, (int)y)) return; + if(orig.startedMoving) return; + + if(context.active) return; + + if(pending.operation == Pending::DRAGGING_NEW_LINE_POINT && pending.hasSuggestion) { + Constraint::TryConstrain(SS.GW.pending.suggestion, + Entity::NO_ENTITY, Entity::NO_ENTITY, pending.request.entity(0)); + } + + if(pending.operation == Pending::DRAGGING_NEW_LINE_POINT || + pending.operation == Pending::DRAGGING_NEW_CUBIC_POINT || + pending.operation == Pending::DRAGGING_NEW_ARC_POINT || + pending.operation == Pending::DRAGGING_NEW_RADIUS || + pending.operation == Pending::DRAGGING_NEW_POINT + ) + { + // Special case; use a right click to stop drawing lines, since + // a left click would draw another one. This is quicker and more + // intuitive than hitting escape. Likewise for other entities + // for consistency. + ClearPending(); + return; + } + + // The current mouse location + Vector v = offset.ScaledBy(-1); + v = v.Plus(projRight.ScaledBy(x/scale)); + v = v.Plus(projUp.ScaledBy(y/scale)); + + Platform::MenuRef menu = Platform::CreateMenu(); + context.active = true; + + if(!hover.IsEmpty()) { + MakeSelected(&hover); + SS.ScheduleShowTW(); + } + GroupSelection(); + + bool itemsSelected = (gs.n > 0 || gs.constraints > 0); + if(itemsSelected) { + if(gs.stylables > 0) { + Platform::MenuRef styleMenu = menu->AddSubMenu(_("Assign to Style")); + + bool empty = true; + for(const Style &s : SK.style) { + if(s.h.v < Style::FIRST_CUSTOM) continue; + + uint32_t v = s.h.v; + + styleMenu->AddItem(s.DescriptionString(), [v]() { + Style::AssignSelectionToStyle(v); + }); + empty = false; + } + + if(!empty) styleMenu->AddSeparator(); + + styleMenu->AddItem(_("No Style"), []() { + Style::AssignSelectionToStyle(0); + }); + styleMenu->AddItem(_("Newly Created Custom Style..."), [this]() { + uint32_t vs = Style::CreateCustomStyle(); + Style::AssignSelectionToStyle(vs); + ForceTextWindowShown(); + }); + } + if(gs.n + gs.constraints == 1) { + menu->AddItem(_("Group Info"), [this]() { + hGroup hg; + if(gs.entities == 1) { + hg = SK.GetEntity(gs.entity[0])->group; + } else if(gs.points == 1) { + hg = SK.GetEntity(gs.point[0])->group; + } else if(gs.constraints == 1) { + hg = SK.GetConstraint(gs.constraint[0])->group; + } else { + return; + } + ClearSelection(); + + SS.TW.GoToScreen(TextWindow::Screen::GROUP_INFO); + SS.TW.shown.group = hg; + SS.ScheduleShowTW(); + ForceTextWindowShown(); + }); + } + if(gs.n + gs.constraints == 1 && gs.stylables == 1) { + menu->AddItem(_("Style Info"), [this]() { + hStyle hs; + if(gs.entities == 1) { + hs = Style::ForEntity(gs.entity[0]); + } else if(gs.points == 1) { + hs = Style::ForEntity(gs.point[0]); + } else if(gs.constraints == 1) { + hs = SK.GetConstraint(gs.constraint[0])->GetStyle(); + } else { + return; + } + ClearSelection(); + + SS.TW.GoToScreen(TextWindow::Screen::STYLE_INFO); + SS.TW.shown.style = hs; + SS.ScheduleShowTW(); + ForceTextWindowShown(); + }); + } + if(gs.withEndpoints > 0) { + menu->AddItem(_("Select Edge Chain"), + []() { MenuEdit(Command::SELECT_CHAIN); }); + } + if(gs.constraints == 1 && gs.n == 0) { + Constraint *c = SK.GetConstraint(gs.constraint[0]); + if(c->HasLabel() && c->type != Constraint::Type::COMMENT) { + menu->AddItem(_("Toggle Reference Dimension"), + []() { Constraint::MenuConstrain(Command::REFERENCE); }); + } + if(c->type == Constraint::Type::ANGLE || + c->type == Constraint::Type::EQUAL_ANGLE) + { + menu->AddItem(_("Other Supplementary Angle"), + []() { Constraint::MenuConstrain(Command::OTHER_ANGLE); }); + } + } + if(gs.constraintLabels > 0 || gs.points > 0) { + menu->AddItem(_("Snap to Grid"), + []() { MenuEdit(Command::SNAP_TO_GRID); }); + } + + if(gs.points == 1 && gs.point[0].isFromRequest()) { + Request *r = SK.GetRequest(gs.point[0].request()); + int index = r->IndexOfPoint(gs.point[0]); + if((r->type == Request::Type::CUBIC && (index > 1 && index < r->extraPoints + 2)) || + r->type == Request::Type::CUBIC_PERIODIC) { + menu->AddItem(_("Remove Spline Point"), [this, r]() { + int index = r->IndexOfPoint(gs.point[0]); + ssassert(r->extraPoints != 0, + "Expected a bezier with interior control points"); + + SS.UndoRemember(); + Entity *e = SK.GetEntity(r->h.entity(0)); + + // First, fix point-coincident constraints involving this point. + // Then, remove all other constraints, since they would otherwise + // jump to an adjacent one and mess up the bezier after generation. + FixConstraintsForPointBeingDeleted(e->point[index]); + RemoveConstraintsForPointBeingDeleted(e->point[index]); + + for(int i = index; i < MAX_POINTS_IN_ENTITY - 1; i++) { + if(e->point[i + 1].v == 0) break; + Entity *p0 = SK.GetEntity(e->point[i]); + Entity *p1 = SK.GetEntity(e->point[i + 1]); + ReplacePointInConstraints(p1->h, p0->h); + p0->PointForceTo(p1->PointGetNum()); + } + r->extraPoints--; + SS.MarkGroupDirtyByEntity(gs.point[0]); + ClearSelection(); + }); + } + } + if(gs.entities == 1 && gs.entity[0].isFromRequest()) { + Request *r = SK.GetRequest(gs.entity[0].request()); + if(r->type == Request::Type::CUBIC || r->type == Request::Type::CUBIC_PERIODIC) { + Entity *e = SK.GetEntity(gs.entity[0]); + int addAfterPoint = e->GetPositionOfPoint(GetCamera(), Point2d::From(x, y)); + ssassert(addAfterPoint != -1, "Expected a nearest bezier point to be located"); + // Skip derivative point. + if(r->type == Request::Type::CUBIC) addAfterPoint++; + menu->AddItem(_("Add Spline Point"), [this, r, addAfterPoint, v]() { + int pointCount = r->extraPoints + + ((r->type == Request::Type::CUBIC_PERIODIC) ? 3 : 4); + if(pointCount >= MAX_POINTS_IN_ENTITY) { + Error(_("Cannot add spline point: maximum number of points reached.")); + return; + } + + SS.UndoRemember(); + r->extraPoints++; + SS.MarkGroupDirtyByEntity(gs.entity[0]); + SS.GenerateAll(SolveSpaceUI::Generate::REGEN); + + Entity *e = SK.GetEntity(r->h.entity(0)); + for(int i = MAX_POINTS_IN_ENTITY; i > addAfterPoint + 1; i--) { + Entity *p0 = SK.entity.FindByIdNoOops(e->point[i]); + if(p0 == NULL) continue; + Entity *p1 = SK.GetEntity(e->point[i - 1]); + ReplacePointInConstraints(p1->h, p0->h); + p0->PointForceTo(p1->PointGetNum()); + } + Entity *p = SK.GetEntity(e->point[addAfterPoint + 1]); + p->PointForceTo(v); + SS.MarkGroupDirtyByEntity(gs.entity[0]); + ClearSelection(); + }); + } + } + if(gs.entities == gs.n) { + menu->AddItem(_("Toggle Construction"), + []() { MenuRequest(Command::CONSTRUCTION); }); + } + + if(gs.points == 1) { + Entity *p = SK.GetEntity(gs.point[0]); + Constraint *c = nullptr; + IdList *lc = &(SK.constraint); + for(Constraint &ci : *lc) { + if(ci.type != Constraint::Type::POINTS_COINCIDENT) continue; + if(ci.ptA == p->h || ci.ptB == p->h) { + c = &ci; + break; + } + } + if(c) { + menu->AddItem(_("Delete Point-Coincident Constraint"), [this, p]() { + if(!p->IsPoint()) return; + + SS.UndoRemember(); + SK.constraint.ClearTags(); + for(Constraint &c : SK.constraint) { + if(c.type != Constraint::Type::POINTS_COINCIDENT) continue; + if(c.ptA == p->h || c.ptB == p->h) { + c.tag = 1; + } + } + SK.constraint.RemoveTagged(); + ClearSelection(); + }); + } + } + menu->AddSeparator(); + if(LockedInWorkplane()) { + menu->AddItem(_("Cut"), + []() { MenuClipboard(Command::CUT); }); + menu->AddItem(_("Copy"), + []() { MenuClipboard(Command::COPY); }); + } + } else { + menu->AddItem(_("Select All"), + []() { MenuEdit(Command::SELECT_ALL); }); + } + + if((!SS.clipboard.r.IsEmpty() || !SS.clipboard.c.IsEmpty()) && LockedInWorkplane()) { + menu->AddItem(_("Paste"), + []() { MenuClipboard(Command::PASTE); }); + menu->AddItem(_("Paste Transformed..."), + []() { MenuClipboard(Command::PASTE_TRANSFORM); }); + } + + if(itemsSelected) { + menu->AddItem(_("Delete"), + []() { MenuClipboard(Command::DELETE); }); + menu->AddSeparator(); + menu->AddItem(_("Unselect All"), + []() { MenuEdit(Command::UNSELECT_ALL); }); + } + // If only one item is selected, then it must be the one that we just + // selected from the hovered item; in which case unselect all and hovered + // are equivalent. + if(!hover.IsEmpty() && selection.n > 1) { + menu->AddItem(_("Unselect Hovered"), [this] { + if(!hover.IsEmpty()) { + MakeUnselected(&hover, /*coincidentPointTrick=*/true); + } + }); + } + + if(itemsSelected) { + menu->AddSeparator(); + menu->AddItem(_("Zoom to Fit"), + []() { MenuView(Command::ZOOM_TO_FIT); }); + } + + menu->PopUp(); + + context.active = false; + SS.ScheduleShowTW(); +} + +hRequest GraphicsWindow::AddRequest(Request::Type type) { + return AddRequest(type, /*rememberForUndo=*/true); +} +hRequest GraphicsWindow::AddRequest(Request::Type type, bool rememberForUndo) { + if(rememberForUndo) SS.UndoRemember(); + + Request r = {}; + r.group = activeGroup; + Group *g = SK.GetGroup(activeGroup); + if(g->type == Group::Type::DRAWING_3D || g->type == Group::Type::DRAWING_WORKPLANE) { + r.construction = false; + } else { + r.construction = true; + } + r.workplane = ActiveWorkplane(); + r.type = type; + SK.request.AddAndAssignId(&r); + + // We must regenerate the parameters, so that the code that tries to + // place this request's entities where the mouse is can do so. But + // we mustn't try to solve until reasonable values have been supplied + // for these new parameters, or else we'll get a numerical blowup. + r.Generate(&SK.entity, &SK.param); + SS.MarkGroupDirty(r.group); + return r.h; +} + +Vector GraphicsWindow::SnapToEntityByScreenPoint(Point2d pp, hEntity he) { + Entity *e = SK.GetEntity(he); + if(e->IsPoint()) return e->PointGetNum(); + SEdgeList *edges = e->GetOrGenerateEdges(); + + double minD = -1.0f; + double k = 0.0; + const SEdge *edge = NULL; + for(const auto &e : edges->l) { + Point2d p0 = ProjectPoint(e.a); + Point2d p1 = ProjectPoint(e.b); + Point2d dir = p1.Minus(p0); + double d = pp.DistanceToLine(p0, dir, /*asSegment=*/true); + if(minD > 0.0 && d > minD) continue; + minD = d; + k = pp.Minus(p0).Dot(dir) / dir.Dot(dir); + edge = &e; + } + if(edge == NULL) return UnProjectPoint(pp); + return edge->a.Plus(edge->b.Minus(edge->a).ScaledBy(k)); +} + +bool GraphicsWindow::ConstrainPointByHovered(hEntity pt, const Point2d *projected) { + if(!hover.entity.v) return false; + + Entity *point = SK.GetEntity(pt); + Entity *e = SK.GetEntity(hover.entity); + if(e->IsPoint()) { + point->PointForceTo(e->PointGetNum()); + Constraint::ConstrainCoincident(e->h, pt); + return true; + } + if(e->IsCircle()) { + if(projected != NULL) { + Vector snapPos = SnapToEntityByScreenPoint(*projected, e->h); + point->PointForceTo(snapPos); + } + Constraint::Constrain(Constraint::Type::PT_ON_CIRCLE, + pt, Entity::NO_ENTITY, e->h); + return true; + } + if(e->type == Entity::Type::LINE_SEGMENT) { + if(projected != NULL) { + Vector snapPos = SnapToEntityByScreenPoint(*projected, e->h); + point->PointForceTo(snapPos); + } + Constraint::Constrain(Constraint::Type::PT_ON_LINE, + pt, Entity::NO_ENTITY, e->h); + return true; + } + + return false; +} + +bool GraphicsWindow::MouseEvent(Platform::MouseEvent event) { + using Platform::MouseEvent; + double width, height; + window->GetContentSize(&width, &height); + + event.x = event.x - width / 2; + event.y = height / 2 - event.y; + + switch(event.type) { + case MouseEvent::Type::MOTION: + this->MouseMoved(event.x, event.y, + event.button == MouseEvent::Button::LEFT, + event.button == MouseEvent::Button::MIDDLE, + event.button == MouseEvent::Button::RIGHT, + event.shiftDown, + event.controlDown); + break; + + case MouseEvent::Type::PRESS: + if(event.button == MouseEvent::Button::LEFT) { + this->MouseLeftDown(event.x, event.y, event.shiftDown, event.controlDown); + } else if(event.button == MouseEvent::Button::MIDDLE || + event.button == MouseEvent::Button::RIGHT) { + this->MouseMiddleOrRightDown(event.x, event.y); + } + break; + + case MouseEvent::Type::DBL_PRESS: + if(event.button == MouseEvent::Button::LEFT) { + this->MouseLeftDoubleClick(event.x, event.y); + } + break; + + case MouseEvent::Type::RELEASE: + if(event.button == MouseEvent::Button::LEFT) { + this->MouseLeftUp(event.x, event.y, event.shiftDown, event.controlDown); + } else if(event.button == MouseEvent::Button::RIGHT) { + this->MouseRightUp(event.x, event.y); + } + break; + + case MouseEvent::Type::SCROLL_VERT: + this->MouseScroll(event.shiftDown ? event.scrollDelta / 10 : event.scrollDelta); + break; + + case MouseEvent::Type::LEAVE: + this->MouseLeave(); + break; + } + + return true; +} + +void GraphicsWindow::MouseLeftDown(double mx, double my, bool shiftDown, bool ctrlDown) { + orig.mouseDown = true; + + if(window->IsEditorVisible()) { + orig.mouse = Point2d::From(mx, my); + orig.mouseOnButtonDown = orig.mouse; + window->HideEditor(); + return; + } + SS.TW.HideEditControl(); + + if(SS.showToolbar) { + if(ToolbarMouseDown((int)mx, (int)my)) return; + } + + // This will be clobbered by MouseMoved below. + bool hasConstraintSuggestion = pending.hasSuggestion; + Constraint::Type constraintSuggestion = pending.suggestion; + + // Make sure the hover is up to date. + MouseMoved(mx, my, /*leftDown=*/false, /*middleDown=*/false, /*rightDown=*/false, + /*shiftDown=*/false, /*ctrlDown=*/false); + orig.mouse.x = mx; + orig.mouse.y = my; + orig.mouseOnButtonDown = orig.mouse; + Point2d mouse = Point2d::From(mx, my); + + // The current mouse location + Vector v = offset.ScaledBy(-1); + v = v.Plus(projRight.ScaledBy(mx/scale)); + v = v.Plus(projUp.ScaledBy(my/scale)); + + hRequest hr = {}; + hConstraint hc = {}; + switch(pending.operation) { + case Pending::COMMAND: + switch(pending.command) { + case Command::DATUM_POINT: + hr = AddRequest(Request::Type::DATUM_POINT); + SK.GetEntity(hr.entity(0))->PointForceTo(v); + ConstrainPointByHovered(hr.entity(0), &mouse); + + ClearSuper(); + break; + + case Command::LINE_SEGMENT: + case Command::CONSTR_SEGMENT: + hr = AddRequest(Request::Type::LINE_SEGMENT); + SK.GetRequest(hr)->construction = (pending.command == Command::CONSTR_SEGMENT); + SK.GetEntity(hr.entity(1))->PointForceTo(v); + ConstrainPointByHovered(hr.entity(1), &mouse); + + ClearSuper(); + AddToPending(hr); + + pending.operation = Pending::DRAGGING_NEW_LINE_POINT; + pending.request = hr; + pending.point = hr.entity(2); + pending.description = _("click next point of line, or press Esc"); + SK.GetEntity(pending.point)->PointForceTo(v); + break; + + case Command::RECTANGLE: { + if(!SS.GW.LockedInWorkplane()) { + Error(_("Can't draw rectangle in 3d; first, activate a workplane " + "with Sketch -> In Workplane.")); + ClearSuper(); + break; + } + hRequest lns[4]; + int i; + SS.UndoRemember(); + for(i = 0; i < 4; i++) { + lns[i] = AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false); + AddToPending(lns[i]); + } + for(i = 0; i < 4; i++) { + Constraint::ConstrainCoincident( + lns[i].entity(1), lns[(i+1)%4].entity(2)); + SK.GetEntity(lns[i].entity(1))->PointForceTo(v); + SK.GetEntity(lns[i].entity(2))->PointForceTo(v); + } + for(i = 0; i < 4; i++) { + Constraint::Constrain( + (i % 2) ? Constraint::Type::HORIZONTAL : Constraint::Type::VERTICAL, + Entity::NO_ENTITY, Entity::NO_ENTITY, + lns[i].entity(0)); + } + if(ConstrainPointByHovered(lns[2].entity(1), &mouse)) { + Vector pos = SK.GetEntity(lns[2].entity(1))->PointGetNum(); + for(i = 0; i < 4; i++) { + SK.GetEntity(lns[i].entity(1))->PointForceTo(pos); + SK.GetEntity(lns[i].entity(2))->PointForceTo(pos); + } + } + + pending.operation = Pending::DRAGGING_NEW_POINT; + pending.point = lns[1].entity(2); + pending.description = _("click to place other corner of rectangle"); + hr = lns[0]; + break; + } + case Command::CIRCLE: + hr = AddRequest(Request::Type::CIRCLE); + // Centered where we clicked + SK.GetEntity(hr.entity(1))->PointForceTo(v); + // Normal to the screen + SK.GetEntity(hr.entity(32))->NormalForceTo( + Quaternion::From(SS.GW.projRight, SS.GW.projUp)); + // Initial radius zero + SK.GetEntity(hr.entity(64))->DistanceForceTo(0); + + ConstrainPointByHovered(hr.entity(1), &mouse); + + ClearSuper(); + AddToPending(hr); + + pending.operation = Pending::DRAGGING_NEW_RADIUS; + pending.circle = hr.entity(0); + pending.description = _("click to set radius"); + break; + + case Command::ARC: { + if(!SS.GW.LockedInWorkplane()) { + Error(_("Can't draw arc in 3d; first, activate a workplane " + "with Sketch -> In Workplane.")); + ClearPending(); + break; + } + hr = AddRequest(Request::Type::ARC_OF_CIRCLE); + // This fudge factor stops us from immediately failing to solve + // because of the arc's implicit (equal radius) tangent. + Vector adj = SS.GW.projRight.WithMagnitude(2/SS.GW.scale); + SK.GetEntity(hr.entity(1))->PointForceTo(v.Minus(adj)); + SK.GetEntity(hr.entity(2))->PointForceTo(v); + SK.GetEntity(hr.entity(3))->PointForceTo(v); + ConstrainPointByHovered(hr.entity(2), &mouse); + + ClearSuper(); + AddToPending(hr); + + pending.operation = Pending::DRAGGING_NEW_ARC_POINT; + pending.point = hr.entity(3); + pending.description = _("click to place point"); + break; + } + case Command::CUBIC: + hr = AddRequest(Request::Type::CUBIC); + SK.GetEntity(hr.entity(1))->PointForceTo(v); + SK.GetEntity(hr.entity(2))->PointForceTo(v); + SK.GetEntity(hr.entity(3))->PointForceTo(v); + SK.GetEntity(hr.entity(4))->PointForceTo(v); + ConstrainPointByHovered(hr.entity(1), &mouse); + + ClearSuper(); + AddToPending(hr); + + pending.operation = Pending::DRAGGING_NEW_CUBIC_POINT; + pending.point = hr.entity(4); + pending.description = _("click next point of cubic, or press Esc"); + break; + + case Command::WORKPLANE: + if(LockedInWorkplane()) { + Error(_("Sketching in a workplane already; sketch in 3d before " + "creating new workplane.")); + ClearSuper(); + break; + } + hr = AddRequest(Request::Type::WORKPLANE); + SK.GetEntity(hr.entity(1))->PointForceTo(v); + SK.GetEntity(hr.entity(32))->NormalForceTo( + Quaternion::From(SS.GW.projRight, SS.GW.projUp)); + ConstrainPointByHovered(hr.entity(1), &mouse); + + ClearSuper(); + break; + + case Command::TTF_TEXT: { + if(!SS.GW.LockedInWorkplane()) { + Error(_("Can't draw text in 3d; first, activate a workplane " + "with Sketch -> In Workplane.")); + ClearSuper(); + break; + } + hr = AddRequest(Request::Type::TTF_TEXT); + AddToPending(hr); + Request *r = SK.GetRequest(hr); + r->str = "Abc"; + r->font = Platform::embeddedFont; + + for(int i = 1; i <= 4; i++) { + SK.GetEntity(hr.entity(i))->PointForceTo(v); + } + + pending.operation = Pending::DRAGGING_NEW_POINT; + pending.point = hr.entity(3); + pending.description = _("click to place bottom right of text"); + break; + } + + case Command::IMAGE: { + if(!SS.GW.LockedInWorkplane()) { + Error(_("Can't draw image in 3d; first, activate a workplane " + "with Sketch -> In Workplane.")); + ClearSuper(); + break; + } + hr = AddRequest(Request::Type::IMAGE); + AddToPending(hr); + Request *r = SK.GetRequest(hr); + r->file = pending.filename; + r->construction = true; + + for(int i = 1; i <= 4; i++) { + SK.GetEntity(hr.entity(i))->PointForceTo(v); + } + + pending.operation = Pending::DRAGGING_NEW_POINT; + pending.point = hr.entity(3); + pending.description = "click to place bottom right of image"; + break; + } + + case Command::COMMENT: { + ClearSuper(); + Constraint c = {}; + c.group = SS.GW.activeGroup; + c.workplane = SS.GW.ActiveWorkplane(); + c.type = Constraint::Type::COMMENT; + c.disp.offset = v; + c.comment = _("NEW COMMENT -- DOUBLE-CLICK TO EDIT"); + hc = Constraint::AddConstraint(&c); + break; + } + default: ssassert(false, "Unexpected pending menu id"); + } + break; + + case Pending::DRAGGING_RADIUS: + ClearPending(); + break; + + case Pending::DRAGGING_NEW_POINT: + case Pending::DRAGGING_NEW_ARC_POINT: + ConstrainPointByHovered(pending.point, &mouse); + ClearPending(); + break; + + case Pending::DRAGGING_NEW_CUBIC_POINT: { + hRequest hr = pending.point.request(); + Request *r = SK.GetRequest(hr); + + if(hover.entity == hr.entity(1) && r->extraPoints >= 2) { + // They want the endpoints coincident, which means a periodic + // spline instead. + r->type = Request::Type::CUBIC_PERIODIC; + // Remove the off-curve control points, which are no longer + // needed here; so move [2,ep+1] down, skipping first pt. + int i; + for(i = 2; i <= r->extraPoints+1; i++) { + SK.GetEntity(hr.entity((i-1)+1))->PointForceTo( + SK.GetEntity(hr.entity(i+1))->PointGetNum()); + } + // and move ep+3 down by two, skipping both + SK.GetEntity(hr.entity((r->extraPoints+1)+1))->PointForceTo( + SK.GetEntity(hr.entity((r->extraPoints+3)+1))->PointGetNum()); + r->extraPoints -= 2; + // And we're done. + SS.MarkGroupDirty(r->group); + ClearPending(); + break; + } + + if(ConstrainPointByHovered(pending.point, &mouse)) { + ClearPending(); + break; + } + + Entity e; + if(r->extraPoints >= (int)arraylen(e.point) - 4) { + ClearPending(); + break; + } + + (SK.GetRequest(hr)->extraPoints)++; + SS.GenerateAll(SolveSpaceUI::Generate::REGEN); + + int ep = r->extraPoints; + Vector last = SK.GetEntity(hr.entity(3+ep))->PointGetNum(); + + SK.GetEntity(hr.entity(2+ep))->PointForceTo(last); + SK.GetEntity(hr.entity(3+ep))->PointForceTo(v); + SK.GetEntity(hr.entity(4+ep))->PointForceTo(v); + pending.point = hr.entity(4+ep); + break; + } + + case Pending::DRAGGING_NEW_LINE_POINT: { + if(hover.entity.v) { + Entity *e = SK.GetEntity(hover.entity); + if(e->IsPoint()) { + hRequest hrl = pending.point.request(); + Entity *sp = SK.GetEntity(hrl.entity(1)); + if(( e->PointGetNum()).Equals( + (sp->PointGetNum()))) + { + // If we constrained by the hovered point, then we + // would create a zero-length line segment. That's + // not good, so just stop drawing. + ClearPending(); + break; + } + } + } + + bool doneDragging = ConstrainPointByHovered(pending.point, &mouse); + + // Constrain the line segment horizontal or vertical if close enough + if(hasConstraintSuggestion) { + Constraint::TryConstrain(constraintSuggestion, + Entity::NO_ENTITY, Entity::NO_ENTITY, pending.request.entity(0)); + } + + if(doneDragging) { + ClearPending(); + break; + } + + // Create a new line segment, so that we continue drawing. + hRequest hr = AddRequest(Request::Type::LINE_SEGMENT); + ReplacePending(pending.request, hr); + SK.GetRequest(hr)->construction = SK.GetRequest(pending.request)->construction; + // Displace the second point of the new line segment slightly, + // to avoid creating zero-length edge warnings. + SK.GetEntity(hr.entity(2))->PointForceTo( + v.Plus(projRight.ScaledBy(0.5/scale))); + + // Constrain the line segments to share an endpoint + Constraint::ConstrainCoincident(pending.point, hr.entity(1)); + Vector pendingPos = SK.GetEntity(pending.point)->PointGetNum(); + SK.GetEntity(hr.entity(1))->PointForceTo(pendingPos); + + // And drag an endpoint of the new line segment + pending.operation = Pending::DRAGGING_NEW_LINE_POINT; + pending.request = hr; + pending.point = hr.entity(2); + pending.description = _("click next point of line, or press Esc"); + + break; + } + + case Pending::NONE: + default: + ClearPending(); + if(!hover.IsEmpty()) { + if(!ctrlDown) { + hoverWasSelectedOnMousedown = IsSelected(&hover); + MakeSelected(&hover); + } else { + MakeUnselected(&hover, /*coincidentPointTrick=*/true); + } + } + break; + } + + // Activate group with newly created request/constraint + Group *g = NULL; + if(hr.v != 0) { + g = SK.GetGroup(SK.GetRequest(hr)->group); + } + if(hc.v != 0) { + g = SK.GetGroup(SK.GetConstraint(hc)->group); + } + if(g != NULL) { + g->visible = true; + } + + SS.ScheduleShowTW(); + Invalidate(); +} + +void GraphicsWindow::MouseLeftUp(double mx, double my, bool shiftDown, bool ctrlDown) { + orig.mouseDown = false; + + switch(pending.operation) { + case Pending::DRAGGING_POINTS: + case Pending::DRAGGING_CONSTRAINT: + case Pending::DRAGGING_NORMAL: + case Pending::DRAGGING_RADIUS: + if(!hoverWasSelectedOnMousedown) { + // And then clear the selection again, since they + // probably didn't want that selected if they just + // were dragging it. + ClearSelection(); + } + hoverWasSelectedOnMousedown = false; + SS.extraLine.draw = false; + ClearPending(); + Invalidate(); + break; + + case Pending::DRAGGING_MARQUEE: + SelectByMarquee(); + ClearPending(); + Invalidate(); + break; + + case Pending::NONE: + if(hover.IsEmpty() && !ctrlDown) { + ClearSelection(); + } + break; + + default: + break; // do nothing + } +} + +void GraphicsWindow::EditConstraint(hConstraint constraint) { + constraintBeingEdited = constraint; + ClearSuper(); + + Constraint *c = SK.GetConstraint(constraintBeingEdited); + if(!c->HasLabel()) { + // Not meaningful to edit a constraint without a dimension + return; + } + if(c->reference) { + // Not meaningful to edit a reference dimension + return; + } + + Vector p3 = c->GetLabelPos(GetCamera()); + Point2d p2 = ProjectPoint(p3); + + std::string editValue; + std::string editPlaceholder; + switch(c->type) { + case Constraint::Type::COMMENT: + editValue = c->comment; + editPlaceholder = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + break; + + default: { + double value = fabs(c->valA); + + // If displayed as radius, also edit as radius. + if(c->type == Constraint::Type::DIAMETER && c->other) + value /= 2; + + // Try showing value with default number of digits after decimal first. + if(c->type == Constraint::Type::LENGTH_RATIO || c->type == Constraint::Type::ARC_ARC_LEN_RATIO || c->type == Constraint::Type::ARC_LINE_LEN_RATIO) { + editValue = ssprintf("%.3f", value); + } else if(c->type == Constraint::Type::ANGLE) { + editValue = SS.DegreeToString(value); + } else { + editValue = SS.MmToString(value, true); + value /= SS.MmPerUnit(); + } + // If that's not enough to represent it exactly, show the value with as many + // digits after decimal as required, up to 10. + int digits = 0; + while(fabs(std::stod(editValue) - value) > 1e-10) { + editValue = ssprintf("%.*f", digits, value); + digits++; + } + editPlaceholder = "10.000000"; + break; + } + } + + double width, height; + window->GetContentSize(&width, &height); + hStyle hs = c->disp.style; + if(hs.v == 0) hs.v = Style::CONSTRAINT; + double capHeight = Style::TextHeight(hs); + double fontHeight = VectorFont::Builtin()->GetHeight(capHeight); + double editMinWidth = VectorFont::Builtin()->GetWidth(capHeight, editPlaceholder); + window->ShowEditor(p2.x + width / 2, height / 2 - p2.y, + fontHeight, editMinWidth, + /*isMonospace=*/false, editValue); +} + +void GraphicsWindow::MouseLeftDoubleClick(double mx, double my) { + if(window->IsEditorVisible()) return; + SS.TW.HideEditControl(); + + if(hover.constraint.v) { + EditConstraint(hover.constraint); + } +} + +void GraphicsWindow::EditControlDone(const std::string &s) { + window->HideEditor(); + window->Invalidate(); + + Constraint *c = SK.GetConstraint(constraintBeingEdited); + + if(c->type == Constraint::Type::COMMENT) { + SS.UndoRemember(); + c->comment = s; + return; + } + + if(Expr *e = Expr::From(s, true)) { + SS.UndoRemember(); + + switch(c->type) { + case Constraint::Type::PROJ_PT_DISTANCE: + case Constraint::Type::PT_LINE_DISTANCE: + case Constraint::Type::PT_FACE_DISTANCE: + case Constraint::Type::PT_PLANE_DISTANCE: + case Constraint::Type::LENGTH_DIFFERENCE: + case Constraint::Type::ARC_ARC_DIFFERENCE: + case Constraint::Type::ARC_LINE_DIFFERENCE: { + // The sign is not displayed to the user, but this is a signed + // distance internally. To flip the sign, the user enters a + // negative distance. + bool wasNeg = (c->valA < 0); + if(wasNeg) { + c->valA = -SS.ExprToMm(e); + } else { + c->valA = SS.ExprToMm(e); + } + break; + } + case Constraint::Type::ANGLE: + case Constraint::Type::LENGTH_RATIO: + case Constraint::Type::ARC_ARC_LEN_RATIO: + case Constraint::Type::ARC_LINE_LEN_RATIO: + // These don't get the units conversion for distance, and + // they're always positive + c->valA = fabs(e->Eval()); + break; + + case Constraint::Type::DIAMETER: + c->valA = fabs(SS.ExprToMm(e)); + + // If displayed and edited as radius, convert back + // to diameter + if(c->other) + c->valA *= 2; + break; + + default: + // These are always positive, and they get the units conversion. + c->valA = fabs(SS.ExprToMm(e)); + break; + } + SS.MarkGroupDirty(c->group); + } +} + +void GraphicsWindow::MouseScroll(double zoomMultiplyer) { + // To support smooth scrolling where scroll wheel events come in increments + // smaller (or larger) than 1 we do: + // scale *= exp(ln(1.2) * zoomMultiplyer); + // to ensure that the same total scroll delta always results in the same + // total zoom irrespective of in how many increments the zoom was applied. + // For example if we scroll a total delta of a+b in two events vs. one then + // scale * e^a * e^b == scale * e^(a+b) + // while + // scale * a * b != scale * (a+b) + // So this constant is ln(1.2) = 0.1823216 to make the default zoom 1.2x + ZoomToMouse(zoomMultiplyer); +} + +void GraphicsWindow::MouseLeave() { + // Un-hover everything when the mouse leaves our window, unless there's + // currently a context menu shown. + if(!context.active) { + hover.Clear(); + toolbarHovered = Command::NONE; + Invalidate(); + } + SS.extraLine.draw = false; +} + +void GraphicsWindow::SixDofEvent(Platform::SixDofEvent event) { + if(event.type == Platform::SixDofEvent::Type::RELEASE) { + ZoomToFit(/*includingInvisibles=*/false, /*useSelection=*/true); + Invalidate(); + return; + } + + if(!havePainted) return; + Vector out = projRight.Cross(projUp); + + // rotation vector is axis of rotation, and its magnitude is angle + Vector aa = Vector::From(event.rotationX, event.rotationY, event.rotationZ); + // but it's given with respect to screen projection frame + aa = aa.ScaleOutOfCsys(projRight, projUp, out); + double aam = aa.Magnitude(); + if(aam > 0.0) aa = aa.WithMagnitude(1); + + // This can either transform our view, or transform a linked part. + GroupSelection(); + Entity *e = NULL; + Group *g = NULL; + if(gs.points == 1 && gs.n == 1) e = SK.GetEntity(gs.point [0]); + if(gs.entities == 1 && gs.n == 1) e = SK.GetEntity(gs.entity[0]); + if(e) g = SK.GetGroup(e->group); + if(g && g->type == Group::Type::LINKED && !event.shiftDown) { + // Apply the transformation to a linked part. Gain down the Z + // axis, since it's hard to see what you're doing on that one since + // it's normal to the screen. + Vector t = projRight.ScaledBy(event.translationX/scale).Plus( + projUp .ScaledBy(event.translationY/scale).Plus( + out .ScaledBy(0.1*event.translationZ/scale))); + Quaternion q = Quaternion::From(aa, aam); + + // If we go five seconds without SpaceNavigator input, or if we've + // switched groups, then consider that a new action and save an undo + // point. + int64_t now = GetMilliseconds(); + if(now - last6DofTime > 5000 || + last6DofGroup != g->h) + { + SS.UndoRemember(); + } + + g->TransformImportedBy(t, q); + + last6DofTime = now; + last6DofGroup = g->h; + SS.MarkGroupDirty(g->h); + } else { + // Apply the transformation to the view of the everything. The + // x and y components are translation; but z component is scale, + // not translation, or else it would do nothing in a parallel + // projection + offset = offset.Plus(projRight.ScaledBy(event.translationX/scale)); + offset = offset.Plus(projUp.ScaledBy(event.translationY/scale)); + scale *= exp(0.001*event.translationZ); + + if(aam > 0.0) { + projRight = projRight.RotatedAbout(aa, -aam); + projUp = projUp. RotatedAbout(aa, -aam); + NormalizeProjectionVectors(); + } + } + + havePainted = false; + Invalidate(); +} + +} // namespace SolveSpace diff --git a/src/param.h b/src/param.h new file mode 100644 index 0000000..a32aec8 --- /dev/null +++ b/src/param.h @@ -0,0 +1,52 @@ +#ifndef SOLVESPACE_PARAM_H +#define SOLVESPACE_PARAM_H + +#include +#include + +#include "handle.h" + +namespace SolveSpace { + +class hRequest; + +class hParam { +public: + // bits 15: 0 -- param index + // 31:16 -- request index + uint32_t v; + + inline hRequest request() const; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class Param { +public: + int tag; + hParam h; + + double val; + bool known; + bool free; + + // Used only in the solver + Param *substd; + + static const hParam NO_PARAM; + + void Clear() {} +}; + +// Use a forward declaration in order to avoid pulling dsc.h in for units that +// don't need to use `ParamList` +template class IdList; + +using ParamList = IdList; + +using ParamSet = std::unordered_set>; + +} // namespace SolveSpace + +#endif // !SOLVESPACE_PARAM_H diff --git a/src/platform/entrycli.cpp b/src/platform/entrycli.cpp new file mode 100644 index 0000000..6284e12 --- /dev/null +++ b/src/platform/entrycli.cpp @@ -0,0 +1,399 @@ +//----------------------------------------------------------------------------- +// Our main() function for the command-line interface. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- + +#include +#include + +#include "solvespace.h" +#include "config.h" + +using namespace SolveSpace; + +static void ShowUsage(const std::string &cmd) { + fprintf(stderr, "Usage: %s [filename...]", cmd.c_str()); +//-----------------------------------------------------------------------------> 80 col */ + fprintf(stderr, R"( + When run, performs an action specified by on every . + +Common options: + -o, --output + For an input file .slvs, replaces the '%%' symbol in + with and uses it as output file. For example, when using + --output %%-2d.png for input files f/a.slvs and f/b.slvs, output files + f/a-2d.png and f/b-2d.png will be written. + -v, --view + Selects the camera direction. can be one of "top", "bottom", + "left", "right", "front", "back", or "isometric". + -t, --chord-tol + Selects the chord tolerance, used for converting exact curves to + piecewise linear, and exact surfaces into triangle meshes. + For export commands, the unit is mm, and the default is 1.0 mm. + For non-export commands, the unit is %%, and the default is 1.0 %%. + -b, --bg-color + Whether to export the background colour in vector formats. Defaults to off. + +Commands: + version + Prints the current solvespace version. + thumbnail --output --size --view + [--chord-tol ] + Outputs a rendered view of the sketch, like the SolveSpace GUI would. + is x, in pixels. Graphics acceleration is + not used, and the output may look slightly different from the GUI. + export-view --output --view [--chord-tol ] + [--bg-color ] + Exports a view of the sketch, in a 2d vector format. + export-wireframe --output [--chord-tol ] + Exports a wireframe of the sketch, in a 3d vector format. + export-mesh --output [--chord-tol ] + Exports a triangle mesh of solids in the sketch, with exact surfaces + being triangulated first. + export-surfaces --output + Exports exact surfaces of solids in the sketch, if any. + regenerate [--chord-tol ] + Reloads all imported files, regenerates the sketch, and saves it. + Note that, although this is not an export command, it uses absolute + chord tolerance, and can be used to prepare assemblies for export. +)"); + + auto FormatListFromFileFilters = [](const std::vector &filters) { + std::string descr; + for(auto filter : filters) { + descr += "\n "; + descr += filter.name; + descr += " ("; + bool first = true; + for(auto extension : filter.extensions) { + if(!first) { + descr += ", "; + } + descr += extension; + first = false; + } + descr += ")"; + } + return descr; + }; + + fprintf(stderr, R"( +File formats: + thumbnail:%s + export-view:%s + export-wireframe:%s + export-mesh:%s + export-surfaces:%s +)", FormatListFromFileFilters(Platform::RasterFileFilters).c_str(), + FormatListFromFileFilters(Platform::VectorFileFilters).c_str(), + FormatListFromFileFilters(Platform::Vector3dFileFilters).c_str(), + FormatListFromFileFilters(Platform::MeshFileFilters).c_str(), + FormatListFromFileFilters(Platform::SurfaceFileFilters).c_str()); +} + +static bool RunCommand(const std::vector args) { + if(args.size() < 2) return false; + + for(const std::string &arg : args) { + if(arg == "--help" || arg == "-h") { + ShowUsage(args[0]); + return true; + } + } + + std::function runner; + + std::vector inputFiles; + auto ParseInputFile = [&](size_t &argn) { + std::string arg = args[argn]; + if(arg[0] != '-') { + inputFiles.push_back(Platform::Path::From(arg)); + return true; + } else return false; + }; + + std::string outputPattern; + auto ParseOutputPattern = [&](size_t &argn) { + if(argn + 1 < args.size() && (args[argn] == "--output" || + args[argn] == "-o")) { + argn++; + outputPattern = args[argn]; + return true; + } else return false; + }; + + Vector projUp = {}, projRight = {}; + auto ParseViewDirection = [&](size_t &argn) { + if(argn + 1 < args.size() && (args[argn] == "--view" || + args[argn] == "-v")) { + argn++; + if(args[argn] == "top") { + projRight = Vector::From(1, 0, 0); + projUp = Vector::From(0, 0, -1); + } else if(args[argn] == "bottom") { + projRight = Vector::From(1, 0, 0); + projUp = Vector::From(0, 0, 1); + } else if(args[argn] == "left") { + projRight = Vector::From(0, 0, 1); + projUp = Vector::From(0, 1, 0); + } else if(args[argn] == "right") { + projRight = Vector::From(0, 0, -1); + projUp = Vector::From(0, 1, 0); + } else if(args[argn] == "front") { + projRight = Vector::From(1, 0, 0); + projUp = Vector::From(0, 1, 0); + } else if(args[argn] == "back") { + projRight = Vector::From(-1, 0, 0); + projUp = Vector::From(0, 1, 0); + } else if(args[argn] == "isometric") { + projRight = Vector::From(0.707, 0.000, -0.707); + projUp = Vector::From(-0.408, 0.816, -0.408); + } else { + fprintf(stderr, "Unrecognized view direction '%s'\n", args[argn].c_str()); + } + return true; + } else return false; + }; + + double chordTol = 1.0; + auto ParseChordTolerance = [&](size_t &argn) { + if(argn + 1 < args.size() && (args[argn] == "--chord-tol" || + args[argn] == "-t")) { + argn++; + if(sscanf(args[argn].c_str(), "%lf", &chordTol) == 1) { + return true; + } else return false; + } else return false; + }; + + bool bg_color = false; + auto ParseBgColor = [&](size_t &argn) { + if(argn + 1 < args.size() && (args[argn] == "--bg-color" || + args[argn] == "-b")) { + argn++; + if(args[argn] == "on") { + bg_color = true; + return true; + } else if(args[argn] == "off") { + bg_color = false; + return true; + } else return false; + } else return false; + }; + + unsigned width = 0, height = 0; + if(args[1] == "version") { + fprintf(stderr, "SolveSpace version %s \n\n", PACKAGE_VERSION); + return false; + } else if(args[1] == "thumbnail") { + auto ParseSize = [&](size_t &argn) { + if(argn + 1 < args.size() && args[argn] == "--size") { + argn++; + if(sscanf(args[argn].c_str(), "%ux%u", &width, &height) == 2) { + return true; + } else return false; + } else return false; + }; + + for(size_t argn = 2; argn < args.size(); argn++) { + if(!(ParseInputFile(argn) || + ParseOutputPattern(argn) || + ParseViewDirection(argn) || + ParseChordTolerance(argn) || + ParseSize(argn))) { + fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); + return false; + } + } + + if(width == 0 || height == 0) { + fprintf(stderr, "Non-zero viewport size must be specified.\n"); + return false; + } + + if(EXACT(projUp.Magnitude() == 0 || projRight.Magnitude() == 0)) { + fprintf(stderr, "View direction must be specified.\n"); + return false; + } + + runner = [&](const Platform::Path &output) { + Camera camera = {}; + camera.pixelRatio = 1; + camera.gridFit = true; + camera.width = width; + camera.height = height; + camera.projUp = projUp; + camera.projRight = projRight; + + SS.GW.projUp = projUp; + SS.GW.projRight = projRight; + SS.GW.scale = SS.GW.ZoomToFit(camera); + camera.scale = SS.GW.scale; + camera.offset = SS.GW.offset; + SS.GenerateAll(); + + CairoPixmapRenderer pixmapCanvas; + pixmapCanvas.antialias = true; + pixmapCanvas.SetLighting(SS.GW.GetLighting()); + pixmapCanvas.SetCamera(camera); + pixmapCanvas.Init(); + + pixmapCanvas.StartFrame(); + SS.GW.Draw(&pixmapCanvas); + pixmapCanvas.FlushFrame(); + pixmapCanvas.FinishFrame(); + pixmapCanvas.ReadFrame()->WritePng(output, /*flip=*/true); + + pixmapCanvas.Clear(); + }; + } else if(args[1] == "export-view") { + for(size_t argn = 2; argn < args.size(); argn++) { + if(!(ParseInputFile(argn) || + ParseOutputPattern(argn) || + ParseViewDirection(argn) || + ParseChordTolerance(argn) || + ParseBgColor(argn))) { + fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); + return false; + } + } + + if(EXACT(projUp.Magnitude() == 0 || projRight.Magnitude() == 0)) { + fprintf(stderr, "View direction must be specified.\n"); + return false; + } + + runner = [&](const Platform::Path &output) { + SS.GW.projRight = projRight; + SS.GW.projUp = projUp; + SS.exportChordTol = chordTol; + SS.exportBackgroundColor = bg_color; + + SS.ExportViewOrWireframeTo(output, /*exportWireframe=*/false); + }; + } else if(args[1] == "export-wireframe") { + for(size_t argn = 2; argn < args.size(); argn++) { + if(!(ParseInputFile(argn) || + ParseOutputPattern(argn) || + ParseChordTolerance(argn))) { + fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); + return false; + } + } + + runner = [&](const Platform::Path &output) { + SS.exportChordTol = chordTol; + + SS.ExportViewOrWireframeTo(output, /*exportWireframe=*/true); + }; + } else if(args[1] == "export-mesh") { + for(size_t argn = 2; argn < args.size(); argn++) { + if(!(ParseInputFile(argn) || + ParseOutputPattern(argn) || + ParseChordTolerance(argn))) { + fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); + return false; + } + } + + runner = [&](const Platform::Path &output) { + SS.exportChordTol = chordTol; + + SS.ExportMeshTo(output); + }; + } else if(args[1] == "export-surfaces") { + for(size_t argn = 2; argn < args.size(); argn++) { + if(!(ParseInputFile(argn) || + ParseOutputPattern(argn))) { + fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); + return false; + } + } + + runner = [&](const Platform::Path &output) { + StepFileWriter sfw = {}; + sfw.ExportSurfacesTo(output); + }; + } else if(args[1] == "regenerate") { + for(size_t argn = 2; argn < args.size(); argn++) { + if(!(ParseInputFile(argn) || + ParseChordTolerance(argn))) { + fprintf(stderr, "Unrecognized option '%s'.\n", args[argn].c_str()); + return false; + } + } + + outputPattern = "%.slvs"; + + runner = [&](const Platform::Path &output) { + SS.exportChordTol = chordTol; + SS.exportMode = true; + + SS.SaveToFile(output); + }; + } else { + fprintf(stderr, "Unrecognized command '%s'.\n", args[1].c_str()); + return false; + } + + if(outputPattern.empty()) { + fprintf(stderr, "An output pattern must be specified.\n"); + return false; + } else if(outputPattern.find('%') == std::string::npos && inputFiles.size() > 1) { + fprintf(stderr, + "Output pattern must include a %% symbol when using multiple inputs!\n"); + return false; + } + + if(inputFiles.empty()) { + fprintf(stderr, "At least one input file must be specified.\n"); + return false; + } + + for(const Platform::Path &inputFile : inputFiles) { + Platform::Path absInputFile = inputFile.Expand(/*fromCurrentDirectory=*/true); + + Platform::Path outputFile = Platform::Path::From(outputPattern); + size_t replaceAt = outputFile.raw.find('%'); + if(replaceAt != std::string::npos) { + Platform::Path outputSubst = inputFile.Parent(); + if(outputSubst.IsEmpty()) { + outputSubst = Platform::Path::From(inputFile.FileStem()); + } else { + outputSubst = outputSubst.Join(inputFile.FileStem()); + } + outputFile.raw.replace(replaceAt, 1, outputSubst.raw); + } + Platform::Path absOutputFile = outputFile.Expand(/*fromCurrentDirectory=*/true); + + SS.Init(); + if(!SS.LoadFromFile(absInputFile)) { + fprintf(stderr, "Cannot load '%s'!\n", inputFile.raw.c_str()); + return false; + } + SS.AfterNewFile(); + runner(absOutputFile); + SK.Clear(); + SS.Clear(); + + fprintf(stderr, "Written '%s'.\n", outputFile.raw.c_str()); + } + + return true; +} + +int main(int argc, char **argv) { + std::vector args = Platform::InitCli(argc, argv); + + if(args.size() == 1) { + ShowUsage(args[0]); + return 0; + } + + if(!RunCommand(args)) { + return 1; + } else { + return 0; + } +} diff --git a/src/platform/entrygui.cpp b/src/platform/entrygui.cpp new file mode 100644 index 0000000..397831a --- /dev/null +++ b/src/platform/entrygui.cpp @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Our main() function for the graphical interface. +// +// Copyright 2018 +//----------------------------------------------------------------------------- +#include "solvespace.h" +#if defined(WIN32) +# include +#endif + +using namespace SolveSpace; + +int main(int argc, char** argv) { + std::vector args = Platform::InitGui(argc, argv); + + Platform::Open3DConnexion(); + SS.Init(); + + if(args.size() >= 2) { + if(args.size() > 2) { + dbp("Only the first file passed on command line will be opened."); + } + + SS.Load(Platform::Path::From(args.back())); + } + + Platform::RunGui(); + + Platform::Close3DConnexion(); + SS.Clear(); + SK.Clear(); + Platform::ClearGui(); + + return 0; +} + +#if defined(WIN32) +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, INT nCmdShow) { + return main(0, NULL); +} +#endif diff --git a/src/platform/gui.cpp b/src/platform/gui.cpp new file mode 100644 index 0000000..0c9637f --- /dev/null +++ b/src/platform/gui.cpp @@ -0,0 +1,136 @@ +//----------------------------------------------------------------------------- +// Platform-dependent GUI functionality that has only minor differences. +// +// Copyright 2018 whitequark +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Keyboard events +//----------------------------------------------------------------------------- + +std::string AcceleratorDescription(const KeyboardEvent &accel) { + std::string label; + if(accel.controlDown) { +#ifdef __APPLE__ + label += "⌘+"; +#else + label += "Ctrl+"; +#endif + } + + if(accel.shiftDown) { + label += "Shift+"; + } + + switch(accel.key) { + case KeyboardEvent::Key::FUNCTION: + label += ssprintf("F%d", accel.num); + break; + + case KeyboardEvent::Key::CHARACTER: + if(accel.chr == '\t') { + label += "Tab"; + } else if(accel.chr == ' ') { + label += "Space"; + } else if(accel.chr == '\x1b') { + label += "Esc"; + } else if(accel.chr == '\x7f') { + label += "Del"; + } else if(accel.chr != 0) { + label += toupper((char)(accel.chr & 0xff)); + } + break; + } + + return label; +} + +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +void Settings::FreezeBool(const std::string &key, bool value) { + FreezeInt(key, (int)value); +} + +bool Settings::ThawBool(const std::string &key, bool defaultValue) { + return ThawInt(key, (int)defaultValue) != 0; +} + +void Settings::FreezeColor(const std::string &key, RgbaColor value) { + FreezeInt(key, value.ToPackedInt()); +} + +RgbaColor Settings::ThawColor(const std::string &key, RgbaColor defaultValue) { + return RgbaColor::FromPackedInt(ThawInt(key, defaultValue.ToPackedInt())); +} + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +void FileDialog::AddFilter(const FileFilter &filter) { + AddFilter(Translate("file-type", filter.name.c_str()), filter.extensions); +} + +void FileDialog::AddFilters(const std::vector &filters) { + for(auto filter : filters) AddFilter(filter); +} + +std::vector SolveSpaceModelFileFilters = { + { CN_("file-type", "SolveSpace models"), { "slvs" } }, +}; + +std::vector SolveSpaceLinkFileFilters = { + { CN_("file-type", "ALL"), { "slvs", "emn", "stl" } }, + { CN_("file-type", "SolveSpace models"), { "slvs" } }, + { CN_("file-type", "IDF circuit board"), { "emn" } }, + { CN_("file-type", "STL triangle mesh"), { "stl" } }, +}; + +std::vector RasterFileFilters = { + { CN_("file-type", "PNG image"), { "png" } }, +}; + +std::vector MeshFileFilters = { + { CN_("file-type", "STL mesh"), { "stl" } }, + { CN_("file-type", "Wavefront OBJ mesh"), { "obj" } }, + { CN_("file-type", "Three.js-compatible mesh, with viewer"), { "html" } }, + { CN_("file-type", "Three.js-compatible mesh, mesh only"), { "js" } }, + { CN_("file-type", "VRML text file"), { "wrl" } }, +}; + +std::vector SurfaceFileFilters = { + { CN_("file-type", "STEP file"), { "step", "stp" } }, +}; + +std::vector VectorFileFilters = { + { CN_("file-type", "PDF file"), { "pdf" } }, + { CN_("file-type", "Encapsulated PostScript"), { "eps", "ps" } }, + { CN_("file-type", "Scalable Vector Graphics"), { "svg" } }, + { CN_("file-type", "STEP file"), { "step", "stp" } }, + { CN_("file-type", "DXF file (AutoCAD 2007)"), { "dxf" } }, + { CN_("file-type", "HPGL file"), { "plt", "hpgl" } }, + { CN_("file-type", "G Code"), { "ngc", "txt" } }, +}; + +std::vector Vector3dFileFilters = { + { CN_("file-type", "STEP file"), { "step", "stp" } }, + { CN_("file-type", "DXF file (AutoCAD 2007)"), { "dxf" } }, +}; + +std::vector ImportFileFilters = { + { CN_("file-type", "AutoCAD DXF and DWG files"), { "dxf", "dwg" } }, +}; + +std::vector CsvFileFilters = { + { CN_("file-type", "Comma-separated values"), { "csv" } }, +}; + + +} +} diff --git a/src/platform/gui.h b/src/platform/gui.h new file mode 100644 index 0000000..46dcc18 --- /dev/null +++ b/src/platform/gui.h @@ -0,0 +1,400 @@ +//----------------------------------------------------------------------------- +// An abstraction for platform-dependent GUI functionality. +// +// Copyright 2018 whitequark +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_GUI_H +#define SOLVESPACE_GUI_H + +#include +#include +#include +#include + +#include "platform.h" + +namespace SolveSpace { +class RgbaColor; + +namespace Platform { + +//----------------------------------------------------------------------------- +// Events +//----------------------------------------------------------------------------- + +// A mouse input event. +class MouseEvent { +public: + enum class Type { + MOTION, + PRESS, + DBL_PRESS, + RELEASE, + SCROLL_VERT, + LEAVE, + }; + + enum class Button { + NONE, + LEFT, + MIDDLE, + RIGHT, + }; + + Type type; + double x; + double y; + bool shiftDown; + bool controlDown; + union { + Button button; // for Type::{MOTION,PRESS,DBL_PRESS,RELEASE} + double scrollDelta; // for Type::SCROLL_VERT + }; +}; + +// A 3-DOF input event. +struct SixDofEvent { + enum class Type { + MOTION, + PRESS, + RELEASE, + }; + + enum class Button { + FIT, + }; + + Type type; + bool shiftDown; + bool controlDown; + double translationX, translationY, translationZ; // for Type::MOTION + double rotationX, rotationY, rotationZ; // for Type::MOTION + Button button; // for Type::{PRESS,RELEASE} +}; + +// A keyboard input event. +struct KeyboardEvent { + enum class Type { + PRESS, + RELEASE, + }; + + enum class Key { + CHARACTER, + FUNCTION, + }; + + Type type; + Key key; + union { + char32_t chr; // for Key::CHARACTER + int num; // for Key::FUNCTION + }; + bool shiftDown; + bool controlDown; + + bool Equals(const KeyboardEvent &other) { + return type == other.type && key == other.key && + shiftDown == other.shiftDown && controlDown == other.controlDown && + ((key == Key::CHARACTER && chr == other.chr) || + (key == Key::FUNCTION && num == other.num)); + } +}; + +std::string AcceleratorDescription(const KeyboardEvent &accel); + +//----------------------------------------------------------------------------- +// Interfaces +//----------------------------------------------------------------------------- + +// Handling fatal errors. +[[noreturn]] +void FatalError(const std::string &message); + +// A native settings store. +class Settings { +public: + virtual ~Settings() = default; + + virtual void FreezeInt(const std::string &key, uint32_t value) = 0; + virtual uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) = 0; + + virtual void FreezeFloat(const std::string &key, double value) = 0; + virtual double ThawFloat(const std::string &key, double defaultValue = 0.0) = 0; + + virtual void FreezeString(const std::string &key, const std::string &value) = 0; + virtual std::string ThawString(const std::string &key, + const std::string &defaultValue = "") = 0; + + virtual void FreezeBool(const std::string &key, bool value); + virtual bool ThawBool(const std::string &key, bool defaultValue = false); + + virtual void FreezeColor(const std::string &key, RgbaColor value); + virtual RgbaColor ThawColor(const std::string &key, RgbaColor defaultValue); +}; + +typedef std::shared_ptr SettingsRef; + +SettingsRef GetSettings(); + +// A native single-shot timer. +class Timer { +public: + std::function onTimeout; + + virtual ~Timer() = default; + + virtual void RunAfter(unsigned milliseconds) = 0; + virtual void RunAfterNextFrame() { RunAfter(1); } + virtual void RunAfterProcessingEvents() { RunAfter(0); } +}; + +typedef std::shared_ptr TimerRef; + +TimerRef CreateTimer(); + +// A native menu item. +class MenuItem { +public: + enum class Indicator { + NONE, + CHECK_MARK, + RADIO_MARK, + }; + + std::function onTrigger; + + virtual ~MenuItem() = default; + + virtual void SetAccelerator(KeyboardEvent accel) = 0; + virtual void SetIndicator(Indicator type) = 0; + virtual void SetEnabled(bool enabled) = 0; + virtual void SetActive(bool active) = 0; +}; + +typedef std::shared_ptr MenuItemRef; + +// A native menu. +class Menu { +public: + virtual ~Menu() = default; + + virtual std::shared_ptr AddItem( + const std::string &label, std::function onTrigger = std::function(), + bool mnemonics = true) = 0; + virtual std::shared_ptr AddSubMenu(const std::string &label) = 0; + virtual void AddSeparator() = 0; + + virtual void PopUp() = 0; + + virtual void Clear() = 0; +}; + +typedef std::shared_ptr MenuRef; + +// A native menu bar. +class MenuBar { +public: + virtual ~MenuBar() = default; + + virtual std::shared_ptr AddSubMenu(const std::string &label) = 0; + + virtual void Clear() = 0; +}; + +typedef std::shared_ptr MenuBarRef; + +MenuRef CreateMenu(); +MenuBarRef GetOrCreateMainMenu(bool *unique); + +// A native top-level window, with an OpenGL context, and an editor overlay. +class Window { +public: + enum class Kind { + TOPLEVEL, + TOOL, + }; + + enum class Cursor { + POINTER, + HAND + }; + + std::function onClose; + std::function onFullScreen; + std::function onMouseEvent; + std::function onSixDofEvent; + std::function onKeyboardEvent; + std::function onEditingDone; + std::function onScrollbarAdjusted; + std::function onContextLost; + std::function onRender; + + virtual ~Window() = default; + + // Returns physical display DPI. + virtual double GetPixelDensity() = 0; + // Returns raster graphics and coordinate scale (already applied on the platform side), + // i.e. size of logical pixel in physical pixels, or device pixel ratio. + virtual double GetDevicePixelRatio() = 0; + // Returns (fractional) font scale, to be applied on top of (integral) device pixel ratio. + virtual double GetDeviceFontScale() { + return GetPixelDensity() / GetDevicePixelRatio() / 96.0; + } + + virtual bool IsVisible() = 0; + virtual void SetVisible(bool visible) = 0; + virtual void Focus() = 0; + + virtual bool IsFullScreen() = 0; + virtual void SetFullScreen(bool fullScreen) = 0; + + virtual void SetTitle(const std::string &title) = 0; + virtual bool SetTitleForFilename(const Path &filename) { return false; } + + virtual void SetMenuBar(MenuBarRef menuBar) = 0; + + virtual void GetContentSize(double *width, double *height) = 0; + virtual void SetMinContentSize(double width, double height) = 0; + + virtual void FreezePosition(SettingsRef settings, const std::string &key) = 0; + virtual void ThawPosition(SettingsRef settings, const std::string &key) = 0; + + virtual void SetCursor(Cursor cursor) = 0; + virtual void SetTooltip(const std::string &text, double x, double y, + double width, double height) = 0; + + virtual bool IsEditorVisible() = 0; + virtual void ShowEditor(double x, double y, double fontHeight, double minWidth, + bool isMonospace, const std::string &text) = 0; + virtual void HideEditor() = 0; + + virtual void SetScrollbarVisible(bool visible) = 0; + virtual void ConfigureScrollbar(double min, double max, double pageSize) = 0; + virtual double GetScrollbarPosition() = 0; + virtual void SetScrollbarPosition(double pos) = 0; + + virtual void Invalidate() = 0; +}; + +typedef std::shared_ptr WindowRef; + +WindowRef CreateWindow(Window::Kind kind = Window::Kind::TOPLEVEL, + WindowRef parentWindow = NULL); + +// 3DConnexion support. +void Open3DConnexion(); +void Close3DConnexion(); +void Request3DConnexionEventsForWindow(WindowRef window); + +// A native dialog that asks for one choice out of several. +class MessageDialog { +public: + enum class Type { + INFORMATION, + QUESTION, + WARNING, + ERROR + }; + + enum class Response { + NONE, + OK, + YES, + NO, + CANCEL + }; + + std::function onResponse; + + virtual ~MessageDialog() = default; + + virtual void SetType(Type type) = 0; + virtual void SetTitle(std::string title) = 0; + virtual void SetMessage(std::string message) = 0; + virtual void SetDescription(std::string description) = 0; + + virtual void AddButton(std::string label, Response response, bool isDefault = false) = 0; + + virtual Response RunModal() = 0; + virtual void ShowModal() { + Response response = RunModal(); + if(onResponse) { + onResponse(response); + } + } +}; + +typedef std::shared_ptr MessageDialogRef; + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow); + +// A file filter. +struct FileFilter { + std::string name; + std::vector extensions; +}; + +// SolveSpace's native file format +extern std::vector SolveSpaceModelFileFilters; +// SolveSpace's linkable file formats +extern std::vector SolveSpaceLinkFileFilters; +// Raster image +extern std::vector RasterFileFilters; +// Triangle mesh +extern std::vector MeshFileFilters; +// NURBS surfaces +extern std::vector SurfaceFileFilters; +// 2d vector (lines and curves) format +extern std::vector VectorFileFilters; +// 3d vector (wireframe lines and curves) format +extern std::vector Vector3dFileFilters; +// Any importable format +extern std::vector ImportFileFilters; +// Comma-separated value, like a spreadsheet would use +extern std::vector CsvFileFilters; + +// A native dialog that asks to choose a file. +class FileDialog { +public: + virtual ~FileDialog() = default; + + virtual void SetTitle(std::string title) = 0; + virtual void SetCurrentName(std::string name) = 0; + + virtual Platform::Path GetFilename() = 0; + virtual void SetFilename(Platform::Path path) = 0; + virtual void SuggestFilename(Platform::Path path) = 0; + + virtual void AddFilter(std::string name, std::vector extensions) = 0; + void AddFilter(const FileFilter &filter); + void AddFilters(const std::vector &filters); + + virtual void FreezeChoices(SettingsRef settings, const std::string &key) = 0; + virtual void ThawChoices(SettingsRef settings, const std::string &key) = 0; + + virtual bool RunModal() = 0; +}; + +typedef std::shared_ptr FileDialogRef; + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow); +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow); + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector GetFontFiles(); +void OpenInBrowser(const std::string &url); + +std::vector InitGui(int argc, char **argv); +void RunGui(); +void ExitGui(); +void ClearGui(); + +} +} // namespace SolveSpace + +#endif diff --git a/src/platform/guigtk.cpp b/src/platform/guigtk.cpp new file mode 100644 index 0000000..522fb13 --- /dev/null +++ b/src/platform/guigtk.cpp @@ -0,0 +1,1679 @@ +//----------------------------------------------------------------------------- +// The GTK-based implementation of platform-dependent GUI functionality. +// +// Copyright 2018 whitequark +//----------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#if defined(HAVE_GTK_FILECHOOSERNATIVE) +# include +#endif + +#if defined(HAVE_SPACEWARE) +# include +# include +# if defined(GDK_WINDOWING_X11) +# include +# endif +# if defined(GDK_WINDOWING_WAYLAND) +# include +# endif +# if GTK_CHECK_VERSION(3, 20, 0) +# include +# else +# include +# endif +#endif + +#include "solvespace.h" + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Utility functions +//----------------------------------------------------------------------------- + +static std::string PrepareMnemonics(std::string label) { + std::replace(label.begin(), label.end(), '&', '_'); + return label; +} + +static std::string PrepareTitle(const std::string &title) { + return title + " — SolveSpace"; +} + +//----------------------------------------------------------------------------- +// Fatal errors +//----------------------------------------------------------------------------- + +void FatalError(const std::string &message) { + fprintf(stderr, "%s", message.c_str()); + abort(); +} + +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +class SettingsImplGtk final : public Settings { +public: + // Why aren't we using GSettings? Two reasons. It doesn't allow to easily see whether + // the setting had the default value, and it requires to install a schema globally. + Path _path; + json_object *_json = NULL; + + static Path GetConfigPath() { + Path configHome; + if(getenv("XDG_CONFIG_HOME")) { + configHome = Path::From(getenv("XDG_CONFIG_HOME")); + } else if(getenv("HOME")) { + configHome = Path::From(getenv("HOME")).Join(".config"); + } else { + dbp("neither XDG_CONFIG_HOME nor HOME are set"); + return Path::From(""); + } + if(!configHome.IsEmpty()) { + configHome = configHome.Join("solvespace"); + } + + const char *configHomeC = configHome.raw.c_str(); + struct stat st; + if(stat(configHomeC, &st)) { + if(errno == ENOENT) { + if(mkdir(configHomeC, 0777)) { + dbp("cannot mkdir %s: %s", configHomeC, strerror(errno)); + return Path::From(""); + } + } else { + dbp("cannot stat %s: %s", configHomeC, strerror(errno)); + return Path::From(""); + } + } else if(!S_ISDIR(st.st_mode)) { + dbp("%s is not a directory", configHomeC); + return Path::From(""); + } + + return configHome.Join("settings.json"); + } + + SettingsImplGtk() { + _path = GetConfigPath(); + if(_path.IsEmpty()) { + dbp("settings will not be saved"); + } else { + _json = json_object_from_file(_path.raw.c_str()); + if(!_json && errno != ENOENT) { + dbp("cannot load settings: %s", strerror(errno)); + } + } + + if(_json == NULL) { + _json = json_object_new_object(); + } + } + + ~SettingsImplGtk() override { + if(!_path.IsEmpty()) { + // json-c <0.12 has the first argument non-const + if(json_object_to_file_ext((char *)_path.raw.c_str(), _json, + JSON_C_TO_STRING_PRETTY)) { + dbp("cannot save settings: %s", strerror(errno)); + } + } + + json_object_put(_json); + } + + void FreezeInt(const std::string &key, uint32_t value) override { + struct json_object *jsonValue = json_object_new_int(value); + json_object_object_add(_json, key.c_str(), jsonValue); + } + + uint32_t ThawInt(const std::string &key, uint32_t defaultValue) override { + struct json_object *jsonValue; + if(json_object_object_get_ex(_json, key.c_str(), &jsonValue)) { + return json_object_get_int(jsonValue); + } + return defaultValue; + } + + void FreezeBool(const std::string &key, bool value) override { + struct json_object *jsonValue = json_object_new_boolean(value); + json_object_object_add(_json, key.c_str(), jsonValue); + } + + bool ThawBool(const std::string &key, bool defaultValue) override { + struct json_object *jsonValue; + if(json_object_object_get_ex(_json, key.c_str(), &jsonValue)) { + return json_object_get_boolean(jsonValue); + } + return defaultValue; + } + + void FreezeFloat(const std::string &key, double value) override { + struct json_object *jsonValue = json_object_new_double(value); + json_object_object_add(_json, key.c_str(), jsonValue); + } + + double ThawFloat(const std::string &key, double defaultValue) override { + struct json_object *jsonValue; + if(json_object_object_get_ex(_json, key.c_str(), &jsonValue)) { + return json_object_get_double(jsonValue); + } + return defaultValue; + } + + void FreezeString(const std::string &key, const std::string &value) override { + struct json_object *jsonValue = json_object_new_string(value.c_str()); + json_object_object_add(_json, key.c_str(), jsonValue); + } + + std::string ThawString(const std::string &key, + const std::string &defaultValue = "") override { + struct json_object *jsonValue; + if(json_object_object_get_ex(_json, key.c_str(), &jsonValue)) { + return json_object_get_string(jsonValue); + } + return defaultValue; + } +}; + +SettingsRef GetSettings() { + static std::shared_ptr settings; + if(!settings) { + settings = std::make_shared(); + } + return settings; +} + +//----------------------------------------------------------------------------- +// Timers +//----------------------------------------------------------------------------- + +class TimerImplGtk final : public Timer { +public: + sigc::connection _connection; + + void RunAfter(unsigned milliseconds) override { + if(!_connection.empty()) { + _connection.disconnect(); + } + + auto handler = [this]() { + if(this->onTimeout) { + this->onTimeout(); + } + return false; + }; + // Note: asan warnings about new-delete-type-mismatch are false positives here: + // https://gitlab.gnome.org/GNOME/gtkmm/-/issues/65 + // Pass new_delete_type_mismatch=0 to ASAN_OPTIONS to disable those warnings. + // Unfortunately they won't go away until upgrading to gtkmm4 + _connection = Glib::signal_timeout().connect(handler, milliseconds); + } +}; + +TimerRef CreateTimer() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// GTK menu extensions +//----------------------------------------------------------------------------- + +class GtkMenuItem : public Gtk::CheckMenuItem { + Platform::MenuItem *_receiver; + bool _has_indicator; + bool _synthetic_event; + +public: + GtkMenuItem(Platform::MenuItem *receiver) : + _receiver(receiver), _has_indicator(false), _synthetic_event(false) { + } + + void set_accel_key(const Gtk::AccelKey &accel_key) { + Gtk::CheckMenuItem::set_accel_key(accel_key); + } + + bool has_indicator() const { + return _has_indicator; + } + + void set_has_indicator(bool has_indicator) { + _has_indicator = has_indicator; + } + + void set_active(bool active) { + if(Gtk::CheckMenuItem::get_active() == active) + return; + + _synthetic_event = true; + Gtk::CheckMenuItem::set_active(active); + _synthetic_event = false; + } + +protected: + void on_activate() override { + Gtk::CheckMenuItem::on_activate(); + + if(!_synthetic_event && _receiver->onTrigger) { + _receiver->onTrigger(); + } + } + + void draw_indicator_vfunc(const Cairo::RefPtr &cr) override { + if(_has_indicator) { + Gtk::CheckMenuItem::draw_indicator_vfunc(cr); + } + } +}; + +//----------------------------------------------------------------------------- +// Menus +//----------------------------------------------------------------------------- + +class MenuItemImplGtk final : public MenuItem { +public: + GtkMenuItem gtkMenuItem; + + MenuItemImplGtk() : gtkMenuItem(this) {} + + void SetAccelerator(KeyboardEvent accel) override { + guint accelKey = 0; + if(accel.key == KeyboardEvent::Key::CHARACTER) { + if(accel.chr == '\t') { + accelKey = GDK_KEY_Tab; + } else if(accel.chr == '\x1b') { + accelKey = GDK_KEY_Escape; + } else if(accel.chr == '\x7f') { + accelKey = GDK_KEY_Delete; + } else { + accelKey = gdk_unicode_to_keyval(accel.chr); + } + } else if(accel.key == KeyboardEvent::Key::FUNCTION) { + accelKey = GDK_KEY_F1 + accel.num - 1; + } + + Gdk::ModifierType accelMods = {}; + if(accel.shiftDown) { + accelMods |= Gdk::SHIFT_MASK; + } + if(accel.controlDown) { + accelMods |= Gdk::CONTROL_MASK; + } + + gtkMenuItem.set_accel_key(Gtk::AccelKey(accelKey, accelMods)); + } + + void SetIndicator(Indicator type) override { + switch(type) { + case Indicator::NONE: + gtkMenuItem.set_has_indicator(false); + break; + + case Indicator::CHECK_MARK: + gtkMenuItem.set_has_indicator(true); + gtkMenuItem.set_draw_as_radio(false); + break; + + case Indicator::RADIO_MARK: + gtkMenuItem.set_has_indicator(true); + gtkMenuItem.set_draw_as_radio(true); + break; + } + } + + void SetActive(bool active) override { + ssassert(gtkMenuItem.has_indicator(), + "Cannot change state of a menu item without indicator"); + gtkMenuItem.set_active(active); + } + + void SetEnabled(bool enabled) override { + gtkMenuItem.set_sensitive(enabled); + } +}; + +class MenuImplGtk final : public Menu { +public: + Gtk::Menu gtkMenu; + std::vector> menuItems; + std::vector> subMenus; + + MenuItemRef AddItem(const std::string &label, + std::function onTrigger = NULL, + bool mnemonics = true) override { + auto menuItem = std::make_shared(); + menuItems.push_back(menuItem); + + menuItem->gtkMenuItem.set_label(mnemonics ? PrepareMnemonics(label) : label); + menuItem->gtkMenuItem.set_use_underline(mnemonics); + menuItem->gtkMenuItem.show(); + menuItem->onTrigger = onTrigger; + gtkMenu.append(menuItem->gtkMenuItem); + + return menuItem; + } + + MenuRef AddSubMenu(const std::string &label) override { + auto menuItem = std::make_shared(); + menuItems.push_back(menuItem); + + auto subMenu = std::make_shared(); + subMenus.push_back(subMenu); + + menuItem->gtkMenuItem.set_label(PrepareMnemonics(label)); + menuItem->gtkMenuItem.set_use_underline(true); + menuItem->gtkMenuItem.set_submenu(subMenu->gtkMenu); + menuItem->gtkMenuItem.show_all(); + gtkMenu.append(menuItem->gtkMenuItem); + + return subMenu; + } + + void AddSeparator() override { + Gtk::SeparatorMenuItem *gtkMenuItem = Gtk::manage(new Gtk::SeparatorMenuItem()); + gtkMenuItem->show(); + gtkMenu.append(*Gtk::manage(gtkMenuItem)); + } + + void PopUp() override { + Glib::RefPtr loop = Glib::MainLoop::create(); + auto signal = gtkMenu.signal_deactivate().connect([&]() { loop->quit(); }); + + gtkMenu.show_all(); + gtkMenu.popup(0, GDK_CURRENT_TIME); + loop->run(); + signal.disconnect(); + } + + void Clear() override { + gtkMenu.foreach([&](Gtk::Widget &w) { gtkMenu.remove(w); }); + menuItems.clear(); + subMenus.clear(); + } +}; + +MenuRef CreateMenu() { + return std::make_shared(); +} + +class MenuBarImplGtk final : public MenuBar { +public: + Gtk::MenuBar gtkMenuBar; + std::vector> subMenus; + + MenuRef AddSubMenu(const std::string &label) override { + auto subMenu = std::make_shared(); + subMenus.push_back(subMenu); + + Gtk::MenuItem *gtkMenuItem = Gtk::manage(new Gtk::MenuItem); + gtkMenuItem->set_label(PrepareMnemonics(label)); + gtkMenuItem->set_use_underline(true); + gtkMenuItem->set_submenu(subMenu->gtkMenu); + gtkMenuItem->show_all(); + gtkMenuBar.append(*gtkMenuItem); + + return subMenu; + } + + void Clear() override { + gtkMenuBar.foreach([&](Gtk::Widget &w) { gtkMenuBar.remove(w); }); + subMenus.clear(); + } +}; + +MenuBarRef GetOrCreateMainMenu(bool *unique) { + *unique = false; + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// GTK GL and window extensions +//----------------------------------------------------------------------------- + +class GtkGLWidget : public Gtk::GLArea { + struct LastPress { + double x, y; + guint button; + guint32 time; + GdkDevice *device; + }; + + Window *_receiver; + LastPress _last_press; + +public: + GtkGLWidget(Platform::Window *receiver) : _receiver(receiver), _last_press() { + set_has_depth_buffer(true); + set_can_focus(true); + set_events(Gdk::POINTER_MOTION_MASK | + Gdk::BUTTON_PRESS_MASK | + Gdk::BUTTON_RELEASE_MASK | + Gdk::BUTTON_MOTION_MASK | + Gdk::SCROLL_MASK | + Gdk::SMOOTH_SCROLL_MASK | + Gdk::TOUCHPAD_GESTURE_MASK | + Gdk::LEAVE_NOTIFY_MASK | + Gdk::KEY_PRESS_MASK | + Gdk::KEY_RELEASE_MASK); + } + +protected: + // Work around a bug fixed in GTKMM 3.22: + // https://mail.gnome.org/archives/gtkmm-list/2016-April/msg00020.html + Glib::RefPtr on_create_context() override { + return get_window()->create_gl_context(); + } + + bool on_render(const Glib::RefPtr &context) override { + if(_receiver->onRender) { + _receiver->onRender(); + } + return true; + } + + bool process_pointer_event(MouseEvent::Type type, double x, double y, + guint state, guint button = 0, double scroll_delta = 0) { + MouseEvent event = {}; + event.type = type; + event.x = x; + event.y = y; + if(button == 1 || (state & GDK_BUTTON1_MASK) != 0) { + event.button = MouseEvent::Button::LEFT; + } else if(button == 2 || (state & GDK_BUTTON2_MASK) != 0) { + event.button = MouseEvent::Button::MIDDLE; + } else if(button == 3 || (state & GDK_BUTTON3_MASK) != 0) { + event.button = MouseEvent::Button::RIGHT; + } + if((state & GDK_SHIFT_MASK) != 0) { + event.shiftDown = true; + } + if((state & GDK_CONTROL_MASK) != 0) { + event.controlDown = true; + } + if(scroll_delta != 0) { + event.scrollDelta = scroll_delta; + } + + if(_receiver->onMouseEvent) { + return _receiver->onMouseEvent(event); + } + + return false; + } + + bool on_motion_notify_event(GdkEventMotion *gdk_event) override { + double x,y; + GdkModifierType state; + gdk_event_get_coords((GdkEvent*)gdk_event, &x, &y); + gdk_event_get_state((GdkEvent*)gdk_event, &state); + + if(process_pointer_event(MouseEvent::Type::MOTION, x, y, state)) + return true; + + return Gtk::GLArea::on_motion_notify_event(gdk_event); + } + + bool on_button_press_event(GdkEventButton *gdk_event) override { + MouseEvent::Type type; + GdkEventType gdk_type; + gdk_type = gdk_event_get_event_type((GdkEvent*)gdk_event); + + if(gdk_type == GDK_BUTTON_PRESS) { + type = MouseEvent::Type::PRESS; + } else if(gdk_type == GDK_2BUTTON_PRESS) { + type = MouseEvent::Type::DBL_PRESS; + } else { + return Gtk::GLArea::on_button_press_event(gdk_event); + } + double x,y; + gdk_event_get_coords((GdkEvent*)gdk_event, &x, &y); + GdkModifierType state; + gdk_event_get_state((GdkEvent*)gdk_event, &state); + guint button; + gdk_event_get_button((GdkEvent*)gdk_event, &button); + + // In GTK, the sequence of events for a double click is: + // - press + // - release + // - press + // - double-press + // - release + // + // Having a press event right before the double press event is inconsistent with + // the way double click handling works on Windows and macOS, and may cause receiver + // code to treat the sequence as three press events. + // To avoid this, we check if a press event happened quickly enough after the + // previous one to be considered a double press, and eat it up if a receiver + // is set up. + // Since we ignore triple press events, we reset the last press data when receiving + // the double press event, in order to avoid eating up the third press event of + // a triple click sequence. + if(gdk_type == GDK_BUTTON_PRESS) { + LastPress c = { + x, y, button, + gdk_event_get_time((GdkEvent*)gdk_event), + gdk_event_get_device((GdkEvent*)gdk_event), + }; + LastPress p = _last_press; + _last_press = c; + + if(_receiver->onMouseEvent) { + const Glib::RefPtr settings = get_settings(); + const guint dbl_press_time = settings-> + property_gtk_double_click_time().get_value(); + const double dbl_press_distance = settings-> + property_gtk_double_click_distance().get_value(); + + if(c.device == p.device && + c.button == p.button && + c.time - p.time < dbl_press_time && + std::abs(c.x - p.x) <= dbl_press_distance && + std::abs(c.y - p.y) <= dbl_press_distance) { + // Eat this press event, as it'll be followed immediately + // by a double press event + return true; + } + } + } else if(gdk_type == GDK_2BUTTON_PRESS) { + const guint32 time = gdk_event_get_time((GdkEvent*)gdk_event); + const GdkDevice *device = gdk_event_get_device((GdkEvent*)gdk_event); + // A double press event is synthesised by GTK, and has the exact same + // time and device as the press event the preceeded it. + ssassert(_last_press.time == time && _last_press.device == device, + "double press event not following a press event"); + // Reset in order to avoid eating the press event for a triple click + _last_press = {}; + } + + if(process_pointer_event(type, x, y, state, button)) + return true; + + return Gtk::GLArea::on_button_press_event(gdk_event); + } + + bool on_button_release_event(GdkEventButton *gdk_event) override { + double x,y; + gdk_event_get_coords((GdkEvent*)gdk_event, &x, &y); + GdkModifierType state; + gdk_event_get_state((GdkEvent*)gdk_event, &state); + guint button; + gdk_event_get_button((GdkEvent*)gdk_event, &button); + if(process_pointer_event(MouseEvent::Type::RELEASE, x, y, state, button)) + return true; + + return Gtk::GLArea::on_button_release_event(gdk_event); + } + + bool on_scroll_event(GdkEventScroll *gdk_event) override { + double dx, dy; + GdkScrollDirection dir; + double delta; + +// for gtk4 ?? +// gdk_scroll_event_get_deltas((GdkEvent*)gdk_event, &dx, &dy); +// gdk_scroll_event_get_direction((GdkEvent*)gdk_event, &dir); + + if(gdk_event_get_scroll_deltas((GdkEvent*)gdk_event, &dx, &dy)) { + delta = -dy; + } else if(gdk_event_get_scroll_direction((GdkEvent*)gdk_event, &dir)) { + if(dir == GDK_SCROLL_UP) { + delta = 1; + } else if(dir == GDK_SCROLL_DOWN) { + delta = -1; + } else { + return false; + } + } else { + return false; + } + + double x,y; + gdk_event_get_coords((GdkEvent*)gdk_event, &x, &y); + GdkModifierType state; + gdk_event_get_state((GdkEvent*)gdk_event, &state); + + if(process_pointer_event(MouseEvent::Type::SCROLL_VERT, + x, y, state, 0, delta)) + return true; + + return Gtk::GLArea::on_scroll_event(gdk_event); + } + + bool on_leave_notify_event(GdkEventCrossing *gdk_event) override { + double x,y; + gdk_event_get_coords((GdkEvent*)gdk_event, &x, &y); + GdkModifierType state; + gdk_event_get_state((GdkEvent*)gdk_event, &state); + + if(process_pointer_event(MouseEvent::Type::LEAVE, x, y, state)) + return true; + + return Gtk::GLArea::on_leave_notify_event(gdk_event); + } + + bool process_key_event(KeyboardEvent::Type type, GdkEventKey *gdk_event) { + KeyboardEvent event = {}; + event.type = type; + + GdkModifierType state; + gdk_event_get_state((GdkEvent*)gdk_event, &state); + + Gdk::ModifierType mod_mask = get_modifier_mask(Gdk::MODIFIER_INTENT_DEFAULT_MOD_MASK); + if((state & mod_mask) & ~(GDK_SHIFT_MASK|GDK_CONTROL_MASK)) { + return false; + } + + event.shiftDown = (state & GDK_SHIFT_MASK) != 0; + event.controlDown = (state & GDK_CONTROL_MASK) != 0; + + guint keyval; + gdk_event_get_keyval((GdkEvent*)gdk_event, &keyval); + + char32_t chr = gdk_keyval_to_unicode(gdk_keyval_to_lower(keyval)); + if(chr != 0) { + event.key = KeyboardEvent::Key::CHARACTER; + event.chr = chr; + } else if(keyval >= GDK_KEY_F1 && + keyval <= GDK_KEY_F12) { + event.key = KeyboardEvent::Key::FUNCTION; + event.num = keyval - GDK_KEY_F1 + 1; + } else { + return false; + } + + if(_receiver->onKeyboardEvent) { + return _receiver->onKeyboardEvent(event); + } + + return false; + } + + bool on_key_press_event(GdkEventKey *gdk_event) override { + if(process_key_event(KeyboardEvent::Type::PRESS, gdk_event)) + return true; + + return Gtk::GLArea::on_key_press_event(gdk_event); + } + + bool on_key_release_event(GdkEventKey *gdk_event) override { + if(process_key_event(KeyboardEvent::Type::RELEASE, gdk_event)) + return true; + + return Gtk::GLArea::on_key_release_event(gdk_event); + } +}; + +class GtkEditorOverlay : public Gtk::Fixed { + Window *_receiver; + GtkGLWidget _gl_widget; + Gtk::Entry _entry; + +public: + GtkEditorOverlay(Platform::Window *receiver) : _receiver(receiver), _gl_widget(receiver) { + add(_gl_widget); + + _entry.set_no_show_all(true); + _entry.set_has_frame(false); + add(_entry); + + _entry.signal_activate(). + connect(sigc::mem_fun(this, &GtkEditorOverlay::on_activate)); + } + + bool is_editing() const { + return _entry.is_visible(); + } + + void start_editing(int x, int y, int font_height, int min_width, bool is_monospace, + const std::string &val) { + Pango::FontDescription font_desc; + font_desc.set_family(is_monospace ? "monospace" : "normal"); + font_desc.set_absolute_size(font_height * Pango::SCALE); + _entry.override_font(font_desc); + + // The y coordinate denotes baseline. + Pango::FontMetrics font_metrics = get_pango_context()->get_metrics(font_desc); + y -= font_metrics.get_ascent() / Pango::SCALE; + + Glib::RefPtr layout = Pango::Layout::create(get_pango_context()); + layout->set_font_description(font_desc); + // Add one extra char width to avoid scrolling. + layout->set_text(val + " "); + int width = layout->get_logical_extents().get_width(); + + Gtk::Border margin = _entry.get_style_context()->get_margin(); + Gtk::Border border = _entry.get_style_context()->get_border(); + Gtk::Border padding = _entry.get_style_context()->get_padding(); + move(_entry, + x - margin.get_left() - border.get_left() - padding.get_left(), + y - margin.get_top() - border.get_top() - padding.get_top()); + + int fitWidth = width / Pango::SCALE + padding.get_left() + padding.get_right(); + _entry.set_size_request(max(fitWidth, min_width), -1); + queue_resize(); + + _entry.set_text(val); + + if(!_entry.is_visible()) { + _entry.show(); + _entry.grab_focus(); + + // We grab the input for ourselves and not the entry to still have + // the pointer events go through the underlay. + add_modal_grab(); + } + } + + void stop_editing() { + if(_entry.is_visible()) { + remove_modal_grab(); + _entry.hide(); + _gl_widget.grab_focus(); + } + } + + GtkGLWidget &get_gl_widget() { + return _gl_widget; + } + +protected: + bool on_key_press_event(GdkEventKey *gdk_event) override { + guint keyval; + gdk_event_get_keyval((GdkEvent*)gdk_event, &keyval); + + if(is_editing()) { + if(keyval == GDK_KEY_Escape) { + return _gl_widget.event((GdkEvent *)gdk_event); + } else { + _entry.event((GdkEvent *)gdk_event); + } + return true; + } + + return Gtk::Fixed::on_key_press_event(gdk_event); + } + + bool on_key_release_event(GdkEventKey *gdk_event) override { + if(is_editing()) { + _entry.event((GdkEvent *)gdk_event); + return true; + } + + return Gtk::Fixed::on_key_release_event(gdk_event); + } + + void on_size_allocate(Gtk::Allocation& allocation) override { + Gtk::Fixed::on_size_allocate(allocation); + + _gl_widget.size_allocate(allocation); + + int width, height, min_height, natural_height; + _entry.get_size_request(width, height); + _entry.get_preferred_height(min_height, natural_height); + + Gtk::Allocation entry_rect = _entry.get_allocation(); + entry_rect.set_width(width); + entry_rect.set_height(natural_height); + _entry.size_allocate(entry_rect); + } + + void on_activate() { + if(_receiver->onEditingDone) { + _receiver->onEditingDone(_entry.get_text()); + } + } +}; + +class GtkWindow : public Gtk::Window { + Platform::Window *_receiver; + Gtk::VBox _vbox; + Gtk::MenuBar *_menu_bar = NULL; + Gtk::HBox _hbox; + GtkEditorOverlay _editor_overlay; + Gtk::VScrollbar _scrollbar; + bool _is_under_cursor = false; + bool _is_fullscreen = false; + std::string _tooltip_text; + Gdk::Rectangle _tooltip_area; + +public: + GtkWindow(Platform::Window *receiver) : _receiver(receiver), _editor_overlay(receiver) { + _hbox.pack_start(_editor_overlay, /*expand=*/true, /*fill=*/true); + _hbox.pack_end(_scrollbar, /*expand=*/false, /*fill=*/false); + _vbox.pack_end(_hbox, /*expand=*/true, /*fill=*/true); + add(_vbox); + + _vbox.show(); + _hbox.show(); + _editor_overlay.show(); + get_gl_widget().show(); + + _scrollbar.get_adjustment()->signal_value_changed(). + connect(sigc::mem_fun(this, &GtkWindow::on_scrollbar_value_changed)); + + get_gl_widget().set_has_tooltip(true); + get_gl_widget().signal_query_tooltip(). + connect(sigc::mem_fun(this, &GtkWindow::on_query_tooltip)); + } + + bool is_full_screen() const { + return _is_fullscreen; + } + + Gtk::MenuBar *get_menu_bar() const { + return _menu_bar; + } + + void set_menu_bar(Gtk::MenuBar *menu_bar) { + if(_menu_bar) { + _vbox.remove(*_menu_bar); + } + _menu_bar = menu_bar; + if(_menu_bar) { + _menu_bar->show_all(); + _vbox.pack_start(*_menu_bar, /*expand=*/false, /*fill=*/false); + } + } + + GtkEditorOverlay &get_editor_overlay() { + return _editor_overlay; + } + + GtkGLWidget &get_gl_widget() { + return _editor_overlay.get_gl_widget(); + } + + Gtk::VScrollbar &get_scrollbar() { + return _scrollbar; + } + + void set_tooltip(const std::string &text, const Gdk::Rectangle &rect) { + if(_tooltip_text != text) { + _tooltip_text = text; + _tooltip_area = rect; + get_gl_widget().trigger_tooltip_query(); + } + } + +protected: + bool on_query_tooltip(int x, int y, bool keyboard_tooltip, + const Glib::RefPtr &tooltip) { + tooltip->set_text(_tooltip_text); + tooltip->set_tip_area(_tooltip_area); + return !_tooltip_text.empty() && (keyboard_tooltip || _is_under_cursor); + } + + bool on_enter_notify_event(GdkEventCrossing* gdk_event) override { + _is_under_cursor = true; + + return true; + } + + bool on_leave_notify_event(GdkEventCrossing* gdk_event) override { + _is_under_cursor = false; + + return true; + } + + bool on_delete_event(GdkEventAny* gdk_event) override { + if(_receiver->onClose) { + _receiver->onClose(); + return true; + } + + return false; + } + + bool on_window_state_event(GdkEventWindowState *gdk_event) override { + // window state event is superseded by GdkWindow::state on GTK4 + GdkWindowState new_window_state; + new_window_state = gdk_event->new_window_state; + + _is_fullscreen = new_window_state & GDK_WINDOW_STATE_FULLSCREEN; + if(_receiver->onFullScreen) { + _receiver->onFullScreen(_is_fullscreen); + } + + return true; + } + + void on_scrollbar_value_changed() { + if(_receiver->onScrollbarAdjusted) { + _receiver->onScrollbarAdjusted(_scrollbar.get_adjustment()->get_value()); + } + } +}; + +//----------------------------------------------------------------------------- +// Windows +//----------------------------------------------------------------------------- + +class WindowImplGtk final : public Window { +public: + GtkWindow gtkWindow; + MenuBarRef menuBar; + + WindowImplGtk(Window::Kind kind) : gtkWindow(this) { + switch(kind) { + case Kind::TOPLEVEL: + break; + + case Kind::TOOL: + gtkWindow.set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); + gtkWindow.set_skip_taskbar_hint(true); + gtkWindow.set_skip_pager_hint(true); + break; + } + + auto icon = LoadPng("freedesktop/solvespace-48x48.png"); + auto gdkIcon = + Gdk::Pixbuf::create_from_data(&icon->data[0], Gdk::COLORSPACE_RGB, + icon->format == Pixmap::Format::RGBA, 8, + icon->width, icon->height, icon->stride); + gtkWindow.set_icon(gdkIcon->copy()); + } + + double GetPixelDensity() override { + return gtkWindow.get_screen()->get_resolution(); + } + + double GetDevicePixelRatio() override { + return gtkWindow.get_scale_factor(); + } + + bool IsVisible() override { + return gtkWindow.is_visible(); + } + + void SetVisible(bool visible) override { + if(visible) { + gtkWindow.show(); + } else { + gtkWindow.hide(); + } + } + + void Focus() override { + gtkWindow.present(); + } + + bool IsFullScreen() override { + return gtkWindow.is_full_screen(); + } + + void SetFullScreen(bool fullScreen) override { + if(fullScreen) { + gtkWindow.fullscreen(); + } else { + gtkWindow.unfullscreen(); + } + } + + void SetTitle(const std::string &title) override { + gtkWindow.set_title(PrepareTitle(title)); + } + + void SetMenuBar(MenuBarRef newMenuBar) override { + if(newMenuBar) { + Gtk::MenuBar *gtkMenuBar = &((MenuBarImplGtk*)&*newMenuBar)->gtkMenuBar; + gtkWindow.set_menu_bar(gtkMenuBar); + } else { + gtkWindow.set_menu_bar(NULL); + } + menuBar = newMenuBar; + } + + void GetContentSize(double *width, double *height) override { + *width = gtkWindow.get_gl_widget().get_allocated_width(); + *height = gtkWindow.get_gl_widget().get_allocated_height(); + } + + void SetMinContentSize(double width, double height) override { + gtkWindow.get_gl_widget().set_size_request((int)width, (int)height); + } + + void FreezePosition(SettingsRef settings, const std::string &key) override { + if(!gtkWindow.is_visible()) return; + + int left, top, width, height; + gtkWindow.get_position(left, top); + gtkWindow.get_size(width, height); + bool isMaximized = gtkWindow.is_maximized(); + + settings->FreezeInt(key + "_Left", left); + settings->FreezeInt(key + "_Top", top); + settings->FreezeInt(key + "_Width", width); + settings->FreezeInt(key + "_Height", height); + settings->FreezeBool(key + "_Maximized", isMaximized); + } + + void ThawPosition(SettingsRef settings, const std::string &key) override { + int left, top, width, height; + gtkWindow.get_position(left, top); + gtkWindow.get_size(width, height); + + left = settings->ThawInt(key + "_Left", left); + top = settings->ThawInt(key + "_Top", top); + width = settings->ThawInt(key + "_Width", width); + height = settings->ThawInt(key + "_Height", height); + + gtkWindow.move(left, top); + gtkWindow.resize(width, height); + + if(settings->ThawBool(key + "_Maximized", false)) { + gtkWindow.maximize(); + } + } + + void SetCursor(Cursor cursor) override { + std::string cursor_name; + switch(cursor) { + case Cursor::POINTER: cursor_name = "default"; break; + case Cursor::HAND: cursor_name = "pointer"; break; + default: ssassert(false, "Unexpected cursor"); + } + + auto gdkWindow = gtkWindow.get_gl_widget().get_window(); + if(gdkWindow) { + gdkWindow->set_cursor(Gdk::Cursor::create(gdkWindow->get_display(), cursor_name.c_str())); +// gdkWindow->get_display() + } + } + + void SetTooltip(const std::string &text, double x, double y, + double width, double height) override { + gtkWindow.set_tooltip(text, { (int)x, (int)y, (int)width, (int)height }); + } + + bool IsEditorVisible() override { + return gtkWindow.get_editor_overlay().is_editing(); + } + + void ShowEditor(double x, double y, double fontHeight, double minWidth, + bool isMonospace, const std::string &text) override { + gtkWindow.get_editor_overlay().start_editing( + (int)x, (int)y, (int)fontHeight, (int)minWidth, isMonospace, text); + } + + void HideEditor() override { + gtkWindow.get_editor_overlay().stop_editing(); + } + + void SetScrollbarVisible(bool visible) override { + if(visible) { + gtkWindow.get_scrollbar().show(); + } else { + gtkWindow.get_scrollbar().hide(); + } + } + + void ConfigureScrollbar(double min, double max, double pageSize) override { + auto adjustment = gtkWindow.get_scrollbar().get_adjustment(); + adjustment->configure(adjustment->get_value(), min, max, 1, 4, pageSize); + } + + double GetScrollbarPosition() override { + return gtkWindow.get_scrollbar().get_adjustment()->get_value(); + } + + void SetScrollbarPosition(double pos) override { + return gtkWindow.get_scrollbar().get_adjustment()->set_value(pos); + } + + void Invalidate() override { + gtkWindow.get_gl_widget().queue_render(); + } +}; + +WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { + auto window = std::make_shared(kind); + if(parentWindow) { + window->gtkWindow.set_transient_for( + std::static_pointer_cast(parentWindow)->gtkWindow); + } + return window; +} + +//----------------------------------------------------------------------------- +// 3DConnexion support +//----------------------------------------------------------------------------- + +void Open3DConnexion() {} +void Close3DConnexion() {} + +#if defined(HAVE_SPACEWARE) && (defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)) +static void ProcessSpnavEvent(WindowImplGtk *window, const spnav_event &spnavEvent, bool shiftDown, bool controlDown) { + switch(spnavEvent.type) { + case SPNAV_EVENT_MOTION: { + SixDofEvent event = {}; + event.type = SixDofEvent::Type::MOTION; + event.translationX = (double)spnavEvent.motion.x; + event.translationY = (double)spnavEvent.motion.y; + event.translationZ = (double)spnavEvent.motion.z * -1.0; + event.rotationX = (double)spnavEvent.motion.rx * 0.001; + event.rotationY = (double)spnavEvent.motion.ry * 0.001; + event.rotationZ = (double)spnavEvent.motion.rz * -0.001; + event.shiftDown = shiftDown; + event.controlDown = controlDown; + if(window->onSixDofEvent) { + window->onSixDofEvent(event); + } + break; + } + + case SPNAV_EVENT_BUTTON: + SixDofEvent event = {}; + if(spnavEvent.button.press) { + event.type = SixDofEvent::Type::PRESS; + } else { + event.type = SixDofEvent::Type::RELEASE; + } + switch(spnavEvent.button.bnum) { + case 0: event.button = SixDofEvent::Button::FIT; break; + default: return; + } + event.shiftDown = shiftDown; + event.controlDown = controlDown; + if(window->onSixDofEvent) { + window->onSixDofEvent(event); + } + break; + } +} + +static GdkFilterReturn GdkSpnavFilter(GdkXEvent *gdkXEvent, GdkEvent *gdkEvent, gpointer data) { + XEvent *xEvent = (XEvent *)gdkXEvent; + WindowImplGtk *window = (WindowImplGtk *)data; + bool shiftDown = (xEvent->xmotion.state & ShiftMask) != 0; + bool controlDown = (xEvent->xmotion.state & ControlMask) != 0; + + spnav_event spnavEvent; + if(spnav_x11_event(xEvent, &spnavEvent)) { + ProcessSpnavEvent(window, spnavEvent, shiftDown, controlDown); + return GDK_FILTER_REMOVE; + } + return GDK_FILTER_CONTINUE; +} + +static gboolean ConsumeSpnavQueue(GIOChannel *, GIOCondition, gpointer data) { + WindowImplGtk *window = (WindowImplGtk *)data; + Glib::RefPtr gdkWindow = window->gtkWindow.get_window(); + + // We don't get modifier state through the socket. + int x, y; + Gdk::ModifierType mask{}; +#if GTK_CHECK_VERSION(3, 20, 0) + Glib::RefPtr device = gdkWindow->get_display()->get_default_seat()->get_pointer(); +#else + Glib::RefPtr device = gdkWindow->get_display()->get_device_manager()->get_client_pointer(); +#endif + gdkWindow->get_device_position(device, x, y, mask); + bool shiftDown = (mask & Gdk::SHIFT_MASK) != 0; + bool controlDown = (mask & Gdk::CONTROL_MASK) != 0; + + spnav_event spnavEvent; + while(spnav_poll_event(&spnavEvent)) { + ProcessSpnavEvent(window, spnavEvent, shiftDown, controlDown); + } + return TRUE; +} + +void Request3DConnexionEventsForWindow(WindowRef window) { + std::shared_ptr windowImpl = + std::static_pointer_cast(window); + + Glib::RefPtr gdkWindow = windowImpl->gtkWindow.get_window(); +#if defined(GDK_WINDOWING_X11) + if(GDK_IS_X11_DISPLAY(gdkWindow->get_display()->gobj())) { + if(spnav_x11_open(gdk_x11_get_default_xdisplay(), + gdk_x11_window_get_xid(gdkWindow->gobj())) != -1) { + gdkWindow->add_filter(GdkSpnavFilter, windowImpl.get()); + } else if(spnav_open() != -1) { + g_io_add_watch(g_io_channel_unix_new(spnav_fd()), G_IO_IN, + ConsumeSpnavQueue, windowImpl.get()); + } + } +#endif +#if defined(GDK_WINDOWING_WAYLAND) + if(GDK_IS_WAYLAND_DISPLAY(gdkWindow->get_display()->gobj())) { + if(spnav_open() != -1) { + g_io_add_watch(g_io_channel_unix_new(spnav_fd()), G_IO_IN, + ConsumeSpnavQueue, windowImpl.get()); + } + } +#endif + +} +#else +void Request3DConnexionEventsForWindow(WindowRef window) {} +#endif + +//----------------------------------------------------------------------------- +// Message dialogs +//----------------------------------------------------------------------------- + +class MessageDialogImplGtk; + +static std::vector> shownMessageDialogs; + +class MessageDialogImplGtk final : public MessageDialog, + public std::enable_shared_from_this { +public: + Gtk::Image gtkImage; + Gtk::MessageDialog gtkDialog; + + MessageDialogImplGtk(Gtk::Window &parent) + : gtkDialog(parent, "", /*use_markup=*/false, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_NONE, /*modal=*/true) + { + SetTitle("Message"); + } + + void SetType(Type type) override { + switch(type) { + case Type::INFORMATION: + gtkImage.set_from_icon_name("dialog-information", Gtk::ICON_SIZE_DIALOG); + break; + + case Type::QUESTION: + gtkImage.set_from_icon_name("dialog-question", Gtk::ICON_SIZE_DIALOG); + break; + + case Type::WARNING: + gtkImage.set_from_icon_name("dialog-warning", Gtk::ICON_SIZE_DIALOG); + break; + + case Type::ERROR: + gtkImage.set_from_icon_name("dialog-error", Gtk::ICON_SIZE_DIALOG); + break; + } + gtkDialog.set_image(gtkImage); + } + + void SetTitle(std::string title) override { + gtkDialog.set_title(PrepareTitle(title)); + } + + void SetMessage(std::string message) override { + gtkDialog.set_message(message); + } + + void SetDescription(std::string description) override { + gtkDialog.set_secondary_text(description); + } + + void AddButton(std::string label, Response response, bool isDefault) override { + int responseId = 0; + switch(response) { + case Response::NONE: ssassert(false, "Unexpected response"); + case Response::OK: responseId = Gtk::RESPONSE_OK; break; + case Response::YES: responseId = Gtk::RESPONSE_YES; break; + case Response::NO: responseId = Gtk::RESPONSE_NO; break; + case Response::CANCEL: responseId = Gtk::RESPONSE_CANCEL; break; + } + gtkDialog.add_button(PrepareMnemonics(label), responseId); + if(isDefault) { + gtkDialog.set_default_response(responseId); + } + } + + Response ProcessResponse(int gtkResponse) { + Response response; + switch(gtkResponse) { + case Gtk::RESPONSE_OK: response = Response::OK; break; + case Gtk::RESPONSE_YES: response = Response::YES; break; + case Gtk::RESPONSE_NO: response = Response::NO; break; + case Gtk::RESPONSE_CANCEL: response = Response::CANCEL; break; + + case Gtk::RESPONSE_NONE: + case Gtk::RESPONSE_CLOSE: + case Gtk::RESPONSE_DELETE_EVENT: + response = Response::NONE; + break; + + default: ssassert(false, "Unexpected response"); + } + + if(onResponse) { + onResponse(response); + } + return response; + } + + void ShowModal() override { + gtkDialog.signal_hide().connect([this] { + auto it = std::remove(shownMessageDialogs.begin(), shownMessageDialogs.end(), + shared_from_this()); + shownMessageDialogs.erase(it); + }); + shownMessageDialogs.push_back(shared_from_this()); + + gtkDialog.signal_response().connect([this](int gtkResponse) { + ProcessResponse(gtkResponse); + gtkDialog.hide(); + }); + gtkDialog.show(); + } + + Response RunModal() override { + return ProcessResponse(gtkDialog.run()); + } +}; + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow) { + return std::make_shared( + std::static_pointer_cast(parentWindow)->gtkWindow); +} + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +class FileDialogImplGtk : public FileDialog { +public: + Gtk::FileChooser *gtkChooser; + std::vector extensions; + + void InitFileChooser(Gtk::FileChooser &chooser) { + gtkChooser = &chooser; + gtkChooser->property_filter().signal_changed(). + connect(sigc::mem_fun(this, &FileDialogImplGtk::FilterChanged)); + } + + void SetCurrentName(std::string name) override { + gtkChooser->set_current_name(name); + } + + Platform::Path GetFilename() override { + return Path::From(gtkChooser->get_filename()); + } + + void SetFilename(Platform::Path path) override { + gtkChooser->set_filename(path.raw); + } + + void SuggestFilename(Platform::Path path) override { + gtkChooser->set_current_name(path.FileStem()+"."+GetExtension()); + } + + void AddFilter(std::string name, std::vector extensions) override { + Glib::RefPtr gtkFilter = Gtk::FileFilter::create(); + Glib::ustring desc; + for(auto extension : extensions) { + Glib::ustring pattern = "*"; + if(!extension.empty()) { + pattern = "*." + extension; + gtkFilter->add_pattern(pattern); + gtkFilter->add_pattern(Glib::ustring(pattern).uppercase()); + } + if(!desc.empty()) { + desc += ", "; + } + desc += pattern; + } + gtkFilter->set_name(name + " (" + desc + ")"); + + this->extensions.push_back(extensions.front()); + gtkChooser->add_filter(gtkFilter); + } + + std::string GetExtension() { + auto filters = gtkChooser->list_filters(); + size_t filterIndex = + std::find(filters.begin(), filters.end(), gtkChooser->get_filter()) - + filters.begin(); + if(filterIndex < extensions.size()) { + return extensions[filterIndex]; + } else { + return extensions.front(); + } + } + + void SetExtension(std::string extension) { + auto filters = gtkChooser->list_filters(); + size_t extensionIndex = + std::find(extensions.begin(), extensions.end(), extension) - + extensions.begin(); + if(extensionIndex < filters.size()) { + gtkChooser->set_filter(filters[extensionIndex]); + } else { + gtkChooser->set_filter(filters.front()); + } + } + +//TODO: This is not getting called when the extension selection is changed. + void FilterChanged() { + std::string extension = GetExtension(); + if(extension.empty()) + return; + + Platform::Path path = GetFilename(); + if(gtkChooser->get_action() != Gtk::FILE_CHOOSER_ACTION_OPEN) { + SetCurrentName(path.WithExtension(extension).FileName()); + } + } + + void FreezeChoices(SettingsRef settings, const std::string &key) override { + settings->FreezeString("Dialog_" + key + "_Folder", + gtkChooser->get_current_folder()); + settings->FreezeString("Dialog_" + key + "_Filter", GetExtension()); + } + + void ThawChoices(SettingsRef settings, const std::string &key) override { + gtkChooser->set_current_folder(settings->ThawString("Dialog_" + key + "_Folder")); + SetExtension(settings->ThawString("Dialog_" + key + "_Filter")); + } + + void CheckForUntitledFile() { + if(gtkChooser->get_action() == Gtk::FILE_CHOOSER_ACTION_SAVE && + Path::From(gtkChooser->get_current_name()).FileStem().empty()) { + gtkChooser->set_current_name(std::string(_("untitled")) + "." + GetExtension()); + } + } +}; + +class FileDialogGtkImplGtk final : public FileDialogImplGtk { +public: + Gtk::FileChooserDialog gtkDialog; + + FileDialogGtkImplGtk(Gtk::Window >kParent, bool isSave) + : gtkDialog(gtkParent, + isSave ? C_("title", "Save File") + : C_("title", "Open File"), + isSave ? Gtk::FILE_CHOOSER_ACTION_SAVE + : Gtk::FILE_CHOOSER_ACTION_OPEN) { + gtkDialog.add_button(C_("button", "_Cancel"), Gtk::RESPONSE_CANCEL); + gtkDialog.add_button(isSave ? C_("button", "_Save") + : C_("button", "_Open"), Gtk::RESPONSE_OK); + gtkDialog.set_default_response(Gtk::RESPONSE_OK); + if(isSave) { + gtkDialog.set_do_overwrite_confirmation(true); + } + InitFileChooser(gtkDialog); + } + + void SetTitle(std::string title) override { + gtkDialog.set_title(PrepareTitle(title)); + } + + bool RunModal() override { + CheckForUntitledFile(); + if(gtkDialog.run() == Gtk::RESPONSE_OK) { + return true; + } else { + return false; + } + } +}; + +#if defined(HAVE_GTK_FILECHOOSERNATIVE) + +class FileDialogNativeImplGtk final : public FileDialogImplGtk { +public: + Glib::RefPtr gtkNative; + + FileDialogNativeImplGtk(Gtk::Window >kParent, bool isSave) { + gtkNative = Gtk::FileChooserNative::create( + isSave ? C_("title", "Save File") + : C_("title", "Open File"), + gtkParent, + isSave ? Gtk::FILE_CHOOSER_ACTION_SAVE + : Gtk::FILE_CHOOSER_ACTION_OPEN, + isSave ? C_("button", "_Save") + : C_("button", "_Open"), + C_("button", "_Cancel")); + if(isSave) { + gtkNative->set_do_overwrite_confirmation(true); + } + // Seriously, GTK?! + InitFileChooser(*gtkNative.operator->()); + } + + void SetTitle(std::string title) override { + gtkNative->set_title(PrepareTitle(title)); + } + + bool RunModal() override { + CheckForUntitledFile(); + if(gtkNative->run() == Gtk::RESPONSE_ACCEPT) { + return true; + } else { + return false; + } + } +}; + +#endif + +#if defined(HAVE_GTK_FILECHOOSERNATIVE) +# define FILE_DIALOG_IMPL FileDialogNativeImplGtk +#else +# define FILE_DIALOG_IMPL FileDialogGtkImplGtk +#endif + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow) { + Gtk::Window >kParent = std::static_pointer_cast(parentWindow)->gtkWindow; + return std::make_shared(gtkParent, /*isSave=*/false); +} + +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow) { + Gtk::Window >kParent = std::static_pointer_cast(parentWindow)->gtkWindow; + return std::make_shared(gtkParent, /*isSave=*/true); +} + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector GetFontFiles() { + std::vector fonts; + + // fontconfig is already initialized by GTK + FcPattern *pat = FcPatternCreate(); + FcObjectSet *os = FcObjectSetBuild(FC_FILE, (char *)0); + FcFontSet *fs = FcFontList(0, pat, os); + + for(int i = 0; i < fs->nfont; i++) { + FcChar8 *filenameFC = FcPatternFormat(fs->fonts[i], (const FcChar8*) "%{file}"); + fonts.push_back(Platform::Path::From((const char *)filenameFC)); + FcStrFree(filenameFC); + } + + FcFontSetDestroy(fs); + FcObjectSetDestroy(os); + FcPatternDestroy(pat); + + return fonts; +} + +void OpenInBrowser(const std::string &url) { + // first param should be our window? + gtk_show_uri_on_window(NULL, url.c_str(), GDK_CURRENT_TIME, NULL); +} + +Gtk::Main *gtkMain; + +std::vector InitGui(int argc, char **argv) { + // It would in principle be possible to judiciously use Glib::filename_{from,to}_utf8, + // but it's not really worth the effort. + // The setlocale() call is necessary for Glib::get_charset() to detect the system + // character set; otherwise it thinks it is always ANSI_X3.4-1968. + // We set it back to C after all so that printf() and friends behave in a consistent way. + setlocale(LC_ALL, ""); + if(!Glib::get_charset()) { + dbp("Sorry, only UTF-8 locales are supported."); + exit(1); + } + setlocale(LC_ALL, "C"); + + // Let GTK parse arguments and update argc/argv. (They're passed by reference.) + gtkMain = new Gtk::Main(argc, argv, /*set_locale=*/false); + + // Now that GTK arguments are removed, grab arguments for ourselves. + std::vector args = InitCli(argc, argv); + + // Add our application-specific styles, to override GTK defaults. + Glib::RefPtr style_provider = Gtk::CssProvider::create(); + style_provider->load_from_data(R"( + entry { + background: white; + color: black; + } + )"); + Gtk::StyleContext::add_provider_for_screen( + Gdk::Screen::get_default(), style_provider, + 600 /*Gtk::STYLE_PROVIDER_PRIORITY_APPLICATION*/); + + // Set locale from user preferences. + // This apparently only consults the LANGUAGE environment variable. + const char* const* langNames = g_get_language_names(); + while(*langNames) { + if(SetLocale(*langNames++)) break; + } + if(!*langNames) { + SetLocale("en_US"); + } + + return args; +} + +void RunGui() { + Gtk::Main::run(); +} + +void ExitGui() { + Gtk::Main::quit(); +} + +void ClearGui() { + delete gtkMain; +} + +} +} diff --git a/src/platform/guihtml.cpp b/src/platform/guihtml.cpp new file mode 100644 index 0000000..2625f8e --- /dev/null +++ b/src/platform/guihtml.cpp @@ -0,0 +1,1449 @@ +//----------------------------------------------------------------------------- +// The Emscripten-based implementation of platform-dependent GUI functionality. +// +// Copyright 2018 whitequark +//----------------------------------------------------------------------------- +#include +#include +#include +#include +#include "config.h" +#include "solvespace.h" + +using namespace emscripten; + +EMSCRIPTEN_BINDINGS(solvespace) { + emscripten::class_>("VoidFunctor") + .constructor<>() + .function("opcall", &std::function::operator()); + + emscripten::class_>("Void1Functor") + .constructor<>() + .function("opcall", &std::function::operator()); +} + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Emscripten API bridging +//----------------------------------------------------------------------------- + +#define sscheck(expr) do { \ + EMSCRIPTEN_RESULT emResult = (EMSCRIPTEN_RESULT)(expr); \ + if(emResult < 0) \ + HandleError(__FILE__, __LINE__, __func__, #expr, emResult); \ + } while(0) + +static void HandleError(const char *file, int line, const char *function, const char *expr, + EMSCRIPTEN_RESULT emResult) { + const char *error = "Unknown error"; + switch(emResult) { + case EMSCRIPTEN_RESULT_DEFERRED: error = "Deferred"; break; + case EMSCRIPTEN_RESULT_NOT_SUPPORTED: error = "Not supported"; break; + case EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED: error = "Failed (not deferred)"; break; + case EMSCRIPTEN_RESULT_INVALID_TARGET: error = "Invalid target"; break; + case EMSCRIPTEN_RESULT_UNKNOWN_TARGET: error = "Unknown target"; break; + case EMSCRIPTEN_RESULT_INVALID_PARAM: error = "Invalid parameter"; break; + case EMSCRIPTEN_RESULT_FAILED: error = "Failed"; break; + case EMSCRIPTEN_RESULT_NO_DATA: error = "No data"; break; + } + + std::string message; + message += ssprintf("File %s, line %u, function %s:\n", file, line, function); + message += ssprintf("Emscripten API call failed: %s.\n", expr); + message += ssprintf("Error: %s\n", error); + FatalError(message); +} + +static val Wrap(const std::function &functor) { + return val(functor)["opcall"].call("bind", val(functor)); +} + +static void RegisterEventListener(const val &target, std::string event, std::function functor) { + std::function wrapper = [functor](val) { if(functor) functor(); }; + val wrapped = val(wrapper)["opcall"].call("bind", val(wrapper)); + target.call("addEventListener", event, wrapped); +} + +//----------------------------------------------------------------------------- +// Fatal errors +//----------------------------------------------------------------------------- + +void FatalError(const std::string &message) { + dbp("%s", message.c_str()); +#ifndef NDEBUG + emscripten_debugger(); +#endif + abort(); +} + +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +class SettingsImplHtml : public Settings { +public: + void FreezeInt(const std::string &key, uint32_t value) { + val::global("localStorage").call("setItem", key, value); + } + + uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) { + val value = val::global("localStorage").call("getItem", key); + if(value == val::null()) + return defaultValue; + return val::global("parseInt")(value, 0).as(); + } + + void FreezeFloat(const std::string &key, double value) { + val::global("localStorage").call("setItem", key, value); + } + + double ThawFloat(const std::string &key, double defaultValue = 0.0) { + val value = val::global("localStorage").call("getItem", key); + if(value == val::null()) + return defaultValue; + return val::global("parseFloat")(value).as(); + } + + void FreezeString(const std::string &key, const std::string &value) { + val::global("localStorage").call("setItem", key, value); + } + + std::string ThawString(const std::string &key, + const std::string &defaultValue = "") { + val value = val::global("localStorage").call("getItem", key); + if(value == val::null()) { + return defaultValue; + } + return value.as(); + } +}; + +SettingsRef GetSettings() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Timers +//----------------------------------------------------------------------------- + +class TimerImplHtml : public Timer { +public: + static void Callback(void *arg) { + TimerImplHtml *timer = (TimerImplHtml *)arg; + if(timer->onTimeout) { + timer->onTimeout(); + } + } + + void RunAfter(unsigned milliseconds) override { + emscripten_async_call(TimerImplHtml::Callback, this, milliseconds + 1); + } + + void RunAfterNextFrame() override { + emscripten_async_call(TimerImplHtml::Callback, this, 0); + } + + void RunAfterProcessingEvents() override { + emscripten_push_uncounted_main_loop_blocker(TimerImplHtml::Callback, this); + } +}; + +TimerRef CreateTimer() { + return std::unique_ptr(new TimerImplHtml); +} + +//----------------------------------------------------------------------------- +// Menus +//----------------------------------------------------------------------------- + +class MenuItemImplHtml : public MenuItem { +public: + val htmlMenuItem; + + MenuItemImplHtml() : + htmlMenuItem(val::global("document").call("createElement", val("li"))) + {} + + void SetAccelerator(KeyboardEvent accel) override { + val htmlAccel = htmlMenuItem.call("querySelector", val(".accel")); + if(htmlAccel.as()) { + htmlAccel.call("remove"); + } + htmlAccel = val::global("document").call("createElement", val("span")); + htmlAccel.call("setAttribute", val("class"), val("accel")); + htmlAccel.set("innerText", AcceleratorDescription(accel)); + htmlMenuItem.call("appendChild", htmlAccel); + } + + void SetIndicator(Indicator type) override { + val htmlClasses = htmlMenuItem["classList"]; + htmlClasses.call("remove", val("check")); + htmlClasses.call("remove", val("radio")); + switch(type) { + case Indicator::NONE: + break; + + case Indicator::CHECK_MARK: + htmlClasses.call("add", val("check")); + break; + + case Indicator::RADIO_MARK: + htmlClasses.call("add", val("radio")); + break; + } + } + + void SetEnabled(bool enabled) override { + if(enabled) { + htmlMenuItem["classList"].call("remove", val("disabled")); + } else { + htmlMenuItem["classList"].call("add", val("disabled")); + } + } + + void SetActive(bool active) override { + if(active) { + htmlMenuItem["classList"].call("add", val("active")); + } else { + htmlMenuItem["classList"].call("remove", val("active")); + } + } +}; + +class MenuImplHtml; + +static std::shared_ptr popupMenuOnScreen; + +class MenuImplHtml : public Menu, + public std::enable_shared_from_this { +public: + val htmlMenu; + + std::vector> menuItems; + std::vector> subMenus; + + std::function popupDismissFunc; + + MenuImplHtml() : + htmlMenu(val::global("document").call("createElement", val("ul"))) + { + htmlMenu["classList"].call("add", val("menu")); + } + + MenuItemRef AddItem(const std::string &label, std::function onTrigger, + bool mnemonics = true) override { + std::shared_ptr menuItem = std::make_shared(); + menuItems.push_back(menuItem); + menuItem->onTrigger = onTrigger; + + if(mnemonics) { + val::global("window").call("setLabelWithMnemonic", menuItem->htmlMenuItem, + label); + } else { + val htmlLabel = val::global("document").call("createElement", val("span")); + htmlLabel["classList"].call("add", val("label")); + htmlLabel.set("innerText", label); + menuItem->htmlMenuItem.call("appendChild", htmlLabel); + } + RegisterEventListener(menuItem->htmlMenuItem, "trigger", [menuItem]() { + if(menuItem->onTrigger) { + menuItem->onTrigger(); + } + }); + htmlMenu.call("appendChild", menuItem->htmlMenuItem); + return menuItem; + } + + std::shared_ptr AddSubMenu(const std::string &label) override { + val htmlMenuItem = val::global("document").call("createElement", val("li")); + val::global("window").call("setLabelWithMnemonic", htmlMenuItem, label); + htmlMenuItem["classList"].call("add", val("has-submenu")); + htmlMenu.call("appendChild", htmlMenuItem); + + std::shared_ptr subMenu = std::make_shared(); + subMenus.push_back(subMenu); + htmlMenuItem.call("appendChild", subMenu->htmlMenu); + return subMenu; + } + + void AddSeparator() override { + val htmlSeparator = val::global("document").call("createElement", val("li")); + htmlSeparator["classList"].call("add", val("separator")); + htmlMenu.call("appendChild", htmlSeparator); + } + + void PopUp() override { + if(popupMenuOnScreen) { + popupMenuOnScreen->htmlMenu.call("remove"); + popupMenuOnScreen = NULL; + } + + EmscriptenMouseEvent emStatus = {}; + sscheck(emscripten_get_mouse_status(&emStatus)); + htmlMenu["classList"].call("add", val("popup")); + htmlMenu["style"].set("left", std::to_string(emStatus.clientX) + "px"); + htmlMenu["style"].set("top", std::to_string(emStatus.clientY) + "px"); + + val::global("document")["body"].call("appendChild", htmlMenu); + popupMenuOnScreen = shared_from_this(); + } + + void Clear() override { + while(htmlMenu["childElementCount"].as() > 0) { + htmlMenu["firstChild"].call("remove"); + } + } +}; + +MenuRef CreateMenu() { + return std::make_shared(); +} + +class MenuBarImplHtml final : public MenuBar { +public: + val htmlMenuBar; + + std::vector> subMenus; + + MenuBarImplHtml() : + htmlMenuBar(val::global("document").call("createElement", val("ul"))) + { + htmlMenuBar["classList"].call("add", val("menu")); + htmlMenuBar["classList"].call("add", val("menubar")); + } + + std::shared_ptr AddSubMenu(const std::string &label) override { + val htmlMenuItem = val::global("document").call("createElement", val("li")); + val::global("window").call("setLabelWithMnemonic", htmlMenuItem, label); + htmlMenuBar.call("appendChild", htmlMenuItem); + + std::shared_ptr subMenu = std::make_shared(); + subMenus.push_back(subMenu); + htmlMenuItem.call("appendChild", subMenu->htmlMenu); + return subMenu; + } + + void Clear() override { + while(htmlMenuBar["childElementCount"].as() > 0) { + htmlMenuBar["firstChild"].call("remove"); + } + } +}; + +MenuBarRef GetOrCreateMainMenu(bool *unique) { + *unique = false; + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Windows +//----------------------------------------------------------------------------- + +class TouchEventHelper { +public: + // FIXME(emscripten): Workaround. touchstart and touchend repeats two times. + bool touchActionStarted = false; + + int previousNumTouches = 0; + + double centerX = 0; + double centerY = 0; + + // double startPinchDistance = 0; + double previousPinchDistance = 0; + + std::function onPointerDown; + std::function onPointerMove; + std::function onPointerUp; + std::function onScroll; + + void clear(void) { + touchActionStarted = false; + previousNumTouches = 0; + centerX = 0; + centerY = 0; + // startPinchDistance = 0; + previousPinchDistance = 0; + } + + void calculateCenterPosition(const EmscriptenTouchEvent& emEvent, double& dst_x, double& dst_y) { + double x = 0; + double y = 0; + for (int i = 0; i < emEvent.numTouches; i++) { + x += emEvent.touches[i].targetX; + y += emEvent.touches[i].targetY; + } + dst_x = x / emEvent.numTouches; + dst_y = y / emEvent.numTouches; + } + + void calculatePinchDistance(const EmscriptenTouchEvent& emEvent, double& dst_distance) { + if (emEvent.numTouches < 2) { + return; + } + double x1 = emEvent.touches[0].targetX; + double y1 = emEvent.touches[0].targetY; + double x2 = emEvent.touches[1].targetX; + double y2 = emEvent.touches[1].targetY; + dst_distance = std::sqrt(std::pow(x1 - x2, 2) + std::pow(y1 - y2, 2)); + } + + void createMouseEventPRESS(const EmscriptenTouchEvent& emEvent, MouseEvent& dst_mouseevent) { + double x = 0, y = 0; + this->calculateCenterPosition(emEvent, x, y); + this->centerX = x; + this->centerY = y; + this->touchActionStarted = true; + this->previousNumTouches = emEvent.numTouches; + dst_mouseevent.type = MouseEvent::Type::PRESS; + dst_mouseevent.x = x; + dst_mouseevent.y = y; + dst_mouseevent.shiftDown = emEvent.shiftKey; + dst_mouseevent.controlDown = emEvent.ctrlKey; + switch(emEvent.numTouches) { + case 1: + dst_mouseevent.button = MouseEvent::Button::LEFT; + break; + case 2: { + dst_mouseevent.button = MouseEvent::Button::RIGHT; + // double distance = 0; + this->calculatePinchDistance(emEvent, this->previousPinchDistance); + // this->startPinchDistance = distance; + // this->previousPinchDistance = distance; + break; + } + default: + dst_mouseevent.button = MouseEvent::Button::MIDDLE; + break; + } + } + + void createMouseEventRELEASE(const EmscriptenTouchEvent& emEvent, MouseEvent& dst_mouseevent) { + this->calculateCenterPosition(emEvent, this->centerX, this->centerY); + this->previousNumTouches = 0; + dst_mouseevent.type = MouseEvent::Type::RELEASE; + dst_mouseevent.x = this->centerX; + dst_mouseevent.y = this->centerY; + dst_mouseevent.shiftDown = emEvent.shiftKey; + dst_mouseevent.controlDown = emEvent.ctrlKey; + switch(this->previousNumTouches) { + case 1: + dst_mouseevent.button = MouseEvent::Button::LEFT; + break; + case 2: + dst_mouseevent.button = MouseEvent::Button::RIGHT; + break; + default: + dst_mouseevent.button = MouseEvent::Button::MIDDLE; + break; + } + } + + void createMouseEventMOTION(const EmscriptenTouchEvent& emEvent, MouseEvent& dst_mouseevent) { + dst_mouseevent.type = MouseEvent::Type::MOTION; + this->calculateCenterPosition(emEvent, this->centerX, this->centerY); + dst_mouseevent.x = this->centerX; + dst_mouseevent.y = this->centerY; + dst_mouseevent.shiftDown = emEvent.shiftKey; + dst_mouseevent.controlDown = emEvent.ctrlKey; + switch(emEvent.numTouches) { + case 1: + dst_mouseevent.button = MouseEvent::Button::LEFT; + break; + case 2: + dst_mouseevent.button = MouseEvent::Button::RIGHT; + break; + default: + dst_mouseevent.button = MouseEvent::Button::MIDDLE; + break; + } + } + + void createMouseEventSCROLL(const EmscriptenTouchEvent& emEvent, MouseEvent& event) { + event.type = MouseEvent::Type::SCROLL_VERT; + double newDistance = 0; + this->calculatePinchDistance(emEvent, newDistance); + this->calculateCenterPosition(emEvent, this->centerX, this->centerY); + event.x = this->centerX; + event.y = this->centerY; + event.shiftDown = emEvent.shiftKey; + event.controlDown = emEvent.ctrlKey; + // FIXME(emscripten): best value range for scrollDelta ? + event.scrollDelta = (newDistance - this->previousPinchDistance) / 25.0; + if (std::abs(event.scrollDelta) > 2) { + event.scrollDelta = 2; + if (std::signbit(event.scrollDelta)) { + event.scrollDelta *= -1.0; + } + } + this->previousPinchDistance = newDistance; + } + + void onTouchStart(const EmscriptenTouchEvent& emEvent, void* callbackParameter) { + if (this->touchActionStarted) { + // dbp("onTouchStart(): Break due to already started."); + return; + } + + MouseEvent event; + this->createMouseEventPRESS(emEvent, event); + this->previousNumTouches = emEvent.numTouches; + if (this->onPointerDown) { + // dbp("onPointerDown(): numTouches=%d, timestamp=%f", emEvent.numTouches, emEvent.timestamp); + this->onPointerDown(&event, callbackParameter); + } + } + + void onTouchMove(const EmscriptenTouchEvent& emEvent, void* callbackParameter) { + this->calculateCenterPosition(emEvent, this->centerX, this->centerY); + int newNumTouches = emEvent.numTouches; + if (newNumTouches != this->previousNumTouches) { + MouseEvent releaseEvent; + + this->createMouseEventRELEASE(emEvent, releaseEvent); + if (this->onPointerUp) { + // dbp("onPointerUp(): numTouches=%d, timestamp=%f", emEvent.numTouches, emEvent.timestamp); + this->onPointerUp(&releaseEvent, callbackParameter); + } + + MouseEvent pressEvent; + + this->createMouseEventPRESS(emEvent, pressEvent); + if (this->onPointerDown) { + // dbp("onPointerDown(): numTouches=%d, timestamp=%f", emEvent.numTouches, emEvent.timestamp); + this->onPointerDown(&pressEvent, callbackParameter); + } + } + + MouseEvent motionEvent = { }; + this->createMouseEventMOTION(emEvent, motionEvent); + + if (this->onPointerMove) { + // dbp("onPointerMove(): numTouches=%d, timestamp=%f", emEvent.numTouches, emEvent.timestamp); + this->onPointerMove(&motionEvent, callbackParameter); + } + + if (emEvent.numTouches == 2) { + MouseEvent scrollEvent; + this->createMouseEventSCROLL(emEvent, scrollEvent); + if (scrollEvent.scrollDelta != 0) { + if (this->onScroll) { + // dbp("Scroll %f", scrollEvent.scrollDelta); + this->onScroll(&scrollEvent, callbackParameter); + } + } + } + + this->previousNumTouches = emEvent.numTouches; + } + + void onTouchEnd(const EmscriptenTouchEvent& emEvent, void* callbackParameter) { + if (!this->touchActionStarted) { + return; + } + + MouseEvent releaseEvent = { }; + this->createMouseEventRELEASE(emEvent, releaseEvent); + + if (this->onPointerUp) { + // dbp("onPointerUp(): numTouches=%d, timestamp=%d", emEvent.numTouches, emEvent.timestamp); + this->onPointerUp(&releaseEvent, callbackParameter); + } + + this->clear(); + } + + void onTouchCancel(const EmscriptenTouchEvent& emEvent, void* callbackParameter) { + this->onTouchEnd(emEvent, callbackParameter); + } +}; + +static TouchEventHelper touchEventHelper; + +static KeyboardEvent handledKeyboardEvent; + +class WindowImplHtml final : public Window { +public: + std::string emCanvasSel; + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE emContext = 0; + + val htmlContainer; + val htmlEditor; + val scrollbarHelper; + + std::shared_ptr menuBar; + + WindowImplHtml(val htmlContainer, std::string emCanvasSel) : + emCanvasSel(emCanvasSel), + htmlContainer(htmlContainer), + htmlEditor(val::global("document").call("createElement", val("input"))) + { + htmlEditor["classList"].call("add", val("editor")); + htmlEditor["style"].set("display", "none"); + auto editingDoneFunc = [this] { + if(onEditingDone) { + onEditingDone(htmlEditor["value"].as()); + } + }; + RegisterEventListener(htmlEditor, "trigger", editingDoneFunc); + htmlContainer["parentElement"].call("appendChild", htmlEditor); + + std::string scrollbarElementQuery = emCanvasSel + "scrollbar"; + dbp("scrollbar element query: \"%s\"", scrollbarElementQuery.c_str()); + val scrollbarElement = val::global("document").call("querySelector", val(scrollbarElementQuery)); + if (scrollbarElement == val::null()) { + // dbp("scrollbar element is null."); + this->scrollbarHelper = val::null(); + } else { + dbp("scrollbar element OK."); + this->scrollbarHelper = val::global("window")["ScrollbarHelper"].new_(val(scrollbarElementQuery)); + static std::function onScrollCallback = [this] { + // dbp("onScrollCallback std::function this=%p", (void*)this); + if (this->onScrollbarAdjusted) { + double newpos = this->scrollbarHelper.call("getScrollbarPosition"); + // dbp(" call onScrollbarAdjusted(%f)", newpos); + this->onScrollbarAdjusted(newpos); + } + this->Invalidate(); + }; + this->scrollbarHelper.set("onScrollCallback", Wrap(onScrollCallback)); + } + + sscheck(emscripten_set_resize_callback( + EMSCRIPTEN_EVENT_TARGET_WINDOW, this, /*useCapture=*/false, + WindowImplHtml::ResizeCallback)); + sscheck(emscripten_set_resize_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::ResizeCallback)); + sscheck(emscripten_set_mousemove_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::MouseCallback)); + sscheck(emscripten_set_mousedown_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::MouseCallback)); + sscheck(emscripten_set_click_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::MouseCallback)); + sscheck(emscripten_set_dblclick_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::MouseCallback)); + sscheck(emscripten_set_mouseup_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::MouseCallback)); + sscheck(emscripten_set_mouseleave_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::MouseCallback)); + + sscheck(emscripten_set_touchstart_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::TouchCallback)); + sscheck(emscripten_set_touchmove_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::TouchCallback)); + sscheck(emscripten_set_touchend_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::TouchCallback)); + sscheck(emscripten_set_touchcancel_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::TouchCallback)); + + sscheck(emscripten_set_wheel_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::WheelCallback)); + sscheck(emscripten_set_keydown_callback( + EMSCRIPTEN_EVENT_TARGET_WINDOW, this, /*useCapture=*/false, + WindowImplHtml::KeyboardCallback)); + sscheck(emscripten_set_keyup_callback( + EMSCRIPTEN_EVENT_TARGET_WINDOW, this, /*useCapture=*/false, + WindowImplHtml::KeyboardCallback)); + sscheck(emscripten_set_webglcontextlost_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::ContextLostCallback)); + sscheck(emscripten_set_webglcontextrestored_callback( + emCanvasSel.c_str(), this, /*useCapture=*/false, + WindowImplHtml::ContextRestoredCallback)); + + ResizeCanvasElement(); + SetupWebGLContext(); + } + + ~WindowImplHtml() { + if(emContext != 0) { + sscheck(emscripten_webgl_destroy_context(emContext)); + } + } + + static EM_BOOL ResizeCallback(int emEventType, const EmscriptenUiEvent *emEvent, void *data) { + WindowImplHtml *window = (WindowImplHtml *)data; + window->Invalidate(); + return EM_TRUE; + } + + static EM_BOOL MouseCallback(int emEventType, const EmscriptenMouseEvent *emEvent, + void *data) { + if(val::global("window").call("isModal")) return EM_FALSE; + + WindowImplHtml *window = (WindowImplHtml *)data; + MouseEvent event = {}; + switch(emEventType) { + case EMSCRIPTEN_EVENT_MOUSEMOVE: + event.type = MouseEvent::Type::MOTION; + break; + case EMSCRIPTEN_EVENT_MOUSEDOWN: + event.type = MouseEvent::Type::PRESS; + break; + case EMSCRIPTEN_EVENT_DBLCLICK: + event.type = MouseEvent::Type::DBL_PRESS; + break; + case EMSCRIPTEN_EVENT_MOUSEUP: + event.type = MouseEvent::Type::RELEASE; + break; + case EMSCRIPTEN_EVENT_MOUSELEAVE: + event.type = MouseEvent::Type::LEAVE; + break; + default: + return EM_FALSE; + } + switch(emEventType) { + case EMSCRIPTEN_EVENT_MOUSEMOVE: + if(emEvent->buttons & 1) { + event.button = MouseEvent::Button::LEFT; + } else if(emEvent->buttons & 2) { + event.button = MouseEvent::Button::RIGHT; + } else if(emEvent->buttons & 4) { + event.button = MouseEvent::Button::MIDDLE; + } + break; + case EMSCRIPTEN_EVENT_MOUSEDOWN: + case EMSCRIPTEN_EVENT_DBLCLICK: + case EMSCRIPTEN_EVENT_MOUSEUP: + switch(emEvent->button) { + case 0: event.button = MouseEvent::Button::LEFT; break; + case 1: event.button = MouseEvent::Button::MIDDLE; break; + case 2: event.button = MouseEvent::Button::RIGHT; break; + } + break; + default: + return EM_FALSE; + } + event.x = emEvent->targetX; + event.y = emEvent->targetY; + event.shiftDown = emEvent->shiftKey || emEvent->altKey; + event.controlDown = emEvent->ctrlKey; + + if(window->onMouseEvent) { + return window->onMouseEvent(event); + } + return EM_FALSE; + } + + static EM_BOOL TouchCallback(int emEventType, const EmscriptenTouchEvent *emEvent, + void *data) { + + if(val::global("window").call("isModal")) return EM_FALSE; + + static bool initialized = false; + + WindowImplHtml *window = (WindowImplHtml *)data; + + if (!initialized) { + touchEventHelper.onPointerDown = [](MouseEvent* event, void* param) -> void { + WindowImplHtml* window = (WindowImplHtml*)param; + if (window->onMouseEvent) { + window->onMouseEvent(*event); + } + }; + touchEventHelper.onPointerMove = [](MouseEvent* event, void* param) -> void { + WindowImplHtml* window = (WindowImplHtml*)param; + if (window->onMouseEvent) { + window->onMouseEvent(*event); + } + }; + touchEventHelper.onPointerUp = [](MouseEvent* event, void* param) -> void { + WindowImplHtml* window = (WindowImplHtml*)param; + if (window->onMouseEvent) { + window->onMouseEvent(*event); + } + }; + touchEventHelper.onScroll = [](MouseEvent* event, void* param) -> void { + WindowImplHtml* window = (WindowImplHtml*)param; + if (window->onMouseEvent) { + window->onMouseEvent(*event); + } + }; + initialized = true; + } + + switch(emEventType) { + case EMSCRIPTEN_EVENT_TOUCHSTART: + touchEventHelper.onTouchStart(*emEvent, window); + break; + case EMSCRIPTEN_EVENT_TOUCHMOVE: + touchEventHelper.onTouchMove(*emEvent, window); + break; + case EMSCRIPTEN_EVENT_TOUCHEND: + touchEventHelper.onTouchEnd(*emEvent, window); + break; + case EMSCRIPTEN_EVENT_TOUCHCANCEL: + touchEventHelper.onTouchCancel(*emEvent, window); + break; + default: + return EM_FALSE; + } + + return true; + } + + static EM_BOOL WheelCallback(int emEventType, const EmscriptenWheelEvent *emEvent, + void *data) { + if(val::global("window").call("isModal")) return EM_FALSE; + + WindowImplHtml *window = (WindowImplHtml *)data; + MouseEvent event = {}; + if(emEvent->deltaY != 0) { + event.type = MouseEvent::Type::SCROLL_VERT; + // FIXME(emscripten): + // Pay attention to: + // dbp("Mouse wheel delta mode: %lu", emEvent->deltaMode); + // https://emscripten.org/docs/api_reference/html5.h.html#id11 + // https://www.w3.org/TR/DOM-Level-3-Events/#dom-wheelevent-deltamode + // and adjust the 0.01 below. deltaMode == 0 on a Firefox on a Windows. + event.scrollDelta = -emEvent->deltaY * 0.01; + } else { + return EM_FALSE; + } + + const EmscriptenMouseEvent &emStatus = emEvent->mouse; + event.x = emStatus.targetX; + event.y = emStatus.targetY; + event.shiftDown = emStatus.shiftKey; + event.controlDown = emStatus.ctrlKey; + + if(window->onMouseEvent) { + return window->onMouseEvent(event); + } + return EM_FALSE; + } + + static EM_BOOL KeyboardCallback(int emEventType, const EmscriptenKeyboardEvent *emEvent, + void *data) { + if(emEvent->altKey) return EM_FALSE; + if(emEvent->repeat) return EM_FALSE; + + WindowImplHtml *window = (WindowImplHtml *)data; + KeyboardEvent event = {}; + switch(emEventType) { + case EMSCRIPTEN_EVENT_KEYDOWN: + event.type = KeyboardEvent::Type::PRESS; + break; + + case EMSCRIPTEN_EVENT_KEYUP: + event.type = KeyboardEvent::Type::RELEASE; + break; + + default: + return EM_FALSE; + } + event.shiftDown = emEvent->shiftKey; + event.controlDown = emEvent->ctrlKey; + + std::string key = emEvent->key; + if(key[0] == 'F' && isdigit(key[1])) { + event.key = KeyboardEvent::Key::FUNCTION; + event.num = std::stol(key.substr(1)); + } else { + event.key = KeyboardEvent::Key::CHARACTER; + + auto utf8 = ReadUTF8(key); + if(++utf8.begin() == utf8.end()) { + event.chr = tolower(*utf8.begin()); + } else if(key == "Escape") { + event.chr = '\e'; + } else if(key == "Tab") { + event.chr = '\t'; + } else if(key == "Backspace") { + event.chr = '\b'; + } else if(key == "Delete") { + event.chr = '\x7f'; + } else { + return EM_FALSE; + } + + if(event.chr == '>' && event.shiftDown) { + event.shiftDown = false; + } + } + + if(event.Equals(handledKeyboardEvent)) return EM_FALSE; + if(val::global("window").call("isModal")) { + handledKeyboardEvent = {}; + return EM_FALSE; + } + + if(window->onKeyboardEvent) { + if(window->onKeyboardEvent(event)) { + handledKeyboardEvent = event; + return EM_TRUE; + } + } + return EM_FALSE; + } + + void SetupWebGLContext() { + EmscriptenWebGLContextAttributes emAttribs = {}; + emscripten_webgl_init_context_attributes(&emAttribs); + emAttribs.alpha = false; + emAttribs.failIfMajorPerformanceCaveat = true; + + sscheck(emContext = emscripten_webgl_create_context(emCanvasSel.c_str(), &emAttribs)); + dbp("Canvas %s: got context %d", emCanvasSel.c_str(), emContext); + } + + static bool ContextLostCallback(int eventType, const void *reserved, void *data) { + WindowImplHtml *window = (WindowImplHtml *)data; + dbp("Canvas %s: context lost", window->emCanvasSel.c_str()); + window->emContext = 0; + + if(window->onContextLost) { + window->onContextLost(); + } + return EM_TRUE; + } + + static bool ContextRestoredCallback(int eventType, const void *reserved, void *data) { + WindowImplHtml *window = (WindowImplHtml *)data; + dbp("Canvas %s: context restored", window->emCanvasSel.c_str()); + window->SetupWebGLContext(); + return EM_TRUE; + } + + void ResizeCanvasElement() { + double width, height; + std::string htmlContainerSel = "#" + htmlContainer["id"].as(); + sscheck(emscripten_get_element_css_size(htmlContainerSel.c_str(), &width, &height)); + // sscheck(emscripten_get_element_css_size(emCanvasSel.c_str(), &width, &height)); + + double devicePixelRatio = GetDevicePixelRatio(); + width *= devicePixelRatio; + height *= devicePixelRatio; + + int currentWidth = 0, currentHeight = 0; + sscheck(emscripten_get_canvas_element_size(emCanvasSel.c_str(), ¤tWidth, ¤tHeight)); + + if ((int)width != currentWidth || (int)height != currentHeight) { + // dbp("Canvas %s container current size: (%d, %d)", emCanvasSel.c_str(), (int)currentWidth, (int)currentHeight); + // dbp("Canvas %s: resizing to (%d, %d)", emCanvasSel.c_str(), (int)width, (int)height); + sscheck(emscripten_set_canvas_element_size(emCanvasSel.c_str(), (int)width, (int)height)); + } + } + + static void RenderCallback(void *data) { + WindowImplHtml *window = (WindowImplHtml *)data; + if(window->emContext == 0) { + dbp("Canvas %s: cannot render: no context", window->emCanvasSel.c_str()); + return; + } + + window->ResizeCanvasElement(); + sscheck(emscripten_webgl_make_context_current(window->emContext)); + if(window->onRender) { + window->onRender(); + } + } + + double GetPixelDensity() override { + return 96.0 * GetDevicePixelRatio(); + } + + double GetDevicePixelRatio() override { + return emscripten_get_device_pixel_ratio(); + } + + bool IsVisible() override { + // FIXME(emscripten): implement + return true; + } + + void SetVisible(bool visible) override { + // FIXME(emscripten): implement + } + + void Focus() override { + // Do nothing, we can't affect focus of browser windows. + } + + bool IsFullScreen() override { + EmscriptenFullscreenChangeEvent emEvent = {}; + sscheck(emscripten_get_fullscreen_status(&emEvent)); + return emEvent.isFullscreen; + } + + void SetFullScreen(bool fullScreen) override { + if(fullScreen) { + EmscriptenFullscreenStrategy emStrategy = {}; + emStrategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; + emStrategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF; + emStrategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; + sscheck(emscripten_request_fullscreen_strategy( + emCanvasSel.c_str(), /*deferUntilInEventHandler=*/true, &emStrategy)); + } else { + sscheck(emscripten_exit_fullscreen()); + } + } + + void SetTitle(const std::string &title) override { + // FIXME(emscripten): implement + } + + void SetMenuBar(MenuBarRef menuBar) override { + std::shared_ptr menuBarImpl = + std::static_pointer_cast(menuBar); + this->menuBar = menuBarImpl; + + val htmlMain = val::global("document").call("querySelector", val("main")); + val htmlCurrentMenuBar = htmlMain.call("querySelector", val(".menubar")); + if(htmlCurrentMenuBar.as()) { + htmlCurrentMenuBar.call("remove"); + } + htmlMain.call("insertBefore", menuBarImpl->htmlMenuBar, + htmlMain["firstChild"]); + ResizeCanvasElement(); + } + + void GetContentSize(double *width, double *height) override { + sscheck(emscripten_get_element_css_size(emCanvasSel.c_str(), width, height)); + } + + void SetMinContentSize(double width, double height) override { + // Do nothing, we can't affect sizing of browser windows. + } + + void FreezePosition(SettingsRef settings, const std::string &key) override { + // Do nothing, we can't position browser windows. + } + + void ThawPosition(SettingsRef settings, const std::string &key) override { + // Do nothing, we can't position browser windows. + } + + void SetCursor(Cursor cursor) override { + std::string htmlCursor; + switch(cursor) { + case Cursor::POINTER: htmlCursor = "default"; break; + case Cursor::HAND: htmlCursor = "pointer"; break; + } + htmlContainer["style"].set("cursor", htmlCursor); + } + + void SetTooltip(const std::string &text, double x, double y, + double width, double height) override { + val htmlCanvas = + val::global("document").call("querySelector", emCanvasSel); + htmlCanvas.set("title", text); + } + + bool IsEditorVisible() override { + return htmlEditor["style"]["display"].as() != "none"; + } + + void ShowEditor(double x, double y, double fontHeight, double minWidth, + bool isMonospace, const std::string &text) override { + htmlEditor["style"].set("display", val("")); + val canvasClientRect = val::global("document").call("querySelector", val(this->emCanvasSel)).call("getBoundingClientRect"); + double canvasLeft = canvasClientRect["left"].as(); + double canvasTop = canvasClientRect["top"].as(); + htmlEditor["style"].set("left", std::to_string(canvasLeft + x - 4) + "px"); + htmlEditor["style"].set("top", std::to_string(canvasTop + y - fontHeight - 2) + "px"); + htmlEditor["style"].set("fontSize", std::to_string(fontHeight) + "px"); + htmlEditor["style"].set("minWidth", std::to_string(minWidth) + "px"); + htmlEditor["style"].set("fontFamily", isMonospace ? "monospace" : "sans"); + htmlEditor.set("value", text); + htmlEditor.call("focus"); + } + + void HideEditor() override { + htmlEditor["style"].set("display", val("none")); + } + + void SetScrollbarVisible(bool visible) override { + // dbp("SetScrollbarVisible(): visible=%d", visible ? 1 : 0); + if (this->scrollbarHelper == val::null()) { + // dbp("scrollbarHelper is null."); + return; + } + if (!visible) { + this->scrollbarHelper.call("setScrollbarEnabled", val(false)); + } + } + + double scrollbarPos = 0.0; + double scrollbarMin = 0.0; + double scrollbarMax = 0.0; + double scrollbarPageSize = 0.0; + + void ConfigureScrollbar(double min, double max, double pageSize) override { + // dbp("ConfigureScrollbar(): min=%f, max=%f, pageSize=%f", min, max, pageSize); + if (this->scrollbarHelper == val::null()) { + // dbp("scrollbarHelper is null."); + return; + } + // FIXME(emscripten): implement + this->scrollbarMin = min; + this->scrollbarMax = max; + this->scrollbarPageSize = pageSize; + + this->scrollbarHelper.call("setRange", this->scrollbarMin, this->scrollbarMax); + this->scrollbarHelper.call("setPageSize", pageSize); + } + + double GetScrollbarPosition() override { + // dbp("GetScrollbarPosition()"); + if (this->scrollbarHelper == val::null()) { + // dbp("scrollbarHelper is null."); + return 0; + } + this->scrollbarPos = this->scrollbarHelper.call("getScrollbarPosition"); + // dbp(" GetScrollbarPosition() returns %f", this->scrollbarPos); + return scrollbarPos; + } + + void SetScrollbarPosition(double pos) override { + // dbp("SetScrollbarPosition(): pos=%f", pos); + if (this->scrollbarHelper == val::null()) { + // dbp("scrollbarHelper is null."); + return; + } + this->scrollbarHelper.call("setScrollbarPosition", pos); + scrollbarPos = pos; + } + + void Invalidate() override { + emscripten_async_call(WindowImplHtml::RenderCallback, this, -1); + } +}; + +WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { + static int windowNum; + + std::string htmlContainerId = std::string("container") + std::to_string(windowNum); + val htmlContainer = + val::global("document").call("getElementById", htmlContainerId); + std::string emCanvasSel = std::string("#canvas") + std::to_string(windowNum); + + windowNum++; + return std::make_shared(htmlContainer, emCanvasSel); +} + +//----------------------------------------------------------------------------- +// 3DConnexion support +//----------------------------------------------------------------------------- + +void Open3DConnexion() {} +void Close3DConnexion() {} +void Request3DConnexionEventsForWindow(WindowRef window) {} + +//----------------------------------------------------------------------------- +// Message dialogs +//----------------------------------------------------------------------------- + +class MessageDialogImplHtml; + +static std::vector> dialogsOnScreen; + +class MessageDialogImplHtml final : public MessageDialog, + public std::enable_shared_from_this { +public: + val htmlModal; + val htmlDialog; + val htmlMessage; + val htmlDescription; + val htmlButtons; + + bool is_shown = false; + + Response latestResponse = Response::NONE; + + MessageDialogImplHtml() : + htmlModal(val::global("document").call("createElement", val("div"))), + htmlDialog(val::global("document").call("createElement", val("div"))), + htmlMessage(val::global("document").call("createElement", val("strong"))), + htmlDescription(val::global("document").call("createElement", val("p"))), + htmlButtons(val::global("document").call("createElement", val("div"))) + { + htmlModal["classList"].call("add", val("modal")); + htmlModal.call("appendChild", htmlDialog); + htmlDialog["classList"].call("add", val("dialog")); + htmlDialog.call("appendChild", htmlMessage); + htmlDialog.call("appendChild", htmlDescription); + htmlButtons["classList"].call("add", val("buttons")); + htmlDialog.call("appendChild", htmlButtons); + } + + void SetType(Type type) { + // FIXME(emscripten): implement + } + + void SetTitle(std::string title) { + // FIXME(emscripten): implement + } + + void SetMessage(std::string message) { + htmlMessage.set("innerText", message); + } + + void SetDescription(std::string description) { + htmlDescription.set("innerText", description); + } + + void AddButton(std::string label, Response response, bool isDefault = false) { + val htmlButton = val::global("document").call("createElement", val("div")); + htmlButton["classList"].call("add", val("button")); + val::global("window").call("setLabelWithMnemonic", htmlButton, label); + if(isDefault) { + htmlButton["classList"].call("add", val("default"), val("selected")); + } + + std::function responseFunc = [this, response] { + htmlModal.call("remove"); + this->latestResponse = response; + if(onResponse) { + onResponse(response); + } + auto it = std::remove(dialogsOnScreen.begin(), dialogsOnScreen.end(), + shared_from_this()); + dialogsOnScreen.erase(it); + + this->is_shown = false; + }; + RegisterEventListener(htmlButton, "trigger", responseFunc); + + htmlButtons.call("appendChild", htmlButton); + } + + Response RunModal() { + this->ShowModal(); + //FIXME(emscripten): use val::await() with JavaScript's Promise + while (true) { + if (this->is_shown) { + emscripten_sleep(50); + } else { + break; + } + } + + if (this->latestResponse != Response::NONE) { + return this->latestResponse; + } else { + // FIXME(emscripten): + return this->latestResponse; + } + } + + void ShowModal() { + dialogsOnScreen.push_back(shared_from_this()); + val::global("document")["body"].call("appendChild", htmlModal); + + this->is_shown = true; + } +}; + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow) { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +// In emscripten pseudo filesystem, all userdata will be stored in this directory. +static std::string basePathInFilesystem = "/data/"; + + +/* FileDialog that can open, save and browse. Also refer `src/platform/html/filemanagerui.js`. + */ +class FileDialogImplHtml : public FileDialog { +public: + + enum class Modes { + OPEN = 0, + SAVE, + BROWSER + }; + + Modes mode; + + std::string title; + std::string filename; + std::string filters; + + val jsFileManagerUI; + + FileDialogImplHtml(Modes mode) { + dbp("FileDialogImplHtml::FileDialogImplHtml()"); + val fileManagerUIClass = val::global("window")["FileManagerUI"]; + val dialogModeValue; + this->mode = mode; + if (mode == Modes::OPEN) { + dialogModeValue = val(0); + } else if (mode == Modes::SAVE) { + dialogModeValue = val(1); + } else { + dialogModeValue = val(2); + } + this->jsFileManagerUI = fileManagerUIClass.new_(dialogModeValue); + dbp("FileDialogImplHtml::FileDialogImplHtml() Done."); + } + + ~FileDialogImplHtml() override { + dbp("FileDialogImplHtml::~FileDialogImplHtml()"); + this->jsFileManagerUI.call("dispose"); + } + + void SetTitle(std::string title) override { + dbp("FileDialogImplHtml::SetTitle(): title=\"%s\"", title.c_str()); + this->title = title; + this->jsFileManagerUI.call("setTitle", val(title)); + } + + void SetCurrentName(std::string name) override { + dbp("FileDialogImplHtml::SetCurrentName(): name=\"%s\", parent=\"%s\"", name.c_str(), this->GetFilename().Parent().raw.c_str()); + + Path filepath = Path::From(name); + if (filepath.IsAbsolute()) { + // dbp("FileDialogImplHtml::SetCurrentName(): path is absolute."); + SetFilename(filepath); + } else { + // dbp("FileDialogImplHtml::SetCurrentName(): path is relative."); + SetFilename(GetFilename().Parent().Join(name)); + } + } + + Platform::Path GetFilename() override { + return Platform::Path::From(this->filename.c_str()); + } + + void SetFilename(Platform::Path path) override { + dbp("FileDialogImplHtml::GetFilename(): path=\"%s\"", path.raw.c_str()); + this->filename = std::string(path.raw); + std::string filename_ = Path::From(this->filename).FileName(); + this->jsFileManagerUI.call("setDefaultFilename", val(filename_)); + } + + void SuggestFilename(Platform::Path path) override { + dbp("FileDialogImplHtml::SuggestFilename(): path=\"%s\"", path.raw.c_str()); + SetFilename(Platform::Path::From(path.FileStem())); + } + + void AddFilter(std::string name, std::vector extensions) override { + if (this->filters.length() > 0) { + this->filters += ","; + } + for (size_t i = 0; i < extensions.size(); i++) { + if (i != 0) { + this->filters += ","; + } + this->filters += "." + extensions[i]; + } + dbp("FileDialogImplHtml::AddFilter(): filter=%s", this->filters.c_str()); + this->jsFileManagerUI.call("setFilter", val(this->filters)); + } + + void FreezeChoices(SettingsRef settings, const std::string &key) override { + //FIXME(emscripten): implement + } + + void ThawChoices(SettingsRef settings, const std::string &key) override { + //FIXME(emscripten): implement + } + + bool RunModal() override { + dbp("FileDialogImplHtml::RunModal()"); + + this->jsFileManagerUI.call("setBasePath", val(basePathInFilesystem)); + this->jsFileManagerUI.call("show"); + while (true) { + bool isShown = this->jsFileManagerUI.call("isShown"); + if (!isShown) { + break; + } else { + emscripten_sleep(50); + } + } + + dbp("FileSaveDialogImplHtml::RunModal() : dialog closed."); + + std::string selectedFilename = this->jsFileManagerUI.call("getSelectedFilename"); + if (selectedFilename.length() > 0) { + // Dummy call to set parent directory + this->SetFilename(Path::From(basePathInFilesystem + "/dummy")); + this->SetCurrentName(selectedFilename); + } + + + if (selectedFilename.length() > 0) { + return true; + } else { + return false; + } + } +}; + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow) { + dbp("CreateOpenFileDialog()"); + return std::shared_ptr(new FileDialogImplHtml(FileDialogImplHtml::Modes::OPEN)); +} + +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow) { + dbp("CreateSaveFileDialog()"); + return std::shared_ptr(new FileDialogImplHtml(FileDialogImplHtml::Modes::SAVE)); +} + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector GetFontFiles() { + return {}; +} + +void OpenInBrowser(const std::string &url) { + val::global("window").call("open", url); +} + + +void OnSaveFinishedCallback(const Platform::Path& filename, bool is_saveAs, bool is_autosave) { + dbp("OnSaveFinished(): %s, is_saveAs=%d, is_autosave=%d\n", filename.FileName().c_str(), is_saveAs, is_autosave); + val::global("window").call("saveFileDone", filename.raw, is_saveAs, is_autosave); +} + +std::vector InitGui(int argc, char **argv) { + std::function onBeforeUnload = std::bind(&SolveSpaceUI::Exit, &SS); + RegisterEventListener(val::global("window"), "beforeunload", onBeforeUnload); + + // dbp("Set onSaveFinished"); + SS.OnSaveFinished = OnSaveFinishedCallback; + + // FIXME(emscripten): get locale from user preferences + SetLocale("en_US"); + + return {}; +} + +static void MainLoopIteration() { + // We don't do anything here, as all our work is registered via timers. +} + +void RunGui() { + emscripten_set_main_loop(MainLoopIteration, 0, /*simulate_infinite_loop=*/true); +} + +void ExitGui() { + exit(0); +} + +void ClearGui() {} + +} +} diff --git a/src/platform/guimac.mm b/src/platform/guimac.mm new file mode 100644 index 0000000..8f25afb --- /dev/null +++ b/src/platform/guimac.mm @@ -0,0 +1,1688 @@ +//----------------------------------------------------------------------------- +// The Cocoa-based implementation of platform-dependent GUI functionality. +// +// Copyright 2018 whitequark +//----------------------------------------------------------------------------- +#include "solvespace.h" +#import + +using namespace SolveSpace; + +//----------------------------------------------------------------------------- +// Internal AppKit classes +//----------------------------------------------------------------------------- + +@interface NSToolTipManager : NSObject ++ (NSToolTipManager *)sharedToolTipManager; +- (void)setInitialToolTipDelay:(double)delay; +- (void)orderOutToolTip; +- (void)abortToolTip; +- (void)_displayTemporaryToolTipForView:(id)arg1 withString:(id)arg2; +@end + +//----------------------------------------------------------------------------- +// Objective-C bridging +//----------------------------------------------------------------------------- + +static NSString* Wrap(const std::string &s) { + return [NSString stringWithUTF8String:s.c_str()]; +} + +@interface SSFunction : NSObject +- (SSFunction *)initWithFunction:(std::function *)aFunc; +- (void)run; +@end + +@implementation SSFunction +{ + std::function *func; +} + +- (SSFunction *)initWithFunction:(std::function *)aFunc { + if(self = [super init]) { + func = aFunc; + } + return self; +} + +- (void)run { + if(*func) (*func)(); +} +@end + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Utility functions +//----------------------------------------------------------------------------- + +static std::string PrepareMnemonics(std::string label) { + // OS X does not support mnemonics + label.erase(std::remove(label.begin(), label.end(), '&'), label.end()); + return label; +} + +//----------------------------------------------------------------------------- +// Fatal errors +//----------------------------------------------------------------------------- + +// This gets put into the "Application Specific Information" field in crash +// reporter dialog. +typedef struct { + unsigned version __attribute__((aligned(8))); + const char *message __attribute__((aligned(8))); + const char *signature __attribute__((aligned(8))); + const char *backtrace __attribute__((aligned(8))); + const char *message2 __attribute__((aligned(8))); + void *reserved __attribute__((aligned(8))); + void *reserved2 __attribute__((aligned(8))); +} crash_info_t; + +#define CRASH_VERSION 4 + +crash_info_t crashAnnotation __attribute__((section("__DATA,__crash_info"))) = { + CRASH_VERSION, NULL, NULL, NULL, NULL, NULL, NULL +}; + +void FatalError(const std::string &message) { + crashAnnotation.message = message.c_str(); + abort(); +} + +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +class SettingsImplCocoa final : public Settings { +public: + NSUserDefaults *userDefaults; + + SettingsImplCocoa() { + userDefaults = [NSUserDefaults standardUserDefaults]; + } + + void FreezeInt(const std::string &key, uint32_t value) override { + [userDefaults setInteger:value forKey:Wrap(key)]; + } + + uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) override { + NSString *nsKey = Wrap(key); + if([userDefaults objectForKey:nsKey]) { + return [userDefaults integerForKey:nsKey]; + } + return defaultValue; + } + + void FreezeBool(const std::string &key, bool value) override { + [userDefaults setBool:value forKey:Wrap(key)]; + } + + bool ThawBool(const std::string &key, bool defaultValue = false) override { + NSString *nsKey = Wrap(key); + if([userDefaults objectForKey:nsKey]) { + return [userDefaults boolForKey:nsKey]; + } + return defaultValue; + } + + void FreezeFloat(const std::string &key, double value) override { + [userDefaults setDouble:value forKey:Wrap(key)]; + } + + double ThawFloat(const std::string &key, double defaultValue = 0.0) override { + NSString *nsKey = Wrap(key); + if([userDefaults objectForKey:nsKey]) { + return [userDefaults doubleForKey:nsKey]; + } + return defaultValue; + } + + void FreezeString(const std::string &key, const std::string &value) override { + [userDefaults setObject:Wrap(value) forKey:Wrap(key)]; + } + + std::string ThawString(const std::string &key, + const std::string &defaultValue = "") override { + NSObject *nsValue = [userDefaults objectForKey:Wrap(key)]; + if(nsValue && [nsValue isKindOfClass:[NSString class]]) { + return [(NSString *)nsValue UTF8String]; + } + return defaultValue; + } +}; + +SettingsRef GetSettings() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Timers +//----------------------------------------------------------------------------- + +class TimerImplCocoa final : public Timer { +public: + NSTimer *timer; + + TimerImplCocoa() : timer(NULL) {} + + void RunAfter(unsigned milliseconds) override { + SSFunction *callback = [[SSFunction alloc] initWithFunction:&this->onTimeout]; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: + [callback methodSignatureForSelector:@selector(run)]]; + invocation.target = callback; + invocation.selector = @selector(run); + + if(timer != NULL) { + [timer invalidate]; + } + timer = [NSTimer timerWithTimeInterval:(milliseconds / 1000.0) + invocation:invocation repeats:NO]; + [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; + } + + ~TimerImplCocoa() { + if(timer != NULL) { + [timer invalidate]; + } + } +}; + +TimerRef CreateTimer() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Menus +//----------------------------------------------------------------------------- + +class MenuItemImplCocoa final : public MenuItem { +public: + SSFunction *ssFunction; + NSMenuItem *nsMenuItem; + + MenuItemImplCocoa() { + ssFunction = [[SSFunction alloc] initWithFunction:&onTrigger]; + nsMenuItem = [[NSMenuItem alloc] initWithTitle:@"" + action:@selector(run) keyEquivalent:@""]; + nsMenuItem.target = ssFunction; + } + + void SetAccelerator(KeyboardEvent accel) override { + unichar accelChar; + switch(accel.key) { + case KeyboardEvent::Key::CHARACTER: + if(accel.chr == NSDeleteCharacter) { + accelChar = NSBackspaceCharacter; + } else { + accelChar = accel.chr; + } + break; + + case KeyboardEvent::Key::FUNCTION: + accelChar = NSF1FunctionKey + accel.num - 1; + break; + } + nsMenuItem.keyEquivalent = [[NSString alloc] initWithCharacters:&accelChar length:1]; + + NSUInteger modifierMask = 0; + if(accel.shiftDown) + modifierMask |= NSEventModifierFlagShift; + if(accel.controlDown) + modifierMask |= NSEventModifierFlagCommand; + nsMenuItem.keyEquivalentModifierMask = modifierMask; + } + + void SetIndicator(Indicator state) override { + // macOS does not support radio menu items + } + + void SetActive(bool active) override { + nsMenuItem.state = active ? NSControlStateValueOn : NSControlStateValueOff; + } + + void SetEnabled(bool enabled) override { + nsMenuItem.enabled = enabled; + } +}; + +class MenuImplCocoa final : public Menu { +public: + NSMenu *nsMenu; + + std::vector> menuItems; + std::vector> subMenus; + + MenuImplCocoa() { + nsMenu = [[NSMenu alloc] initWithTitle:@""]; + [nsMenu setAutoenablesItems:NO]; + } + + MenuItemRef AddItem(const std::string &label, + std::function onTrigger = NULL, + bool mnemonics = true) override { + auto menuItem = std::make_shared(); + menuItems.push_back(menuItem); + + menuItem->onTrigger = onTrigger; + [menuItem->nsMenuItem setTitle:Wrap(mnemonics ? PrepareMnemonics(label) : label)]; + [nsMenu addItem:menuItem->nsMenuItem]; + + return menuItem; + } + + MenuRef AddSubMenu(const std::string &label) override { + auto subMenu = std::make_shared(); + subMenus.push_back(subMenu); + + NSMenuItem *nsMenuItem = + [nsMenu addItemWithTitle:Wrap(PrepareMnemonics(label)) action:nil keyEquivalent:@""]; + [nsMenu setSubmenu:subMenu->nsMenu forItem:nsMenuItem]; + + return subMenu; + } + + void AddSeparator() override { + [nsMenu addItem:[NSMenuItem separatorItem]]; + } + + void PopUp() override { + NSEvent* event = [NSApp currentEvent]; + [NSMenu popUpContextMenu:nsMenu withEvent:event forView:event.window.contentView]; + } + + void Clear() override { + [nsMenu removeAllItems]; + menuItems.clear(); + subMenus.clear(); + } +}; + +MenuRef CreateMenu() { + return std::make_shared(); +} + +class MenuBarImplCocoa final : public MenuBar { +public: + NSMenu *nsMenuBar; + + std::vector> subMenus; + + MenuBarImplCocoa() { + nsMenuBar = [NSApp mainMenu]; + } + + MenuRef AddSubMenu(const std::string &label) override { + auto subMenu = std::make_shared(); + subMenus.push_back(subMenu); + + NSMenuItem *nsMenuItem = [nsMenuBar addItemWithTitle:@"" action:nil keyEquivalent:@""]; + [subMenu->nsMenu setTitle:Wrap(PrepareMnemonics(label))]; + [nsMenuBar setSubmenu:subMenu->nsMenu forItem:nsMenuItem]; + + return subMenu; + } + + void Clear() override { + while([nsMenuBar numberOfItems] != 1) { + [nsMenuBar removeItemAtIndex:1]; + } + subMenus.clear(); + } +}; + +MenuBarRef GetOrCreateMainMenu(bool *unique) { + static std::shared_ptr mainMenu; + if(!mainMenu) { + mainMenu = std::make_shared(); + } + *unique = true; + return mainMenu; +} + +} +} + +//----------------------------------------------------------------------------- +// Cocoa NSView and NSWindow extensions +//----------------------------------------------------------------------------- + +@interface SSView : NSOpenGLView +@property Platform::Window *receiver; + +@property BOOL acceptsFirstResponder; + +@property(readonly, getter=isEditing) BOOL editing; +- (void)startEditing:(NSString *)text at:(NSPoint)origin + withHeight:(double)fontHeight minWidth:(double)minWidth + usingMonospace:(BOOL)isMonospace; +- (void)stopEditing; +- (void)didEdit:(NSString *)text; + +@property double scrollerMin; +@property double scrollerSize; +@property double pageSize; + +@end + +@implementation SSView +{ + NSTrackingArea *trackingArea; + NSTextField *editor; + double magnificationGestureCurrentZ; + double rotationGestureCurrent; + Point2d trackpadPositionShift; + bool inTrackpadScrollGesture; + int activeTrackpadTouches; + bool scrollFromTrackpadTouch; + Platform::Window::Kind kind; +} + +@synthesize acceptsFirstResponder; + +- (id)initWithKind:(Platform::Window::Kind)aKind { + NSOpenGLPixelFormatAttribute attrs[] = { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFADepthSize, 24, + 0 + }; + NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; + if(self = [super initWithFrame:NSMakeRect(0, 0, 0, 0) pixelFormat:pixelFormat]) { + self.wantsBestResolutionOpenGLSurface = YES; + self.wantsLayer = YES; + editor = [[NSTextField alloc] init]; + editor.editable = YES; + [[editor cell] setWraps:NO]; + [[editor cell] setScrollable:YES]; + editor.bezeled = NO; + editor.target = self; + editor.action = @selector(didEdit:); + + inTrackpadScrollGesture = false; + activeTrackpadTouches = 0; + scrollFromTrackpadTouch = false; + self.acceptsTouchEvents = YES; + kind = aKind; + if(kind == Platform::Window::Kind::TOPLEVEL) { + NSGestureRecognizer *mag = [[NSMagnificationGestureRecognizer alloc] initWithTarget:self + action:@selector(magnifyGesture:)]; + [self addGestureRecognizer:mag]; + + NSRotationGestureRecognizer* rot = [[NSRotationGestureRecognizer alloc] initWithTarget:self + action:@selector(rotateGesture:)]; + [self addGestureRecognizer:rot]; + } + } + return self; +} + +- (void)dealloc { +} + +- (BOOL)isFlipped { + return YES; +} + +@synthesize receiver; + +- (void)drawRect:(NSRect)aRect { + [[self openGLContext] makeCurrentContext]; + if(receiver->onRender) { + receiver->onRender(); + } + [[self openGLContext] flushBuffer]; +} + +- (BOOL)acceptsFirstMouse:(NSEvent *)event { + return YES; +} + +- (void)updateTrackingAreas { + [self removeTrackingArea:trackingArea]; + trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] + options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | + ([self acceptsFirstResponder] + ? NSTrackingActiveInKeyWindow + : NSTrackingActiveAlways)) + owner:self userInfo:nil]; + [self addTrackingArea:trackingArea]; + [super updateTrackingAreas]; +} + +- (Platform::MouseEvent)convertMouseEvent:(NSEvent *)nsEvent { + Platform::MouseEvent event = {}; + + NSPoint nsPoint = [self convertPoint:nsEvent.locationInWindow fromView:nil]; + event.x = nsPoint.x; + event.y = nsPoint.y; + + NSUInteger nsFlags = [nsEvent modifierFlags]; + if(nsFlags & NSEventModifierFlagShift) event.shiftDown = true; + if(nsFlags & NSEventModifierFlagCommand) event.controlDown = true; + + return event; +} + +- (void)mouseMotionEvent:(NSEvent *)nsEvent { + using Platform::MouseEvent; + + MouseEvent event = [self convertMouseEvent:nsEvent]; + event.type = MouseEvent::Type::MOTION; + event.button = MouseEvent::Button::NONE; + + NSUInteger nsButtons = [NSEvent pressedMouseButtons]; + if(nsButtons & (1 << 0)) { + event.button = MouseEvent::Button::LEFT; + } else if(nsButtons & (1 << 1)) { + event.button = MouseEvent::Button::RIGHT; + } else if(nsButtons & (1 << 2)) { + event.button = MouseEvent::Button::MIDDLE; + } + + if(receiver->onMouseEvent) { + receiver->onMouseEvent(event); + } +} + +- (void)mouseMotionEvent:(NSEvent *)nsEvent withButton:(Platform::MouseEvent::Button)button { + using Platform::MouseEvent; + + MouseEvent event = [self convertMouseEvent:nsEvent]; + event.type = MouseEvent::Type::MOTION; + event.button = button; + + if(receiver->onMouseEvent) { + receiver->onMouseEvent(event); + } +} + +- (void)mouseMoved:(NSEvent *)nsEvent { + [self mouseMotionEvent:nsEvent]; + [super mouseMoved:nsEvent]; +} + +- (void)mouseDragged:(NSEvent *)nsEvent { + [self mouseMotionEvent:nsEvent withButton:Platform::MouseEvent::Button::LEFT]; +} + +- (void)otherMouseDragged:(NSEvent *)nsEvent { + [self mouseMotionEvent:nsEvent]; +} + +- (void)rightMouseDragged:(NSEvent *)nsEvent { + [self mouseMotionEvent:nsEvent]; +} + +- (void)mouseButtonEvent:(NSEvent *)nsEvent withType:(Platform::MouseEvent::Type)type { + using Platform::MouseEvent; + + MouseEvent event = [self convertMouseEvent:nsEvent]; + event.type = type; + if([nsEvent buttonNumber] == 0) { + event.button = MouseEvent::Button::LEFT; + } else if([nsEvent buttonNumber] == 1) { + event.button = MouseEvent::Button::RIGHT; + } else if([nsEvent buttonNumber] == 2) { + event.button = MouseEvent::Button::MIDDLE; + } else return; + + if(receiver->onMouseEvent) { + receiver->onMouseEvent(event); + } +} + +- (void)mouseDownEvent:(NSEvent *)nsEvent { + using Platform::MouseEvent; + + MouseEvent::Type type; + if([nsEvent clickCount] == 1) { + type = MouseEvent::Type::PRESS; + } else { + type = MouseEvent::Type::DBL_PRESS; + } + [self mouseButtonEvent:nsEvent withType:type]; +} + +- (void)mouseUpEvent:(NSEvent *)nsEvent { + using Platform::MouseEvent; + + [self mouseButtonEvent:nsEvent withType:(MouseEvent::Type::RELEASE)]; +} + +- (void)mouseDown:(NSEvent *)nsEvent { + [self mouseDownEvent:nsEvent]; +} + +- (void)otherMouseDown:(NSEvent *)nsEvent { + [self mouseDownEvent:nsEvent]; +} + +- (void)rightMouseDown:(NSEvent *)nsEvent { + [self mouseDownEvent:nsEvent]; + [super rightMouseDown:nsEvent]; +} + +- (void)mouseUp:(NSEvent *)nsEvent { + [self mouseUpEvent:nsEvent]; +} + +- (void)otherMouseUp:(NSEvent *)nsEvent { + [self mouseUpEvent:nsEvent]; +} + +- (void)rightMouseUp:(NSEvent *)nsEvent { + [self mouseUpEvent:nsEvent]; +} + +- (void)scrollWheel:(NSEvent *)nsEvent { + using Platform::MouseEvent; + + MouseEvent event = [self convertMouseEvent:nsEvent]; + if(nsEvent.phase == NSEventPhaseBegan) { + // If this scroll began on trackpad then touchesBeganWithEvent was called prior to this + // event and we have at least one active trackpad touch. We store this information so we + // can handle scroll originating from trackpad differently below. + scrollFromTrackpadTouch = activeTrackpadTouches > 0 && + nsEvent.subtype == NSEventSubtypeTabletPoint && + kind == Platform::Window::Kind::TOPLEVEL; + } + // Check if we are scrolling on trackpad and handle things differently. + if(scrollFromTrackpadTouch) { + // This is how Cocoa represents 2 finger trackpad drag gestures, rather than going via + // NSPanGestureRecognizer which is how you might expect this to work... We complicate this + // further by also handling shift-two-finger-drag to mean rotate. Fortunately we're using + // shift in the same way as right-mouse-button MouseEvent does (to converts a pan to a + // rotate) so we get the rotate support for free. It's a bit ugly having to fake mouse + // events and track the deviation from the actual mouse cursor with trackpadPositionShift, + // but in lieu of an event API that allows us to request a rotate/pan with relative + // coordinates, it's the best we can do. + event.button = MouseEvent::Button::RIGHT; + // Make sure control (actually cmd) isn't passed through, ctrl-right-click-drag has special + // meaning as rotate which we don't want to inadvertently trigger. + event.controlDown = false; + if(nsEvent.scrollingDeltaX == 0 && nsEvent.scrollingDeltaY == 0) { + // Cocoa represents the point where the user lifts their fingers off (and any inertial + // scrolling has finished) by an event with scrollingDeltaX and scrollingDeltaY both 0. + // Sometimes you also get a zero scroll at the start of a two-finger-rotate (probably + // reflecting the internal implementation of that being a cancelled possible pan + // gesture), which is why this conditional is structured the way it is. + if(inTrackpadScrollGesture) { + event.x += trackpadPositionShift.x; + event.y += trackpadPositionShift.y; + event.type = MouseEvent::Type::RELEASE; + receiver->onMouseEvent(event); + inTrackpadScrollGesture = false; + trackpadPositionShift = Point2d::From(0, 0); + } + return; + } else if(!inTrackpadScrollGesture) { + inTrackpadScrollGesture = true; + trackpadPositionShift = Point2d::From(0, 0); + event.type = MouseEvent::Type::PRESS; + receiver->onMouseEvent(event); + // And drop through + } + + trackpadPositionShift.x += nsEvent.scrollingDeltaX; + trackpadPositionShift.y += nsEvent.scrollingDeltaY; + event.type = MouseEvent::Type::MOTION; + event.x += trackpadPositionShift.x; + event.y += trackpadPositionShift.y; + receiver->onMouseEvent(event); + return; + } + + event.type = MouseEvent::Type::SCROLL_VERT; + + bool isPrecise = [nsEvent hasPreciseScrollingDeltas]; + event.scrollDelta = [nsEvent scrollingDeltaY] / (isPrecise ? 50 : 5); + + receiver->onMouseEvent(event); +} + +- (void)touchesBeganWithEvent:(NSEvent *)event { + activeTrackpadTouches++; +} + +- (void)touchesEndedWithEvent:(NSEvent *)event { + activeTrackpadTouches--; +} + +- (void)touchesCancelledWithEvent:(NSEvent *)event { + activeTrackpadTouches--; +} + +- (void)mouseExited:(NSEvent *)nsEvent { + using Platform::MouseEvent; + + MouseEvent event = [self convertMouseEvent:nsEvent]; + event.type = MouseEvent::Type::LEAVE; + + if(receiver->onMouseEvent) { + receiver->onMouseEvent(event); + } +} + +- (Platform::KeyboardEvent)convertKeyboardEvent:(NSEvent *)nsEvent { + using Platform::KeyboardEvent; + + KeyboardEvent event = {}; + + NSUInteger nsFlags = [nsEvent modifierFlags]; + if(nsFlags & NSEventModifierFlagShift) + event.shiftDown = true; + if(nsFlags & NSEventModifierFlagCommand) + event.controlDown = true; + + unichar chr = 0; + if(NSString *nsChr = [[nsEvent charactersIgnoringModifiers] lowercaseString]) { + chr = [nsChr characterAtIndex:0]; + } + if(chr >= NSF1FunctionKey && chr <= NSF12FunctionKey) { + event.key = KeyboardEvent::Key::FUNCTION; + event.num = chr - NSF1FunctionKey + 1; + } else { + event.key = KeyboardEvent::Key::CHARACTER; + event.chr = chr; + } + + return event; +} + +- (void)keyDown:(NSEvent *)nsEvent { + using Platform::KeyboardEvent; + + if([NSEvent modifierFlags] & ~(NSEventModifierFlagShift|NSEventModifierFlagCommand)) { + [super keyDown:nsEvent]; + return; + } + + KeyboardEvent event = [self convertKeyboardEvent:nsEvent]; + event.type = KeyboardEvent::Type::PRESS; + + if(receiver->onKeyboardEvent) { + receiver->onKeyboardEvent(event); + return; + } + + [super keyDown:nsEvent]; +} + +- (void)keyUp:(NSEvent *)nsEvent { + using Platform::KeyboardEvent; + + if([NSEvent modifierFlags] & ~(NSEventModifierFlagShift|NSEventModifierFlagCommand)) { + [super keyUp:nsEvent]; + return; + } + + KeyboardEvent event = [self convertKeyboardEvent:nsEvent]; + event.type = KeyboardEvent::Type::RELEASE; + + if(receiver->onKeyboardEvent) { + receiver->onKeyboardEvent(event); + return; + } + + [super keyUp:nsEvent]; +} + +- (void)magnifyGesture:(NSMagnificationGestureRecognizer *)gesture { + // The onSixDofEvent API doesn't allow us to specify the scaling's origin, so for expediency + // we fake out a scrollwheel MouseEvent with a suitably-scaled scrollDelta with a bit of + // absolute-to-relative positioning conversion tracked using magnificationGestureCurrentZ. + + if(gesture.state == NSGestureRecognizerStateBegan) { + magnificationGestureCurrentZ = 0.0; + } + + // Magic number to make gesture.magnification align roughly with what scrollDelta expects + constexpr double kScale = 10.0; + double z = ((double)gesture.magnification * kScale); + double zdelta = z - magnificationGestureCurrentZ; + magnificationGestureCurrentZ = z; + + using Platform::MouseEvent; + MouseEvent event = {}; + event.type = MouseEvent::Type::SCROLL_VERT; + NSPoint nsPoint = [gesture locationInView:self]; + event.x = nsPoint.x; + event.y = nsPoint.y; + event.scrollDelta = zdelta; + if(receiver->onMouseEvent) { + receiver->onMouseEvent(event); + } +} + +- (void)rotateGesture:(NSRotationGestureRecognizer *)gesture { + if(gesture.state == NSGestureRecognizerStateBegan) { + rotationGestureCurrent = 0.0; + } + double rotation = gesture.rotation; + double rotationDelta = rotation - rotationGestureCurrent; + rotationGestureCurrent = rotation; + + using Platform::SixDofEvent; + SixDofEvent event = {}; + event.type = SixDofEvent::Type::MOTION; + event.rotationZ = rotationDelta; + if(receiver->onSixDofEvent) { + receiver->onSixDofEvent(event); + } +} + +@synthesize editing; + +- (void)startEditing:(NSString *)text at:(NSPoint)origin withHeight:(double)fontHeight + minWidth:(double)minWidth usingMonospace:(BOOL)isMonospace { + if(!editing) { + [self addSubview:editor]; + editing = YES; + } + + if(isMonospace) { + editor.font = [NSFont fontWithName:@"Monaco" size:fontHeight]; + } else { + editor.font = [NSFont controlContentFontOfSize:fontHeight]; + } + + origin.x -= 3; /* left padding; no way to get it from NSTextField */ + origin.y -= [editor intrinsicContentSize].height; + origin.y += [editor baselineOffsetFromBottom]; + + [editor setFrameOrigin:origin]; + [editor setStringValue:text]; + [editor sizeToFit]; + + NSSize frameSize = [editor frame].size; + frameSize.width = std::max(frameSize.width, minWidth); + [editor setFrameSize:frameSize]; + + [[self window] makeFirstResponder:editor]; + [[self window] makeKeyWindow]; +} + +- (void)stopEditing { + if(editing) { + [editor removeFromSuperview]; + [[self window] makeFirstResponder:self]; + editing = NO; + } +} + +- (void)didEdit:(id)sender { + if(receiver->onEditingDone) { + receiver->onEditingDone([[editor stringValue] UTF8String]); + } +} + +- (void)cancelOperation:(id)sender { + using Platform::KeyboardEvent; + + if(receiver->onKeyboardEvent) { + KeyboardEvent event = {}; + event.key = KeyboardEvent::Key::CHARACTER; + event.chr = '\e'; + event.type = KeyboardEvent::Type::PRESS; + receiver->onKeyboardEvent(event); + event.type = KeyboardEvent::Type::RELEASE; + receiver->onKeyboardEvent(event); + } +} + +@synthesize scrollerMin; +@synthesize scrollerSize; +@synthesize pageSize; + +- (void)didScroll:(NSScroller *)sender { + double pos; + switch(sender.hitPart) { + case NSScrollerKnob: + case NSScrollerKnobSlot: + pos = receiver->GetScrollbarPosition(); + break; + case NSScrollerDecrementPage: + pos = receiver->GetScrollbarPosition() - pageSize; + break; + case NSScrollerIncrementPage: + pos = receiver->GetScrollbarPosition() + pageSize; + break; + default: + return; + } + + if(receiver->onScrollbarAdjusted) { + receiver->onScrollbarAdjusted(pos); + } +} +@end + +@interface SSWindowDelegate : NSObject +@property Platform::Window *receiver; + +- (BOOL)windowShouldClose:(id)sender; + +@property(readonly, getter=isFullScreen) BOOL fullScreen; +- (void)windowDidEnterFullScreen:(NSNotification *)notification; +- (void)windowDidExitFullScreen:(NSNotification *)notification; +@end + +@implementation SSWindowDelegate +@synthesize receiver; + +- (BOOL)windowShouldClose:(id)sender { + if(receiver->onClose) { + receiver->onClose(); + } + return NO; +} + +@synthesize fullScreen; + +- (void)windowDidEnterFullScreen:(NSNotification *)notification { + fullScreen = true; + if(receiver->onFullScreen) { + receiver->onFullScreen(fullScreen); + } +} + +- (void)windowDidExitFullScreen:(NSNotification *)notification { + fullScreen = false; + if(receiver->onFullScreen) { + receiver->onFullScreen(fullScreen); + } +} +@end + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Windows +//----------------------------------------------------------------------------- + +class WindowImplCocoa final : public Window { +public: + NSWindow *nsWindow; + SSWindowDelegate *ssWindowDelegate; + SSView *ssView; + NSScroller *nsScroller; + NSView *nsContainer; + + NSArray *nsConstraintsWithScrollbar; + NSArray *nsConstraintsWithoutScrollbar; + + double minWidth = 100.0; + double minHeight = 100.0; + + NSString *nsToolTip; + + WindowImplCocoa(Window::Kind kind, std::shared_ptr parentWindow) { + ssView = [[SSView alloc] initWithKind:kind]; + ssView.translatesAutoresizingMaskIntoConstraints = NO; + ssView.receiver = this; + + nsScroller = [[NSScroller alloc] initWithFrame:NSMakeRect(0, 0, 0, 100)]; + nsScroller.translatesAutoresizingMaskIntoConstraints = NO; + nsScroller.enabled = YES; + nsScroller.scrollerStyle = NSScrollerStyleOverlay; + nsScroller.knobStyle = NSScrollerKnobStyleLight; + nsScroller.action = @selector(didScroll:); + nsScroller.target = ssView; + nsScroller.continuous = YES; + + nsContainer = [[NSView alloc] init]; + [nsContainer addSubview:ssView]; + [nsContainer addSubview:nsScroller]; + + NSDictionary *views = NSDictionaryOfVariableBindings(ssView, nsScroller); + nsConstraintsWithoutScrollbar = [NSLayoutConstraint + constraintsWithVisualFormat:@"H:|[ssView]|" + options:0 metrics:nil views:views]; + [nsContainer addConstraints:nsConstraintsWithoutScrollbar]; + nsConstraintsWithScrollbar = [NSLayoutConstraint + constraintsWithVisualFormat:@"H:|[ssView]-0-[nsScroller(11)]|" + options:0 metrics:nil views:views]; + [nsContainer addConstraints:[NSLayoutConstraint + constraintsWithVisualFormat:@"V:|[ssView]|" + options:0 metrics:nil views:views]]; + [nsContainer addConstraints:[NSLayoutConstraint + constraintsWithVisualFormat:@"V:|[nsScroller]|" + options:0 metrics:nil views:views]]; + + switch(kind) { + case Window::Kind::TOPLEVEL: + nsWindow = [[NSWindow alloc] init]; + nsWindow.styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | + NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable; + nsWindow.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary; + ssView.acceptsFirstResponder = YES; + break; + + case Window::Kind::TOOL: + NSPanel *nsPanel = [[NSPanel alloc] init]; + nsPanel.styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | + NSWindowStyleMaskClosable | NSWindowStyleMaskUtilityWindow; + [nsPanel standardWindowButton:NSWindowMiniaturizeButton].hidden = YES; + [nsPanel standardWindowButton:NSWindowZoomButton].hidden = YES; + nsPanel.floatingPanel = YES; + nsPanel.becomesKeyOnlyIfNeeded = YES; + nsWindow = nsPanel; + break; + } + + ssWindowDelegate = [[SSWindowDelegate alloc] init]; + ssWindowDelegate.receiver = this; + nsWindow.delegate = ssWindowDelegate; + + nsWindow.backgroundColor = [NSColor blackColor]; + nsWindow.contentView = nsContainer; + } + + double GetPixelDensity() override { + NSDictionary *description = nsWindow.screen.deviceDescription; + NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue]; + CGSize displayPhysicalSize = CGDisplayScreenSize( + [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); + return (displayPixelSize.width / displayPhysicalSize.width) * 25.4f; + } + + double GetDevicePixelRatio() override { + NSSize unitSize = { 1.0f, 0.0f }; + unitSize = [ssView convertSizeToBacking:unitSize]; + return unitSize.width; + } + + bool IsVisible() override { + return ![nsWindow isVisible]; + } + + void SetVisible(bool visible) override { + if(visible) { + [nsWindow orderFront:nil]; + } else { + [nsWindow close]; + } + } + + void Focus() override { + [nsWindow makeKeyAndOrderFront:nil]; + } + + bool IsFullScreen() override { + return ssWindowDelegate.fullScreen; + } + + void SetFullScreen(bool fullScreen) override { + if(fullScreen != IsFullScreen()) { + [nsWindow toggleFullScreen:nil]; + } + } + + void SetTitle(const std::string &title) override { + nsWindow.representedFilename = @""; + nsWindow.title = Wrap(title); + } + + bool SetTitleForFilename(const Path &filename) override { + [nsWindow setTitleWithRepresentedFilename:Wrap(filename.raw)]; + return true; + } + + void SetMenuBar(MenuBarRef newMenuBar) override { + // Doesn't do anything, since we have an unique global menu bar. + } + + void GetContentSize(double *width, double *height) override { + NSSize nsSize = ssView.frame.size; + *width = nsSize.width; + *height = nsSize.height; + } + + void SetMinContentSize(double width, double height) override { + NSSize nsMinSize; + nsMinSize.width = width; + nsMinSize.height = height; + [nsWindow setContentMinSize:nsMinSize]; + [nsWindow setContentSize:nsMinSize]; + } + + void FreezePosition(SettingsRef _settings, const std::string &key) override { + [nsWindow saveFrameUsingName:Wrap(key)]; + } + + void ThawPosition(SettingsRef _settings, const std::string &key) override { + [nsWindow setFrameUsingName:Wrap(key)]; + } + + void SetCursor(Cursor cursor) override { + NSCursor *nsNewCursor; + switch(cursor) { + case Cursor::POINTER: nsNewCursor = [NSCursor arrowCursor]; break; + case Cursor::HAND: nsNewCursor = [NSCursor pointingHandCursor]; break; + } + + if([NSCursor currentCursor] != nsNewCursor) { + [nsNewCursor set]; + } + } + + void SetTooltip(const std::string &newText, double x, double y, double w, double h) override { + NSString *nsNewText = Wrap(newText); + if(![nsToolTip isEqualToString:nsNewText]) { + nsToolTip = nsNewText; + + NSToolTipManager *nsToolTipManager = [NSToolTipManager sharedToolTipManager]; + if(newText.empty()) { + if ([nsToolTipManager respondsToSelector:@selector(abortToolTip)]) { + [nsToolTipManager abortToolTip]; + } else { + [nsToolTipManager orderOutToolTip]; + } + } else { + [nsToolTipManager _displayTemporaryToolTipForView:ssView withString:Wrap(newText)]; + } + } + } + + bool IsEditorVisible() override { + return [ssView isEditing]; + } + + void ShowEditor(double x, double y, double fontHeight, double minWidth, + bool isMonospace, const std::string &text) override { + [ssView startEditing:Wrap(text) at:(NSPoint){(CGFloat)x, (CGFloat)y} + withHeight:fontHeight minWidth:minWidth usingMonospace:isMonospace]; + } + + void HideEditor() override { + [ssView stopEditing]; + } + + void SetScrollbarVisible(bool visible) override { + if(visible) { + [nsContainer removeConstraints:nsConstraintsWithoutScrollbar]; + [nsContainer addConstraints:nsConstraintsWithScrollbar]; + } else { + [nsContainer removeConstraints:nsConstraintsWithScrollbar]; + [nsContainer addConstraints:nsConstraintsWithoutScrollbar]; + } + } + + void ConfigureScrollbar(double min, double max, double pageSize) override { + ssView.scrollerMin = min; + ssView.scrollerSize = max + 1 - min; + ssView.pageSize = pageSize; + nsScroller.knobProportion = pageSize / ssView.scrollerSize; + nsScroller.hidden = pageSize >= ssView.scrollerSize; + } + + double GetScrollbarPosition() override { + // Platform::Window scrollbar positions are in the range [min, max+1 - pageSize] inclusive, + // and Cocoa scrollbars are from 0.0 to 1.0 inclusive, so we have to apply some scaling and + // transforming. (scrollerSize is max+1-min, see ConfigureScrollbar above) + return ssView.scrollerMin + + nsScroller.doubleValue * (ssView.scrollerSize - ssView.pageSize); + } + + void SetScrollbarPosition(double pos) override { + nsScroller.doubleValue = (pos - ssView.scrollerMin) / ( ssView.scrollerSize - ssView.pageSize); + } + + void Invalidate() override { + ssView.needsDisplay = YES; + } +}; + +WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { + return std::make_shared(kind, + std::static_pointer_cast(parentWindow)); +} + +//----------------------------------------------------------------------------- +// 3DConnexion support +//----------------------------------------------------------------------------- + +// Normally we would just link to the 3DconnexionClient framework. +// +// We don't want to (are not allowed to) distribute the official framework, so we're trying +// to use the one installed on the users' computer. There are some different versions of +// the framework, the official one and re-implementations using an open source driver for +// older devices (spacenav-plus). So weak-linking isn't an option, either. The only remaining +// way is using CFBundle to dynamically load the library at runtime, and also detect its +// availability. +// +// We're also defining everything needed from the 3DconnexionClientAPI, so we're not depending +// on the API headers. + +#pragma pack(push,2) + +enum { + kConnexionClientModeTakeOver = 1, + kConnexionClientModePlugin = 2 +}; + +#define kConnexionMsgDeviceState '3dSR' +#define kConnexionMaskButtons 0x00FF +#define kConnexionMaskAxis 0x3F00 + +typedef struct { + uint16_t version; + uint16_t client; + uint16_t command; + int16_t param; + int32_t value; + UInt64 time; + uint8_t report[8]; + uint16_t buttons8; + int16_t axis[6]; + uint16_t address; + uint32_t buttons; +} ConnexionDeviceState, *ConnexionDeviceStatePtr; + +#pragma pack(pop) + +typedef void (*ConnexionAddedHandlerProc)(io_connect_t); +typedef void (*ConnexionRemovedHandlerProc)(io_connect_t); +typedef void (*ConnexionMessageHandlerProc)(io_connect_t, natural_t, void *); + +typedef OSErr (*InstallConnexionHandlersProc)(ConnexionMessageHandlerProc, ConnexionAddedHandlerProc, ConnexionRemovedHandlerProc); +typedef void (*CleanupConnexionHandlersProc)(void); +typedef UInt16 (*RegisterConnexionClientProc)(UInt32, UInt8 *, UInt16, UInt32); +typedef void (*UnregisterConnexionClientProc)(UInt16); + +static CFBundleRef spaceBundle = nil; +static InstallConnexionHandlersProc installConnexionHandlers = NULL; +static CleanupConnexionHandlersProc cleanupConnexionHandlers = NULL; +static RegisterConnexionClientProc registerConnexionClient = NULL; +static UnregisterConnexionClientProc unregisterConnexionClient = NULL; +static UInt32 connexionSignature = 'SoSp'; +static UInt8 *connexionName = (UInt8 *)"\x10SolveSpace"; +static UInt16 connexionClient = 0; + +static std::vector> connexionWindows; +static bool connexionShiftIsDown = false; +static bool connexionCommandIsDown = false; + +static void ConnexionAdded(io_connect_t con) {} +static void ConnexionRemoved(io_connect_t con) {} +static void ConnexionMessage(io_connect_t con, natural_t type, void *arg) { + if (type != kConnexionMsgDeviceState) { + return; + } + + ConnexionDeviceState *device = (ConnexionDeviceState *)arg; + + dispatch_async(dispatch_get_main_queue(), ^(void){ + SixDofEvent event = {}; + event.type = SixDofEvent::Type::MOTION; + event.translationX = (double)device->axis[0] * -0.25; + event.translationY = (double)device->axis[1] * -0.25; + event.translationZ = (double)device->axis[2] * 0.25; + event.rotationX = (double)device->axis[3] * -0.0005; + event.rotationY = (double)device->axis[4] * -0.0005; + event.rotationZ = (double)device->axis[5] * -0.0005; + event.shiftDown = connexionShiftIsDown; + event.controlDown = connexionCommandIsDown; + + for(auto window : connexionWindows) { + if(auto windowStrong = window.lock()) { + if(windowStrong->onSixDofEvent) { + windowStrong->onSixDofEvent(event); + } + } + } + }); +} + +void Open3DConnexion() { + NSString *bundlePath = @"/Library/Frameworks/3DconnexionClient.framework"; + NSURL *bundleURL = [NSURL fileURLWithPath:bundlePath]; + spaceBundle = CFBundleCreate(kCFAllocatorDefault, (__bridge CFURLRef)bundleURL); + + // Don't continue if no driver is installed on this machine + if(spaceBundle == nil) { + return; + } + + installConnexionHandlers = (InstallConnexionHandlersProc) + CFBundleGetFunctionPointerForName(spaceBundle, + CFSTR("InstallConnexionHandlers")); + + cleanupConnexionHandlers = (CleanupConnexionHandlersProc) + CFBundleGetFunctionPointerForName(spaceBundle, + CFSTR("CleanupConnexionHandlers")); + + registerConnexionClient = (RegisterConnexionClientProc) + CFBundleGetFunctionPointerForName(spaceBundle, + CFSTR("RegisterConnexionClient")); + + unregisterConnexionClient = (UnregisterConnexionClientProc) + CFBundleGetFunctionPointerForName(spaceBundle, + CFSTR("UnregisterConnexionClient")); + + // Only continue if all required symbols have been loaded + if((installConnexionHandlers == NULL) || (cleanupConnexionHandlers == NULL) + || (registerConnexionClient == NULL) || (unregisterConnexionClient == NULL)) { + CFRelease(spaceBundle); + spaceBundle = nil; + return; + } + + installConnexionHandlers(&ConnexionMessage, &ConnexionAdded, &ConnexionRemoved); + connexionClient = registerConnexionClient(connexionSignature, connexionName, + kConnexionClientModeTakeOver, kConnexionMaskButtons | kConnexionMaskAxis); + + [NSEvent addLocalMonitorForEventsMatchingMask:(NSEventMaskKeyDown | NSEventMaskFlagsChanged) + handler:^(NSEvent *event) { + connexionShiftIsDown = (event.modifierFlags & NSEventModifierFlagShift); + connexionCommandIsDown = (event.modifierFlags & NSEventModifierFlagCommand); + return event; + }]; + + [NSEvent addLocalMonitorForEventsMatchingMask:(NSEventMaskKeyUp | NSEventMaskFlagsChanged) + handler:^(NSEvent *event) { + connexionShiftIsDown = (event.modifierFlags & NSEventModifierFlagShift); + connexionCommandIsDown = (event.modifierFlags & NSEventModifierFlagCommand); + return event; + }]; +} + +void Close3DConnexion() { + if(spaceBundle == nil) { + return; + } + + unregisterConnexionClient(connexionClient); + cleanupConnexionHandlers(); + + CFRelease(spaceBundle); +} + +void Request3DConnexionEventsForWindow(WindowRef window) { + connexionWindows.push_back(window); +} + +//----------------------------------------------------------------------------- +// Message dialogs +//----------------------------------------------------------------------------- + +class MessageDialogImplCocoa final : public MessageDialog { +public: + NSAlert *nsAlert = [[NSAlert alloc] init]; + NSWindow *nsWindow; + + std::vector responses; + + void SetType(Type type) override { + switch(type) { + case Type::INFORMATION: + case Type::QUESTION: + nsAlert.alertStyle = NSAlertStyleInformational; + break; + + case Type::WARNING: + case Type::ERROR: + nsAlert.alertStyle = NSAlertStyleWarning; + break; + } + } + + void SetTitle(std::string title) override { + [nsAlert.window setTitle:Wrap(title)]; + } + + void SetMessage(std::string message) override { + nsAlert.messageText = Wrap(message); + } + + void SetDescription(std::string description) override { + nsAlert.informativeText = Wrap(description); + } + + void AddButton(std::string label, Response response, bool isDefault) override { + NSButton *nsButton = [nsAlert addButtonWithTitle:Wrap(PrepareMnemonics(label))]; + if(!isDefault && [nsButton.keyEquivalent isEqualToString:@"\n"]) { + nsButton.keyEquivalent = @""; + } else if(response == Response::CANCEL) { + nsButton.keyEquivalent = @"\e"; + } + responses.push_back(response); + } + + Response RunModal() override { + // FIXME(platform/gui): figure out a way to run the alert as a sheet + NSModalResponse nsResponse = [nsAlert runModal]; + ssassert(nsResponse >= NSAlertFirstButtonReturn && + nsResponse <= NSAlertFirstButtonReturn + (long)responses.size(), + "Unexpected response"); + return responses[nsResponse - NSAlertFirstButtonReturn]; + } +}; + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow) { + std::shared_ptr dialog = std::make_shared(); + dialog->nsWindow = std::static_pointer_cast(parentWindow)->nsWindow; + return dialog; +} + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +} +} + +@interface SSSaveFormatAccessory : NSViewController +@property NSSavePanel *panel; +@property NSMutableArray *filters; + +@property(nonatomic) NSInteger index; +@property(nonatomic) IBOutlet NSTextField *textField; +@property(nonatomic) IBOutlet NSPopUpButton *button; +@end + +@implementation SSSaveFormatAccessory +@synthesize panel, filters, button; + +- (void)setIndex:(NSInteger)newIndex { + self->_index = newIndex; + NSMutableArray *filter = [filters objectAtIndex:newIndex]; + NSString *extension = [filter objectAtIndex:0]; + if(![extension isEqual:@"*"]) { + NSString *filename = panel.nameFieldStringValue; + NSString *basename = [[filename componentsSeparatedByString:@"."] objectAtIndex:0]; + panel.nameFieldStringValue = [basename stringByAppendingPathExtension:extension]; + } + [panel setAllowedFileTypes:filter]; +} +@end + +namespace SolveSpace { +namespace Platform { + +class FileDialogImplCocoa : public FileDialog { +public: + NSSavePanel *nsPanel = nil; + + void SetTitle(std::string title) override { + nsPanel.title = Wrap(title); + } + + void SetCurrentName(std::string name) override { + nsPanel.nameFieldStringValue = Wrap(name); + } + + Platform::Path GetFilename() override { + return Platform::Path::From(nsPanel.URL.fileSystemRepresentation); + } + + void SetFilename(Platform::Path path) override { + nsPanel.directoryURL = + [NSURL fileURLWithPath:Wrap(path.Parent().raw) isDirectory:YES]; + nsPanel.nameFieldStringValue = Wrap(path.FileStem()); + } + + void SuggestFilename(Platform::Path path) override { + SetFilename(path.WithExtension("")); + } + + void FreezeChoices(SettingsRef settings, const std::string &key) override { + if (nsPanel.directoryURL != nil) { + settings->FreezeString("Dialog_" + key + "_Folder", + [nsPanel.directoryURL.absoluteString UTF8String]); + } + } + + void ThawChoices(SettingsRef settings, const std::string &key) override { + nsPanel.directoryURL = + [NSURL URLWithString:Wrap(settings->ThawString("Dialog_" + key + "_Folder", ""))]; + } + + bool RunModal() override { + if([nsPanel runModal] == NSModalResponseOK) { + return true; + } else { + return false; + } + } +}; + +class OpenFileDialogImplCocoa final : public FileDialogImplCocoa { +public: + NSMutableArray *nsFilter = [[NSMutableArray alloc] init]; + + OpenFileDialogImplCocoa() { + SetTitle(C_("title", "Open File")); + } + + void AddFilter(std::string name, std::vector extensions) override { + for(auto extension : extensions) { + [nsFilter addObject:Wrap(extension)]; + } + [nsPanel setAllowedFileTypes:nsFilter]; + } +}; + +class SaveFileDialogImplCocoa final : public FileDialogImplCocoa { +public: + NSMutableArray *nsFilters = [[NSMutableArray alloc] init]; + SSSaveFormatAccessory *ssAccessory = nil; + + SaveFileDialogImplCocoa() { + SetTitle(C_("title", "Save File")); + } + + void AddFilter(std::string name, std::vector extensions) override { + NSMutableArray *nsFilter = [[NSMutableArray alloc] init]; + for(auto extension : extensions) { + [nsFilter addObject:Wrap(extension)]; + } + if(nsFilters.count == 0) { + [nsPanel setAllowedFileTypes:nsFilter]; + } + [nsFilters addObject:nsFilter]; + + std::string desc; + for(auto extension : extensions) { + if(!desc.empty()) desc += ", "; + desc += extension; + } + std::string title = name + " (" + desc + ")"; + if(nsFilters.count == 1) { + [ssAccessory.button removeAllItems]; + } + [ssAccessory.button addItemWithTitle:Wrap(title)]; + [ssAccessory.button synchronizeTitleAndSelectedItem]; + } + + void FreezeChoices(SettingsRef settings, const std::string &key) override { + FileDialogImplCocoa::FreezeChoices(settings, key); + settings->FreezeInt("Dialog_" + key + "_Filter", ssAccessory.index); + } + + void ThawChoices(SettingsRef settings, const std::string &key) override { + FileDialogImplCocoa::ThawChoices(settings, key); + ssAccessory.index = settings->ThawInt("Dialog_" + key + "_Filter", 0); + } + + bool RunModal() override { + if(nsFilters.count == 1) { + nsPanel.accessoryView = nil; + } + + if(nsPanel.nameFieldStringValue.length == 0) { + nsPanel.nameFieldStringValue = Wrap(_("untitled")); + } + + return FileDialogImplCocoa::RunModal(); + } +}; + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow) { + NSOpenPanel *nsPanel = [NSOpenPanel openPanel]; + nsPanel.canSelectHiddenExtension = YES; + + std::shared_ptr dialog = std::make_shared(); + dialog->nsPanel = nsPanel; + + return dialog; +} + +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow) { + NSSavePanel *nsPanel = [NSSavePanel savePanel]; + nsPanel.canSelectHiddenExtension = YES; + + SSSaveFormatAccessory *ssAccessory = + [[SSSaveFormatAccessory alloc] initWithNibName:@"SaveFormatAccessory" bundle:nil]; + ssAccessory.panel = nsPanel; + nsPanel.accessoryView = [ssAccessory view]; + + std::shared_ptr dialog = std::make_shared(); + dialog->nsPanel = nsPanel; + dialog->ssAccessory = ssAccessory; + ssAccessory.filters = dialog->nsFilters; + + return dialog; +} + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector GetFontFiles() { + std::vector fonts; + + NSArray *fontNames = [[NSFontManager sharedFontManager] availableFonts]; + for(NSString *fontName in fontNames) { + CTFontDescriptorRef fontRef = + CTFontDescriptorCreateWithNameAndSize ((__bridge CFStringRef)fontName, 10.0); + CFURLRef url = (CFURLRef)CTFontDescriptorCopyAttribute(fontRef, kCTFontURLAttribute); + NSString *fontPath = [NSString stringWithString:[(NSURL *)CFBridgingRelease(url) path]]; + fonts.push_back( + Platform::Path::From([[NSFileManager defaultManager] + fileSystemRepresentationWithPath:fontPath])); + } + + return fonts; +} + +void OpenInBrowser(const std::string &url) { + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:Wrap(url)]]; +} + +} +} + +@interface SSApplicationDelegate : NSObject +- (IBAction)preferences:(id)sender; +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; + +@property BOOL exiting; + +@end + +@implementation SSApplicationDelegate + +@synthesize exiting; + +- (id)init { + if (self = [super init]) { + self.exiting = false; + } + return self; +} + +- (IBAction)preferences:(id)sender { + if (!SS.GW.showTextWindow) { + SolveSpace::SS.GW.MenuView(SolveSpace::Command::SHOW_TEXT_WND); + } + SolveSpace::SS.TW.GoToScreen(SolveSpace::TextWindow::Screen::CONFIGURATION); + SolveSpace::SS.ScheduleShowTW(); +} + +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { + SolveSpace::Platform::Path path = SolveSpace::Platform::Path::From([filename UTF8String]); + return SolveSpace::SS.Load(path.Expand(/*fromCurrentDirectory=*/true)); +} + +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { + if(!SS.unsaved) { + return NSTerminateNow; + } else { + [self performSelectorOnMainThread:@selector(applicationTerminatePrompt) withObject:nil + waitUntilDone:NO modes:@[NSDefaultRunLoopMode, NSModalPanelRunLoopMode]]; + return NSTerminateLater; + } +} + +- (void)applicationWillTerminate:(NSNotification *)notification { + if(!exiting) { + // Prevent the Platform::ExitGui() call from SolveSpaceUI::Exit() + // triggering another terminate + exiting = true; + // Now let SS save settings etc + SS.Exit(); + } +} + +- (void)applicationTerminatePrompt { + [NSApp replyToApplicationShouldTerminate:SS.OkayToStartNewFile()]; +} +@end + +namespace SolveSpace { +namespace Platform { + +static SSApplicationDelegate *ssDelegate; + +std::vector InitGui(int argc, char **argv) { + std::vector args = InitCli(argc, argv); + if(args.size() >= 2 && args[1].find("-psn_") == 0) { + // For unknown reasons, Finder passes a Carbon PSN (Process Serial Number) argument + // when a freshly downloaded application is run for the first time. Remove it so + // that it isn't interpreted as a filename. + args.erase(args.begin() + 1); + } + + ssDelegate = [[SSApplicationDelegate alloc] init]; + NSApplication.sharedApplication.delegate = ssDelegate; + + // Setting this prevents "Show Tab Bar" and "Show All Tabs" items from being + // automagically added to the View menu + NSWindow.allowsAutomaticWindowTabbing = NO; + + // And this prevents the duplicate "Enter Full Screen" menu item, see + // https://stackoverflow.com/questions/52154977/how-to-get-rid-of-enter-full-screen-menu-item + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"]; + + [NSBundle.mainBundle loadNibNamed:@"MainMenu" owner:nil topLevelObjects:nil]; + + NSArray *languages = NSLocale.preferredLanguages; + for(NSString *language in languages) { + if(SolveSpace::SetLocale([language UTF8String])) break; + } + if(languages.count == 0) { + SolveSpace::SetLocale("en_US"); + } + + return args; +} + +void RunGui() { + [NSApp run]; +} + +void ExitGui() { + if(!ssDelegate.exiting) { + ssDelegate.exiting = true; + [NSApp terminate:nil]; + } +} + +void ClearGui() {} + +} +} diff --git a/src/platform/guinone.cpp b/src/platform/guinone.cpp new file mode 100644 index 0000000..4641b98 --- /dev/null +++ b/src/platform/guinone.cpp @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Our platform support functions for the headless (no OpenGL) test runner. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Rendering +//----------------------------------------------------------------------------- + +std::shared_ptr CreateRenderer() { + return std::make_shared(); +} + +namespace Platform { + +//----------------------------------------------------------------------------- +// Fatal errors +//----------------------------------------------------------------------------- + +void FatalError(const std::string &message) { + fprintf(stderr, "%s", message.c_str()); + abort(); +} + +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +class SettingsImplDummy final : public Settings { +public: + void FreezeInt(const std::string &key, uint32_t value) override { + } + + uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) override { + return defaultValue; + } + + void FreezeFloat(const std::string &key, double value) override { + } + + double ThawFloat(const std::string &key, double defaultValue = 0.0) override { + return defaultValue; + } + + void FreezeString(const std::string &key, const std::string &value) override { + } + + std::string ThawString(const std::string &key, const std::string &defaultValue = "") override { + return defaultValue; + } +}; + +SettingsRef GetSettings() { + static std::shared_ptr settings = + std::make_shared(); + return settings; +} + +//----------------------------------------------------------------------------- +// Timers +//----------------------------------------------------------------------------- + +class TimerImplDummy final : public Timer { +public: + void RunAfter(unsigned milliseconds) override {} +}; + +TimerRef CreateTimer() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Menus +//----------------------------------------------------------------------------- + +MenuRef CreateMenu() { + return std::shared_ptr(); +} + +MenuBarRef GetOrCreateMainMenu(bool *unique) { + *unique = false; + return std::shared_ptr(); +} + +//----------------------------------------------------------------------------- +// Windows +//----------------------------------------------------------------------------- + +WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { + return std::shared_ptr(); +} + +void Request3DConnexionEventsForWindow(WindowRef window) {} + +//----------------------------------------------------------------------------- +// Message dialogs +//----------------------------------------------------------------------------- + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow) { + return std::shared_ptr(); +} + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow) { + return std::shared_ptr(); +} + +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow) { + return std::shared_ptr(); +} + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector fontFiles; +std::vector GetFontFiles() { + return fontFiles; +} + +void OpenInBrowser(const std::string &url) {} + +std::vector InitGui(int argc, char **argv) { + return {}; +} + +void RunGui() {} + +void ExitGui() { + exit(0); +} + +void ClearGui() {} + +} + +} diff --git a/src/platform/guiqt.cpp b/src/platform/guiqt.cpp new file mode 100644 index 0000000..dcee6ea --- /dev/null +++ b/src/platform/guiqt.cpp @@ -0,0 +1,1076 @@ +//----------------------------------------------------------------------------- +// The Qt-based implementation of platform-dependent GUI functionality. +// +// Copyright 2024 Karl Robillard +// Copyright 2023 Raed Marwan +// SPDX-License-Identifier: GPL-3.0-or-later +//----------------------------------------------------------------------------- + +#include +#include "solvespace.h" +#include "platform.h" +#include "guiqt.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +# include +#else +# include +#endif + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Fatal errors +//----------------------------------------------------------------------------- + +void FatalError(const std::string& message) +{ + QMessageBox::critical(NULL, QString("Fatal Error"), + QString::fromStdString(message), + QMessageBox::StandardButton::Ok); + abort(); +} + +//----------------------------------------------------------------------------- +// Message dialogs +//----------------------------------------------------------------------------- + +class MessageDialogImplQt final : public MessageDialog { +public: + QMessageBox messageBoxQ; + + MessageDialogImplQt(QWidget* parent) : messageBoxQ(parent) { + } + +#undef ERROR + void SetType(Type type) override { + switch (type) { + case Type::INFORMATION: + messageBoxQ.setIcon(QMessageBox::Information); + break; + case Type::QUESTION: + messageBoxQ.setIcon(QMessageBox::Question); + break; + case Type::WARNING: + messageBoxQ.setIcon(QMessageBox::Warning); + break; + case Type::ERROR: + messageBoxQ.setIcon(QMessageBox::Critical); + break; + } + } + + void SetTitle(std::string title) override { + messageBoxQ.setWindowTitle(QString::fromStdString(title)); + } + + void SetMessage(std::string message) override { + messageBoxQ.setText(QString::fromStdString(message)); + } + + void SetDescription(std::string description) override { + messageBoxQ.setInformativeText(QString::fromStdString(description)); + } + + void AddButton(std::string label, Response response, bool isDefault) override { + QMessageBox::StandardButton std; + switch (response) { + case Response::NONE: ssassert(false, "Invalid response"); + case Response::OK: + std = QMessageBox::StandardButton::Ok; + break; + case Response::YES: + std = QMessageBox::StandardButton::Yes; + break; + case Response::NO: + std = QMessageBox::StandardButton::No; + break; + case Response::CANCEL: + std = QMessageBox::StandardButton::Cancel; + break; + } + QPushButton* button = messageBoxQ.addButton(std); + button->setText(QString::fromStdString(label)); + if (isDefault) + messageBoxQ.setDefaultButton(button); + } + + Response RunModal() { + switch (messageBoxQ.exec()) + { + case QMessageBox::StandardButton::Cancel: + return Response::CANCEL; + case QMessageBox::StandardButton::No: + return Response::NO; + case QMessageBox::StandardButton::Yes: + return Response::YES; + case QMessageBox::StandardButton::Ok: + return Response::OK; + default: // NONE + return Response::NONE; + } + } +}; + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +class FileDialogImplQt final : public FileDialog { +public: + QFileDialog fileDialogQ; + QStringList filters; + bool filtersMod; + + FileDialogImplQt(QWidget* parent, bool save) : filtersMod(false) { + fileDialogQ.setParent(parent); + fileDialogQ.setWindowFlags(Qt::Dialog); // Reset after setParent. + + // NOTE: The file extension is automatically set by the KDE native + // dialog but not with the Qt one. +#if 0 + fileDialogQ.setOption(QFileDialog::DontUseNativeDialog); +#endif + + if (save) { + fileDialogQ.setAcceptMode(QFileDialog::AcceptSave); + } + } + + void SetTitle(std::string title) { + fileDialogQ.setWindowTitle(QString::fromStdString(title)); + } + + void SetCurrentName(std::string name) { + fileDialogQ.selectFile(QString::fromStdString(name)); + } + + Platform::Path GetFilename() { + QStringList files = fileDialogQ.selectedFiles(); + return Path::From(QDir::toNativeSeparators(files[0]).toStdString()); + } + + void SetFilename(Platform::Path path) { + fileDialogQ.selectFile(QString::fromStdString(path.raw)); + } + + void SuggestFilename(Platform::Path path) { + fileDialogQ.selectFile(QString::fromStdString(path.FileStem())); + } + + void AddFilter(std::string name, std::vector extensions) override { + QString fline(name.c_str()); + int count = 0; + for (auto& ext : extensions) { + fline.append(count ? " *." : " (*."); + fline.append(ext.c_str()); + ++count; + } + fline.append(")"); + + //printf("AddFilter \"%s\"\n", fline.toLocal8Bit().data()); + filters.append(fline); + filtersMod = true; + } + + void updateFilters() { + if (filtersMod) { + filtersMod = false; + fileDialogQ.setNameFilters(filters); + } + } + + void FreezeChoices(SettingsRef settings, const std::string& key) + { + settings->FreezeString("Dialog_" + key + "_Folder", + fileDialogQ.directory().absolutePath().toStdString()); + settings->FreezeString("Dialog_" + key + "_Filter", + fileDialogQ.selectedNameFilter().toStdString()); + } + + void ThawChoices(SettingsRef settings, const std::string &key) + { + updateFilters(); + + std::string val; + val = settings->ThawString("Dialog_" + key + "_Folder"); + fileDialogQ.setDirectory(QDir(QString::fromStdString(val))); + val = settings->ThawString("Dialog_" + key + "_Filter"); + fileDialogQ.selectNameFilter(QString::fromStdString(val)); + } + + bool RunModal() override { + updateFilters(); + return fileDialogQ.exec(); + } +}; + +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +class SettingsImplQt final : public Settings { +public: + QSettings qset; + + SettingsImplQt() : qset("SolveSpace", "solvespace") { + } + + void FreezeInt(const std::string& key, uint32_t value) override { + qset.setValue(QString::fromStdString(key), value); + } + + uint32_t ThawInt(const std::string& key, uint32_t defaultValue = 0) override { + return qset.value(QString::fromStdString(key), defaultValue).toInt(); + } + + void FreezeFloat(const std::string& key, double value) override{ + qset.setValue(QString::fromStdString(key), value); + } + + double ThawFloat(const std::string& key, double defaultValue = 0.0) override { + return qset.value(QString::fromStdString(key), defaultValue).toDouble(); + } + + void FreezeString(const std::string& key, const std::string& value) override { + qset.setValue(QString::fromStdString(key), + QString::fromStdString(value)); + } + + std::string ThawString(const std::string& key, const std::string& defaultValue = "") override { + return qset.value(QString::fromStdString(key), + QString::fromStdString(defaultValue)).toString().toStdString(); + } +}; + +SettingsRef GetSettings() +{ + static std::shared_ptr settings; + if (!settings) { + settings = std::make_shared(); + } + return settings; +} + +//----------------------------------------------------------------------------- +// Timers +//----------------------------------------------------------------------------- + +class TimerImplQt final : public Timer, public QObject +{ +public: + TimerImplQt() {} + + void RunAfter(unsigned milliseconds) override { + QTimer::singleShot(milliseconds, this, &TimerImplQt::runOnTimeOut); + } + + void runOnTimeOut() { + if(onTimeout) { + onTimeout(); + } + } +}; + +TimerRef CreateTimer() { + std::shared_ptr timer = std::make_shared(); + return timer; +} + +//----------------------------------------------------------------------------- +// Menus +//----------------------------------------------------------------------------- + +class MenuItemImplQt final : public MenuItem, public QObject { +public: + QAction action; + + MenuItemImplQt() { + connect(&action, &QAction::triggered, this, &MenuItemImplQt::onTriggered); + } + + void SetAccelerator(KeyboardEvent accel) override { + int key = 0; + + if (accel.key == KeyboardEvent::Key::CHARACTER) { + if (accel.chr == '\t') { + key = Qt::Key_Tab; + } else if (accel.chr == '\x1b') { + key = Qt::Key_Escape; + } else if (accel.chr == '\x7f') { + key = Qt::Key_Delete; + } else { + key = std::toupper(accel.chr); + } + } else if (accel.key == KeyboardEvent::Key::FUNCTION) { + key = Qt::Key_F1 + accel.num - 1; + } + + if (key) { + if (accel.controlDown) { + key |= Qt::CTRL; + } + if (accel.shiftDown) { + key |= Qt::SHIFT; + } + action.setShortcut(key); + } + } + + /* + RADIO_MARK must be implemented using QActionGroup so we scan for + sequential actions with the "radio_mark" property to form these groups. + It would be safer if the Indicator type was an argument to + Platform::Menu::AddItem rather than a set by a separate method to guarantee + that the Indicator type can never change. + */ + void SetIndicator(Indicator type) override { + switch (type) + { + case Indicator::NONE: + action.setCheckable(false); + break; + case Indicator::CHECK_MARK: + action.setCheckable(true); + break; + case Indicator::RADIO_MARK: + action.setCheckable(true); + // Added to QActionGroup later by formActionGroups(). + action.setProperty("radio_mark", true); + break; + } + } + + void SetEnabled(bool enabled) override { + action.setEnabled(enabled); + } + + void SetActive(bool active) override { + action.setChecked(active); + } + +public slots: + void onTriggered(bool value) + { + if (onTrigger) + onTrigger(); + } +}; + +class MenuImplQt final : public Menu { +public: + QMenu* menuQ; + bool hasParent; + std::vector> menuItems; + std::vector> subMenus; + + MenuImplQt(bool hasParentParam = true) { + menuQ = new QMenu(); + hasParent = hasParentParam; + } + + MenuImplQt(QMenu* menuQParam) { + menuQ = menuQParam; + hasParent = true; + } + + std::shared_ptr AddItem(const std::string& label, std::function onTrigger, + bool /*mnemonics*/) override { + + std::shared_ptr menuItem = std::make_shared(); + menuItem->onTrigger = onTrigger; + menuItem->action.setText(QString::fromStdString(label)); + // I do not think anything is needed for mnemonics flag. + // the shortcut key sequence is set in the menuItem class and Qt acts + // accordingly with no further activation ... I think + menuItems.push_back(menuItem); + + // The QWidget::addAction method does not take ownership of the action. + menuQ->addAction(&menuItem->action); + return menuItem; + } + + std::shared_ptr AddSubMenu(const std::string& label) override { + std::shared_ptr subMenu = std::make_shared(menuQ->addMenu(QString::fromStdString(label))); + subMenus.push_back(subMenu); + return subMenu; + } + + void AddSeparator() override { + menuQ->addSeparator(); + } + + void PopUp() override { + if (true == this->hasParent) + return; + + menuQ->popup(menuQ->mapFromGlobal(QCursor::pos())); + menuQ->exec(); + } + + void Clear() override { + menuQ->clear(); + menuItems.clear(); + subMenus.clear(); + } +}; + +MenuRef CreateMenu() { + return std::make_shared(false); // false says -> menu has not Qtwidget as a parent +} + +class MenuBarImpQt final : public MenuBar { +public: + QMenuBar* menuBarQ; + std::vector> subMenus; + + MenuBarImpQt() { + // The QMenuBar is deleted by the QMainWindow its attached to. + menuBarQ = new QMenuBar; + menuBarQ->setNativeMenuBar(false); + } + + std::shared_ptr AddSubMenu(const std::string& label) override { + std::shared_ptr menu = std::make_shared(); + menuBarQ->addMenu(menu->menuQ); + menu->menuQ->setTitle(QString::fromStdString(label)); + subMenus.push_back(menu); + return menu; + } + + void Clear() override { + menuBarQ->clear(); + subMenus.clear(); + } + + static void _formActionGroups(QMenu *menu) { + QActionGroup* group = nullptr; + foreach (QAction* act, menu->actions()) { + if(act->menu()) { + _formActionGroups(act->menu()); + } else { + QVariant var = act->property("radio_mark"); + if(var.isValid()) { + if(! group) + group = new QActionGroup(menu); + //printf("radio_mark on menu %p\n", menu); + group->addAction(act); + } else { + group = nullptr; // End current group. + } + } + } + } + + void formActionGroups() { + foreach (QAction* act, menuBarQ->actions()) { + if (act->menu()) { + _formActionGroups(act->menu()); + } + } + } +}; + +MenuBarRef GetOrCreateMainMenu(bool* unique) { + *unique = false; + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Windows +//----------------------------------------------------------------------------- + +class SSApplication : public QApplication { +public: + SSApplication(int &argc, char **argv) : QApplication(argc, argv) + { + // Setup fonts once for SSView QLineEdit. +#ifdef _WIN32 + fontEdit = QFont("Arial"); + fontEditMono = QFont("Lucida Console"); +#else + fontEdit = QFontDatabase::systemFont(QFontDatabase::GeneralFont); + fontEditMono = QFontDatabase::systemFont(QFontDatabase::FixedFont); + /* + printf("Font general %s\n", fontEdit.family().toLocal8Bit().data()); + printf("Font mono %s\n", fontEditMono.family().toLocal8Bit().data()); + */ +#endif + + // Set language locale. + std::string localeStr("en_US"); + QStringList list = QLocale::system().uiLanguages(); + if (! list.empty()) { + QString lang = list[0]; + if (lang.size() == 5 && lang[2] == '-') { + lang[2] = '_'; + localeStr = lang.toStdString(); + } + } + SetLocale(localeStr); + setlocale(LC_NUMERIC, "C"); + + QIcon icon(":/icons/solvespace.png"); + setWindowIcon(icon); + } + + QFont fontEdit; + QFont fontEditMono; +}; + +SSView::SSView(QWidget* parent) : QOpenGLWidget(parent) { + entry = new QLineEdit(this); + entry->setVisible(false); + connect(entry, SIGNAL(returnPressed()), SLOT(entryFinished())); + + setFocusPolicy(Qt::FocusPolicy::StrongFocus); + setMouseTracking(true); + pixelRatio = pixelRatioI = 1.0; +} + +void SSView::startEditing(double xd, double yd, int fontHeight, int minWidth, + bool isMonoSpace, const std::string& val) +{ + int x = int(xd / pixelRatio); + int y = int(yd / pixelRatio); + //printf("startEditing %d,%d, %d,%d %d\n", x, y, fontHeight, minWidth, isMonoSpace); + + SSApplication* app = static_cast(qApp); + QFont font = isMonoSpace ? app->fontEditMono : app->fontEdit; + font.setPixelSize(fontHeight); + entry->setFont(font); + + QFontMetrics fm(font); + int valWidth = fm.averageCharWidth() * val.size(); + if (minWidth < valWidth) + minWidth = valWidth; + if (x < 0) + x = 0; + + entry->setGeometry(QRect(x, y - fm.ascent(), minWidth, fm.height())); + entry->setText(QString::fromStdString(val)); + + if (! entry->isVisible()) { + entry->selectAll(); + entry->show(); + entry->setFocus(); + } +} + +void SSView::stopEditing() { + if (entry->isVisible()) { + entry->hide(); + setFocus(); + } +} + +void SSView::entryFinished() { + std::string entryText = entry->text().toStdString(); + receiver->onEditingDone(entryText); +} + +void SSView::paintGL() { + // pixelRatio is set here as devicePixelRatioF has been seen to change + // after the resizeGL() & showEvent() methods are called. + pixelRatio = devicePixelRatioF(); + pixelRatioI = floor(pixelRatio); + + receiver->onRender(); +} + +static inline void setMouseKeyModifiers(MouseEvent& me, const QInputEvent* qe) +{ + Qt::KeyboardModifiers mod = qe->modifiers(); + me.shiftDown = mod & Qt::ShiftModifier ? true : false; + me.controlDown = mod & Qt::ControlModifier ? true : false; +} + +void SSView::wheelEvent(QWheelEvent* event) +{ + const double wheelDelta=120.0; + slvMouseEvent.button = MouseEvent::Button::NONE; + slvMouseEvent.type = MouseEvent::Type::SCROLL_VERT; + slvMouseEvent.scrollDelta = (double)event->angleDelta().y() / wheelDelta; + setMouseKeyModifiers(slvMouseEvent, event); + + receiver->onMouseEvent(slvMouseEvent); +} + +void SSView::updateSlvSpaceMouseEvent(QMouseEvent* event) +{ + switch (event->type()) + { + case QEvent::MouseMove: + slvMouseEvent.type = MouseEvent::Type::MOTION; + break; + case QEvent::MouseButtonPress: + slvMouseEvent.type = MouseEvent::Type::PRESS; + break; + case QEvent::MouseButtonDblClick: + slvMouseEvent.type = MouseEvent::Type::DBL_PRESS; + break; + case QEvent::MouseButtonRelease: + slvMouseEvent.type = MouseEvent::Type::RELEASE; + slvMouseEvent.button = MouseEvent::Button::NONE; + break; + case QEvent::Wheel: + slvMouseEvent.type = MouseEvent::Type::SCROLL_VERT; + //slvMouseEvent.scrollDelta = event-> + break; + case QEvent::Leave: + slvMouseEvent.type = MouseEvent::Type::LEAVE; + slvMouseEvent.button = MouseEvent::Button::NONE; + break; + default: + slvMouseEvent.type = MouseEvent::Type::RELEASE; + slvMouseEvent.button = MouseEvent::Button::NONE; + } + + Qt::MouseButtons buttonState = (slvMouseEvent.type == MouseEvent::Type::MOTION) ? event->buttons() : event->button(); + + switch (buttonState) + { + case Qt::MouseButton::LeftButton: + slvMouseEvent.button = MouseEvent::Button::LEFT; + break; + case Qt::MouseButton::RightButton: + slvMouseEvent.button = MouseEvent::Button::RIGHT; + break; + case Qt::MouseButton::MiddleButton: + slvMouseEvent.button = MouseEvent::Button::MIDDLE; + break; + default: + slvMouseEvent.button = MouseEvent::Button::NONE; + //slvMouseEvent.button = slvMouseEvent.button; + } + +#if QT_VERSION >= 0x060000 + QPointF pos = event->position(); + slvMouseEvent.x = pos.x() * pixelRatio; + slvMouseEvent.y = pos.y() * pixelRatio; +#else + slvMouseEvent.x = double(event->x()); + slvMouseEvent.y = double(event->y()); +#endif + + setMouseKeyModifiers(slvMouseEvent, event); + + receiver->onMouseEvent(slvMouseEvent); +} + +void SSView::updateSlvSpaceKeyEvent(QKeyEvent* event) +{ + slvKeyEvent.key = KeyboardEvent::Key(-1); + + Qt::KeyboardModifiers mod = event->modifiers(); + slvKeyEvent.shiftDown = mod & Qt::ShiftModifier ? true : false; + slvKeyEvent.controlDown = mod & Qt::ControlModifier ? true : false; + + if (event->key() >= Qt::Key_F1 && event->key() <= Qt::Key_F35) { + slvKeyEvent.key = KeyboardEvent::Key::FUNCTION; + slvKeyEvent.num = event->key() - Qt::Key_F1 + 1; + } + if (event->key() >= Qt::Key_Space && event->key() <= Qt::Key_yen) { + slvKeyEvent.key = KeyboardEvent::Key::CHARACTER; + QString keyLower = event->text().toLower(); + slvKeyEvent.chr = keyLower.toUcs4().at(0); + } + + receiver->onKeyboardEvent(slvKeyEvent); +} + +SSTextWindow::SSTextWindow(QWidget* parent) + : QDockWidget(parent) +{ + ssView = new SSView; + + QWidget* group = new QWidget; + scrollBar = new QScrollBar(Qt::Vertical, group); + connect(scrollBar, SIGNAL(valueChanged(int)), SLOT(sliderSlot(int))); + + QHBoxLayout* lo = new QHBoxLayout(group); + lo->setContentsMargins(0, 0, 0, 0); + lo->setSpacing(2); + lo->addWidget(ssView); + lo->addWidget(scrollBar); + group->setLayout(lo); + + setWidget(group); + setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); +} + +void SSTextWindow::sliderSlot(int value) +{ + std::function adjust = ssView->receiver->onScrollbarAdjusted; + if(adjust) + adjust(double(value)); +} + +void SSTextWindow::closeEvent(QCloseEvent* ev) +{ + ssView->receiver->onClose(); + ev->ignore(); +} + +SSMainWindow::SSMainWindow() +{ + ssView = new SSView; + setCentralWidget(ssView); +} + +void SSMainWindow::closeEvent(QCloseEvent* ev) +{ + ssView->receiver->onClose(); + ev->ignore(); +} + +class WindowImplQt final : public Window { +public: + QWidget* ssWindow; // SSMainWindow or SSTextWindow. + SSView* view; // Copy of ssWindow ssView. + + // NOTE: Only TextWindow has a scroll bar and only GraphicsWindow has menus, + // but Platform::Window squishes both together in a single interface. + + QScrollBar* scrollBar; // Copy of SSTextWindow::scrollBar or nullptr. + std::shared_ptr menuBar; + + WindowImplQt(Window::Kind kind, std::shared_ptr parent) + { + if(kind == Platform::Window::Kind::TOOL) { + QWidget* qparent = parent ? parent->ssWindow : nullptr; + + SSTextWindow* twin = new SSTextWindow(qparent); + ssWindow = twin; + scrollBar = twin->scrollBar; + view = twin->ssView; + + // Set object name for saveState settings. + twin->setObjectName("TextWindow"); + + QMainWindow* mwin = qobject_cast(qparent); + if(mwin) { + mwin->addDockWidget(Qt::RightDockWidgetArea, twin); + } + } else { + SSMainWindow* mwin = new SSMainWindow; + ssWindow = mwin; + scrollBar = nullptr; + view = mwin->ssView; + } + + // Have the view call our Platform::Window event methods. + view->receiver = this; + } + + // Returns physical display DPI. + double GetPixelDensity() override { + return QGuiApplication::primaryScreen()->logicalDotsPerInch(); + } + + // Returns raster graphics and coordinate scale (already applied on the platform side), + // i.e. size of logical pixel in physical pixels, or device pixel ratio. + double GetDevicePixelRatio() override { + return view->pixelRatioI; + } + + // Returns (fractional) font scale, to be applied on top of (integral) device pixel ratio. + double GetDeviceFontScale() { + return GetPixelDensity() / GetDevicePixelRatio() / 96.0; + } + + bool IsVisible() override { + return ssWindow->isVisible(); + } + + void SetVisible(bool visible) override { + ssWindow->setVisible(visible); + ssWindow->raise(); + } + + void Focus() override { + ssWindow->setFocus(); + } + + bool IsFullScreen() override { + return ssWindow->isFullScreen(); + } + + void SetFullScreen(bool fullScreen) override { + // Qt::WindowNoState is "normal". + ssWindow->setWindowState(fullScreen ? Qt::WindowFullScreen + : Qt::WindowNoState); + } + + void SetTitle(const std::string& title) override { + ssWindow->setWindowTitle(QString::fromStdString(title)); + } + + void SetMenuBar(MenuBarRef menus) override { + QMainWindow* mwin = qobject_cast(ssWindow); + if (mwin) { + // We must take ownership of the new menus. + menuBar = std::static_pointer_cast(menus); + menuBar->formActionGroups(); + + mwin->setMenuBar(menuBar->menuBarQ); + } + } + + void GetContentSize(double* width, double* height) override { +#if QT_VERSION >= 0x060000 + double pixelRatio = view->pixelRatio; + QSize rc = view->size(); + *width = rc.width() * pixelRatio; + *height = rc.height() * pixelRatio; + //printf("KR cont %f %d,%d %f,%f\n", pixelRatio, rc.width(), rc.height(), *width, *height); +#else + *width = view->width(); + *height = view->height(); + //printf("KR cont %f,%f\n", *width, *height); +#endif + } + + void SetMinContentSize(double width, double height) override { + ssWindow->resize(int(width), int(height)); + } + + void FreezePosition(SettingsRef settings, const std::string& key) override { + // Geometry is only saved for the main window; the TextWindow dock + // widget is part of the saveState(). + QMainWindow* mwin = qobject_cast(ssWindow); + if (mwin) { + QSettings& qset = std::static_pointer_cast(settings)->qset; + QString qkey = QString::fromStdString(key); + qset.setValue(qkey + "_Geometry", mwin->saveGeometry()); + qset.setValue(qkey + "_State", mwin->saveState()); + } + } + + void ThawPosition(SettingsRef settings, const std::string& key) override { + QMainWindow* mwin = qobject_cast(ssWindow); + if (mwin) { + QSettings& qset = std::static_pointer_cast(settings)->qset; + QString qkey = QString::fromStdString(key); + mwin->restoreGeometry(qset.value(qkey + "_Geometry").toByteArray()); + mwin->restoreState(qset.value(qkey + "_State").toByteArray()); + } + } + + void SetCursor(Cursor cursor) override { + + switch (cursor) + { + case Cursor::POINTER: + ssWindow->setCursor(Qt::ArrowCursor); + break; + case Cursor::HAND: + ssWindow->setCursor(Qt::PointingHandCursor); + break; + default: + ssWindow->setCursor(Qt::ArrowCursor); + } + } + + void SetTooltip(const std::string& text, double x, double y, + double width, double height) override { + view->setToolTip(QString::fromStdString(text)); + } + + bool IsEditorVisible() override { + return view->entry->isVisible(); + } + + void ShowEditor(double x, double y, double fontHeight, double minWidth, + bool isMonospace, const std::string& text) override { + view->startEditing(x, y, fontHeight, minWidth, isMonospace, text); + } + + void HideEditor() override { + view->stopEditing(); + } + + void SetScrollbarVisible(bool visible) override { + //printf("Scroll vis %d\n", int(visible)); + if (scrollBar) + scrollBar->setVisible(visible); + } + + void ConfigureScrollbar(double min, double max, double pageSize) override { + //printf("Scroll bar %f %f %f\n", min, max, pageSize); + if (scrollBar) { + scrollBar->setRange(int(min), int(max - pageSize)); + scrollBar->setPageStep(int(pageSize)); + } + } + + double GetScrollbarPosition() override { + if (scrollBar) + return (double) scrollBar->value(); + return 0.0; + } + + void SetScrollbarPosition(double pos) override { + //printf("Scroll pos %f\n", pos); + if (scrollBar) + scrollBar->setValue((int) pos); + } + + void Invalidate() override { + view->update(); + } +}; + +#ifdef WIN32 +// This interferes with our identifier. +# undef CreateWindow +#endif + +WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { + return std::make_shared(kind, + std::static_pointer_cast(parentWindow)); +} + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow) { + return std::make_shared( + std::static_pointer_cast(parentWindow)->ssWindow); +} + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow) { + return std::make_shared( + std::static_pointer_cast(parentWindow)->ssWindow, + false); +} + +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow) { + return std::make_shared( + std::static_pointer_cast(parentWindow)->ssWindow, + true); +} + +//----------------------------------------------------------------------------- +// 3DConnexion support +//----------------------------------------------------------------------------- + +void Open3DConnexion() {} +void Close3DConnexion() {} +void Request3DConnexionEventsForWindow(WindowRef window) {} + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector GetFontFiles() { + std::vector fonts; + +#ifdef WIN32 + std::wstring fontsDirW(MAX_PATH, '\0'); + fontsDirW.resize(GetWindowsDirectoryW(&fontsDirW[0], fontsDirW.length())); + fontsDirW += L"\\fonts\\"; + Platform::Path fontsDir = Platform::Path::From(SolveSpace::Platform::Narrow(fontsDirW)); + + WIN32_FIND_DATAW wfd; + HANDLE h = FindFirstFileW((fontsDirW + L"*").c_str(), &wfd); + while (h != INVALID_HANDLE_VALUE) { + fonts.push_back(fontsDir.Join(SolveSpace::Platform::Narrow(wfd.cFileName))); + if (!FindNextFileW(h, &wfd)) break; + } +#else + // FcInit() should have already been called by QFontconfigDatabase. + FcPattern* pat = FcPatternCreate(); + FcObjectSet* os = FcObjectSetBuild(FC_FILE, (char*)0); + FcFontSet* fs = FcFontList(0, pat, os); + + for (int i = 0; i < fs->nfont; i++) { + FcChar8* filenameFC = FcPatternFormat(fs->fonts[i], (const FcChar8*)"%{file}"); + fonts.push_back(Platform::Path::From((const char*)filenameFC)); + FcStrFree(filenameFC); + } + + FcFontSetDestroy(fs); + FcObjectSetDestroy(os); + FcPatternDestroy(pat); +#endif + + return fonts; +} + +void OpenInBrowser(const std::string& url) { + + std::string urlTemp = url; + + if (urlTemp.find("http") == std::string::npos) + { + urlTemp = QApplication::applicationDirPath().toStdString(); + urlTemp += "/" + url; + } + + if (false == QDesktopServices::openUrl(QUrl(urlTemp.c_str(), QUrl::TolerantMode))) + { + std::string errorStr = "Error: unable to open URL path : " + urlTemp; + QMessageBox::critical(0,QString("Manual Open Error"),QString::fromStdString(errorStr),QMessageBox::Ok); + } +} + +void ExitGui() { + // Using exit() rather than quit() to avoid calling window closeEvent() methods. + qApp->exit(); +} + +} +} + +using namespace SolveSpace; + +int main(int argc, char** argv) { + // Must share GL contexts or an undocked QDockWidget is black. + // See https://bugreports.qt.io/browse/QTBUG-89812 + QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); + +#ifndef WIN32 // Allows using OpenGL 1 on Windows + // Specify the GL version so Qt doesn't use GLES on Wayland, which + // doesn't handle "#version 120" shaders. + { + QSurfaceFormat fmt; + fmt.setRenderableType(QSurfaceFormat::OpenGL); + fmt.setVersion(3, 2); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } +#endif + + Platform::SSApplication app(argc, argv); + Platform::Open3DConnexion(); + SS.Init(); + + if(argc >= 2) { + if(argc > 2) { + dbp("Only the first file passed on command line will be opened."); + } + SS.Load(Platform::Path::From(argv[1])); + } + + app.exec(); + + Platform::Close3DConnexion(); + SS.Clear(); + SK.Clear(); + return 0; +} diff --git a/src/platform/guiqt.h b/src/platform/guiqt.h new file mode 100644 index 0000000..b34d883 --- /dev/null +++ b/src/platform/guiqt.h @@ -0,0 +1,132 @@ +//----------------------------------------------------------------------------- +// The Qt-based implementation of platform-dependent GUI functionality. +// +// Copyright 2024 Karl Robillard +// Copyright 2023 Raed Marwan +// SPDX-License-Identifier: GPL-3.0-or-later +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_GUIQT_H +#define SOLVESPACE_GUIQT_H + +#include + +#include +#include +#include +#include +#include +#include + + +namespace SolveSpace { +namespace Platform { + +class SSView : public QOpenGLWidget +{ + Q_OBJECT + +public: + SSView(QWidget* parent = 0); + + void startEditing(double xd, double yd, int fontHeight, int minWidth, + bool isMonoSpace, const std::string& val); + void stopEditing(); + + QSize minimumSizeHint() const { + return QSize(50, 50); + } + + QSize sizeHint() const { + return QSize(400, 400); + } + +protected slots: + void entryFinished(); + +protected: + //void initializeGL() {} + //void resizeGL(int width, int height) {} + + void paintGL(); + + //----Mouse Events-------- + void wheelEvent(QWheelEvent* event); + + void mouseReleaseEvent(QMouseEvent* event) override{ + updateSlvSpaceMouseEvent(event); + } + + void mousePressEvent(QMouseEvent* event) override{ + updateSlvSpaceMouseEvent(event); + } + + void mouseMoveEvent(QMouseEvent* event) override{ + updateSlvSpaceMouseEvent(event); + } + + void updateSlvSpaceMouseEvent(QMouseEvent* event); + + //----Keyboard Events-------- + + void keyPressEvent(QKeyEvent* keyEvent) + { + slvKeyEvent.type = KeyboardEvent::Type::PRESS; + updateSlvSpaceKeyEvent(keyEvent); + QWidget::keyPressEvent(keyEvent); + } + + void keyReleaseEvent(QKeyEvent* keyEvent) + { + slvKeyEvent.type = KeyboardEvent::Type::RELEASE; + updateSlvSpaceKeyEvent(keyEvent); + QWidget::keyReleaseEvent(keyEvent); + } + + void updateSlvSpaceKeyEvent(QKeyEvent* event); + +public: + Platform::Window* receiver; + QLineEdit* entry; + double pixelRatio; + double pixelRatioI; + MouseEvent slvMouseEvent; + KeyboardEvent slvKeyEvent; +}; + +class SSTextWindow : public QDockWidget +{ + Q_OBJECT + +public: + SSTextWindow(QWidget* parent = 0); + +protected slots: + void sliderSlot(int value); + +protected: + void closeEvent(QCloseEvent* ev); + +public: + SSView* ssView; + QScrollBar* scrollBar; +}; + +class SSMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + SSMainWindow(); + +protected: + void closeEvent(QCloseEvent* ev); + +public: + SSView* ssView; +}; + +} +} + +#endif diff --git a/src/platform/guiwin.cpp b/src/platform/guiwin.cpp new file mode 100644 index 0000000..4016181 --- /dev/null +++ b/src/platform/guiwin.cpp @@ -0,0 +1,1740 @@ +//----------------------------------------------------------------------------- +// The Win32-based implementation of platform-dependent GUI functionality. +// +// Copyright 2018 whitequark +//----------------------------------------------------------------------------- +#include "config.h" +#include "solvespace.h" +// Include after solvespace.h to avoid identifier clashes. +#include +#include +#include +#include +#include + +// Macros to compile under XP +#if !defined(LSTATUS) +# define LSTATUS LONG +#endif + +#if !defined(MAPVK_VK_TO_CHAR) +# define MAPVK_VK_TO_CHAR 2 +#endif + +#if !defined(USER_DEFAULT_SCREEN_DPI) +# define USER_DEFAULT_SCREEN_DPI 96 +#endif + +#if !defined(TTM_POPUP) +# define TTM_POPUP (WM_USER + 34) +#endif +// End macros to compile under XP + +#if !defined(WM_DPICHANGED) +# define WM_DPICHANGED 0x02E0 +#endif + +// These interfere with our identifiers. +#undef CreateWindow +#undef ERROR + +#if HAVE_OPENGL == 3 +# define EGLAPI /*static linkage*/ +# define EGL_EGLEXT_PROTOTYPES +# include +# include +#endif + +#if defined(HAVE_SPACEWARE) +# include +# include +# undef uint32_t +#endif + +#if defined(__GNUC__) +// Disable bogus warning emitted by GCC on GetProcAddress, since there seems to be no way +// of restructuring the code to easily disable it just at the call site. +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Windows API bridging +//----------------------------------------------------------------------------- + +#define sscheck(expr) do { \ + SetLastError(0); \ + if(!(expr)) \ + CheckLastError(__FILE__, __LINE__, __func__, #expr); \ + } while(0) + +void CheckLastError(const char *file, int line, const char *function, const char *expr) { + if(GetLastError() != S_OK) { + LPWSTR messageW; + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPWSTR)&messageW, 0, NULL); + + std::string message; + message += ssprintf("File %s, line %u, function %s:\n", file, line, function); + message += ssprintf("Win32 API call failed: %s.\n", expr); + message += ssprintf("Error: %s", Narrow(messageW).c_str()); + FatalError(message); + } +} + +typedef UINT (WINAPI *LPFNGETDPIFORWINDOW)(HWND); + +UINT ssGetDpiForWindow(HWND hwnd) { + static bool checked; + static LPFNGETDPIFORWINDOW lpfnGetDpiForWindow; + if(!checked) { + checked = true; + lpfnGetDpiForWindow = (LPFNGETDPIFORWINDOW) + GetProcAddress(GetModuleHandleW(L"user32.dll"), "GetDpiForWindow"); + } + if(lpfnGetDpiForWindow) { + return lpfnGetDpiForWindow(hwnd); + } else { + HDC hDc; + sscheck(hDc = GetDC(HWND_DESKTOP)); + UINT dpi; + sscheck(dpi = GetDeviceCaps(hDc, LOGPIXELSX)); + sscheck(ReleaseDC(HWND_DESKTOP, hDc)); + return dpi; + } +} + +typedef BOOL (WINAPI *LPFNADJUSTWINDOWRECTEXFORDPI)(LPRECT, DWORD, BOOL, DWORD, UINT); + +BOOL ssAdjustWindowRectExForDpi(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, + DWORD dwExStyle, UINT dpi) { + static bool checked; + static LPFNADJUSTWINDOWRECTEXFORDPI lpfnAdjustWindowRectExForDpi; + if(!checked) { + checked = true; + lpfnAdjustWindowRectExForDpi = (LPFNADJUSTWINDOWRECTEXFORDPI) + GetProcAddress(GetModuleHandleW(L"user32.dll"), "AdjustWindowRectExForDpi"); + } + if(lpfnAdjustWindowRectExForDpi) { + return lpfnAdjustWindowRectExForDpi(lpRect, dwStyle, bMenu, dwExStyle, dpi); + } else { + return AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle); + } +} + +//----------------------------------------------------------------------------- +// Utility functions +//----------------------------------------------------------------------------- + +static std::wstring PrepareTitle(const std::string &s) { + return Widen("SolveSpace - " + s); +} + +static std::string NegateMnemonics(const std::string &label) { + std::string newLabel; + for(char c : label) { + newLabel.push_back(c); + if(c == '&') newLabel.push_back(c); + } + return newLabel; +} + +static int Clamp(int x, int a, int b, int brda, int brdb) { + // If we are outside of an edge of the monitor + // and a "border" is requested "move in" from that edge + // by "b/brdX" (the "b" parameter is the resolution) + if((x <= a) && (brda)) { + a += b / brda; // yes "b/brda" since b is the size + } + + if(((x >= b) && brdb)) { + b -= b / brdb; + } + + return max(a, min(x, b)); +} + +//----------------------------------------------------------------------------- +// Fatal errors +//----------------------------------------------------------------------------- + +bool handlingFatalError = false; + +void FatalError(const std::string &message) { + // Indicate that we're handling a fatal error, to avoid re-entering application code + // and potentially crashing even harder. + handlingFatalError = true; + + switch(MessageBoxW(NULL, Platform::Widen(message + "\nGenerate debug report?").c_str(), + L"Fatal error — SolveSpace", + MB_ICONERROR|MB_TASKMODAL|MB_SETFOREGROUND|MB_TOPMOST| + MB_OKCANCEL|MB_DEFBUTTON2)) { + case IDOK: + abort(); + + case IDCANCEL: + default: { + WCHAR appPath[MAX_PATH] = {}; + GetModuleFileNameW(NULL, appPath, sizeof(appPath)); + ShellExecuteW(NULL, L"open", appPath, NULL, NULL, SW_SHOW); + _exit(1); + } + } +} +//----------------------------------------------------------------------------- +// Settings +//----------------------------------------------------------------------------- + +class SettingsImplWin32 final : public Settings { +public: + HKEY hKey = NULL; + + HKEY GetKey() { + if(hKey == NULL) { + sscheck(ERROR_SUCCESS == RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\SolveSpace", 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hKey, NULL)); + } + return hKey; + } + + ~SettingsImplWin32() { + if(hKey != NULL) { + sscheck(ERROR_SUCCESS == RegCloseKey(hKey)); + } + } + + void FreezeInt(const std::string &key, uint32_t value) { + sscheck(ERROR_SUCCESS == RegSetValueExW(GetKey(), &Widen(key)[0], 0, + REG_DWORD, (const BYTE *)&value, sizeof(value))); + } + + uint32_t ThawInt(const std::string &key, uint32_t defaultValue) { + DWORD value; + DWORD type, length = sizeof(value); + LSTATUS result = RegQueryValueExW(GetKey(), &Widen(key)[0], 0, + &type, (BYTE *)&value, &length); + if(result == ERROR_SUCCESS && type == REG_DWORD) { + return value; + } + return defaultValue; + } + + void FreezeFloat(const std::string &key, double value) { + sscheck(ERROR_SUCCESS == RegSetValueExW(GetKey(), &Widen(key)[0], 0, + REG_QWORD, (const BYTE *)&value, sizeof(value))); + } + + double ThawFloat(const std::string &key, double defaultValue) { + double value; + DWORD type, length = sizeof(value); + LSTATUS result = RegQueryValueExW(GetKey(), &Widen(key)[0], 0, + &type, (BYTE *)&value, &length); + if(result == ERROR_SUCCESS && type == REG_QWORD) { + return value; + } + return defaultValue; + } + + void FreezeString(const std::string &key, const std::string &value) { + ssassert(value.length() == strlen(value.c_str()), + "illegal null byte in middle of a string setting"); + std::wstring valueW = Widen(value); + sscheck(ERROR_SUCCESS == RegSetValueExW(GetKey(), &Widen(key)[0], 0, + REG_SZ, (const BYTE *)&valueW[0], (valueW.length() + 1) * 2)); + } + + std::string ThawString(const std::string &key, const std::string &defaultValue) { + DWORD type, length = 0; + LSTATUS result = RegQueryValueExW(GetKey(), &Widen(key)[0], 0, + &type, NULL, &length); + if(result == ERROR_SUCCESS && type == REG_SZ) { + std::wstring valueW; + valueW.resize(length / 2 - 1); + sscheck(ERROR_SUCCESS == RegQueryValueExW(GetKey(), &Widen(key)[0], 0, + &type, (BYTE *)&valueW[0], &length)); + return Narrow(valueW); + } + return defaultValue; + } +}; + +SettingsRef GetSettings() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Timers +//----------------------------------------------------------------------------- + +class TimerImplWin32 final : public Timer { +public: + static HWND WindowHandle() { + static HWND hTimerWnd; + if(hTimerWnd == NULL) { + sscheck(hTimerWnd = CreateWindowExW(0, L"Message", NULL, 0, 0, 0, 0, 0, + HWND_MESSAGE, NULL, NULL, NULL)); + } + return hTimerWnd; + } + + static void CALLBACK TimerFunc(HWND hwnd, UINT msg, UINT_PTR event, DWORD time) { + sscheck(KillTimer(WindowHandle(), event)); + + TimerImplWin32 *timer = (TimerImplWin32*)event; + if(timer->onTimeout) { + timer->onTimeout(); + } + } + + void RunAfter(unsigned milliseconds) override { + // FIXME(platform/gui): use SetCoalescableTimer when it's available (8+) + sscheck(SetTimer(WindowHandle(), (UINT_PTR)this, + milliseconds, &TimerImplWin32::TimerFunc)); + } + + ~TimerImplWin32() { + // FIXME(platform/gui): there's a race condition here--WM_TIMER messages already + // posted to the queue are not removed, so this destructor is at most "best effort". + KillTimer(WindowHandle(), (UINT_PTR)this); + } +}; + +TimerRef CreateTimer() { + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Menus +//----------------------------------------------------------------------------- + +class MenuImplWin32; + +class MenuItemImplWin32 final : public MenuItem { +public: + std::shared_ptr menu; + + HMENU Handle(); + + MENUITEMINFOW GetInfo(UINT mask) { + MENUITEMINFOW mii = {}; + mii.cbSize = sizeof(mii); + mii.fMask = mask; + sscheck(GetMenuItemInfoW(Handle(), (UINT_PTR)this, FALSE, &mii)); + return mii; + } + + void SetAccelerator(KeyboardEvent accel) override { + MENUITEMINFOW mii = GetInfo(MIIM_TYPE); + + std::wstring nameW(mii.cch, L'\0'); + mii.dwTypeData = &nameW[0]; + mii.cch++; + sscheck(GetMenuItemInfoW(Handle(), (UINT_PTR)this, FALSE, &mii)); + + std::string name = Narrow(nameW); + if(name.find('\t') != std::string::npos) { + name = name.substr(0, name.find('\t')); + } + name += '\t'; + name += AcceleratorDescription(accel); + + nameW = Widen(name); + mii.fMask = MIIM_STRING; + mii.dwTypeData = &nameW[0]; + sscheck(SetMenuItemInfoW(Handle(), (UINT_PTR)this, FALSE, &mii)); + } + + void SetIndicator(Indicator type) override { + MENUITEMINFOW mii = GetInfo(MIIM_FTYPE); + switch(type) { + case Indicator::NONE: + case Indicator::CHECK_MARK: + mii.fType &= ~MFT_RADIOCHECK; + break; + + case Indicator::RADIO_MARK: + mii.fType |= MFT_RADIOCHECK; + break; + } + sscheck(SetMenuItemInfoW(Handle(), (UINT_PTR)this, FALSE, &mii)); + } + + void SetActive(bool active) override { + MENUITEMINFOW mii = GetInfo(MIIM_STATE); + if(active) { + mii.fState |= MFS_CHECKED; + } else { + mii.fState &= ~MFS_CHECKED; + } + sscheck(SetMenuItemInfoW(Handle(), (UINT_PTR)this, FALSE, &mii)); + } + + void SetEnabled(bool enabled) override { + MENUITEMINFOW mii = GetInfo(MIIM_STATE); + if(enabled) { + mii.fState &= ~(MFS_DISABLED|MFS_GRAYED); + } else { + mii.fState |= MFS_DISABLED|MFS_GRAYED; + } + sscheck(SetMenuItemInfoW(Handle(), (UINT_PTR)this, FALSE, &mii)); + } +}; + +int64_t contextMenuPopTime = 0; + +class MenuImplWin32 final : public Menu { +public: + HMENU hMenu; + + std::weak_ptr weakThis; + std::vector> menuItems; + std::vector> subMenus; + + MenuImplWin32() { + sscheck(hMenu = CreatePopupMenu()); + } + + MenuItemRef AddItem(const std::string &label, + std::function onTrigger = NULL, + bool mnemonics = true) override { + auto menuItem = std::make_shared(); + menuItem->menu = weakThis.lock(); + menuItem->onTrigger = onTrigger; + menuItems.push_back(menuItem); + + sscheck(AppendMenuW(hMenu, MF_STRING, (UINT_PTR)menuItem.get(), + Widen(mnemonics ? label : NegateMnemonics(label)).c_str())); + + // uID is just an UINT, which isn't large enough to hold a pointer on 64-bit Windows, + // so we use dwItemData, which is. + MENUITEMINFOW mii = {}; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_DATA; + mii.dwItemData = (LONG_PTR)menuItem.get(); + sscheck(SetMenuItemInfoW(hMenu, (UINT_PTR)menuItem.get(), FALSE, &mii)); + + return menuItem; + } + + MenuRef AddSubMenu(const std::string &label) override { + auto subMenu = std::make_shared(); + subMenu->weakThis = subMenu; + subMenus.push_back(subMenu); + + sscheck(AppendMenuW(hMenu, MF_STRING|MF_POPUP, + (UINT_PTR)subMenu->hMenu, Widen(label).c_str())); + + return subMenu; + } + + void AddSeparator() override { + sscheck(AppendMenuW(hMenu, MF_SEPARATOR, 0, L"")); + } + + void PopUp() override { + MENUINFO mi = {}; + mi.cbSize = sizeof(mi); + mi.fMask = MIM_APPLYTOSUBMENUS|MIM_STYLE; + mi.dwStyle = MNS_NOTIFYBYPOS; + sscheck(SetMenuInfo(hMenu, &mi)); + + POINT pt; + sscheck(GetCursorPos(&pt)); + + sscheck(TrackPopupMenu(hMenu, TPM_TOPALIGN, pt.x, pt.y, 0, GetActiveWindow(), NULL)); + contextMenuPopTime = GetMilliseconds(); + } + + void Clear() override { + for(int n = GetMenuItemCount(hMenu) - 1; n >= 0; n--) { + sscheck(RemoveMenu(hMenu, n, MF_BYPOSITION)); + } + menuItems.clear(); + subMenus.clear(); + } + + ~MenuImplWin32() { + Clear(); + sscheck(DestroyMenu(hMenu)); + } +}; + +HMENU MenuItemImplWin32::Handle() { + return menu->hMenu; +} + +MenuRef CreateMenu() { + auto menu = std::make_shared(); + // std::enable_shared_from_this fails for some reason, not sure why + menu->weakThis = menu; + return menu; +} + +class MenuBarImplWin32 final : public MenuBar { +public: + HMENU hMenuBar; + + std::vector> subMenus; + + MenuBarImplWin32() { + sscheck(hMenuBar = ::CreateMenu()); + } + + MenuRef AddSubMenu(const std::string &label) override { + auto subMenu = std::make_shared(); + subMenu->weakThis = subMenu; + subMenus.push_back(subMenu); + + sscheck(AppendMenuW(hMenuBar, MF_STRING|MF_POPUP, + (UINT_PTR)subMenu->hMenu, Widen(label).c_str())); + + return subMenu; + } + + void Clear() override { + for(int n = GetMenuItemCount(hMenuBar) - 1; n >= 0; n--) { + sscheck(RemoveMenu(hMenuBar, n, MF_BYPOSITION)); + } + subMenus.clear(); + } + + ~MenuBarImplWin32() { + Clear(); + sscheck(DestroyMenu(hMenuBar)); + } +}; + +MenuBarRef GetOrCreateMainMenu(bool *unique) { + *unique = false; + return std::make_shared(); +} + +//----------------------------------------------------------------------------- +// Windows +//----------------------------------------------------------------------------- + +#define SCROLLBAR_UNIT 65536 + +class WindowImplWin32 final : public Window { +public: + HWND hWindow = NULL; + HWND hTooltip = NULL; + HWND hEditor = NULL; + WNDPROC editorWndProc = NULL; + +#if HAVE_OPENGL == 1 + HGLRC hGlRc = NULL; +#elif HAVE_OPENGL == 3 + static EGLDisplay eglDisplay; + EGLSurface eglSurface = EGL_NO_SURFACE; + EGLContext eglContext = EGL_NO_CONTEXT; +#endif + + WINDOWPLACEMENT placement = {}; + int minWidth = 0, minHeight = 0; + +#if defined(HAVE_SPACEWARE) + SiOpenData sod = {}; + SiHdl hSpaceWare = SI_NO_HANDLE; +#endif + + std::shared_ptr menuBar; + std::string tooltipText; + bool scrollbarVisible = false; + + static void RegisterWindowClass() { + static bool registered; + if(registered) return; + + WNDCLASSEXW wc = {}; + wc.cbSize = sizeof(wc); + wc.style = CS_BYTEALIGNCLIENT|CS_BYTEALIGNWINDOW|CS_OWNDC|CS_DBLCLKS; + wc.lpfnWndProc = WndProc; + wc.cbWndExtra = sizeof(WindowImplWin32 *); + wc.hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(4000), + IMAGE_ICON, 32, 32, 0); + wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(4000), + IMAGE_ICON, 16, 16, 0); + wc.hCursor = LoadCursorW(NULL, IDC_ARROW); + wc.lpszClassName = L"SolveSpace"; + sscheck(RegisterClassExW(&wc)); + registered = true; + } + + WindowImplWin32(Window::Kind kind, std::shared_ptr parentWindow) { + placement.length = sizeof(placement); + + RegisterWindowClass(); + + HWND hParentWindow = NULL; + if(parentWindow) { + hParentWindow = parentWindow->hWindow; + } + + DWORD style = WS_SIZEBOX|WS_CLIPCHILDREN; + switch(kind) { + case Window::Kind::TOPLEVEL: + style |= WS_OVERLAPPEDWINDOW|WS_CLIPSIBLINGS; + break; + + case Window::Kind::TOOL: + style |= WS_POPUPWINDOW|WS_CAPTION; + break; + } + sscheck(hWindow = CreateWindowExW(0, L"SolveSpace", L"", style, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hParentWindow, NULL, NULL, NULL)); + sscheck(SetWindowLongPtr(hWindow, 0, (LONG_PTR)this)); + + sscheck(hTooltip = CreateWindowExW(0, TOOLTIPS_CLASS, NULL, + WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hWindow, NULL, NULL, NULL)); + sscheck(SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE)); + + TOOLINFOW ti = {}; + ti.cbSize = sizeof(ti); + ti.uFlags = TTF_SUBCLASS; + ti.hwnd = hWindow; + ti.lpszText = (LPWSTR)L""; + sscheck(SendMessageW(hTooltip, TTM_ADDTOOLW, 0, (LPARAM)&ti)); + sscheck(SendMessageW(hTooltip, TTM_ACTIVATE, FALSE, 0)); + + DWORD editorStyle = WS_CLIPSIBLINGS|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL; + sscheck(hEditor = CreateWindowExW(WS_EX_CLIENTEDGE, WC_EDIT, L"", editorStyle, + 0, 0, 0, 0, hWindow, NULL, NULL, NULL)); + sscheck(editorWndProc = + (WNDPROC)SetWindowLongPtr(hEditor, GWLP_WNDPROC, (LONG_PTR)EditorWndProc)); + + HDC hDc; + sscheck(hDc = GetDC(hWindow)); + +#if HAVE_OPENGL == 1 + PIXELFORMATDESCRIPTOR pfd = {}; + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER; + pfd.dwLayerMask = PFD_MAIN_PLANE; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 32; + pfd.cDepthBits = 24; + pfd.cAccumBits = 0; + pfd.cStencilBits = 0; + int pixelFormat; + sscheck(pixelFormat = ChoosePixelFormat(hDc, &pfd)); + sscheck(SetPixelFormat(hDc, pixelFormat, &pfd)); + + sscheck(hGlRc = wglCreateContext(hDc)); +#elif HAVE_OPENGL == 3 + if(eglDisplay == EGL_NO_DISPLAY) { + ssassert(eglBindAPI(EGL_OPENGL_ES_API), "Cannot bind EGL API"); + + EGLBoolean initialized = EGL_FALSE; + for(auto &platformType : { + // Try platform types from least to most amount of software translation required. + std::make_pair("OpenGL ES", EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE), + std::make_pair("OpenGL", EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE), + std::make_pair("Direct3D 11", EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE), + std::make_pair("Direct3D 9", EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE), + }) { + dbp("Initializing ANGLE with %s backend", platformType.first); + EGLint displayAttributes[] = { + EGL_PLATFORM_ANGLE_TYPE_ANGLE, platformType.second, + EGL_NONE + }; + eglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, hDc, + displayAttributes); + if(eglDisplay != EGL_NO_DISPLAY) { + initialized = eglInitialize(eglDisplay, NULL, NULL); + if(initialized) break; + eglTerminate(eglDisplay); + } + } + ssassert(initialized, "Cannot find a suitable EGL display"); + } + + EGLint configAttributes[] = { + EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER, + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_DEPTH_SIZE, 24, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_NONE + }; + EGLint numConfigs; + EGLConfig windowConfig; + ssassert(eglChooseConfig(eglDisplay, configAttributes, &windowConfig, 1, &numConfigs), + "Cannot choose EGL configuration"); + + EGLint surfaceAttributes[] = { + EGL_NONE + }; + eglSurface = eglCreateWindowSurface(eglDisplay, windowConfig, hWindow, surfaceAttributes); + ssassert(eglSurface != EGL_NO_SURFACE, "Cannot create EGL window surface"); + + EGLint contextAttributes[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + eglContext = eglCreateContext(eglDisplay, windowConfig, NULL, contextAttributes); + ssassert(eglContext != EGL_NO_CONTEXT, "Cannot create EGL context"); +#endif + + sscheck(ReleaseDC(hWindow, hDc)); + } + + ~WindowImplWin32() { + // Make sure any of our child windows get destroyed before we call DestroyWindow, or their + // own destructors may fail. + menuBar.reset(); + + sscheck(DestroyWindow(hWindow)); +#if defined(HAVE_SPACEWARE) + if(hSpaceWare != SI_NO_HANDLE) { + SiClose(hSpaceWare); + } +#endif + } + + static LRESULT CALLBACK WndProc(HWND h, UINT msg, WPARAM wParam, LPARAM lParam) { + if(handlingFatalError) return TRUE; + + WindowImplWin32 *window; + sscheck(window = (WindowImplWin32 *)GetWindowLongPtr(h, 0)); + + // The wndproc may be called from within CreateWindowEx, and before we've associated + // the window with the WindowImplWin32. In that case, just defer to the default wndproc. + if(window == NULL) { + return DefWindowProcW(h, msg, wParam, lParam); + } + +#if defined(HAVE_SPACEWARE) + if(window->hSpaceWare != SI_NO_HANDLE) { + SiGetEventData sged; + SiGetEventWinInit(&sged, msg, wParam, lParam); + + SiSpwEvent sse; + if(SiGetEvent(window->hSpaceWare, 0, &sged, &sse) == SI_IS_EVENT) { + SixDofEvent event = {}; + event.shiftDown = ((GetAsyncKeyState(VK_SHIFT) & 0x8000) != 0); + event.controlDown = ((GetAsyncKeyState(VK_SHIFT) & 0x8000) != 0); + if(sse.type == SI_MOTION_EVENT) { + // The Z axis translation and rotation are both + // backwards in the default mapping. + event.type = SixDofEvent::Type::MOTION; + event.translationX = sse.u.spwData.mData[SI_TX]*1.0, + event.translationY = sse.u.spwData.mData[SI_TY]*1.0, + event.translationZ = -sse.u.spwData.mData[SI_TZ]*1.0, + event.rotationX = sse.u.spwData.mData[SI_RX]*0.001, + event.rotationY = sse.u.spwData.mData[SI_RY]*0.001, + event.rotationZ = -sse.u.spwData.mData[SI_RZ]*0.001; + } else if(sse.type == SI_BUTTON_EVENT) { + if(SiButtonPressed(&sse) == SI_APP_FIT_BUTTON) { + event.type = SixDofEvent::Type::PRESS; + event.button = SixDofEvent::Button::FIT; + } + if(SiButtonReleased(&sse) == SI_APP_FIT_BUTTON) { + event.type = SixDofEvent::Type::RELEASE; + event.button = SixDofEvent::Button::FIT; + } + } else { + return 0; + } + if(window->onSixDofEvent) { + window->onSixDofEvent(event); + } + return 0; + } + } +#endif + + switch (msg) { + case WM_ERASEBKGND: + break; + + case WM_PAINT: { + PAINTSTRUCT ps; + HDC hDc = BeginPaint(window->hWindow, &ps); + if(window->onRender) { +#if HAVE_OPENGL == 1 + wglMakeCurrent(hDc, window->hGlRc); +#elif HAVE_OPENGL == 3 + eglMakeCurrent(window->eglDisplay, window->eglSurface, + window->eglSurface, window->eglContext); +#endif + window->onRender(); +#if HAVE_OPENGL == 1 + SwapBuffers(hDc); +#elif HAVE_OPENGL == 3 + eglSwapBuffers(window->eglDisplay, window->eglSurface); + (void)hDc; +#endif + } + EndPaint(window->hWindow, &ps); + break; + } + + case WM_CLOSE: + if(window->onClose) { + window->onClose(); + } + break; + + case WM_SIZE: + window->Invalidate(); + break; + + case WM_SIZING: { + double pixelRatio = window->GetDevicePixelRatio(); + + RECT rcw, rcc; + sscheck(GetWindowRect(window->hWindow, &rcw)); + sscheck(GetClientRect(window->hWindow, &rcc)); + int nonClientWidth = (rcw.right - rcw.left) - (rcc.right - rcc.left); + int nonClientHeight = (rcw.bottom - rcw.top) - (rcc.bottom - rcc.top); + + RECT *rc = (RECT *)lParam; + int adjWidth = rc->right - rc->left; + int adjHeight = rc->bottom - rc->top; + + adjWidth -= nonClientWidth; + adjWidth = max((int)(window->minWidth * pixelRatio), adjWidth); + adjWidth += nonClientWidth; + adjHeight -= nonClientHeight; + adjHeight = max((int)(window->minHeight * pixelRatio), adjHeight); + adjHeight += nonClientHeight; + switch(wParam) { + case WMSZ_RIGHT: + case WMSZ_BOTTOMRIGHT: + case WMSZ_TOPRIGHT: + rc->right = rc->left + adjWidth; + break; + + case WMSZ_LEFT: + case WMSZ_BOTTOMLEFT: + case WMSZ_TOPLEFT: + rc->left = rc->right - adjWidth; + break; + } + switch(wParam) { + case WMSZ_BOTTOM: + case WMSZ_BOTTOMLEFT: + case WMSZ_BOTTOMRIGHT: + rc->bottom = rc->top + adjHeight; + break; + + case WMSZ_TOP: + case WMSZ_TOPLEFT: + case WMSZ_TOPRIGHT: + rc->top = rc->bottom - adjHeight; + break; + } + break; + } + + case WM_DPICHANGED: { + RECT rc = *(RECT *)lParam; + sscheck(SendMessage(window->hWindow, WM_SIZING, WMSZ_BOTTOMRIGHT, (LPARAM)&rc)); + sscheck(SetWindowPos(window->hWindow, NULL, rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top, + SWP_NOZORDER|SWP_NOACTIVATE)); + window->Invalidate(); + break; + } + + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + case WM_LBUTTONUP: + case WM_MBUTTONUP: + case WM_RBUTTONUP: + if(GetMilliseconds() - Platform::contextMenuPopTime < 100) { + // Ignore the mouse click that dismisses a context menu, to avoid + // (e.g.) clearing a selection. + return 0; + } + // fallthrough + case WM_MOUSEMOVE: + case WM_MOUSEWHEEL: + case WM_MOUSELEAVE: { + double pixelRatio = window->GetDevicePixelRatio(); + + MouseEvent event = {}; + event.x = GET_X_LPARAM(lParam) / pixelRatio; + event.y = GET_Y_LPARAM(lParam) / pixelRatio; + event.button = MouseEvent::Button::NONE; + + event.shiftDown = (wParam & MK_SHIFT) != 0; + event.controlDown = (wParam & MK_CONTROL) != 0; + + bool consumed = false; + switch(msg) { + case WM_LBUTTONDOWN: + event.button = MouseEvent::Button::LEFT; + event.type = MouseEvent::Type::PRESS; + break; + case WM_MBUTTONDOWN: + event.button = MouseEvent::Button::MIDDLE; + event.type = MouseEvent::Type::PRESS; + break; + case WM_RBUTTONDOWN: + event.button = MouseEvent::Button::RIGHT; + event.type = MouseEvent::Type::PRESS; + break; + + case WM_LBUTTONDBLCLK: + event.button = MouseEvent::Button::LEFT; + event.type = MouseEvent::Type::DBL_PRESS; + break; + case WM_MBUTTONDBLCLK: + event.button = MouseEvent::Button::MIDDLE; + event.type = MouseEvent::Type::DBL_PRESS; + break; + case WM_RBUTTONDBLCLK: + event.button = MouseEvent::Button::RIGHT; + event.type = MouseEvent::Type::DBL_PRESS; + break; + + case WM_LBUTTONUP: + event.button = MouseEvent::Button::LEFT; + event.type = MouseEvent::Type::RELEASE; + break; + case WM_MBUTTONUP: + event.button = MouseEvent::Button::MIDDLE; + event.type = MouseEvent::Type::RELEASE; + break; + case WM_RBUTTONUP: + event.button = MouseEvent::Button::RIGHT; + event.type = MouseEvent::Type::RELEASE; + break; + + case WM_MOUSEWHEEL: + // Make the mousewheel work according to which window the mouse is + // over, not according to which window is active. + POINT pt; + pt.x = GET_X_LPARAM(lParam); + pt.y = GET_Y_LPARAM(lParam); + HWND hWindowUnderMouse; + sscheck(hWindowUnderMouse = WindowFromPoint(pt)); + if(hWindowUnderMouse && hWindowUnderMouse != h) { + SendMessageW(hWindowUnderMouse, msg, wParam, lParam); + consumed = true; + break; + } + + // Convert the mouse coordinates from screen to client area so that + // scroll wheel zooming remains centered irrespective of the window + // position. + ScreenToClient(hWindowUnderMouse, &pt); + event.x = pt.x / pixelRatio; + event.y = pt.y / pixelRatio; + + event.type = MouseEvent::Type::SCROLL_VERT; + event.scrollDelta = GET_WHEEL_DELTA_WPARAM(wParam) / (double)WHEEL_DELTA; + break; + + case WM_MOUSELEAVE: + event.type = MouseEvent::Type::LEAVE; + break; + case WM_MOUSEMOVE: { + event.type = MouseEvent::Type::MOTION; + + if(wParam & MK_LBUTTON) { + event.button = MouseEvent::Button::LEFT; + } else if(wParam & MK_MBUTTON) { + event.button = MouseEvent::Button::MIDDLE; + } else if(wParam & MK_RBUTTON) { + event.button = MouseEvent::Button::RIGHT; + } + + // We need this in order to get the WM_MOUSELEAVE + TRACKMOUSEEVENT tme = {}; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = window->hWindow; + sscheck(TrackMouseEvent(&tme)); + break; + } + } + + if(!consumed && window->onMouseEvent) { + window->onMouseEvent(event); + } + break; + } + + case WM_KEYDOWN: + case WM_KEYUP: { + Platform::KeyboardEvent event = {}; + if(msg == WM_KEYDOWN) { + event.type = Platform::KeyboardEvent::Type::PRESS; + } else if(msg == WM_KEYUP) { + event.type = Platform::KeyboardEvent::Type::RELEASE; + } + + if(GetKeyState(VK_SHIFT) & 0x8000) + event.shiftDown = true; + if(GetKeyState(VK_CONTROL) & 0x8000) + event.controlDown = true; + + if(wParam >= VK_F1 && wParam <= VK_F12) { + event.key = Platform::KeyboardEvent::Key::FUNCTION; + event.num = wParam - VK_F1 + 1; + } else { + event.key = Platform::KeyboardEvent::Key::CHARACTER; + event.chr = tolower(MapVirtualKeyW(wParam, MAPVK_VK_TO_CHAR)); + if(event.chr == 0) { + if(wParam == VK_DELETE) { + event.chr = '\x7f'; + } else { + // Non-mappable key. + break; + } + } else if(event.chr == '.' && event.shiftDown) { + event.chr = '>'; + event.shiftDown = false;; + } + } + + if(window->onKeyboardEvent) { + window->onKeyboardEvent(event); + } + break; + } + + case WM_SYSKEYDOWN: { + HWND hParent; + sscheck(hParent = GetParent(h)); + if(hParent != NULL) { + // If the user presses the Alt key when a tool window has focus, + // then that should probably go to the main window instead. + sscheck(SetForegroundWindow(hParent)); + break; + } else { + return DefWindowProcW(h, msg, wParam, lParam); + } + } + + case WM_VSCROLL: { + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_POS|SIF_TRACKPOS|SIF_RANGE|SIF_PAGE; + sscheck(GetScrollInfo(window->hWindow, SB_VERT, &si)); + + switch(LOWORD(wParam)) { + case SB_LINEUP: si.nPos -= SCROLLBAR_UNIT; break; + case SB_PAGEUP: si.nPos -= si.nPage; break; + case SB_LINEDOWN: si.nPos += SCROLLBAR_UNIT; break; + case SB_PAGEDOWN: si.nPos += si.nPage; break; + case SB_TOP: si.nPos = si.nMin; break; + case SB_BOTTOM: si.nPos = si.nMax; break; + case SB_THUMBTRACK: + case SB_THUMBPOSITION: si.nPos = si.nTrackPos; break; + } + + si.nPos = min((UINT)si.nPos, (UINT)(si.nMax - si.nPage)); + + if(window->onScrollbarAdjusted) { + window->onScrollbarAdjusted((double)si.nPos / SCROLLBAR_UNIT); + } + break; + } + + case WM_MENUCOMMAND: { + MENUITEMINFOW mii = {}; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_DATA; + sscheck(GetMenuItemInfoW((HMENU)lParam, wParam, TRUE, &mii)); + + MenuItemImplWin32 *menuItem = (MenuItemImplWin32 *)mii.dwItemData; + if(menuItem->onTrigger) { + menuItem->onTrigger(); + } + break; + } + + default: + return DefWindowProcW(h, msg, wParam, lParam); + } + + return 0; + } + + static LRESULT CALLBACK EditorWndProc(HWND h, UINT msg, WPARAM wParam, LPARAM lParam) { + if(handlingFatalError) return 0; + + HWND hWindow; + sscheck(hWindow = GetParent(h)); + + WindowImplWin32 *window; + sscheck(window = (WindowImplWin32 *)GetWindowLongPtr(hWindow, 0)); + + switch(msg) { + case WM_CHAR: + if(wParam == VK_RETURN) { + if(window->onEditingDone) { + int length; + sscheck(length = GetWindowTextLength(h)); + + std::wstring resultW; + resultW.resize(length); + sscheck(GetWindowTextW(h, &resultW[0], resultW.length() + 1)); + + window->onEditingDone(Narrow(resultW)); + return 0; + } + } else if(wParam == VK_ESCAPE) { + window->HideEditor(); + return 0; + } + } + + return CallWindowProc(window->editorWndProc, h, msg, wParam, lParam); + } + + double GetPixelDensity() override { + UINT dpi; + sscheck(dpi = ssGetDpiForWindow(hWindow)); + return (double)dpi; + } + + double GetDevicePixelRatio() override { + UINT dpi; + sscheck(dpi = ssGetDpiForWindow(hWindow)); + return (double)dpi / USER_DEFAULT_SCREEN_DPI; + } + + bool IsVisible() override { + BOOL isVisible; + isVisible = IsWindowVisible(hWindow); + return isVisible == TRUE; + } + + void SetVisible(bool visible) override { + ShowWindow(hWindow, visible ? SW_SHOW : SW_HIDE); + } + + void Focus() override { + sscheck(SetActiveWindow(hWindow)); + } + + bool IsFullScreen() override { + DWORD style; + sscheck(style = GetWindowLongPtr(hWindow, GWL_STYLE)); + return !(style & WS_OVERLAPPEDWINDOW); + } + + void SetFullScreen(bool fullScreen) override { + DWORD style; + sscheck(style = GetWindowLongPtr(hWindow, GWL_STYLE)); + if(fullScreen) { + sscheck(GetWindowPlacement(hWindow, &placement)); + + MONITORINFO mi; + mi.cbSize = sizeof(mi); + sscheck(GetMonitorInfo(MonitorFromWindow(hWindow, MONITOR_DEFAULTTONEAREST), &mi)); + + sscheck(SetWindowLong(hWindow, GWL_STYLE, style & ~WS_OVERLAPPEDWINDOW)); + sscheck(SetWindowPos(hWindow, HWND_NOTOPMOST, + mi.rcMonitor.left, mi.rcMonitor.top, + mi.rcMonitor.right - mi.rcMonitor.left, + mi.rcMonitor.bottom - mi.rcMonitor.top, + SWP_NOOWNERZORDER|SWP_FRAMECHANGED)); + } else { + sscheck(SetWindowLong(hWindow, GWL_STYLE, style | WS_OVERLAPPEDWINDOW)); + sscheck(SetWindowPlacement(hWindow, &placement)); + sscheck(SetWindowPos(hWindow, NULL, 0, 0, 0, 0, + SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER| + SWP_NOOWNERZORDER|SWP_FRAMECHANGED)); + } + } + + void SetTitle(const std::string &title) override { + sscheck(SetWindowTextW(hWindow, PrepareTitle(title).c_str())); + } + + void SetMenuBar(MenuBarRef newMenuBar) override { + menuBar = std::static_pointer_cast(newMenuBar); + + MENUINFO mi = {}; + mi.cbSize = sizeof(mi); + mi.fMask = MIM_APPLYTOSUBMENUS|MIM_STYLE; + mi.dwStyle = MNS_NOTIFYBYPOS; + sscheck(SetMenuInfo(menuBar->hMenuBar, &mi)); + + sscheck(SetMenu(hWindow, menuBar->hMenuBar)); + } + + void GetContentSize(double *width, double *height) override { + double pixelRatio = GetDevicePixelRatio(); + + RECT rc; + sscheck(GetClientRect(hWindow, &rc)); + *width = (rc.right - rc.left) / pixelRatio; + *height = (rc.bottom - rc.top) / pixelRatio; + } + + void SetMinContentSize(double width, double height) override { + minWidth = (int)width; + minHeight = (int)height; + + double pixelRatio = GetDevicePixelRatio(); + + RECT rc; + sscheck(GetClientRect(hWindow, &rc)); + if(rc.right - rc.left < minWidth * pixelRatio) { + rc.right = rc.left + (LONG)(minWidth * pixelRatio); + } + if(rc.bottom - rc.top < minHeight * pixelRatio) { + rc.bottom = rc.top + (LONG)(minHeight * pixelRatio); + } + } + + void FreezePosition(SettingsRef settings, const std::string &key) override { + sscheck(GetWindowPlacement(hWindow, &placement)); + + BOOL isMaximized; + sscheck(isMaximized = IsZoomed(hWindow)); + + RECT rc = placement.rcNormalPosition; + settings->FreezeInt(key + "_Left", rc.left); + settings->FreezeInt(key + "_Right", rc.right); + settings->FreezeInt(key + "_Top", rc.top); + settings->FreezeInt(key + "_Bottom", rc.bottom); + settings->FreezeBool(key + "_Maximized", isMaximized == TRUE); + } + + void ThawPosition(SettingsRef settings, const std::string &key) override { + sscheck(GetWindowPlacement(hWindow, &placement)); + + RECT rc = placement.rcNormalPosition; + rc.left = settings->ThawInt(key + "_Left", rc.left); + rc.right = settings->ThawInt(key + "_Right", rc.right); + rc.top = settings->ThawInt(key + "_Top", rc.top); + rc.bottom = settings->ThawInt(key + "_Bottom", rc.bottom); + + MONITORINFO mi; + mi.cbSize = sizeof(mi); + sscheck(GetMonitorInfo(MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST), &mi)); + + // If it somehow ended up off-screen, then put it back. + // and make it visible by at least this portion of the screen + const LONG movein = 40; + + RECT mrc = mi.rcMonitor; + rc.left = Clamp(rc.left, mrc.left, mrc.right, 0, movein); + rc.right = Clamp(rc.right, mrc.left, mrc.right, movein, 0); + rc.top = Clamp(rc.top, mrc.top, mrc.bottom, 0, movein); + rc.bottom = Clamp(rc.bottom, mrc.top, mrc.bottom, movein, 0); + + // And make sure the minimum size is respected. (We can freeze a size smaller + // than minimum size if the DPI changed between runs.) + sscheck(SendMessageW(hWindow, WM_SIZING, WMSZ_BOTTOMRIGHT, (LPARAM)&rc)); + + placement.flags = 0; + if(settings->ThawBool(key + "_Maximized", false)) { + placement.showCmd = SW_SHOWMAXIMIZED; + } else { + placement.showCmd = SW_SHOW; + } + placement.rcNormalPosition = rc; + sscheck(SetWindowPlacement(hWindow, &placement)); + } + + void SetCursor(Cursor cursor) override { + LPWSTR cursorName = IDC_ARROW; + switch(cursor) { + case Cursor::POINTER: cursorName = IDC_ARROW; break; + case Cursor::HAND: cursorName = IDC_HAND; break; + } + + HCURSOR hCursor; + sscheck(hCursor = LoadCursorW(NULL, cursorName)); + sscheck(::SetCursor(hCursor)); + } + + void SetTooltip(const std::string &newText, double x, double y, + double width, double height) override { + if(newText == tooltipText) return; + tooltipText = newText; + + if(!newText.empty()) { + double pixelRatio = GetDevicePixelRatio(); + RECT toolRect; + toolRect.left = (int)(x * pixelRatio); + toolRect.top = (int)(y * pixelRatio); + toolRect.right = toolRect.left + (int)(width * pixelRatio); + toolRect.bottom = toolRect.top + (int)(height * pixelRatio); + + std::wstring newTextW = Widen(newText); + TOOLINFOW ti = {}; + ti.cbSize = sizeof(ti); + ti.hwnd = hWindow; + ti.rect = toolRect; + ti.lpszText = &newTextW[0]; + sscheck(SendMessageW(hTooltip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti)); + sscheck(SendMessageW(hTooltip, TTM_NEWTOOLRECTW, 0, (LPARAM)&ti)); + } + // The following SendMessage call sometimes fails with ERROR_ACCESS_DENIED for + // no discernible reason, but only on wine. + SendMessageW(hTooltip, TTM_ACTIVATE, !newText.empty(), 0); + } + + bool IsEditorVisible() override { + BOOL visible; + visible = IsWindowVisible(hEditor); + return visible == TRUE; + } + + void ShowEditor(double x, double y, double fontHeight, double minWidth, + bool isMonospace, const std::string &text) override { + if(IsEditorVisible()) return; + + double pixelRatio = GetDevicePixelRatio(); + + HFONT hFont = CreateFontW(-(int)(fontHeight * GetDevicePixelRatio()), 0, 0, 0, + FW_REGULAR, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, FF_DONTCARE, isMonospace ? L"Lucida Console" : L"Arial"); + if(hFont == NULL) { + sscheck(hFont = (HFONT)GetStockObject(SYSTEM_FONT)); + } + sscheck(SendMessageW(hEditor, WM_SETFONT, (WPARAM)hFont, FALSE)); + sscheck(SendMessageW(hEditor, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, 0)); + + std::wstring textW = Widen(text); + + HDC hDc; + TEXTMETRICW tm; + SIZE ts; + sscheck(hDc = GetDC(hEditor)); + sscheck(SelectObject(hDc, hFont)); + sscheck(GetTextMetricsW(hDc, &tm)); + sscheck(GetTextExtentPoint32W(hDc, textW.c_str(), textW.length(), &ts)); + sscheck(ReleaseDC(hEditor, hDc)); + + RECT rc; + rc.left = (LONG)(x * pixelRatio); + rc.top = (LONG)(y * pixelRatio) - tm.tmAscent; + // Add one extra char width to avoid scrolling. + rc.right = (LONG)(x * pixelRatio) + + std::max((LONG)(minWidth * pixelRatio), ts.cx + tm.tmAveCharWidth); + rc.bottom = (LONG)(y * pixelRatio) + tm.tmDescent; + sscheck(ssAdjustWindowRectExForDpi(&rc, 0, /*bMenu=*/FALSE, WS_EX_CLIENTEDGE, + ssGetDpiForWindow(hWindow))); + + sscheck(MoveWindow(hEditor, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, + /*bRepaint=*/true)); + ShowWindow(hEditor, SW_SHOW); + if(!textW.empty()) { + sscheck(SendMessageW(hEditor, WM_SETTEXT, 0, (LPARAM)textW.c_str())); + sscheck(SendMessageW(hEditor, EM_SETSEL, 0, textW.length())); + sscheck(SetFocus(hEditor)); + } + } + + void HideEditor() override { + if(!IsEditorVisible()) return; + + ShowWindow(hEditor, SW_HIDE); + } + + void SetScrollbarVisible(bool visible) override { + if(scrollbarVisible != visible) { + scrollbarVisible = visible; + sscheck(ShowScrollBar(hWindow, SB_VERT, visible)); + // Force the window 1 pixel taller and then restore it's original size. + // This somehow fixes the problem where on Windows 10 and 11 toggling + // the scroll bar would cause the client area of the text window to + // be stretched or compressed horizontally. It looks bad and the + // buttons on the toolbar do not line up with the hit areas. + // See: https://github.com/solvespace/solvespace/issues/681 + // This fix is the result of a long discussion with claude-sonnet-4.6 + // https://github.com/solvespace/solvespace/agents/pull/1680 + // https://github.com/solvespace/solvespace/pull/1680 + RECT rc; + GetWindowRect(hWindow, &rc); + SetWindowPos(hWindow, HWND_TOP, rc.left, rc.top, rc.right - rc.left, + rc.bottom - rc.top + 1, SWP_FRAMECHANGED); + SetWindowPos(hWindow, HWND_TOP, rc.left, rc.top, rc.right - rc.left, + rc.bottom - rc.top, SWP_FRAMECHANGED); + } + } + + void ConfigureScrollbar(double min, double max, double pageSize) override { + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE|SIF_PAGE; + si.nMin = (UINT)(min * SCROLLBAR_UNIT); + si.nMax = (UINT)(max * SCROLLBAR_UNIT); + si.nPage = (UINT)(pageSize * SCROLLBAR_UNIT); + SetScrollInfo(hWindow, SB_VERT, &si, /*redraw=*/TRUE); // Returns scrollbar position + } + + double GetScrollbarPosition() override { + if(!scrollbarVisible) return 0.0; + + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + sscheck(GetScrollInfo(hWindow, SB_VERT, &si)); + return (double)si.nPos / SCROLLBAR_UNIT; + } + + void SetScrollbarPosition(double pos) override { + if(!scrollbarVisible) return; + + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + sscheck(GetScrollInfo(hWindow, SB_VERT, &si)); + if(si.nPos == (int)(pos * SCROLLBAR_UNIT)) + return; + + si.nPos = (int)(pos * SCROLLBAR_UNIT); + SetScrollInfo(hWindow, SB_VERT, &si, /*redraw=*/TRUE); // Returns scrollbar position + + // Windows won't synthesize a WM_VSCROLL for us here. + if(onScrollbarAdjusted) { + onScrollbarAdjusted((double)si.nPos / SCROLLBAR_UNIT); + } + } + + void Invalidate() override { + sscheck(InvalidateRect(hWindow, NULL, /*bErase=*/FALSE)); + } +}; + +#if HAVE_OPENGL == 3 +EGLDisplay WindowImplWin32::eglDisplay = EGL_NO_DISPLAY; +#endif + +WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) { + return std::make_shared(kind, + std::static_pointer_cast(parentWindow)); +} + +//----------------------------------------------------------------------------- +// 3DConnexion support +//----------------------------------------------------------------------------- + +#if defined(HAVE_SPACEWARE) +static HWND hSpaceWareDriverClass; + +void Open3DConnexion() { + hSpaceWareDriverClass = FindWindowW(L"SpaceWare Driver Class", NULL); + if(hSpaceWareDriverClass != NULL) { + SiInitialize(); + } +} + +void Close3DConnexion() { + if(hSpaceWareDriverClass != NULL) { + SiTerminate(); + } +} + +void Request3DConnexionEventsForWindow(WindowRef window) { + std::shared_ptr windowImpl = + std::static_pointer_cast(window); + if(hSpaceWareDriverClass != NULL) { + SiOpenWinInit(&windowImpl->sod, windowImpl->hWindow); + windowImpl->hSpaceWare = SiOpen("SolveSpace", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, + &windowImpl->sod); + SiSetUiMode(windowImpl->hSpaceWare, SI_UI_NO_CONTROLS); + } +} +#else +void Open3DConnexion() {} +void Close3DConnexion() {} +void Request3DConnexionEventsForWindow(WindowRef window) {} +#endif + +//----------------------------------------------------------------------------- +// Message dialogs +//----------------------------------------------------------------------------- + +class MessageDialogImplWin32 final : public MessageDialog { +public: + MSGBOXPARAMSW mbp = {}; + + int style; + + std::wstring titleW; + std::wstring messageW; + std::wstring descriptionW; + std::wstring textW; + + std::vector buttons; + int defaultButton; + + MessageDialogImplWin32() { + mbp.cbSize = sizeof(mbp); + SetTitle("Message"); + } + + void SetType(Type type) override { + switch(type) { + case Type::INFORMATION: + style = MB_USERICON; // Avoid beep + mbp.hInstance = GetModuleHandle(NULL); + mbp.lpszIcon = MAKEINTRESOURCE(4000); // Use SolveSpace icon + // mbp.lpszIcon = IDI_INFORMATION; + break; + + case Type::QUESTION: + style = MB_ICONQUESTION; + break; + + case Type::WARNING: + style = MB_ICONWARNING; + break; + + case Type::ERROR: + style = MB_USERICON; // Avoid beep + mbp.hInstance = GetModuleHandle(NULL); + mbp.lpszIcon = MAKEINTRESOURCE(4000); // Use SolveSpace icon + // mbp.lpszIcon = IDI_ERROR; + break; + } + } + + void SetTitle(std::string title) override { + titleW = PrepareTitle(title); + mbp.lpszCaption = titleW.c_str(); + } + + void SetMessage(std::string message) override { + messageW = Widen(message); + UpdateText(); + } + + void SetDescription(std::string description) override { + descriptionW = Widen(description); + UpdateText(); + } + + void UpdateText() { + textW = messageW + L"\n\n" + descriptionW; + mbp.lpszText = textW.c_str(); + } + + void AddButton(std::string _label, Response response, bool isDefault) override { + int button; + switch(response) { + default: + case Response::NONE: ssassert(false, "Invalid response"); + case Response::OK: button = IDOK; break; + case Response::YES: button = IDYES; break; + case Response::NO: button = IDNO; break; + case Response::CANCEL: button = IDCANCEL; break; + } + buttons.push_back(button); + if(isDefault) { + defaultButton = button; + } + } + + Response RunModal() override { + mbp.dwStyle = style; + + std::sort(buttons.begin(), buttons.end()); + if(buttons == std::vector({ IDOK })) { + mbp.dwStyle |= MB_OK; + } else if(buttons == std::vector({ IDOK, IDCANCEL })) { + mbp.dwStyle |= MB_OKCANCEL; + } else if(buttons == std::vector({ IDYES, IDNO })) { + mbp.dwStyle |= MB_YESNO; + } else if(buttons == std::vector({ IDCANCEL, IDYES, IDNO })) { + mbp.dwStyle |= MB_YESNOCANCEL; + } else { + ssassert(false, "Unexpected button set"); + } + + switch(MessageBoxIndirectW(&mbp)) { + case IDOK: return Response::OK; break; + case IDYES: return Response::YES; break; + case IDNO: return Response::NO; break; + case IDCANCEL: return Response::CANCEL; break; + default: ssassert(false, "Unexpected response"); + } + } +}; + +MessageDialogRef CreateMessageDialog(WindowRef parentWindow) { + std::shared_ptr dialog = std::make_shared(); + dialog->mbp.hwndOwner = std::static_pointer_cast(parentWindow)->hWindow; + return dialog; +} + +//----------------------------------------------------------------------------- +// File dialogs +//----------------------------------------------------------------------------- + +class FileDialogImplWin32 final : public FileDialog { +public: + OPENFILENAMEW ofn = {}; + bool isSaveDialog; + std::wstring titleW; + std::wstring filtersW; + std::wstring defExtW; + std::wstring initialDirW; + // UNC paths may be as long as 32767 characters. + // Unfortunately, the Get*FileName API does not provide any way to use it + // except with a preallocated buffer of fixed size, so we use something + // reasonably large. + wchar_t filenameWC[32768] = {}; + + FileDialogImplWin32() { + ofn.lStructSize = sizeof(ofn); + ofn.lpstrFile = filenameWC; + ofn.nMaxFile = sizeof(filenameWC) / sizeof(wchar_t); + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | + OFN_OVERWRITEPROMPT; + } + + void SetTitle(std::string title) override { + titleW = PrepareTitle(title); + ofn.lpstrTitle = titleW.c_str(); + } + + void SetCurrentName(std::string name) override { + SetFilename(GetFilename().Parent().Join(name)); + } + + Platform::Path GetFilename() override { + return Path::From(Narrow(filenameWC)); + } + + void SetFilename(Platform::Path path) override { + wcsncpy(filenameWC, Widen(path.raw).c_str(), sizeof(filenameWC) / sizeof(wchar_t) - 1); + } + + void SuggestFilename(Platform::Path path) override { + SetFilename(Platform::Path::From(path.FileStem())); + } + + void AddFilter(std::string name, std::vector extensions) override { + std::string desc, patterns; + for(auto &extension : extensions) { + std::string pattern = "*." + extension; + if(!desc.empty()) desc += ", "; + desc += pattern; + if(!patterns.empty()) patterns += ";"; + patterns += pattern; + } + filtersW += Widen(name + " (" + desc + ")" + '\0' + patterns + '\0'); + ofn.lpstrFilter = filtersW.c_str(); + if(ofn.lpstrDefExt == NULL) { + defExtW = Widen(extensions.front()); + ofn.lpstrDefExt = defExtW.c_str(); + } + } + + void FreezeChoices(SettingsRef settings, const std::string &key) override { + settings->FreezeString("Dialog_" + key + "_Folder", GetFilename().Parent().raw); + settings->FreezeInt("Dialog_" + key + "_Filter", ofn.nFilterIndex); + } + + void ThawChoices(SettingsRef settings, const std::string &key) override { + initialDirW = Widen(settings->ThawString("Dialog_" + key + "_Folder", "")); + ofn.lpstrInitialDir = initialDirW.c_str(); + ofn.nFilterIndex = settings->ThawInt("Dialog_" + key + "_Filter", 0); + } + + bool RunModal() override { + if(isSaveDialog) { + SetTitle(C_("title", "Save File")); + if(GetFilename().IsEmpty()) { + SetFilename(Path::From(_("untitled"))); + } + return GetSaveFileNameW(&ofn) == TRUE; + } else { + SetTitle(C_("title", "Open File")); + return GetOpenFileNameW(&ofn) == TRUE; + } + } +}; + +FileDialogRef CreateOpenFileDialog(WindowRef parentWindow) { + std::shared_ptr dialog = std::make_shared(); + dialog->ofn.hwndOwner = std::static_pointer_cast(parentWindow)->hWindow; + dialog->isSaveDialog = false; + return dialog; +} + +FileDialogRef CreateSaveFileDialog(WindowRef parentWindow) { + std::shared_ptr dialog = std::make_shared(); + dialog->ofn.hwndOwner = std::static_pointer_cast(parentWindow)->hWindow; + dialog->isSaveDialog = true; + return dialog; +} + +//----------------------------------------------------------------------------- +// Application-wide APIs +//----------------------------------------------------------------------------- + +std::vector GetFontFiles() { + std::vector fonts; + + std::wstring fontsDirW(MAX_PATH, '\0'); + fontsDirW.resize(GetWindowsDirectoryW(&fontsDirW[0], fontsDirW.length())); + fontsDirW += L"\\fonts\\"; + Platform::Path fontsDir = Platform::Path::From(Narrow(fontsDirW)); + + WIN32_FIND_DATAW wfd; + HANDLE h = FindFirstFileW((fontsDirW + L"*").c_str(), &wfd); + while(h != INVALID_HANDLE_VALUE) { + fonts.push_back(fontsDir.Join(Narrow(wfd.cFileName))); + if(!FindNextFileW(h, &wfd)) break; + } + + return fonts; +} + +void OpenInBrowser(const std::string &url) { + ShellExecuteW(NULL, L"open", Widen(url).c_str(), NULL, NULL, SW_SHOWNORMAL); +} + +std::vector InitGui(int argc, char **argv) { + std::vector args = InitCli(argc, argv); + + INITCOMMONCONTROLSEX icc; + icc.dwSize = sizeof(icc); + icc.dwICC = ICC_STANDARD_CLASSES|ICC_BAR_CLASSES; + InitCommonControlsEx(&icc); + + if(!SetLocale((uint16_t)GetUserDefaultLCID())) { + SetLocale("en_US"); + } + + return args; +} + +void RunGui() { + MSG msg; + // The return value of the following functions doesn't indicate success or failure. + while(GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +} + +void ExitGui() { + PostQuitMessage(0); +} + +void ClearGui() {} + +} +} diff --git a/src/platform/html/emshell.html b/src/platform/html/emshell.html new file mode 100644 index 0000000..951d588 --- /dev/null +++ b/src/platform/html/emshell.html @@ -0,0 +1,91 @@ + +SolveSpace Web Edition (EXPERIMENTAL)
+
+
+
Downloading...
+ + +
+
{{{ SCRIPT }}} diff --git a/src/platform/html/filemanagerui.js b/src/platform/html/filemanagerui.js new file mode 100644 index 0000000..c48e1a5 --- /dev/null +++ b/src/platform/html/filemanagerui.js @@ -0,0 +1,525 @@ +"use strict"; + +const FileManagerUI_OPEN = 0; +const FileManagerUI_SAVE = FileManagerUI_OPEN + 1; +const FileManagerUI_BROWSE = FileManagerUI_SAVE + 1; + +//FIXME(emscripten): File size thresholds. How large file can we accept safely ? + +/** Maximum filesize for a uploaded file. + * @type {number} */ +const FileManagerUI_UPLOAD_FILE_SIZE_LIMIT = 50 * 1000 * 1000; + +const tryMakeDirectory = (path) => { + try { + FS.mkdir(path); + } catch { + // NOP + } +} + + +class FileManagerUI { + /** + * @param {number} mode - dialog mode FileManagerUI_[ OPEN, SAVE, BROWSE ] + */ + constructor(mode) { + /** @type {boolean} */ + this.__isOpenDialog = false; + /** @type {boolean} */ + this.__isSaveDialog = false; + /** @type {boolean} */ + this.__isBrowseDialog = false; + + if (mode == FileManagerUI_OPEN) { + this.__isOpenDialog = true; + } else if (mode == FileManagerUI_SAVE) { + this.__isSaveDialog = true; + } else { + this.__isBrowseDialog = true; + } + + /** @type {boolean} true if the dialog is shown. */ + this.__isShown = false; + + /** @type {string[]} */ + this.__extension_filters = [".slvs"]; + + /** @type {string} */ + this.__basePathInFilesystem = ""; + + /** @type {string} filename user selected. empty if nothing selected */ + this.__selectedFilename = ""; + + this.__closedWithCancel = false; + + this.__defaultFilename = "untitled"; + } + + /** deconstructor + */ + dispose() { + if (this.__dialogRootElement) { + this.__dialogHeaderElement = null; + this.__descriptionElement = null; + this.__filelistElement = null; + this.__fileInputElement = null; + this.__saveFilenameInputElement = null; + this.__buttonContainerElement = null; + this.__dialogRootElement.parentElement.removeChild(this.__dialogRootElement); + this.__dialogRootElement = null; + } + } + + /** + * @param {string} label + * @param {string} response + * @param {bool} isDefault + */ + __addButton(label, response, isDefault, onclick) { + const buttonElem = document.createElement("div"); + addClass(buttonElem, "button"); + setLabelWithMnemonic(buttonElem, label); + if (isDefault) { + addClass(buttonElem, "default"); + addClass(buttonElem, "selected"); + } + buttonElem.addEventListener("click", () => { + if (onclick) { + if (onclick()) { + this.__close(); + } + } else { + this.__close(); + } + }); + + this.__buttonContainerElement.appendChild(buttonElem); + } + + /** + * @param {HTMLElement} div element that built + */ + buildDialog() { + const root = document.createElement('div'); + addClass(root, "modal"); + root.style.display = "none"; + root.style.zIndex = 1000; + + const dialog = document.createElement('div'); + addClass(dialog, "dialog"); + addClass(dialog, "wide"); + root.appendChild(dialog); + + const messageHeader = document.createElement('strong'); + this.__dialogHeaderElement = messageHeader; + addClass(messageHeader, "dialog_header"); + dialog.appendChild(messageHeader); + + const description = document.createElement('p'); + this.__descriptionElement = description; + dialog.appendChild(description); + + const filelistheader = document.createElement('h3'); + filelistheader.textContent = 'Files:'; + dialog.appendChild(filelistheader); + + const filelist = document.createElement('ul'); + this.__filelistElement = filelist; + addClass(filelist, 'filelist'); + dialog.appendChild(filelist); + + const dummyfilelistitem = document.createElement('li'); + dummyfilelistitem.textContent = "(No file in pseudo filesystem)"; + filelist.appendChild(dummyfilelistitem); + + if (this.__isOpenDialog) { + const fileuploadcontainer = document.createElement('div'); + dialog.appendChild(fileuploadcontainer); + + const fileuploadheader = document.createElement('h3'); + fileuploadheader.textContent = "Upload file:"; + fileuploadcontainer.appendChild(fileuploadheader); + + const dragdropdescription = document.createElement('p'); + dragdropdescription.textContent = "(Drag & drop file to the following box)"; + dragdropdescription.style.fontSize = "0.8em"; + dragdropdescription.style.margin = "0.1em"; + fileuploadcontainer.appendChild(dragdropdescription); + + const filedroparea = document.createElement('div'); + addClass(filedroparea, 'filedrop'); + filedroparea.addEventListener('dragstart', (ev) => this.__onFileDragDrop(ev)); + filedroparea.addEventListener('dragover', (ev) => this.__onFileDragDrop(ev)); + filedroparea.addEventListener('dragleave', (ev) => this.__onFileDragDrop(ev)); + filedroparea.addEventListener('drop', (ev) => this.__onFileDragDrop(ev)); + fileuploadcontainer.appendChild(filedroparea); + + const fileinput = document.createElement('input'); + this.__fileInputElement = fileinput; + fileinput.setAttribute('type', 'file'); + fileinput.style.width = "100%"; + fileinput.addEventListener('change', (ev) => this.__onFileInputChanged(ev)); + filedroparea.appendChild(fileinput); + + } else if (this.__isSaveDialog) { + const filenameinputcontainer = document.createElement('div'); + dialog.appendChild(filenameinputcontainer); + + const filenameinputheader = document.createElement('h3'); + filenameinputheader.textContent = "Filename:"; + filenameinputcontainer.appendChild(filenameinputheader); + + const filenameinput = document.createElement('input'); + filenameinput.setAttribute('type', 'input'); + filenameinput.style.width = "90%"; + filenameinput.style.margin = "auto 1em auto 1em"; + this.__saveFilenameInputElement = filenameinput; + filenameinputcontainer.appendChild(filenameinput); + } + + // Paragraph element for spacer + dialog.appendChild(document.createElement('p')); + + const buttoncontainer = document.createElement('div'); + this.__buttonContainerElement = buttoncontainer; + addClass(buttoncontainer, "buttons"); + dialog.appendChild(buttoncontainer); + + this.__addButton('OK', 0, false, () => { + if (this.__isOpenDialog) { + let selectedFilename = null; + const fileitems = document.querySelectorAll('input[type="radio"][name="filemanager_filelist"]'); + Array.from(fileitems).forEach((radiobox) => { + if (radiobox.checked) { + selectedFilename = radiobox.parentElement.getAttribute('data-filename'); + } + }); + if (selectedFilename) { + return true; + } else { + return false; + } + } else { + return true; + } + }); + + this.__addButton('Cancel', 1, true, () => { + this.__closedWithCancel = true; + return true; + }); + + return root; + } + + /** + * @param {string} text + */ + setTitle(text) { + this.__dialogHeaderText = text; + } + + /** + * @param {string} text + */ + setDescription(text) { + this.__descriptionText = text; + } + + /** + * @param {string} path file prefix. (ex) 'tmp/' to '/tmp/filename.txt' + */ + setBasePath(path) { + this.__basePathInFilesystem = path; + tryMakeDirectory(path); + } + + /** + * @param {string} filename + */ + setDefaultFilename(filename) { + this.__defaultFilename = filename; + } + + /** + * + * @param {string} filter comma-separated extensions like ".slvs,.stl;." + */ + setFilter(filter) { + const exts = filter.split(','); + this.__extension_filters = exts; + } + + __buildFileEntry(filename) { + const lielem = document.createElement('li'); + const label = document.createElement('label'); + label.setAttribute('data-filename', filename); + lielem.appendChild(label); + const radiobox = document.createElement('input'); + radiobox.setAttribute('type', 'radio'); + if (!this.__isOpenDialog) { + radiobox.style.display = "none"; + } + radiobox.setAttribute('name', 'filemanager_filelist'); + label.appendChild(radiobox); + const filenametext = document.createTextNode(filename); + label.appendChild(filenametext); + + return lielem; + } + + /** + * @returns {string[]} filename array + */ + __getFileEntries() { + const basePath = this.__basePathInFilesystem; + /** @type {any[]} */ + const nodes = FS.readdir(basePath); + /** @type {string[]} */ + const files = nodes.filter((nodename) => { + return FS.isFile(FS.lstat(basePath + nodename).mode); + }); + /*.map((filename) => { + return basePath + filename; + });*/ + console.log(`__getFileEntries():`, files); + return files; + } + + /** + * @param {string[]?} files file list already constructed + * @returns {string[]} filename array + */ + __getFileEntries_recurse(basePath) { + //FIXME:remove try catch block + try { + //const basePath = this.__basePathInFilesystem; + FS.currentPath = basePath; + /** @type {any[]} */ + const nodes = FS.readdir(basePath); + + const filesInThisDirectory = nodes.filter((nodename) => { + return FS.isFile(FS.lstat(basePath + "/" + nodename).mode); + }).map((filename) => { + return basePath + "/" + filename; + }); + let files = filesInThisDirectory; + + const directories = nodes.filter((nodename) => { + return FS.isDir(FS.lstat(basePath + "/" + nodename).mode); + }); + + for (let i = 0; i < directories.length; i++) { + const directoryname = directories[i]; + if (directoryname == '.' || directoryname == '..') { + continue; + } + const orig_cwd = FS.currentPath; + const directoryfullpath = basePath + "/" + directoryname; + FS.currentPath = directoryfullpath; + files = files.concat(this.__getFileEntries_recurse(directoryfullpath)); + FS.currentPath = orig_cwd; + } + + console.log(`__getFileEntries_recurse(): in "${basePath}"`, files); + return files; + + } catch (excep) { + console.log(excep); + throw excep; + } + } + + __updateFileList() { + console.log(`__updateFileList()`); + Array.from(this.__filelistElement.children).forEach((elem) => { + this.__filelistElement.removeChild(elem); + }); + // const files = this.__getFileEntries(); + FS.currentPath = this.__basePathInFilesystem; + const files = this.__getFileEntries_recurse(this.__basePathInFilesystem); + if (files.length < 1) { + const dummyfilelistitem = document.createElement('li'); + dummyfilelistitem.textContent = "(No file in pseudo filesystem)"; + this.__filelistElement.appendChild(dummyfilelistitem); + + } else { + files.forEach((entry) => { + this.__filelistElement.appendChild(this.__buildFileEntry(entry)); + }); + } + } + + + /** + * @param {File} file + */ + __getFileAsArrayBuffer(file) { + return new Promise((resolve, reject) => { + const filereader = new FileReader(); + filereader.onerror = (ev) => { + reject(ev); + }; + filereader.onload = (ev) => { + resolve(ev.target.result); + }; + filereader.readAsArrayBuffer(file); + }); + } + + /** + * + * @param {File} file + */ + async __tryAddFile(file) { + return new Promise(async (resolve, reject) => { + if (!file) { + reject(new Error(`Invalid arg: file is ${file}`)); + + } else if (file.size > FileManagerUI_UPLOAD_FILE_SIZE_LIMIT) { + //FIXME(emscripten): Use our MessageDialog instead of browser's alert(). + alert(`Specified file is larger than limit of ${FileManagerUI_UPLOAD_FILE_SIZE_LIMIT} bytes. Canceced.`); + reject(new Error(`File is too large: "${file.name} is ${file.size} bytes`)); + + } else { + // Just add to Filesystem + const path = `${this.__basePathInFilesystem}${file.name}`; + const blobArrayBuffer = await this.__getFileAsArrayBuffer(file); + const u8array = new Uint8Array(blobArrayBuffer); + const fs = FS.open(path, "w"); + FS.write(fs, u8array, 0, u8array.length, 0); + FS.close(fs); + resolve(); + } + }); + } + + __addSelectedFile() { + if (this.__fileInputElement.files.length < 1) { + console.warn(`No file selected.`); + return; + } + + const file = this.__fileInputElement.files[0]; + this.__tryAddFile(file) + .then(() => { + this.__updateFileList(); + }) + .catch((err) => { + this.__fileInputElement.value = null; + console.error(err); + }) + } + + /** + * @param {DragEvent} ev + */ + __onFileDragDrop(ev) { + ev.preventDefault(); + if (ev.type == "dragenter" || ev.type == "dragover" || ev.type == "dragleave") { + return; + } + if (ev.dataTransfer.files.length < 1) { + return; + } + this.__fileInputElement.files = ev.dataTransfer.files; + + this.__addSelectedFile(); + } + + /** + * @param {InputEvent} _ev + */ + __onFileInputChanged(_ev) { + this.__addSelectedFile(); + } + + + /** Show the FileManager UI dialog */ + __show() { + this.__closedWithCancel = false; + + /** @type {HTMLElement} */ + this.__dialogRootElement = this.buildDialog(); + document.querySelector('body').appendChild(this.__dialogRootElement); + + this.__dialogHeaderElement.textContent = this.__dialogHeaderText || "File manager"; + this.__descriptionElement.textContent = this.__descriptionText || "Select a file."; + if (this.__extension_filters) { + this.__descriptionElement.textContent += "Requested filter is " + this.__extension_filters.join(", "); + } + + if (this.__isOpenDialog && this.__extension_filters) { + this.__fileInputElement.accept = this.__extension_filters.concat(','); + } + + if (this.__isSaveDialog) { + this.__saveFilenameInputElement.value = this.__defaultFilename; + } + + this.__dialogRootElement.style.display = "block"; + this.__isShown = true; + } + + /** Close the dialog */ + __close() { + this.__selectedFilename = ""; + if (this.__isOpenDialog) { + Array.from(document.querySelectorAll('input[type="radio"][name="filemanager_filelist"]')) + .forEach((elem) => { + if (elem.checked) { + this.__selectedFilename = elem.parentElement.getAttribute("data-filename"); + } + }); + } else if (this.__isSaveDialog) { + if (!this.__closedWithCancel) { + this.__selectedFilename = this.__saveFilenameInputElement.value; + } + } + + Array.from(this.__filelistElement.children).forEach((elem) => { + this.__filelistElement.removeChild(elem); + }); + + this.dispose(); + + this.__isShown = false; + } + + /** + * @return {boolean} + */ + isShown() { + return this.__isShown; + } + + /** + * + * @returns {Promise} filename string on resolved. + */ + showModalAsync() { + return new Promise((resolve, reject) => { + this.__show(); + this.__updateFileList(); + const intervalTimer = setInterval(() => { + if (!this.isShown()) { + clearInterval(intervalTimer); + resolve(this.__selectedFilename); + } + }, 50); + }); + } + + getSelectedFilename() { + return this.__selectedFilename; + } + + show() { + this.__show(); + this.__updateFileList(); + } +}; + + +window.FileManagerUI = FileManagerUI; diff --git a/src/platform/html/solvespaceui.css b/src/platform/html/solvespaceui.css new file mode 100644 index 0000000..3d2f44b --- /dev/null +++ b/src/platform/html/solvespaceui.css @@ -0,0 +1,344 @@ +* { + font-family: sans; +} +html, body { + padding: 0; + margin: 0; + background: black; + display: flex; + flex-direction: column; + height: 100%; +} +html, body, canvas, #splash, #container { + margin: 0; + padding: 0; + width: 100%; + height: 100%; +} +body { + overflow: hidden; +} + +/* Splashscreen */ +#splash { + z-index: 1000; + background: black; + color: white; + position: absolute; +} +#splash .center { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + text-align: center; +} +#splash a { + color: white; +} + +#spinner { + height: 30px; + width: 30px; + margin: 0px auto; + border-left: 10px solid rgb(255, 255, 255); + border-top: 10px solid rgb(0, 255, 0); + border-right: 10px solid rgb(255, 0, 255); + border-bottom: 10px solid rgb(0, 255, 0); + border-radius: 100%; + animation: rotation 3s linear infinite; + margin-bottom: 5px; +} +@keyframes rotation { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} + +/* Grid layout for main */ +main { + height: 100%; + + /* Use CSS Grid layout for vertical placement. */ + display: grid; + /* Row 0 for menubar (fit to content), Row 1 for canvas0, canvas1 (rest of space) */ + grid-template-rows: auto 1fr; +} + +/* Buttons */ +.button { + border: 1px solid hsl(0, 0%, 60%); + background: hsl(0, 0%, 10%); + color: white; + padding: 4px 8px; + cursor: default; +} +.button.selected { + background: hsl(0, 0%, 20%); +} +.button:hover { + background: hsl(0, 0%, 40%); +} + +/* Editors */ +.editor { + position: fixed; + padding: 0; + border: none; +} + +/* Menus */ +.menu { + font-size: 0; + margin: 0; + padding: 0; + padding-right: 10px; + list-style-type: none; + background: hsl(0, 0%, 20%); + color: white; + cursor: default; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* Normal menu items */ +.menu > li { + z-index: 100; + font-size: 16px; + display: inline-flex; + justify-content: space-between; + align-items: center; + white-space: nowrap; + position: relative; + width: 100%; + height: 19px; + margin: 2px; + padding: 3px; +} +.menu > li::before, .menu > li::after { + font-family: 'Font Awesome 5 Free'; + font-weight: 900; + font-size: 12px; +} +.menu > li.hover, +.menu > li.selected, +.menu.menubar > li:hover:not(.selected) { + background: hsl(0, 0%, 30%); +} +.menu > li.disabled { + color: hsl(0, 0%, 30%); +} + +/* Check and radio menu items */ +.menu > li { + padding-left: 24px; +} +.menu > li::before { + position: absolute; + text-align: center; + left: 0px; + width: 24px; +} +.menu > li.check::before { + content: '\f0c8'; +} +.menu > li.check.active::before { + content: '\f14a'; +} +.menu > li.radio::before { + content: '\f111'; +} +.menu > li.radio.active::before { + content: '\f192'; +} + +/* Separator menu items */ +.menu > li.separator { + height: 0px; + border-top: 1px solid hsl(0, 0%, 30%); + margin: 0 2px 0 2px; + padding-top: 0; + padding-bottom: 0; +} + +/* Accelerators */ +.menu > li > .accel { + text-align: right; + margin-left: 20px; +} + +/* Submenus */ +.menu > li > .menu, +.menu.popup { + display: none; + white-space: normal; + padding-right: 31px; +} +.menu > li.has-submenu::after { + content: '\f0da'; +} +.menu > li.selected > .menu, +.menu > li.hover > .menu, +.menu.popup { + display: block; + background: hsl(0, 0%, 10%); + border: 1px solid hsl(0, 0%, 30%); + position: absolute; + left: 100%; + top: -3px; +} + +/* Popup menus */ +.menu.popup { + display: block; + position: absolute; + width: min-content; +} + +/* Menubars */ +.menubar { + padding-left: 5px; +} +.menubar > li { + width: auto; + width: fit-content; + margin: 0; + padding: 5px; +} +.menubar > li.selected { + background: hsl(0, 0%, 10%); + border: 1px solid hsl(0, 0%, 30%); + padding: 4px; +} +.menubar.menu > li.selected > .menu { + display: block; + position: absolute; + left: -1px; + top: 27px; +} + +/* Modal popups */ +.modal { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + background: hsla(0, 0%, 0%, 60%); +} +.modal > div { + position: absolute; + top: 15%; + left: 50%; + transform: translate(-50%, 0%); +} + +/* Dialogs */ +.dialog { + border: 1px solid hsl(0, 0%, 30%); + background: hsl(0, 0%, 10%); + color: white; + padding: 20px; + display: flex; + flex-direction: column; + min-width: 200px; + max-width: 400px; + white-space: pre-wrap; + max-height: 70%; + overflow-y: auto; +} +.dialog.wide { + width: 80%; + max-width: 1200px; +} +.dialog > .buttons { + display: flex; + justify-content: space-around; +} +.dialog .filedrop { + margin: 1em 0 1em 0; + padding: 1em; + border: 2px solid black; + background-color: hsl(0, 0%, 50%); +} +.dialog .filelist { + display: flex; + flex-flow: row wrap; + list-style: none; + margin: 0; + padding: 0; +} +.dialog .filelist li { + padding: 0.2em 0.5em 0.2em 0.5em; + break-inside: avoid; +} + +/* Mnemonics */ +.label > u { + position: relative; + top: 0px; + text-decoration: none; +} +body.mnemonic .label > u { + border-bottom: 1px solid; +} + +/* Canvases */ +canvas { + border: 0px none; + background-color: black; +} + +#container { + display: flex; + overflow: hidden; +} +/* FIXME(emscripten): this should be dynamically adjustable, not hardcoded in CSS */ +#container0 { + flex-basis: 80%; + height: 100%; + position: relative; + overflow: hidden; +} + +#container1parent { + flex-basis: 20%; + height: 100%; + position: relative; + overflow: hidden; + min-width: 410px; + + display: grid; + grid-template-columns: auto 19px; + grid-template-rows: 100%; +} + +#container1 { + height: 100%; +} + +#canvas1scrollbarbox { + /* 19px is a magic number for scrollbar width (Yes, this is platform-dependent value but looks almost working.) */ + width: 19px; + min-width: 19px; + height: 100%; + overflow-x: hidden; + overflow-y: scroll; + + background-color: lightgray; + -webkit-overflow-scrolling: auto; +} + +#canvas1scrollbar { + /* 0px will disable the scrollbar by browser. */ + width: 1px; + /* Disable scrollbar as default. This value will be overwritten by program. */ + height: 100%; +} + +#view_separator { + width: 4px; + background: hsl(0, 0%, 20%); +} diff --git a/src/platform/html/solvespaceui.js b/src/platform/html/solvespaceui.js new file mode 100644 index 0000000..80af245 --- /dev/null +++ b/src/platform/html/solvespaceui.js @@ -0,0 +1,813 @@ +function isModal() { + var hasModal = !!document.querySelector('.modal'); + var hasMenuBar = !!document.querySelector('.menubar .selected'); + var hasPopupMenu = !!document.querySelector('.menu.popup'); + return hasModal || hasMenuBar || hasPopupMenu; +} + +/* String helpers */ + +/** + * @param {string} s - original string + * @param {number} digits - char length of generating string + * @param {string} ch - string to be used for padding + * @return {string} generated string ($digits chars length) or $s + */ +function stringPadLeft(s, digits, ch) { + if (s.length > digits) { + return s; + } + for (let i = s.length; i < digits; i++) { + s = ch + s; + } + return s; +} + +/** Generate a string expression of now + * @return {string} like a "2022_08_31_2245" string (for 2022-08-31 22:45; local time) + */ +function GetCurrentDateTimeString() { + const now = new Date(); + const padLeft2 = (num) => { return stringPadLeft(num.toString(), 2, '0') }; + return (`${now.getFullYear()}_${padLeft2(now.getMonth()+1)}_${padLeft2(now.getDate())}` + + `_` + `${padLeft2(now.getHours())}${padLeft2(now.getMinutes())}`); +} + +/* CSS helpers */ +function hasClass(element, className) { + return element.classList.contains(className); +} +function addClass(element, className) { + element.classList.add(className); +} +function removeClass(element, className) { + element.classList.remove(className); +} +function removeClassFromAllChildren(element, className) { + element.querySelectorAll('.' + className).forEach(function(element) { + removeClass(element, className); + }) +} + +/* Mnemonic helpers */ +function setLabelWithMnemonic(element, labelText) { + var label = document.createElement('span'); + addClass(label, 'label'); + element.appendChild(label); + + var matches = labelText.match('(.*?)&(.)(.*)?'); + if(matches) { + label.appendChild(document.createTextNode(matches[1])); + if(matches[2]) { + var mnemonic = document.createElement('u'); + mnemonic.innerText = matches[2]; + label.appendChild(mnemonic); + addClass(element, 'mnemonic-Key' + matches[2].toUpperCase()); + } + if(matches[3]) { + label.appendChild(document.createTextNode(matches[3])); + } + } else { + label.appendChild(document.createTextNode(labelText)) + } +} + +/** Touchevent helper + * @param {TouchEvent} event + * @return {boolean} true if same element is target of touchstart and touchend + */ +function isSameElementOnTouchstartAndTouchend(event) { + const elementOnTouchStart = event.target; + const elementOnTouchEnd = document.elementFromPoint(event.changedTouches[0].clientX, event.changedTouches[0].clientY); + return elementOnTouchStart == elementOnTouchEnd; +} + +/* Button helpers */ +function isButton(element) { + return hasClass(element, 'button'); +} + +/* Button DOM traversal helpers */ +function getButton(element) { + if(!element) return; + if(element.tagName == 'U') { + element = element.parentElement; + } + if(hasClass(element, 'label')) { + return getButton(element.parentElement); + } else if(isButton(element)) { + return element; + } +} + +/* Button behavior */ +window.addEventListener('click', function(event) { + var button = getButton(event.target); + if(button) { + button.dispatchEvent(new Event('trigger')); + } +}); +window.addEventListener("touchend", (event) => { + if (!isSameElementOnTouchstartAndTouchend(event)) { + return; + } + const button = getButton(event.target); + if (button) { + button.dispatchEvent(new Event('trigger')); + } +}); + +window.addEventListener('keydown', function(event) { + var selected = document.querySelector('.button.selected'); + if(!selected) return; + + var outSelected, newSelected; + if(event.key == 'ArrowRight') { + outSelected = selected; + newSelected = selected.nextElementSibling; + if(!newSelected) { + newSelected = outSelected.parentElement.firstElementChild; + } + } else if(event.key == 'ArrowLeft') { + outSelected = selected; + newSelected = selected.previousElementSibling; + if(!newSelected) { + newSelected = outSelected.parentElement.lastElementChild; + } + } else if(event.key == 'Enter') { + selected.dispatchEvent(new Event('trigger')); + } else if(event.key == 'Escape' && hasClass(selected, 'default')) { + selected.dispatchEvent(new Event('trigger')); + } + + if(outSelected) removeClass(outSelected, 'selected'); + if(newSelected) addClass(newSelected, 'selected'); + + event.stopPropagation(); +}); + +/* Editor helpers */ +function isEditor(element) { + return hasClass(element, 'editor'); +} + +/* Editor DOM traversal helpers */ +function getEditor(element) { + if(!element) return; + if(isEditor(element)) { + return element; + } +} + +/* Editor behavior */ +window.addEventListener('keydown', function(event) { + var editor = getEditor(event.target); + if(editor) { + if(event.key == 'Enter') { + editor.dispatchEvent(new Event('trigger')); + } else if(event.key == 'Escape') { + editor.style.display = 'none'; + } + event.stopPropagation(); + } +}, {capture: true}); + +/* Menu helpers */ +function isMenubar(element) { + return hasClass(element, 'menubar'); +} +function isMenu(element) { + return hasClass(element, 'menu'); +} +function isPopupMenu(element) { + return isMenu(element) && hasClass(element, 'popup') +} +function hasSubmenu(menuItem) { + return !!menuItem.querySelector('.menu'); +} + +/* Menu item helpers */ +function isMenuItemSelectable(menuItem) { + return !(hasClass(menuItem, 'disabled') || hasClass(menuItem, 'separator')); +} +function isMenuItemSelected(menuItem) { + return hasClass(menuItem, 'selected') || hasClass(menuItem, 'hover'); +} +function deselectMenuItem(menuItem) { + removeClass(menuItem, 'selected'); + removeClass(menuItem, 'hover'); + removeClassFromAllChildren(menuItem, 'selected'); + removeClassFromAllChildren(menuItem, 'hover'); +} +function selectMenuItem(menuItem) { + var menu = menuItem.parentElement; + removeClassFromAllChildren(menu, 'selected'); + removeClassFromAllChildren(menu, 'hover'); + if(isMenubar(menu)) { + addClass(menuItem, 'selected'); + } else { + addClass(menuItem, 'hover'); + } +} +function triggerMenuItem(menuItem) { + selectMenuItem(menuItem); + if(hasSubmenu(menuItem)) { + selectMenuItem(menuItem.querySelector('li:first-child')); + } else { + var parent = menuItem.parentElement; + while(!isMenubar(parent) && !isPopupMenu(parent)) { + parent = parent.parentElement; + } + removeClassFromAllChildren(parent, 'selected'); + removeClassFromAllChildren(parent, 'hover'); + if(isPopupMenu(parent)) { + parent.remove(); + } + + menuItem.dispatchEvent(new Event('trigger')); + } +} + +/* Menu DOM traversal helpers */ +function getMenuItem(element) { + if(!element) return; + if(element.tagName == 'U') { + element = element.parentElement; + } + if(hasClass(element, 'label')) { + return getMenuItem(element.parentElement); + } else if(element.tagName == 'LI' && isMenu(element.parentElement)) { + return element; + } +} +function getMenu(element) { + if(!element) return; + if(isMenu(element)) { + return element; + } else { + var menuItem = getMenuItem(element); + if(menuItem && isMenu(menuItem.parentElement)) { + return menuItem.parentElement; + } + } +} + +/* Menu behavior */ +window.addEventListener('click', function(event) { + var menuItem = getMenuItem(event.target); + var menu = getMenu(menuItem); + if(menu && isMenubar(menu)) { + if(hasClass(menuItem, 'selected')) { + removeClass(menuItem, 'selected'); + } else { + selectMenuItem(menuItem); + } + event.stopPropagation(); + } else if(menu) { + if(!hasSubmenu(menuItem)) { + triggerMenuItem(menuItem); + } + event.stopPropagation(); + } else { + document.querySelectorAll('.menu .selected, .menu .hover') + .forEach(function(menuItem) { + deselectMenuItem(menuItem); + event.stopPropagation(); + }); + document.querySelectorAll('.menu.popup') + .forEach(function(menu) { + menu.remove(); + }); + } +}); +window.addEventListener("touchend", (event) => { + if (!isSameElementOnTouchstartAndTouchend(event)) { + return; + } + var menuItem = getMenuItem(event.target); + var menu = getMenu(menuItem); + if(menu && isMenubar(menu)) { + if(hasClass(menuItem, 'selected')) { + removeClass(menuItem, 'selected'); + } else { + selectMenuItem(menuItem); + } + event.stopPropagation(); + event.preventDefault(); + } else if(menu) { + if(!hasSubmenu(menuItem)) { + triggerMenuItem(menuItem); + } else { + addClass(menuItem, "selected"); + addClass(menuItem, "hover"); + } + event.stopPropagation(); + } else { + document.querySelectorAll('.menu .selected, .menu .hover') + .forEach(function(menuItem) { + deselectMenuItem(menuItem); + event.stopPropagation(); + }); + document.querySelectorAll('.menu.popup') + .forEach(function(menu) { + menu.remove(); + }); + } +}); +window.addEventListener('mouseover', function(event) { + var menuItem = getMenuItem(event.target); + var menu = getMenu(menuItem); + if(menu) { + var selected = menu.querySelectorAll('.selected, .hover'); + if(isMenubar(menu)) { + if(selected.length > 0) { + selected.forEach(function(menuItem) { + if(selected != menuItem) { + deselectMenuItem(menuItem); + } + }); + addClass(menuItem, 'selected'); + } + } else { + if(isMenuItemSelectable(menuItem)) { + selectMenuItem(menuItem); + } + } + } +}); +window.addEventListener('keydown', function(event) { + var allSelected = document.querySelectorAll('.menubar .selected, .menubar .hover,' + + '.menu.popup .selected, .menu.popup .hover'); + if(allSelected.length == 0) return; + + var selected = allSelected[allSelected.length - 1]; + var outSelected, newSelected; + var isMenubarItem = isMenubar(getMenu(selected)); + + if(isMenubarItem && event.key == 'ArrowRight' || + !isMenubarItem && event.key == 'ArrowDown') { + outSelected = selected; + newSelected = selected.nextElementSibling; + while(newSelected && !isMenuItemSelectable(newSelected)) { + newSelected = newSelected.nextElementSibling; + } + if(!newSelected) { + newSelected = outSelected.parentElement.firstElementChild; + } + } else if(isMenubarItem && event.key == 'ArrowLeft' || + !isMenubarItem && event.key == 'ArrowUp') { + outSelected = selected; + newSelected = selected.previousElementSibling; + while(newSelected && !isMenuItemSelectable(newSelected)) { + newSelected = newSelected.previousElementSibling; + } + if(!newSelected) { + newSelected = outSelected.parentElement.lastElementChild; + } + } else if(!isMenubarItem && event.key == 'ArrowRight') { + if(hasSubmenu(selected)) { + selectMenuItem(selected.querySelector('li:first-child')); + } else { + outSelected = allSelected[0]; + newSelected = outSelected.nextElementSibling; + if(!newSelected) { + newSelected = outSelected.parentElement.firstElementChild; + } + } + } else if(!isMenubarItem && event.key == 'ArrowLeft') { + if(allSelected.length > 2) { + outSelected = selected; + } else { + outSelected = allSelected[0]; + newSelected = outSelected.previousElementSibling; + if(!newSelected) { + newSelected = outSelected.parentElement.lastElementChild; + } + } + } else if(isMenubarItem && event.key == 'ArrowDown') { + newSelected = selected.querySelector('li:first-child'); + } else if(event.key == 'Enter') { + triggerMenuItem(selected); + } else if(event.key == 'Escape') { + outSelected = allSelected[0]; + } else { + var withMnemonic = getMenu(selected).querySelector('.mnemonic-' + event.key); + if(withMnemonic) { + triggerMenuItem(withMnemonic); + } + } + + if(outSelected) deselectMenuItem(outSelected); + if(newSelected) selectMenuItem(newSelected); + + event.stopPropagation(); +}); + +/* Mnemonic behavior */ +window.addEventListener('keydown', function(event) { + var withMnemonic; + if(event.altKey && event.key == 'Alt') { + addClass(document.body, 'mnemonic'); + } else if(!isModal() && event.altKey && (withMnemonic = + document.querySelector('.menubar > .mnemonic-' + event.code))) { + triggerMenuItem(withMnemonic); + event.stopPropagation(); + } else { + removeClass(document.body, 'mnemonic'); + } +}); +window.addEventListener('keyup', function(event) { + if(event.key == 'Alt') { + removeClass(document.body, 'mnemonic'); + } +}); + + +// FIXME(emscripten): Should be implemented in guihtmlcpp ? +class FileUploadHelper { + constructor() { + this.modalRoot = document.createElement("div"); + addClass(this.modalRoot, "modal"); + this.modalRoot.style.display = "none"; + this.modalRoot.style.zIndex = 1000; + + this.dialogRoot = document.createElement("div"); + addClass(this.dialogRoot, "dialog"); + this.modalRoot.appendChild(this.dialogRoot); + + this.messageHeader = document.createElement("strong"); + this.dialogRoot.appendChild(this.messageHeader); + + this.descriptionParagraph = document.createElement("p"); + this.dialogRoot.appendChild(this.descriptionParagraph); + + this.currentFileListHeader = document.createElement("p"); + this.currentFileListHeader.textContent = "Current uploaded files:"; + this.dialogRoot.appendChild(this.currentFileListHeader); + + this.currentFileList = document.createElement("div"); + this.dialogRoot.appendChild(this.currentFileList); + + this.fileInputContainer = document.createElement("div"); + + this.fileInputElement = document.createElement("input"); + this.fileInputElement.setAttribute("type", "file"); + this.fileInputElement.addEventListener("change", (ev)=> this.onFileInputChanged(ev)); + this.fileInputContainer.appendChild(this.fileInputElement); + + this.dialogRoot.appendChild(this.fileInputContainer); + + this.buttonHolder = document.createElement("div"); + addClass(this.buttonHolder, "buttons"); + this.dialogRoot.appendChild(this.buttonHolder); + + this.AddButton("OK", 0, false); + this.AddButton("Cancel", 1, true); + + this.closeDialog(); + + document.querySelector("body").appendChild(this.modalRoot); + + this.currentFilename = null; + + // FIXME(emscripten): For debugging + this.title = ""; + this.filename = ""; + this.filters = ""; + } + + dispose() { + document.querySelector("body").removeChild(this.modalRoot); + } + + AddButton(label, response, isDefault) { + // FIXME(emscripten): implement + const buttonElem = document.createElement("div"); + addClass(buttonElem, "button"); + setLabelWithMnemonic(buttonElem, label); + if (isDefault) { + addClass(buttonElem, "default"); + addClass(buttonElem, "selected"); + } + buttonElem.addEventListener("click", () => { + this.closeDialog(); + }); + + this.buttonHolder.appendChild(buttonElem); + } + + getFileEntries() { + const basePath = '/'; + /** @type {Array { + return FS.isFile(FS.lstat(basePath + nodename).mode); + }).map((filename) => { + return basePath + filename; + }); + return files; + } + + generateFileList() { + let filepaths = this.getFileEntries(); + const listElem = document.createElement("ul"); + for (let i = 0; i < filepaths.length; i++) { + const listitemElem = document.createElement("li"); + const stat = FS.lstat(filepaths[i]); + const text = `"${filepaths[i]}" (${stat.size} bytes)`; + listitemElem.textContent = text; + listElem.appendChild(listitemElem); + } + return listElem; + } + + updateFileList() { + this.currentFileList.innerHTML = ""; + this.currentFileList.appendChild(this.generateFileList()); + } + + onFileInputChanged(ev) { + const selectedFiles = ev.target.files; + if (selectedFiles.length < 1) { + return; + } + const selectedFile = selectedFiles[0]; + const selectedFilename = selectedFile.name; + this.filename = selectedFilename; + this.currentFilename = selectedFilename; + + // Prepare FileReader + const fileReader = new FileReader(); + const fileReaderReadAsArrayBufferPromise = new Promise((resolve, reject) => { + fileReader.addEventListener("load", (ev) => { + resolve(ev.target.result); + }); + fileReader.addEventListener("abort", (err) => { + reject(err); + }); + fileReader.readAsArrayBuffer(selectedFile); + }); + + fileReaderReadAsArrayBufferPromise + .then((arrayBuffer) => { + // Write selected file to FS + console.log(`Write uploaded file blob to filesystem. "${selectedFilename}" (${arrayBuffer.byteLength} bytes)`); + const u8array = new Uint8Array(arrayBuffer); + const fs = FS.open("/" + selectedFilename, "w"); + FS.write(fs, u8array, 0, u8array.length, 0); + FS.close(fs); + + // Update file list in dialog + this.updateFileList(); + }) + .catch((err) => { + console.error("Error while fileReader.readAsArrayBuffer():", err); + }); + } + + showDialog() { + this.updateFileList(); + + this.is_shown = true; + this.modalRoot.style.display = "block"; + } + + closeDialog() { + this.is_shown = false; + this.modalRoot.style.display = "none"; + } +}; + +// FIXME(emscripten): Workaround +function createFileUploadHelperInstance() { + return new FileUploadHelper(); +} + +// FIXME(emscripten): Should be implemented in guihtmlcpp ? +class FileDownloadHelper { + constructor() { + this.modalRoot = document.createElement("div"); + addClass(this.modalRoot, "modal"); + this.modalRoot.style.display = "none"; + this.modalRoot.style.zIndex = 1000; + + this.dialogRoot = document.createElement("div"); + addClass(this.dialogRoot, "dialog"); + this.modalRoot.appendChild(this.dialogRoot); + + this.messageHeader = document.createElement("strong"); + this.dialogRoot.appendChild(this.messageHeader); + + this.descriptionParagraph = document.createElement("p"); + this.dialogRoot.appendChild(this.descriptionParagraph); + + this.buttonHolder = document.createElement("div"); + addClass(this.buttonHolder, "buttons"); + this.dialogRoot.appendChild(this.buttonHolder); + + this.closeDialog(); + + document.querySelector("body").appendChild(this.modalRoot); + } + + dispose() { + document.querySelector("body").removeChild(this.modalRoot); + } + + AddButton(label, response, isDefault) { + // FIXME(emscripten): implement + const buttonElem = document.createElement("div"); + addClass(buttonElem, "button"); + setLabelWithMnemonic(buttonElem, label); + if (isDefault) { + addClass(buttonElem, "default"); + addClass(buttonElem, "selected"); + } + buttonElem.addEventListener("click", () => { + this.closeDialog(); + this.dispose(); + }); + + this.buttonHolder.appendChild(buttonElem); + } + + createBlobURLFromArrayBuffer(arrayBuffer) { + const u8array = new Uint8Array(arrayBuffer); + let dataUrl = "data:application/octet-stream;base64,"; + let binaryString = ""; + for (let i = 0; i < u8array.length; i++) { + binaryString += String.fromCharCode(u8array[i]); + } + dataUrl += btoa(binaryString); + + return dataUrl; + } + + prepareFile(filename) { + this.messageHeader.textContent = "Your file ready"; + + const stat = FS.lstat(filename); + const filesize = stat.size; + const fs = FS.open(filename, "r"); + const readbuffer = new Uint8Array(filesize); + FS.read(fs, readbuffer, 0, filesize, 0); + FS.close(fs); + + const blobURL = this.createBlobURLFromArrayBuffer(readbuffer.buffer); + + this.descriptionParagraph.innerHTML = ""; + const linkElem = document.createElement("a"); + //let downloadfilename = "solvespace_browser-"; + //downloadfilename += `${GetCurrentDateTimeString()}.slvs`; + let downloadfilename = filename; + linkElem.setAttribute("download", downloadfilename); + linkElem.setAttribute("href", blobURL); + // WORKAROUND: FIXME(emscripten) + linkElem.style.color = "lightblue"; + linkElem.textContent = downloadfilename; + this.descriptionParagraph.appendChild(linkElem); + } + + showDialog() { + this.is_shown = true; + this.modalRoot.style.display = "block"; + } + + closeDialog() { + this.is_shown = false; + this.modalRoot.style.display = "none"; + } +}; + +function saveFileDone(filename, isSaveAs, isAutosave) { + console.log(`saveFileDone(${filename}, ${isSaveAs}, ${isAutosave})`); + if (isAutosave) { + return; + } + const fileDownloadHelper = new FileDownloadHelper(); + fileDownloadHelper.AddButton("OK", 0, true); + fileDownloadHelper.prepareFile(filename); + console.log(`Calling shoDialog()...`); + fileDownloadHelper.showDialog(); + console.log(`shoDialog() finished.`); +} + + +class ScrollbarHelper { + /** + * @param {HTMLElement} elementquery CSS query string for the element that has scrollbar. + */ + constructor(elementquery) { + this.target = document.querySelector(elementquery); + this.rangeMin = 0; + this.rangeMax = 0; + this.currentRatio = 0; + + this.onScrollCallback = null; + this.onScrollCallbackTicking = false; + if (this.target) { + // console.log("addEventListner scroll"); + this.target.parentElement.addEventListener('scroll', () => { + if (this.onScrollCallbackTicking) { + return; + } + window.requestAnimationFrame(() => { + if (this.onScrollCallback) { + this.onScrollCallback(); + } + this.onScrollCallbackTicking = false; + }); + this.onScrollCallbackTicking = true; + }); + } + } + + /** + * + * @param {number} ratio how long against to the viewport height (1.0 to exact same as viewport's height) + */ + setScrollbarSize(ratio) { + // if (isNaN(ratio)) { + // console.warn(`setScrollbarSize(): ratio is Nan = ${ratio}`); + // } + // if (ratio < 0 || ratio > 1) { + // console.warn(`setScrollbarSize(): ratio is out of range 0-1 but ${ratio}`); + // } + // console.log(`ScrollbarHelper.setScrollbarSize(): ratio=${ratio}`); + this.target.style.height = `${100 * ratio}%`; + } + + getScrollbarPosition() { + const scrollbarElem = this.target.parentElement; + const scrollTopMin = 0; + const scrollTopMax = scrollbarElem.scrollHeight - scrollbarElem.clientHeight; + const ratioOnScrollbar = (scrollbarElem.scrollTop - scrollTopMin) / (scrollTopMax - scrollTopMin); + this.currentRatio = (scrollbarElem.scrollTop - scrollTopMin) / (scrollTopMax - scrollTopMin); + let pos = this.currentRatio * (this.rangeMax - this.pageSize - this.rangeMin) + this.rangeMin; + // console.log(`ScrollbarHelper.getScrollbarPosition(): ratio=${ratioOnScrollbar}, pos=${pos}, scrollTop=${scrollbarElem.scrollTop}, scrollTopMin=${scrollTopMin}, scrollTopMax=${scrollTopMax}, rangeMin=${this.rangeMin}, rangeMax=${this.rangeMax}, pageSize=${this.pageSize}`); + if (isNaN(pos)) { + return 0; + } else { + return pos; + } + } + + /** + * @param {number} value in range of rangeMin and rangeMax + */ + setScrollbarPosition(position) { + const positionMin = this.rangeMin; + const positionMax = this.rangeMax - this.pageSize; + const currentPositionRatio = (position - positionMin) / (positionMax - positionMin); + + const scrollbarElement = this.target.parentElement; + const scrollTopMin = 0; + const scrollTopMax = scrollbarElement.scrollHeight - scrollbarElement.clientHeight; + const scrollWidth = scrollTopMax - scrollTopMin; + const newScrollTop = currentPositionRatio * scrollWidth; + scrollbarElement.scrollTop = currentPositionRatio * scrollWidth; + + // console.log(`ScrollbarHelper.setScrollbarPosition(): pos=${position}, currentPositionRatio=${currentPositionRatio}, calculated scrollTop=${newScrollTop}`); + + if (false) { + // const ratio = (position - this.rangeMin) * ((this.rangeMax - this.pageSize) - this.rangeMin); + + const scrollTopMin = 0; + const scrollTopMax = this.target.scrollHeight - this.target.clientHeight; + const scrollWidth = scrollTopMax - scrollTopMin; + const newScrollTop = ratio * scrollWidth; + // this.target.parentElement.scrollTop = ratio * scrollWidth; + this.target.scrollTop = ratio * scrollWidth; + + console.log(`ScrollbarHelper.setScrollbarPosition(): pos=${position}, ratio=${ratio}, calculated scrollTop=${newScrollTop}`); + } + } + + /** */ + setRange(min, max, pageSize) { + this.rangeMin = min; + this.rangeMax = max; + this.currentRatio = 0; + + this.setPageSize(pageSize); + } + + setPageSize(pageSize) { + if (this.rangeMin == this.rangeMax) { + // console.log(`ScrollbarHelper::setPageSize(): size=${size}, but rangeMin == rangeMax`); + return; + } + this.pageSize = pageSize; + const ratio = (this.rangeMax - this.rangeMin) / this.pageSize; + // console.log(`ScrollbarHelper::setPageSize(): pageSize=${pageSize}, ratio=${ratio}`); + this.setScrollbarSize(ratio); + } + + setScrollbarEnabled(enabled) { + if (!enabled) { + this.target.style.height = "100%"; + } + } +}; + +window.ScrollbarHelper = ScrollbarHelper; diff --git a/src/platform/platform.cpp b/src/platform/platform.cpp new file mode 100644 index 0000000..a57ff5e --- /dev/null +++ b/src/platform/platform.cpp @@ -0,0 +1,657 @@ +//----------------------------------------------------------------------------- +// Platform-dependent functionality. +// +// Copyright 2017 whitequark +//----------------------------------------------------------------------------- +#if defined(__APPLE__) +// Include Apple headers before solvespace.h to avoid identifier clashes. +# include +# include +# include +#endif + +#include +#include +#include + +#include + +#if defined(WIN32) +// Conversely, include Microsoft headers after solvespace.h to avoid clashes. +# include +# include +#else +# include +# include +#endif + +#include "platform.h" +#include "util.h" +#include "config.h" + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// UTF-8 ⟷ UTF-16 conversion, on Windows. +//----------------------------------------------------------------------------- + +#if defined(WIN32) + +std::string Narrow(const wchar_t *in) +{ + std::string out; + DWORD len = WideCharToMultiByte(CP_UTF8, 0, in, -1, NULL, 0, NULL, NULL); + out.resize(len - 1); + ssassert(WideCharToMultiByte(CP_UTF8, 0, in, -1, &out[0], len, NULL, NULL), + "Invalid UTF-16"); + return out; +} + +std::string Narrow(const std::wstring &in) +{ + if(in == L"") return ""; + + std::string out; + out.resize(WideCharToMultiByte(CP_UTF8, 0, &in[0], (int)in.length(), + NULL, 0, NULL, NULL)); + ssassert(WideCharToMultiByte(CP_UTF8, 0, &in[0], (int)in.length(), + &out[0], (int)out.length(), NULL, NULL), + "Invalid UTF-16"); + return out; +} + +std::wstring Widen(const char *in) +{ + std::wstring out; + DWORD len = MultiByteToWideChar(CP_UTF8, 0, in, -1, NULL, 0); + out.resize(len - 1); + ssassert(MultiByteToWideChar(CP_UTF8, 0, in, -1, &out[0], len), + "Invalid UTF-8"); + return out; +} + +std::wstring Widen(const std::string &in) +{ + if(in == "") return L""; + + std::wstring out; + out.resize(MultiByteToWideChar(CP_UTF8, 0, &in[0], (int)in.length(), NULL, 0)); + ssassert(MultiByteToWideChar(CP_UTF8, 0, &in[0], (int)in.length(), + &out[0], (int)out.length()), + "Invalid UTF-8"); + return out; +} + +#endif + +//----------------------------------------------------------------------------- +// Path utility functions. +//----------------------------------------------------------------------------- + +static std::vector Split(const std::string &joined, char separator) { + std::vector parts; + + size_t oldpos = 0, pos = 0; + while(true) { + oldpos = pos; + pos = joined.find(separator, pos); + if(pos == std::string::npos) break; + parts.push_back(joined.substr(oldpos, pos - oldpos)); + pos += 1; + } + + parts.push_back(joined.substr(oldpos)); + + return parts; +} + +static std::string Concat(const std::vector &parts, char separator) { + std::string joined; + + bool first = true; + for(auto &part : parts) { + if(!first) joined += separator; + joined += part; + first = false; + } + + return joined; +} + +//----------------------------------------------------------------------------- +// Path manipulation. +//----------------------------------------------------------------------------- + +#if defined(WIN32) +const char SEPARATOR = '\\'; +#else +const char SEPARATOR = '/'; +#endif + +Path Path::From(std::string raw) { + Path path = { raw }; + return path; +} + +Path Path::CurrentDirectory() { +#if defined(WIN32) + // On Windows, OpenFile needs an absolute UNC path proper, so get that. + std::wstring rawW; + rawW.resize(GetCurrentDirectoryW(0, NULL)); + DWORD length = GetCurrentDirectoryW((int)rawW.length(), &rawW[0]); + ssassert(length > 0 && length == rawW.length() - 1, "Cannot get current directory"); + rawW.resize(length); + return From(Narrow(rawW)); +#else + char *raw = getcwd(NULL, 0); + ssassert(raw != NULL, "Cannot get current directory"); + Path path = From(raw); + free(raw); + return path; +#endif +} + +std::string Path::FileName() const { + std::string fileName = raw; + size_t slash = fileName.rfind(SEPARATOR); + if(slash != std::string::npos) { + fileName = fileName.substr(slash + 1); + } + return fileName; +} + +std::string Path::FileStem() const { + std::string baseName = FileName(); + size_t dot = baseName.rfind('.'); + if(dot != std::string::npos) { + baseName = baseName.substr(0, dot); + } + return baseName; +} + +std::string Path::Extension() const { + size_t dot = raw.rfind('.'); + if(dot != std::string::npos) { + return raw.substr(dot + 1); + } + return ""; +} + +bool Path::HasExtension(std::string theirExt) const { + std::string ourExt = Extension(); + std::transform(ourExt.begin(), ourExt.end(), ourExt.begin(), ::tolower); + std::transform(theirExt.begin(), theirExt.end(), theirExt.begin(), ::tolower); + return ourExt == theirExt; +} + +Path Path::WithExtension(std::string ext) const { + Path withExt = *this; + size_t dot = withExt.raw.rfind('.'); + if(dot != std::string::npos) { + withExt.raw.erase(dot); + } + if(!ext.empty()) { + withExt.raw += "."; + withExt.raw += ext; + } + return withExt; +} + +static void FindPrefix(const std::string &raw, size_t *pos) { + *pos = std::string::npos; +#if defined(WIN32) + if(raw.size() >= 7 && raw[2] == '?' && raw[3] == '\\' && + isalpha(raw[4]) && raw[5] == ':' && raw[6] == '\\') { + *pos = 7; + } else if(raw.size() >= 3 && isalpha(raw[0]) && raw[1] == ':' && raw[2] == '\\') { + *pos = 3; + } else if(raw.size() >= 2 && raw[0] == '\\' && raw[1] == '\\') { + size_t slashAt = raw.find('\\', 2); + if(slashAt != std::string::npos) { + *pos = raw.find('\\', slashAt + 1); + } + } +#else + if(!raw.empty() && raw[0] == '/') { + *pos = 1; + } +#endif +} + +bool Path::IsAbsolute() const { + size_t pos; + FindPrefix(raw, &pos); + return pos != std::string::npos; +} + +// Removes one component from the end of the path. +// Returns an empty path if the path consists only of a root. +Path Path::Parent() const { + Path parent = { raw }; + if(!parent.raw.empty() && parent.raw.back() == SEPARATOR) { + parent.raw.pop_back(); + } + size_t slash = parent.raw.rfind(SEPARATOR); + if(slash != std::string::npos) { + parent.raw = parent.raw.substr(0, slash + 1); + } else { + parent.raw.clear(); + } + if(IsAbsolute() && !parent.IsAbsolute()) { + return From(""); + } + return parent; +} + +// Concatenates a component to this path. +// Returns a relative path if this path is empty. +// Returns an empty path if the component is absolute. +Path Path::Join(const std::string &component) const { + ssassert(component.find(SEPARATOR) == std::string::npos, + "Use the Path::Join(const Path &) overload to append an entire path"); + return Join(Path::From(component)); +} + +// Concatenates a relative path to this path. +// Returns a relative path if this path is empty. +// Returns an empty path if the other path is absolute. +Path Path::Join(const Path &other) const { + if(other.IsAbsolute()) { + return From(""); + } + + Path joined; + if(IsEmpty()) { + joined.raw = "."; + } else { + joined.raw = raw; + } + + if(joined.raw.back() != SEPARATOR) { + joined.raw += SEPARATOR; + } + joined.raw += other.raw; + return joined; +} + +// Expands the "." and ".." components in this path. +// On Windows, additionally prepends the UNC prefix to absolute paths without one. +// Returns an empty path if a ".." component would escape from the root. +Path Path::Expand(bool fromCurrentDirectory) const { + Path source; + Path expanded; + + if(fromCurrentDirectory && !IsAbsolute()) { + source = CurrentDirectory().Join(*this); + } else { + source = *this; + } + + size_t splitAt; + FindPrefix(source.raw, &splitAt); + if(splitAt != std::string::npos) { + expanded.raw = source.raw.substr(0, splitAt); + } else { + splitAt = 0; + } + + std::vector expandedComponents; + for(std::string component : Split(source.raw.substr(splitAt), SEPARATOR)) { + if(component == ".") { + // skip + } else if(component == "..") { + if(!expandedComponents.empty()) { + expandedComponents.pop_back(); + } else { + return From(""); + } + } else if(!component.empty()) { + expandedComponents.push_back(component); + } + } + + if(expanded.IsEmpty()) { + if(expandedComponents.empty()) { + expandedComponents.emplace_back("."); + } + expanded = From(Concat(expandedComponents, SEPARATOR)); + } else if(!expandedComponents.empty()) { + expanded = expanded.Join(From(Concat(expandedComponents, SEPARATOR))); + } + +#if defined(WIN32) + if(expanded.IsAbsolute() && expanded.raw.substr(0, 2) != "\\\\") { + expanded.raw = "\\\\?\\" + expanded.raw; + } +#endif + + return expanded; +} + +static std::string FilesystemNormalize(const std::string &str) { +#if defined(WIN32) + std::wstring strW = Widen(str); + std::transform(strW.begin(), strW.end(), strW.begin(), towlower); + return Narrow(strW); +#elif defined(__APPLE__) + CFMutableStringRef cfStr = + CFStringCreateMutableCopy(NULL, 0, + CFStringCreateWithBytesNoCopy(NULL, (const UInt8*)str.data(), str.size(), + kCFStringEncodingUTF8, /*isExternalRepresentation=*/false, kCFAllocatorNull)); + CFStringLowercase(cfStr, NULL); + std::string normalizedStr; + normalizedStr.resize(CFStringGetMaximumSizeOfFileSystemRepresentation(cfStr)); + CFStringGetFileSystemRepresentation(cfStr, &normalizedStr[0], normalizedStr.size()); + normalizedStr.erase(normalizedStr.find('\0')); + return normalizedStr; +#else + return str; +#endif +} + +bool Path::Equals(const Path &other) const { + return FilesystemNormalize(raw) == FilesystemNormalize(other.raw); +} + +// Returns a relative path from a given base path. +// Returns an empty path if any of the paths is not absolute, or +// if they belong to different roots, or +// if they cannot be expanded. +Path Path::RelativeTo(const Path &base) const { + Path expanded = Expand(); + Path baseExpanded = base.Expand(); + if(!(expanded.IsAbsolute() && baseExpanded.IsAbsolute())){ + return From(""); + } + + size_t splitAt; + FindPrefix(expanded.raw, &splitAt); + size_t baseSplitAt; + FindPrefix(baseExpanded.raw, &baseSplitAt); + if(FilesystemNormalize(expanded.raw.substr(0, splitAt)) != + FilesystemNormalize(baseExpanded.raw.substr(0, splitAt))) { + return From(""); + } + + std::vector components = + Split(expanded.raw.substr(splitAt), SEPARATOR); + std::vector baseComponents = + Split(baseExpanded.raw.substr(baseSplitAt), SEPARATOR); + size_t common; + for(common = 0; common < baseComponents.size() && + common < components.size(); common++) { + if(FilesystemNormalize(baseComponents[common]) != + FilesystemNormalize(components[common])) { + break; + } + } + + std::vector resultComponents; + for(size_t i = common; i < baseComponents.size(); i++) { + resultComponents.emplace_back(".."); + } + resultComponents.insert(resultComponents.end(), + components.begin() + common, components.end()); + if(resultComponents.empty()) { + resultComponents.emplace_back("."); + } + return From(Concat(resultComponents, SEPARATOR)); +} + +Path Path::FromPortable(const std::string &repr) { + return From(Concat(Split(repr, '/'), SEPARATOR)); +} + +std::string Path::ToPortable() const { + ssassert(!IsAbsolute(), "absolute paths cannot be made portable"); + + return Concat(Split(raw, SEPARATOR), '/'); +} + +//----------------------------------------------------------------------------- +// File manipulation. +//----------------------------------------------------------------------------- + +FILE *OpenFile(const Platform::Path &filename, const char *mode) { + ssassert(filename.raw.length() == strlen(filename.raw.c_str()), + "Unexpected null byte in middle of a path"); +#if defined(WIN32) + return _wfopen(Widen(filename.Expand(/*fromCurrentDirectory=*/true).raw).c_str(), Widen(mode).c_str()); +#else + return fopen(filename.raw.c_str(), mode); +#endif +} + +bool FileExists(const Platform::Path &filename) { + FILE *f = OpenFile(filename, "rb"); + if(f == NULL) return false; + fclose(f); + return true; +} + +void RemoveFile(const Platform::Path &filename) { + ssassert(filename.raw.length() == strlen(filename.raw.c_str()), + "Unexpected null byte in middle of a path"); +#if defined(WIN32) + _wremove(Widen(filename.Expand().raw).c_str()); +#else + remove(filename.raw.c_str()); +#endif +} + +bool ReadFile(const Platform::Path &filename, std::string *data) { + FILE *f = OpenFile(filename, "rb"); + if(f == NULL) return false; + + if(fseek(f, 0, SEEK_END) != 0) + return false; + data->resize(ftell(f)); + if(fseek(f, 0, SEEK_SET) != 0) + return false; + if(fread(&(*data)[0], 1, data->size(), f) != data->size()) + return false; + if(fclose(f) != 0) + return false; + + return true; +} + +bool WriteFile(const Platform::Path &filename, const std::string &data) { + FILE *f = OpenFile(filename, "wb"); + if(f == NULL) return false; + + if(fwrite(&data[0], 1, data.size(), f) != data.size()) + return false; + if(fclose(f) != 0) + return false; + + return true; +} + +//----------------------------------------------------------------------------- +// Loading resources, on Windows. +//----------------------------------------------------------------------------- + +#if defined(WIN32) + +const void *LoadResource(const std::string &name, size_t *size) { + HRSRC hres = FindResourceW(NULL, Widen(name).c_str(), RT_RCDATA); + ssassert(hres != NULL, "Cannot find resource"); + HGLOBAL res = ::LoadResource(NULL, hres); + ssassert(res != NULL, "Cannot load resource"); + + *size = SizeofResource(NULL, hres); + return LockResource(res); +} + +#endif + +//----------------------------------------------------------------------------- +// Loading resources, on *nix. +//----------------------------------------------------------------------------- + +#if defined(__APPLE__) + +static Platform::Path PathFromCFURL(CFURLRef cfUrl) { + Path path; + CFStringRef cfPath = CFURLCopyFileSystemPath(cfUrl, kCFURLPOSIXPathStyle); + path.raw.resize(CFStringGetMaximumSizeOfFileSystemRepresentation(cfPath)); + CFStringGetFileSystemRepresentation(cfPath, &path.raw[0], path.raw.size()); + path.raw.erase(path.raw.find('\0')); + CFRelease(cfPath); + return path; +} + +static Platform::Path ResourcePath(const std::string &name) { + Path path; + + // First, try to get the URL from the bundle. + CFStringRef cfName = CFStringCreateWithCString(kCFAllocatorDefault, name.c_str(), + kCFStringEncodingUTF8); + CFURLRef cfUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), cfName, NULL, NULL); + if(cfUrl != NULL) { + path = PathFromCFURL(cfUrl); + CFRelease(cfUrl); + } + CFRelease(cfName); + + if(!path.IsEmpty()) return path; + + // If that failed, it means we aren't running from the bundle. + // Reference off the executable path, then. + cfUrl = CFBundleCopyExecutableURL(CFBundleGetMainBundle()); + if(cfUrl != NULL) { + path = PathFromCFURL(cfUrl).Parent().Parent().Join("res"); + path = path.Join(Path::FromPortable(name)); + CFRelease(cfUrl); + } + + return path; +} + +#elif defined(__EMSCRIPTEN__) + +static Platform::Path ResourcePath(const std::string &name) { + return Path::From("res/" + name); +} + +#elif !defined(WIN32) + +# if defined(__linux__) +static const char *selfSymlink = "/proc/self/exe"; +# elif defined(__NetBSD__) +static const char *selfSymlink = "/proc/curproc/exe"; +# elif defined(__OpenBSD__) || defined(__FreeBSD__) +static const char *selfSymlink = "/proc/curproc/file"; +# else +static const char *selfSymlink = ""; +# endif + +static Platform::Path FindLocalResourceDir() { + // Find out the path to the running binary. + Platform::Path selfPath; + char *expandedSelfPath = realpath(selfSymlink, NULL); + if(expandedSelfPath != NULL) { + selfPath = Path::From(expandedSelfPath); + } + free(expandedSelfPath); + + Platform::Path resourceDir; + if(selfPath.IsEmpty()) { + // We don't know how to find the local resource directory on this platform, + // so use the global one (by returning an empty string). + return Path::From(UNIX_DATADIR); + } else { + resourceDir = selfPath.Parent().Parent().Join("res"); + } + + struct stat st; + if(stat(resourceDir.raw.c_str(), &st) != -1) { + // An executable-adjacent resource directory exists, good. + return resourceDir; + } + + resourceDir = selfPath.Parent().Parent().Join("share").Join("solvespace"); + if(stat(resourceDir.raw.c_str(), &st) != -1) { + // A resource directory exists at a relative path, good. + return resourceDir; + } + + // No executable-adjacent resource directory; use the one from compile-time prefix. + return Path::From(UNIX_DATADIR); +} + +static Platform::Path ResourcePath(const std::string &name) { + static Platform::Path resourceDir; + if(resourceDir.IsEmpty()) { + resourceDir = FindLocalResourceDir(); + } + + return resourceDir.Join(Path::FromPortable(name)); +} + +#endif + +#if !defined(WIN32) + +const void *LoadResource(const std::string &name, size_t *size) { + static std::map cache; + + auto it = cache.find(name); + if(it == cache.end()) { + ssassert(ReadFile(ResourcePath(name), &cache[name]), "Cannot read resource"); + it = cache.find(name); + } + + const std::string &content = (*it).second; + *size = content.size(); + return (const void*)content.data(); +} + +#endif + +//----------------------------------------------------------------------------- +// Startup and command-line argument handling, on Windows. +//----------------------------------------------------------------------------- + +#if defined(WIN32) + +std::vector InitCli(int argc, char **argv) { +#if defined(_MSC_VER) + // We display our own message on abort; just call ReportFault. + _set_abort_behavior(_CALL_REPORTFAULT, _WRITE_ABORT_MSG|_CALL_REPORTFAULT); + int crtReportTypes[] = {_CRT_WARN, _CRT_ERROR, _CRT_ASSERT}; + for(int crtReportType : crtReportTypes) { + _CrtSetReportMode(crtReportType, _CRTDBG_MODE_FILE|_CRTDBG_MODE_DEBUG); + _CrtSetReportFile(crtReportType, _CRTDBG_FILE_STDERR); + } +#endif + + // Extract the command-line arguments; the ones from main() are ignored, + // since they are in the OEM encoding. + int argcW; + LPWSTR *argvW = CommandLineToArgvW(GetCommandLineW(), &argcW); + std::vector args; + for(int i = 0; i < argcW; i++) + args.push_back(Platform::Narrow(argvW[i])); + LocalFree(argvW); + return args; +} + +#endif + +//----------------------------------------------------------------------------- +// Startup and command-line argument handling, on *nix. +//----------------------------------------------------------------------------- + +#if !defined(WIN32) + +std::vector InitCli(int argc, char **argv) { + return {&argv[0], &argv[argc]}; +} + +#endif + +} +} diff --git a/src/platform/platform.h b/src/platform/platform.h new file mode 100644 index 0000000..771a4cf --- /dev/null +++ b/src/platform/platform.h @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Platform-dependent functionality. +// +// Copyright 2017 whitequark +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_PLATFORM_H +#define SOLVESPACE_PLATFORM_H + +#include +#include + +namespace SolveSpace { +namespace Platform { + +// UTF-8 ⟷ UTF-16 conversion, for Windows. +#if defined(WIN32) +std::string Narrow(const wchar_t *s); +std::wstring Widen(const char *s); +std::string Narrow(const std::wstring &s); +std::wstring Widen(const std::string &s); +#endif + +#if defined(_WIN32) + const std::string embeddedFont = "res://fonts/BitstreamVeraSans-Roman-builtin.ttf"; +#else // Linux and macOS + const std::string embeddedFont = "BitstreamVeraSans-Roman-builtin.ttf"; +#endif + +// A filesystem path, respecting the conventions of the current platform. +// Transformation functions return an empty path on error. +class Path { +public: + std::string raw; + + static Path From(std::string raw); + static Path CurrentDirectory(); + + void Clear() { raw.clear(); } + + bool Equals(const Path &other) const; + bool IsEmpty() const { return raw.empty(); } + bool IsAbsolute() const; + bool HasExtension(std::string ext) const; + + std::string FileName() const; + std::string FileStem() const; + std::string Extension() const; + + Path WithExtension(std::string ext) const; + Path Parent() const; + Path Join(const std::string &component) const; + Path Join(const Path &other) const; + Path Expand(bool fromCurrentDirectory = false) const; + Path RelativeTo(const Path &base) const; + + // Converting to and from a platform-independent representation + // (conventionally, the Unix one). + static Path FromPortable(const std::string &repr); + std::string ToPortable() const; +}; + +struct PathLess { + bool operator()(const Path &a, const Path &b) const { return a.raw < b.raw; } +}; + +// File manipulation functions. +bool FileExists(const Platform::Path &filename); +FILE *OpenFile(const Platform::Path &filename, const char *mode); +bool ReadFile(const Platform::Path &filename, std::string *data); +bool WriteFile(const Platform::Path &filename, const std::string &data); +void RemoveFile(const Platform::Path &filename); + +// Resource loading function. +const void *LoadResource(const std::string &name, size_t *size); + +// Startup and command-line argument handling. +std::vector InitCli(int argc, char **argv); + +// Temporary arena functions. +void *AllocTemporary(size_t size); +void FreeAllTemporary(); + +} // namespace Platform +} // namespace SolveSpace + +#endif diff --git a/src/platform/platformbase.cpp b/src/platform/platformbase.cpp new file mode 100644 index 0000000..6e3bb8a --- /dev/null +++ b/src/platform/platformbase.cpp @@ -0,0 +1,101 @@ +#include +#include + +#include + +#if defined(WIN32) +# include +#endif // defined(WIN32) + +#include "util.h" +#include "platform.h" + +namespace SolveSpace { +namespace Platform { + +//----------------------------------------------------------------------------- +// Debug output, on Windows. +//----------------------------------------------------------------------------- + +#if defined(WIN32) + +#if !defined(_alloca) +// Fix for compiling with MinGW.org GCC-6.3.0-1 +#define _alloca alloca +#include +#endif + +void DebugPrint(const char *fmt, ...) +{ + va_list va; + va_start(va, fmt); + int len = _vscprintf(fmt, va) + 1; + va_end(va); + + va_start(va, fmt); + char *buf = (char *)_alloca(len); + _vsnprintf(buf, len, fmt, va); + va_end(va); + + // The native version of OutputDebugString, unlike most others, + // is OutputDebugStringA. + OutputDebugStringA(buf); + OutputDebugStringA("\n"); + +#ifndef NDEBUG + // Duplicate to stderr in debug builds, but not in release; this is slow. + fputs(buf, stderr); + fputc('\n', stderr); +#endif +} + +#endif + +//----------------------------------------------------------------------------- +// Debug output, on *nix. +//----------------------------------------------------------------------------- + +#if !defined(WIN32) + +void DebugPrint(const char *fmt, ...) { + va_list va; + va_start(va, fmt); + vfprintf(stderr, fmt, va); + fputc('\n', stderr); + va_end(va); +} + +#endif + +//----------------------------------------------------------------------------- +// Temporary arena. +//----------------------------------------------------------------------------- + +struct MimallocHeap { + mi_heap_t *heap = NULL; + + ~MimallocHeap() { + if(heap != NULL) + mi_heap_destroy(heap); + } +}; + +static thread_local MimallocHeap TempArena; + +void *AllocTemporary(size_t size) { + if(TempArena.heap == NULL) { + TempArena.heap = mi_heap_new(); + ssassert(TempArena.heap != NULL, "out of memory"); + } + void *ptr = mi_heap_zalloc(TempArena.heap, size); + ssassert(ptr != NULL, "out of memory"); + return ptr; +} + +void FreeAllTemporary() { + MimallocHeap temp; + std::swap(TempArena.heap, temp.heap); +} + +} +} diff --git a/src/polygon.cpp b/src/polygon.cpp new file mode 100644 index 0000000..211f6a6 --- /dev/null +++ b/src/polygon.cpp @@ -0,0 +1,924 @@ +//----------------------------------------------------------------------------- +// Operations on polygons (planar, of line segment edges). +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +Vector STriangle::Normal() const { + Vector ab = b.Minus(a), bc = c.Minus(b); + return ab.Cross(bc); +} + +double STriangle::MinAltitude() const { + double altA = a.DistanceToLine(b, c.Minus(b)), + altB = b.DistanceToLine(c, a.Minus(c)), + altC = c.DistanceToLine(a, b.Minus(a)); + + return min(altA, min(altB, altC)); +} + +bool STriangle::ContainsPoint(Vector p) const { + Vector n = Normal(); + if(MinAltitude() < LENGTH_EPS) { + // shouldn't happen; zero-area triangle + return false; + } + return ContainsPointProjd(n.WithMagnitude(1), p); +} + +bool STriangle::ContainsPointProjd(Vector n, Vector p) const { + Vector ab = b.Minus(a), bc = c.Minus(b), ca = a.Minus(c); + + Vector no_ab = n.Cross(ab); + if(no_ab.Dot(p) < no_ab.Dot(a) - LENGTH_EPS) return false; + + Vector no_bc = n.Cross(bc); + if(no_bc.Dot(p) < no_bc.Dot(b) - LENGTH_EPS) return false; + + Vector no_ca = n.Cross(ca); + if(no_ca.Dot(p) < no_ca.Dot(c) - LENGTH_EPS) return false; + + return true; +} + +bool STriangle::Raytrace(const Vector &rayPoint, const Vector &rayDir, + double *t, Vector *inters) const { + // Algorithm from: "Fast, Minimum Storage Ray/Triangle Intersection" by + // Tomas Moeller and Ben Trumbore. + + // Find vectors for two edges sharing vertex A. + Vector edge1 = b.Minus(a); + Vector edge2 = c.Minus(a); + + // Begin calculating determinant - also used to calculate U parameter. + Vector pvec = rayDir.Cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle. + // Also, cull back facing triangles here. + double det = edge1.Dot(pvec); + if(-det < LENGTH_EPS) return false; + double inv_det = 1.0f / det; + + // Calculate distance from vertex A to ray origin. + Vector tvec = rayPoint.Minus(a); + + // Calculate U parameter and test bounds. + double u = tvec.Dot(pvec) * inv_det; + if (u < 0.0f || u > 1.0f) return false; + + // Prepare to test V parameter. + Vector qvec = tvec.Cross(edge1); + + // Calculate V parameter and test bounds. + double v = rayDir.Dot(qvec) * inv_det; + if (v < 0.0f || u + v > 1.0f) return false; + + // Calculate t, ray intersects triangle. + *t = edge2.Dot(qvec) * inv_det; + + // Calculate intersection point. + if(inters != NULL) *inters = rayPoint.Plus(rayDir.ScaledBy(*t)); + + return true; +} + +double STriangle::SignedVolume() const { + return a.Dot(b.Cross(c)) / 6.0; +} + +double STriangle::Area() const { + Vector ab = a.Minus(b); + Vector cb = c.Minus(b); + return ab.Cross(cb).Magnitude() / 2.0; +} + +bool STriangle::IsDegenerate() const { + return a.OnLineSegment(b, c) || + b.OnLineSegment(a, c) || + c.OnLineSegment(a, b); +} + +void STriangle::FlipNormal() { + swap(a, b); + swap(an, bn); +} + +STriangle STriangle::Transform(Vector u, Vector v, Vector n) const { + STriangle tr = *this; + tr.a = tr.a.ScaleOutOfCsys(u, v, n); + tr.an = tr.an.ScaleOutOfCsys(u, v, n); + tr.b = tr.b.ScaleOutOfCsys(u, v, n); + tr.bn = tr.bn.ScaleOutOfCsys(u, v, n); + tr.c = tr.c.ScaleOutOfCsys(u, v, n); + tr.cn = tr.cn.ScaleOutOfCsys(u, v, n); + return tr; +} + +STriangle STriangle::From(STriMeta meta, Vector a, Vector b, Vector c) { + STriangle tr = {}; + tr.meta = meta; + tr.a = a; + tr.b = b; + tr.c = c; + return tr; +} + +SEdge SEdge::From(Vector a, Vector b) { + SEdge se = {}; + se.a = a; + se.b = b; + return se; +} + +bool SEdge::EdgeCrosses(Vector ea, Vector eb, Vector *ppi, SPointList *spl) const { + Vector d = eb.Minus(ea); + double t_eps = LENGTH_EPS/d.Magnitude(); + + double t, tthis; + bool skew; + Vector pi; + bool inOrEdge0, inOrEdge1; + + Vector dthis = b.Minus(a); + double tthis_eps = LENGTH_EPS/dthis.Magnitude(); + + if((ea.Equals(a) && eb.Equals(b)) || + (eb.Equals(a) && ea.Equals(b))) + { + if(ppi) *ppi = a; + if(spl) spl->Add(a); + return true; + } + + // Can't just test if distance between d and a equals distance between d and b; + // they could be on opposite sides, since we don't have the sign. + double m = sqrt(d.Magnitude()*dthis.Magnitude()); + if(sqrt(fabs(d.Dot(dthis))) > (m - LENGTH_EPS)) { + // The edges are parallel. + if(fabs(a.DistanceToLine(ea, d)) > LENGTH_EPS) { + // and not coincident, so can't be intersecting + return false; + } + // The edges are coincident. Make sure that neither endpoint lies + // on the other + bool inters = false; + double t; + t = a.Minus(ea).DivProjected(d); + if(t > t_eps && t < (1 - t_eps)) inters = true; + t = b.Minus(ea).DivProjected(d); + if(t > t_eps && t < (1 - t_eps)) inters = true; + t = ea.Minus(a).DivProjected(dthis); + if(t > tthis_eps && t < (1 - tthis_eps)) inters = true; + t = eb.Minus(a).DivProjected(dthis); + if(t > tthis_eps && t < (1 - tthis_eps)) inters = true; + + if(inters) { + if(ppi) *ppi = a; + if(spl) spl->Add(a); + return true; + } else { + // So coincident but disjoint, okay. + return false; + } + } + + // Lines are not parallel, so look for an intersection. + pi = Vector::AtIntersectionOfLines(ea, eb, a, b, + &skew, + &t, &tthis); + if(skew) return false; + + inOrEdge0 = (t > -t_eps) && (t < (1 + t_eps)); + inOrEdge1 = (tthis > -tthis_eps) && (tthis < (1 + tthis_eps)); + + if(inOrEdge0 && inOrEdge1) { + if(a.Equals(ea) || b.Equals(ea) || + a.Equals(eb) || b.Equals(eb)) + { + // Not an intersection if we share an endpoint with an edge + return false; + } + // But it's an intersection if a vertex of one edge lies on the + // inside of the other (or if they cross away from either's + // vertex). + if(ppi) *ppi = pi; + if(spl) spl->Add(pi); + return true; + } + return false; +} + +void SEdgeList::Clear() { + l.Clear(); +} + +void SEdgeList::AddEdge(Vector a, Vector b, int auxA, int auxB, int tag) { + SEdge e = {}; + e.tag = tag; + e.a = a; + e.b = b; + e.auxA = auxA; + e.auxB = auxB; + l.Add(&e); +} + +bool SEdgeList::AssembleContour(Vector first, Vector last, SContour *dest, + SEdge *errorAt, bool keepDir, int start) const +{ + int i; + + dest->AddPoint(first); + dest->AddPoint(last); + + do { + for(i = start; i < l.n; i++) { + /// @todo fix const! + SEdge *se = const_cast(&(l[i])); + if(se->tag) continue; + + if(se->a.Equals(last)) { + dest->AddPoint(se->b); + last = se->b; + se->tag = 1; + break; + } + // Don't allow backwards edges if keepDir is true. + if(!keepDir && se->b.Equals(last)) { + dest->AddPoint(se->a); + last = se->a; + se->tag = 1; + break; + } + } + if(i >= l.n) { + // Couldn't assemble a closed contour; mark where. + if(errorAt) { + errorAt->a = first; + errorAt->b = last; + } + return false; + } + + } while(!last.Equals(first)); + + return true; +} + +bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) const { + dest->Clear(); + + bool allClosed = true; + Vector first = Vector::From(0, 0, 0); + Vector last = Vector::From(0, 0, 0); + int i; + for(i = 0; i < l.n; i++) { + if(!l[i].tag) { + first = l[i].a; + last = l[i].b; + /// @todo fix const! + const_cast(&(l[i]))->tag = 1; + // Create a new empty contour in our polygon, and finish assembling + // into that contour. + dest->AddEmptyContour(); + if(!AssembleContour(first, last, dest->l.Last(), errorAt, keepDir, i+1)) { + allClosed = false; + } + // But continue assembling, even if some of the contours are open + } + } + return allClosed; +} + +//----------------------------------------------------------------------------- +// Test if the specified edge crosses any of the edges in our list. Two edges +// are not considered to cross if they share an endpoint (within LENGTH_EPS), +// but they are considered to cross if they are coincident and overlapping. +// If pi is not NULL, then a crossing is returned in that. +//----------------------------------------------------------------------------- +int SEdgeList::AnyEdgeCrossings(Vector a, Vector b, Vector *ppi, SPointList *spl) const { + auto cnt = std::count_if(l.begin(), l.end(), + [&](SEdge const &se) { return se.EdgeCrosses(a, b, ppi, spl); }); + return static_cast(cnt); +} + +//----------------------------------------------------------------------------- +// Returns true if the intersecting edge list contains an edge that shares +// an endpoint with one of our edges. +//----------------------------------------------------------------------------- +bool SEdgeList::ContainsEdgeFrom(const SEdgeList *sel) const { + for(const SEdge *se = l.First(); se; se = l.NextAfter(se)) { + if(sel->ContainsEdge(se)) return true; + } + return false; +} +bool SEdgeList::ContainsEdge(const SEdge *set) const { + for(const SEdge *se = l.First(); se; se = l.NextAfter(se)) { + if((se->a).Equals(set->a) && (se->b).Equals(set->b)) return true; + if((se->b).Equals(set->a) && (se->a).Equals(set->b)) return true; + } + return false; +} + +//----------------------------------------------------------------------------- +// Remove unnecessary edges: +// - if two are anti-parallel then +// if both=true, remove both +// else remove only one. +// - if two are parallel then remove one. +//----------------------------------------------------------------------------- +void SEdgeList::CullExtraneousEdges(bool both) { + l.ClearTags(); + for(int i = 0; i < l.n; i++) { + SEdge *se = &(l[i]); + for(int j = i + 1; j < l.n; j++) { + SEdge *set = &(l[j]); + if((set->a).Equals(se->a) && (set->b).Equals(se->b)) { + // Two parallel edges exist; so keep only the first one. + set->tag = 1; + } + if((set->a).Equals(se->b) && (set->b).Equals(se->a)) { + // Two anti-parallel edges exist; if both=true, keep neither, + // otherwise keep only one. + if (both) se->tag = 1; + set->tag = 1; + } + } + } + l.RemoveTagged(); +} + +//----------------------------------------------------------------------------- +// Make a kd-tree of edges. This is used for O(log(n)) implementations of stuff +// that would naively be O(n). +//----------------------------------------------------------------------------- +SKdNodeEdges *SKdNodeEdges::Alloc() { + SKdNodeEdges *ne = (SKdNodeEdges *)Platform::AllocTemporary(sizeof(SKdNodeEdges)); + *ne = {}; + return ne; +} +SEdgeLl *SEdgeLl::Alloc() { + SEdgeLl *sell = (SEdgeLl *)Platform::AllocTemporary(sizeof(SEdgeLl)); + *sell = {}; + return sell; +} +SKdNodeEdges *SKdNodeEdges::From(SEdgeList *sel) { + SEdgeLl *sell = NULL; + SEdge *se; + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + SEdgeLl *n = SEdgeLl::Alloc(); + n->se = se; + n->next = sell; + sell = n; + } + return SKdNodeEdges::From(sell); +} +SKdNodeEdges *SKdNodeEdges::From(SEdgeLl *sell) { + SKdNodeEdges *n = SKdNodeEdges::Alloc(); + + // Compute the midpoints (just mean, though median would be better) of + // each component. + Vector ptAve = Vector::From(0, 0, 0); + SEdgeLl *flip; + int totaln = 0; + for(flip = sell; flip; flip = flip->next) { + ptAve = ptAve.Plus(flip->se->a); + ptAve = ptAve.Plus(flip->se->b); + totaln++; + } + ptAve = ptAve.ScaledBy(1.0 / (2*totaln)); + + // For each component, see how it splits. + int ltln[3] = { 0, 0, 0 }, gtln[3] = { 0, 0, 0 }; + double badness[3]; + for(flip = sell; flip; flip = flip->next) { + for(int i = 0; i < 3; i++) { + if(flip->se->a.Element(i) < ptAve.Element(i) + KDTREE_EPS || + flip->se->b.Element(i) < ptAve.Element(i) + KDTREE_EPS) + { + ltln[i]++; + } + if(flip->se->a.Element(i) > ptAve.Element(i) - KDTREE_EPS || + flip->se->b.Element(i) > ptAve.Element(i) - KDTREE_EPS) + { + gtln[i]++; + } + } + } + for(int i = 0; i < 3; i++) { + badness[i] = pow((double)ltln[i], 4) + pow((double)gtln[i], 4); + } + + // Choose the least bad coordinate to split along. + if(badness[0] < badness[1] && badness[0] < badness[2]) { + n->which = 0; + } else if(badness[1] < badness[2]) { + n->which = 1; + } else { + n->which = 2; + } + n->c = ptAve.Element(n->which); + + if(totaln < 3 || totaln == gtln[n->which] || totaln == ltln[n->which]) { + n->edges = sell; + // and we're a leaf node + return n; + } + + // Sort the edges according to which side(s) of the split plane they're on. + SEdgeLl *gtl = NULL, *ltl = NULL; + for(flip = sell; flip; flip = flip->next) { + if(flip->se->a.Element(n->which) < n->c + KDTREE_EPS || + flip->se->b.Element(n->which) < n->c + KDTREE_EPS) + { + SEdgeLl *selln = SEdgeLl::Alloc(); + selln->se = flip->se; + selln->next = ltl; + ltl = selln; + } + if(flip->se->a.Element(n->which) > n->c - KDTREE_EPS || + flip->se->b.Element(n->which) > n->c - KDTREE_EPS) + { + SEdgeLl *selln = SEdgeLl::Alloc(); + selln->se = flip->se; + selln->next = gtl; + gtl = selln; + } + } + + n->lt = SKdNodeEdges::From(ltl); + n->gt = SKdNodeEdges::From(gtl); + return n; +} + +int SKdNodeEdges::AnyEdgeCrossings(Vector a, Vector b, int cnt, + Vector *pi, SPointList *spl) const +{ + int inters = 0; + if(gt && lt) { + if(a.Element(which) < c + KDTREE_EPS || + b.Element(which) < c + KDTREE_EPS) + { + inters += lt->AnyEdgeCrossings(a, b, cnt, pi, spl); + } + if(a.Element(which) > c - KDTREE_EPS || + b.Element(which) > c - KDTREE_EPS) + { + inters += gt->AnyEdgeCrossings(a, b, cnt, pi, spl); + } + } else { + SEdgeLl *sell; + for(sell = edges; sell; sell = sell->next) { + SEdge *se = sell->se; + if(se->tag == cnt) continue; + if(se->EdgeCrosses(a, b, pi, spl)) { + inters++; + } + se->tag = cnt; + } + } + return inters; +} + +//----------------------------------------------------------------------------- +// We have an edge list that contains only collinear edges, maybe with more +// splits than necessary. Merge any collinear segments that join. +//----------------------------------------------------------------------------- +void SEdgeList::MergeCollinearSegments(Vector a, Vector b) { + const Vector lineStart = a; + const Vector lineDirection = b.Minus(a); + std::sort(l.begin(), l.end(), [&](const SEdge &a, const SEdge &b) { + double ta = (a.a.Minus(lineStart)).DivProjected(lineDirection); + double tb = (b.a.Minus(lineStart)).DivProjected(lineDirection); + + return (ta < tb); + }); + + l.ClearTags(); + SEdge *prev = nullptr; + for(auto &now : l) { + if(prev != nullptr) { + if((prev->b).Equals(now.a) && prev->auxA == now.auxA) { + // The previous segment joins up to us; so merge it into us. + prev->tag = 1; + now.a = prev->a; + } + } + prev = &now; + } + l.RemoveTagged(); +} + +void SPointList::Clear() { + l.Clear(); +} + +bool SPointList::ContainsPoint(Vector pt) const { + return (IndexForPoint(pt) >= 0); +} + +int SPointList::IndexForPoint(Vector pt) const { + int i; + for(i = 0; i < l.n; i++) { + const SPoint *p = &(l[i]); + if(pt.Equals(p->p)) { + return i; + } + } + // Not found, so return negative to indicate that. + return -1; +} + +void SPointList::IncrementTagFor(Vector pt) { + SPoint *p; + for(p = l.First(); p; p = l.NextAfter(p)) { + if(pt.Equals(p->p)) { + (p->tag)++; + return; + } + } + SPoint pa; + pa.p = pt; + pa.tag = 1; + l.Add(&pa); +} + +void SPointList::Add(Vector pt) { + SPoint p = {}; + p.p = pt; + l.Add(&p); +} + +void SContour::AddPoint(Vector p) { + SPoint sp; + sp.tag = 0; + sp.p = p; + + l.Add(&sp); +} + +void SContour::MakeEdgesInto(SEdgeList *el) const { + int i; + for(i = 0; i < (l.n - 1); i++) { + el->AddEdge(l[i].p, l[i+1].p); + } +} + +void SContour::CopyInto(SContour *dest) const { + for(const SPoint *sp = l.First(); sp; sp = l.NextAfter(sp)) { + dest->AddPoint(sp->p); + } +} + +void SContour::FindPointWithMinX() { + xminPt = Vector::From(1e10, 1e10, 1e10); + for(const SPoint *sp = l.First(); sp; sp = l.NextAfter(sp)) { + if(sp->p.x < xminPt.x) { + xminPt = sp->p; + } + } +} + +Vector SContour::ComputeNormal() const { + Vector n = Vector::From(0, 0, 0); + + for(int i = 0; i < l.n - 2; i++) { + Vector u = (l[i+1].p).Minus(l[i+0].p).WithMagnitude(1); + Vector v = (l[i+2].p).Minus(l[i+1].p).WithMagnitude(1); + Vector nt = u.Cross(v); + if(nt.Magnitude() > n.Magnitude()) { + n = nt; + } + } + return n.WithMagnitude(1); +} + +Vector SContour::AnyEdgeMidpoint() const { + ssassert(l.n >= 2, "Need two points to find a midpoint"); + return ((l[0].p).Plus(l[1].p)).ScaledBy(0.5); +} + +bool SContour::IsClockwiseProjdToNormal(Vector n) const { + // Degenerate things might happen as we draw; doesn't really matter + // what we do then. + if(n.Magnitude() < 0.01) return true; + + return (SignedAreaProjdToNormal(n) < 0); +} + +double SContour::SignedAreaProjdToNormal(Vector n) const { + // An arbitrary 2d coordinate system that has n as its normal + Vector u = n.Normal(0); + Vector v = n.Normal(1); + + double area = 0; + for(int i = 0; i < (l.n - 1); i++) { + double u0 = (l[i ].p).Dot(u); + double v0 = (l[i ].p).Dot(v); + double u1 = (l[i+1].p).Dot(u); + double v1 = (l[i+1].p).Dot(v); + + area += ((v0 + v1)/2)*(u1 - u0); + } + return area; +} + +bool SContour::ContainsPointProjdToNormal(Vector n, Vector p) const { + Vector u = n.Normal(0); + Vector v = n.Normal(1); + + double up = p.Dot(u); + double vp = p.Dot(v); + + bool inside = false; + for(int i = 0; i < (l.n - 1); i++) { + double ua = (l[i ].p).Dot(u); + double va = (l[i ].p).Dot(v); + // The curve needs to be exactly closed; approximation is death. + double ub = (l[(i+1)%(l.n-1)].p).Dot(u); + double vb = (l[(i+1)%(l.n-1)].p).Dot(v); + + if ((((va <= vp) && (vp < vb)) || + ((vb <= vp) && (vp < va))) && + (up < (ub - ua) * (vp - va) / (vb - va) + ua)) + { + inside = !inside; + } + } + + return inside; +} + +void SContour::Reverse() { + l.Reverse(); +} + + +void SPolygon::Clear() { + int i; + for(i = 0; i < l.n; i++) { + (l[i]).l.Clear(); + } + l.Clear(); +} + +void SPolygon::AddEmptyContour() { + SContour c = {}; + l.Add(&c); +} + +void SPolygon::MakeEdgesInto(SEdgeList *el) const { + int i; + for(i = 0; i < l.n; i++) { + (l[i]).MakeEdgesInto(el); + } +} + +Vector SPolygon::ComputeNormal() const { + if(l.IsEmpty()) + return Vector::From(0, 0, 0); + return (l[0]).ComputeNormal(); +} + +double SPolygon::SignedArea() const { + double area = 0; + // This returns the true area only if the contours are all oriented + // correctly, with the holes backwards from the outer contours. + for(const SContour *sc = l.First(); sc; sc = l.NextAfter(sc)) { + area += sc->SignedAreaProjdToNormal(normal); + } + return area; +} + +bool SPolygon::ContainsPoint(Vector p) const { + return (WindingNumberForPoint(p) % 2) == 1; +} + +size_t SPolygon::WindingNumberForPoint(Vector p) const { + auto winding = std::count_if(l.begin(), l.end(), [&](const SContour &sc) { + return sc.ContainsPointProjdToNormal(normal, p); + }); + return winding; +} + +void SPolygon::FixContourDirections() { + // At output, the contour's tag will be 1 if we reversed it, else 0. + l.ClearTags(); + + // Outside curve looks counterclockwise, projected against our normal. + int i, j; + for(i = 0; i < l.n; i++) { + SContour *sc = &(l[i]); + if(sc->l.n < 2) continue; + // The contours may not intersect, but they may share vertices; so + // testing a vertex for point-in-polygon may fail, but the midpoint + // of an edge is okay. + Vector pt = (((sc->l[0]).p).Plus(sc->l[1].p)).ScaledBy(0.5); + + sc->timesEnclosed = 0; + bool outer = true; + for(j = 0; j < l.n; j++) { + if(i == j) continue; + SContour *sct = &(l[j]); + if(sct->ContainsPointProjdToNormal(normal, pt)) { + outer = !outer; + (sc->timesEnclosed)++; + } + } + + bool clockwise = sc->IsClockwiseProjdToNormal(normal); + if((clockwise && outer) || (!clockwise && !outer)) { + sc->Reverse(); + sc->tag = 1; + } + } +} + +bool SPolygon::IsEmpty() const { + if(l.IsEmpty() || l[0].l.IsEmpty()) + return true; + return false; +} + +Vector SPolygon::AnyPoint() const { + ssassert(!IsEmpty(), "Need at least one point"); + return l[0].l[0].p; +} + +bool SPolygon::SelfIntersecting(Vector *intersectsAt) const { + SEdgeList el = {}; + MakeEdgesInto(&el); + SKdNodeEdges *kdtree = SKdNodeEdges::From(&el); + + int cnt = 1; + el.l.ClearTags(); + + bool ret = false; + SEdge *se; + for(se = el.l.First(); se; se = el.l.NextAfter(se)) { + int inters = kdtree->AnyEdgeCrossings(se->a, se->b, cnt, intersectsAt); + if(inters != 1) { + ret = true; + break; + } + cnt++; + } + + el.Clear(); + return ret; +} + +void SPolygon::InverseTransformInto(SPolygon *sp, Vector u, Vector v, Vector n) const { + for(const SContour &sc : l) { + SContour tsc = {}; + tsc.timesEnclosed = sc.timesEnclosed; + for(const SPoint &sp : sc.l) { + tsc.AddPoint(sp.p.DotInToCsys(u, v, n)); + } + sp->l.Add(&tsc); + } +} + +//----------------------------------------------------------------------------- +// Low-quality routines to cutter radius compensate a polygon. Assumes the +// polygon is in the xy plane, and the contours all go in the right direction +// with respect to normal (0, 0, -1). +//----------------------------------------------------------------------------- +void SPolygon::OffsetInto(SPolygon *dest, double r) const { + int i; + dest->Clear(); + for(i = 0; i < l.n; i++) { + const SContour *sc = &(l[i]); + dest->AddEmptyContour(); + sc->OffsetInto(&(dest->l[dest->l.n-1]), r); + } +} +//----------------------------------------------------------------------------- +// Calculate the intersection point of two lines. Returns true for success, +// false if they're parallel. +//----------------------------------------------------------------------------- +static bool IntersectionOfLines(double x0A, double y0A, double dxA, double dyA, + double x0B, double y0B, double dxB, double dyB, + double *xi, double *yi) +{ + double A[2][2]; + double b[2]; + + // The line is given to us in the form: + // (x(t), y(t)) = (x0, y0) + t*(dx, dy) + // so first rewrite it as + // (x - x0, y - y0) dot (dy, -dx) = 0 + // x*dy - x0*dy - y*dx + y0*dx = 0 + // x*dy - y*dx = (x0*dy - y0*dx) + + // So write the matrix, pre-pivoted. + if(fabs(dyA) > fabs(dyB)) { + A[0][0] = dyA; A[0][1] = -dxA; b[0] = x0A*dyA - y0A*dxA; + A[1][0] = dyB; A[1][1] = -dxB; b[1] = x0B*dyB - y0B*dxB; + } else { + A[1][0] = dyA; A[1][1] = -dxA; b[1] = x0A*dyA - y0A*dxA; + A[0][0] = dyB; A[0][1] = -dxB; b[0] = x0B*dyB - y0B*dxB; + } + + // Check the determinant; if it's zero then no solution. + if(fabs(A[0][0]*A[1][1] - A[0][1]*A[1][0]) < LENGTH_EPS) { + return false; + } + + // Solve + double v = A[1][0] / A[0][0]; + A[1][0] -= A[0][0]*v; + A[1][1] -= A[0][1]*v; + b[1] -= b[0]*v; + + // Back-substitute. + *yi = b[1] / A[1][1]; + *xi = (b[0] - A[0][1]*(*yi)) / A[0][0]; + + return true; +} +void SContour::OffsetInto(SContour *dest, double r) const { + int i; + + for(i = 0; i < l.n; i++) { + Vector a, b, c; + Vector dp, dn; + double thetan, thetap; + + a = l[WRAP(i-1, (l.n-1))].p; + b = l[WRAP(i, (l.n-1))].p; + c = l[WRAP(i+1, (l.n-1))].p; + + dp = a.Minus(b); + thetap = atan2(dp.y, dp.x); + + dn = b.Minus(c); + thetan = atan2(dn.y, dn.x); + + // A short line segment in a badly-generated polygon might look + // okay but screw up our sense of direction. + if(dp.Magnitude() < LENGTH_EPS || dn.Magnitude() < LENGTH_EPS) { + continue; + } + + if(thetan > thetap && (thetan - thetap) > PI) { + thetap += 2*PI; + } + if(thetan < thetap && (thetap - thetan) > PI) { + thetan += 2*PI; + } + + if(fabs(thetan - thetap) < (1*PI)/180) { + Vector p = { b.x - r*sin(thetap), b.y + r*cos(thetap), 0 }; + dest->AddPoint(p); + } else if(thetan < thetap) { + // This is an inside corner. We have two edges, Ep and En. Move + // out from their intersection by radius, normal to En, and + // then draw a line parallel to En. Move out from their + // intersection by radius, normal to Ep, and then draw a second + // line parallel to Ep. The point that we want to generate is + // the intersection of these two lines--it removes as much + // material as we can without removing any that we shouldn't. + double px0, py0, pdx, pdy; + double nx0, ny0, ndx, ndy; + double x = 0.0, y = 0.0; + + px0 = b.x - r*sin(thetap); + py0 = b.y + r*cos(thetap); + pdx = cos(thetap); + pdy = sin(thetap); + + nx0 = b.x - r*sin(thetan); + ny0 = b.y + r*cos(thetan); + ndx = cos(thetan); + ndy = sin(thetan); + + IntersectionOfLines(px0, py0, pdx, pdy, + nx0, ny0, ndx, ndy, + &x, &y); + + dest->AddPoint(Vector::From(x, y, 0)); + } else { + if(fabs(thetap - thetan) < (6*PI)/180) { + Vector pp = { b.x - r*sin(thetap), + b.y + r*cos(thetap), 0 }; + dest->AddPoint(pp); + + Vector pn = { b.x - r*sin(thetan), + b.y + r*cos(thetan), 0 }; + dest->AddPoint(pn); + } else { + double theta; + for(theta = thetap; theta <= thetan; theta += (6*PI)/180) { + Vector p = { b.x - r*sin(theta), + b.y + r*cos(theta), 0 }; + dest->AddPoint(p); + } + } + } + } +} + +} // namespace SolveSpace diff --git a/src/polygon.h b/src/polygon.h new file mode 100644 index 0000000..4668421 --- /dev/null +++ b/src/polygon.h @@ -0,0 +1,432 @@ +//----------------------------------------------------------------------------- +// Anything relating to plane polygons and triangles, and (generally, non- +// planar) meshes thereof. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_POLYGON_H +#define SOLVESPACE_POLYGON_H + +#include +#include +#include +#include + +#include "dsc.h" + +namespace SolveSpace { + +class Group; +class SPointList; +class SPolygon; +class SContour; +class SMesh; +class SSurface; +class SBsp3; +class SOutlineList; + +enum class EarType : uint32_t { + UNKNOWN = 0, + NOT_EAR = 1, + EAR = 2 +}; + +enum class BspClass : uint32_t { + POS = 100, + NEG = 101, + COPLANAR = 200 +}; + +enum class EdgeKind : uint32_t { + NAKED_OR_SELF_INTER = 100, + SELF_INTER = 200, + TURNING = 300, + EMPHASIZED = 400, + SHARP = 500, +}; + +class SEdge { +public: + int tag; + int auxA, auxB; + Vector a, b; + + static SEdge From(Vector a, Vector b); + bool EdgeCrosses(Vector a, Vector b, Vector *pi=NULL, SPointList *spl=NULL) const; +}; + +class SEdgeList { +public: + List l; + + void Clear(); + void AddEdge(Vector a, Vector b, int auxA=0, int auxB=0, int tag=0); + bool AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir=false) const; + bool AssembleContour(Vector first, Vector last, SContour *dest, + SEdge *errorAt, bool keepDir, int start) const; + int AnyEdgeCrossings(Vector a, Vector b, + Vector *pi=NULL, SPointList *spl=NULL) const; + bool ContainsEdgeFrom(const SEdgeList *sel) const; + bool ContainsEdge(const SEdge *se) const; + void CullExtraneousEdges(bool both=true); + void MergeCollinearSegments(Vector a, Vector b); +}; + +// A kd-tree element needs to go on a side of a node if it's when KDTREE_EPS +// of the boundary. So increasing this number never breaks anything, but may +// result in more duplicated elements. So it's conservative to be sloppy here. +#define KDTREE_EPS (20*LENGTH_EPS) + +class SEdgeLl { +public: + SEdge *se; + SEdgeLl *next; + + static SEdgeLl *Alloc(); +}; + +class SKdNodeEdges { +public: + int which; // whether c is x, y, or z + double c; + SKdNodeEdges *gt; + SKdNodeEdges *lt; + + SEdgeLl *edges; + + static SKdNodeEdges *From(SEdgeList *sel); + static SKdNodeEdges *From(SEdgeLl *sell); + static SKdNodeEdges *Alloc(); + int AnyEdgeCrossings(Vector a, Vector b, int cnt, + Vector *pi=NULL, SPointList *spl=NULL) const; +}; + +class SPoint { +public: + int tag; + + EarType ear; + + Vector p; + Vector auxv; +}; + +class SPointList { +public: + List l; + + void Clear(); + bool ContainsPoint(Vector pt) const; + int IndexForPoint(Vector pt) const; + void IncrementTagFor(Vector pt); + void Add(Vector pt); +}; + +class SContour { +public: + int tag; + int timesEnclosed; + Vector xminPt; + List l; + + void AddPoint(Vector p); + void MakeEdgesInto(SEdgeList *el) const; + void Reverse(); + Vector ComputeNormal() const; + double SignedAreaProjdToNormal(Vector n) const; + bool IsClockwiseProjdToNormal(Vector n) const; + bool ContainsPointProjdToNormal(Vector n, Vector p) const; + void OffsetInto(SContour *dest, double r) const; + void CopyInto(SContour *dest) const; + void FindPointWithMinX(); + Vector AnyEdgeMidpoint() const; + + bool IsEmptyTriangle(int ap, int bp, int cp, double scaledEPS) const; + bool IsEar(int bp, double scaledEps) const; + bool BridgeToContour(SContour *sc, SEdgeList *el, List *vl); + void ClipEarInto(SMesh *m, int bp, double scaledEps); + void UvTriangulateInto(SMesh *m, SSurface *srf); +}; + +typedef struct { + uint32_t face; + RgbaColor color; +} STriMeta; + +class SPolygon { +public: + List l; + Vector normal; + + Vector ComputeNormal() const; + void AddEmptyContour(); + size_t WindingNumberForPoint(Vector p) const; + double SignedArea() const; + bool ContainsPoint(Vector p) const; + void MakeEdgesInto(SEdgeList *el) const; + void FixContourDirections(); + void Clear(); + bool SelfIntersecting(Vector *intersectsAt) const; + bool IsEmpty() const; + Vector AnyPoint() const; + void OffsetInto(SPolygon *dest, double r) const; + void UvTriangulateInto(SMesh *m, SSurface *srf); + void UvGridTriangulateInto(SMesh *m, SSurface *srf); + void TriangulateInto(SMesh *m) const; + void InverseTransformInto(SPolygon *sp, Vector u, Vector v, Vector n) const; +}; + +class STriangle { +public: + int tag; + STriMeta meta; + + union { + struct { Vector a, b, c; }; + Vector vertices[3]; + }; + + union { + struct { Vector an, bn, cn; }; + Vector normals[3]; + }; + + static STriangle From(STriMeta meta, Vector a, Vector b, Vector c); + Vector Normal() const; + void FlipNormal(); + double MinAltitude() const; + bool ContainsPoint(Vector p) const; + bool ContainsPointProjd(Vector n, Vector p) const; + STriangle Transform(Vector o, Vector u, Vector v) const; + bool Raytrace(const Vector &rayPoint, const Vector &rayDir, + double *t, Vector *inters) const; + double SignedVolume() const; + double Area() const; + bool IsDegenerate() const; +}; + +class SBsp2 { +public: + Vector np; // normal to the plane + + Vector no; // outer normal to the edge + double d; + SEdge edge; + + SBsp2 *pos; + SBsp2 *neg; + + SBsp2 *more; + + void InsertTriangleHow(BspClass how, STriangle *tr, SMesh *m, SBsp3 *bsp3); + void InsertTriangle(STriangle *tr, SMesh *m, SBsp3 *bsp3); + Vector IntersectionWith(Vector a, Vector b) const; + void InsertEdge(SEdge *nedge, Vector nnp, Vector out); + static SBsp2 *InsertOrCreateEdge(SBsp2 *where, SEdge *nedge, + Vector nnp, Vector out); + static SBsp2 *Alloc(); +}; + +class SBsp3 { +public: + Vector n; + double d; + + STriangle tri; + SBsp3 *pos; + SBsp3 *neg; + + SBsp3 *more; + + SBsp2 *edges; + + static SBsp3 *Alloc(); + static SBsp3 *FromMesh(const SMesh *m); + + Vector IntersectionWith(Vector a, Vector b) const; + + void InsertHow(BspClass how, STriangle *str, SMesh *instead); + void Insert(STriangle *str, SMesh *instead); + static SBsp3 *InsertOrCreate(SBsp3 *where, STriangle *str, SMesh *instead); + + void InsertConvexHow(BspClass how, STriMeta meta, Vector *vertex, size_t n, + SMesh *instead); + SBsp3 *InsertConvex(STriMeta meta, Vector *vertex, size_t n, SMesh *instead); + + void InsertInPlane(bool pos2, STriangle *tr, SMesh *m); + + void GenerateInPaintOrder(SMesh *m) const; +}; + +class SMesh { +public: + List l; + + bool flipNormal; + bool keepInsideOtherShell; + bool keepCoplanar; + bool atLeastOneDiscarded; + bool isTransparent; + + void Clear(); + void AddTriangle(const STriangle *st); + void AddTriangle(STriMeta meta, Vector a, Vector b, Vector c); + void AddTriangle(STriMeta meta, Vector n, + Vector a, Vector b, Vector c); + void DoBounding(Vector v, Vector *vmax, Vector *vmin) const; + void GetBounding(Vector *vmax, Vector *vmin) const; + + void Simplify(int start); + + void AddAgainstBsp(SMesh *srcm, SBsp3 *bsp3); + void MakeFromUnionOf(SMesh *a, SMesh *b); + void MakeFromDifferenceOf(SMesh *a, SMesh *b); + void MakeFromIntersectionOf(SMesh *a, SMesh *b); + + void MakeFromCopyOf(SMesh *a); + void MakeFromTransformationOf(SMesh *a, Vector trans, + Quaternion q, double scale); + void MakeFromAssemblyOf(SMesh *a, SMesh *b); + + void MakeEdgesInPlaneInto(SEdgeList *sel, Vector n, double d); + void MakeOutlinesInto(SOutlineList *sol, EdgeKind type); + + void PrecomputeTransparency(); + void RemoveDegenerateTriangles(); + double CalculateVolume() const; + double CalculateSurfaceArea(const std::vector &faces) const; + + bool IsEmpty() const; + void RemapFaces(Group *g, int remap); + + uint32_t FirstIntersectionWith(Point2d mp) const; + + Vector GetCenterOfMass() const; +}; + +// A linked list of triangles +class STriangleLl { +public: + STriangle *tri; + + STriangleLl *next; + + static STriangleLl *Alloc(); +}; + +class SOutline { +public: + int tag; + Vector a, b, nl, nr; + + bool IsVisible(Vector projDir) const; +}; + +class SOutlineList { +public: + List l; + + void Clear(); + void AddEdge(Vector a, Vector b, Vector nl, Vector nr, int tag = 0); + void ListTaggedInto(SEdgeList *el, int auxA = 0, int auxB = 0); + + void MakeFromCopyOf(SOutlineList *ol); +}; + +class SKdNode { +public: + struct EdgeOnInfo { + int count; + bool frontFacing; + bool intersectsMesh; + STriangle *tr; + int ai; + int bi; + }; + + int which; // whether c is x, y, or z + double c; + + SKdNode *gt; + SKdNode *lt; + + STriangleLl *tris; + + static SKdNode *Alloc(); + static SKdNode *From(SMesh *m); + static SKdNode *From(STriangleLl *tll); + + void AddTriangle(STriangle *tr); + void MakeMeshInto(SMesh *m) const; + void ListTrianglesInto(std::vector *tl) const; + void ClearTags() const; + + void FindEdgeOn(Vector a, Vector b, int cnt, bool coplanarIsInter, EdgeOnInfo *info) const; + void MakeCertainEdgesInto(SEdgeList *sel, EdgeKind how, bool coplanarIsInter, + bool *inter, bool *leaky, int auxA = 0) const; + void MakeOutlinesInto(SOutlineList *sel, EdgeKind tagKind) const; + + void OcclusionTestLine(SEdge orig, SEdgeList *sel, int cnt) const; + void SplitLinesAgainstTriangle(SEdgeList *sel, STriangle *tr) const; + + void SnapToMesh(SMesh *m); + void SnapToVertex(Vector v, SMesh *extras); +}; + +class PolylineBuilder { +public: + struct Edge; + + struct Vertex { + Vector pos; + std::vector edges; + + bool GetNext(uint32_t kind, Vertex **next, Edge **nextEdge); + bool GetNext(uint32_t kind, Vector plane, double d, Vertex **next, Edge **nextEdge); + size_t CountEdgesWithTagAndKind(int tag, uint32_t kind) const; + }; + + struct VertexPairHash { + size_t operator()(const std::pair &v) const; + }; + + struct Edge { + Vertex *a; + Vertex *b; + uint32_t kind; + int tag; + + union { + uintptr_t data; + SOutline *outline; + SEdge *edge; + }; + + Vertex *GetOtherVertex(Vertex *v) const; + bool GetStartAndNext(Vertex **start, Vertex **next, bool loop) const; + }; + + std::unordered_map vertices; + std::unordered_map, Edge *, VertexPairHash> edgeMap; + std::vector edges; + + ~PolylineBuilder(); + void Clear(); + + Vertex *AddVertex(const Vector &pos); + Edge *AddEdge(const Vector &p0, const Vector &p1, uint32_t kind, uintptr_t data = 0); + void Generate(std::function const &startFunc, + std::function const &nextFunc, + std::function const &aloneFunc, + std::function const &endFunc = []() {}); + + void MakeFromEdges(const SEdgeList &sel); + void MakeFromOutlines(const SOutlineList &sol); + void GenerateEdges(SEdgeList *sel); + void GenerateOutlines(SOutlineList *sol); +}; + +} // namespace SolveSpace + +#endif diff --git a/src/polyline.cpp b/src/polyline.cpp new file mode 100644 index 0000000..0b7e2e9 --- /dev/null +++ b/src/polyline.cpp @@ -0,0 +1,247 @@ +//----------------------------------------------------------------------------- +// A helper class to assemble scattered edges into contiguous polylines, +// as nicely as possible. +// +// Copyright 2016 M-Labs Ltd +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +bool PolylineBuilder::Vertex::GetNext(uint32_t kind, Vertex **next, Edge **nextEdge) { + auto it = std::find_if(edges.begin(), edges.end(), [&](const Edge *e) { + return e->tag == 0 && e->kind == kind; + }); + + if(it != edges.end()) { + (*it)->tag = 1; + *next = (*it)->GetOtherVertex(this); + *nextEdge = *it; + return true; + } + + return false; +} + +bool PolylineBuilder::Vertex::GetNext(uint32_t kind, Vector plane, double dist, + Vertex **next, Edge **nextEdge) { + Edge *best = NULL; + double minD = VERY_POSITIVE; + for(Edge *e : edges) { + if(e->tag != 0) continue; + if(e->kind != kind) continue; + + // We choose the best next edge with minimal distance from the current plane + Vector nextPos = e->GetOtherVertex(this)->pos; + double curD = fabs(plane.Dot(nextPos) - dist); + if(best != NULL && curD > minD) continue; + best = e; + minD = curD; + } + + if(best != NULL) { + best->tag = 1; + *next = best->GetOtherVertex(this); + *nextEdge = best; + return true; + } + + return false; +} + + +size_t PolylineBuilder::Vertex::CountEdgesWithTagAndKind(int tag, uint32_t kind) const { + return std::count_if(edges.begin(), edges.end(), [&](const Edge *e) { + return e->tag == tag && e->kind == kind; + }); +} + +PolylineBuilder::Vertex *PolylineBuilder::Edge::GetOtherVertex(PolylineBuilder::Vertex *v) const { + if(a == v) return b; + if(b == v) return a; + return NULL; +} + +size_t PolylineBuilder::VertexPairHash::operator()(const std::pair &v) const { + return ((uintptr_t)v.first / sizeof(Vertex)) ^ + ((uintptr_t)v.second / sizeof(Vertex)); +} + +bool PolylineBuilder::Edge::GetStartAndNext(PolylineBuilder::Vertex **start, + PolylineBuilder::Vertex **next, bool loop) const { + size_t numA = a->CountEdgesWithTagAndKind(0, kind); + size_t numB = b->CountEdgesWithTagAndKind(0, kind); + + if((numA == 1 && numB > 1) || (loop && numA > 1 && numB > 1)) { + *start = a; + *next = b; + return true; + } + + if(numA > 1 && numB == 1) { + *start = b; + *next = a; + return true; + } + + return false; +} + +PolylineBuilder::~PolylineBuilder() { + Clear(); +} + +void PolylineBuilder::Clear() { + for(Edge *e : edges) { + delete e; + } + edges.clear(); + + for(auto &v : vertices) { + delete v.second; + } + vertices.clear(); +} + +PolylineBuilder::Vertex *PolylineBuilder::AddVertex(const Vector &pos) { + auto it = vertices.find(pos); + if(it != vertices.end()) { + return it->second; + } + + Vertex *result = new Vertex; + result->pos = pos; + vertices.emplace(pos, result); + + return result; +} + +PolylineBuilder::Edge *PolylineBuilder::AddEdge(const Vector &p0, const Vector &p1, + uint32_t kind, uintptr_t data) { + Vertex *v0 = AddVertex(p0); + Vertex *v1 = AddVertex(p1); + if(v0 == v1) return NULL; + + auto it = edgeMap.find(std::make_pair(v0, v1)); + if(it != edgeMap.end()) { + return it->second; + } + + PolylineBuilder::Edge *edge = new PolylineBuilder::Edge {}; + edge->a = v0; + edge->b = v1; + edge->kind = kind; + edge->tag = 0; + edge->data = data; + edges.push_back(edge); + edgeMap.emplace(std::make_pair(v0, v1), edge); + + v0->edges.push_back(edge); + v1->edges.push_back(edge); + + return edge; +} + +void PolylineBuilder::Generate( + std::function const &startFunc, + std::function const &nextFunc, + std::function const &aloneFunc, std::function const &endFunc) { + bool found; + bool loop = false; + do { + found = false; + for(PolylineBuilder::Edge *e : edges) { + if(e->tag != 0) continue; + + Vertex *start; + Vertex *next; + if(!e->GetStartAndNext(&start, &next, loop)) continue; + + Vector startPos = start->pos; + Vector nextPos = next->pos; + found = true; + e->tag = 1; + + startFunc(start, next, e); + + Edge *nextEdge; + if(next->GetNext(e->kind, &next, &nextEdge)) { + Vector plane = nextPos.Minus(startPos).Cross(next->pos.Minus(startPos)); + double dist = plane.Dot(startPos); + nextFunc(next, nextEdge); + while(next->GetNext(e->kind, plane, dist, &next, &nextEdge)) { + nextFunc(next, nextEdge); + } + } + + endFunc(); + } + + if(!found && !loop) { + loop = true; + found = true; + } + } while(found); + + for(PolylineBuilder::Edge *e : edges) { + if(e->tag != 0) continue; + aloneFunc(e); + } +} + +void PolylineBuilder::MakeFromEdges(const SEdgeList &sel) { + for(const SEdge &se : sel.l) { + AddEdge(se.a, se.b, (uint32_t)se.auxA, reinterpret_cast(&se)); + } +} + +void PolylineBuilder::MakeFromOutlines(const SOutlineList &ol) { + for(const SOutline &so : ol.l) { + // Use outline tag as kind, so that emphasized and contour outlines + // would not be composed together. + AddEdge(so.a, so.b, (uint32_t)so.tag, reinterpret_cast(&so)); + } +} + +void PolylineBuilder::GenerateEdges(SEdgeList *sel) { + Vector prev; + auto startFunc = [&](Vertex *start, Vertex *next, Edge *e) { + sel->AddEdge(start->pos, next->pos, e->kind); + prev = next->pos; + }; + + auto nextFunc = [&](Vertex *next, Edge *e) { + sel->AddEdge(prev, next->pos, e->kind); + prev = next->pos; + }; + + auto aloneFunc = [&](Edge *e) { + sel->AddEdge(e->a->pos, e->b->pos, e->kind); + }; + + Generate(startFunc, nextFunc, aloneFunc); +} + +void PolylineBuilder::GenerateOutlines(SOutlineList *sol) { + Vector prev; + auto startFunc = [&](Vertex *start, Vertex *next, Edge *e) { + SOutline *so = e->outline; + sol->AddEdge(start->pos, next->pos, so->nl, so->nr, so->tag); + prev = next->pos; + }; + + auto nextFunc = [&](Vertex *next, Edge *e) { + SOutline *so = e->outline; + sol->AddEdge(prev, next->pos, so->nl, so->nr, so->tag); + prev = next->pos; + }; + + auto aloneFunc = [&](Edge *e) { + SOutline *so = e->outline; + sol->AddEdge(so->a, so->b, so->nl, so->nr, so->tag); + }; + + Generate(startFunc, nextFunc, aloneFunc); +} + +} // namespace SolveSpace diff --git a/src/render/gl3shader.cpp b/src/render/gl3shader.cpp new file mode 100644 index 0000000..7c4552e --- /dev/null +++ b/src/render/gl3shader.cpp @@ -0,0 +1,1071 @@ +//----------------------------------------------------------------------------- +// OpenGL ES 2.0 and OpenGL 3.0 shader interface. +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include "gl3shader.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Floating point data structures +//----------------------------------------------------------------------------- + +Vector2f Vector2f::From(float x, float y) { + return { x, y }; +} + +Vector2f Vector2f::From(double x, double y) { + return { (float)x, (float)y }; +} + +Vector2f Vector2f::FromInt(uint32_t x, uint32_t y) { + return { (float)x, (float)y }; +} + +Vector3f Vector3f::From(float x, float y, float z) { + return { x, y, z }; +} + +Vector3f Vector3f::From(const Vector &v) { + return { (float)v.x, (float)v.y, (float)v.z }; +} + +Vector3f Vector3f::From(const RgbaColor &c) { + return { c.redF(), c.greenF(), c.blueF() }; +} + +Vector4f Vector4f::From(float x, float y, float z, float w) { + return { x, y, z, w }; +} + +Vector4f Vector4f::From(const Vector &v, float w) { + return { (float)v.x, (float)v.y, (float)v.z, w }; +} + +Vector4f Vector4f::FromInt(uint32_t x, uint32_t y, uint32_t z, uint32_t w) { + return { (float)x, (float)y, (float)z, (float)w }; +} + +Vector4f Vector4f::From(const RgbaColor &c) { + return { c.redF(), c.greenF(), c.blueF(), c.alphaF() }; +} + +//----------------------------------------------------------------------------- +// Shader manipulation +//----------------------------------------------------------------------------- + +static GLuint CompileShader(const std::string &res, GLenum type) { + size_t size; + const char *resData = (const char *)Platform::LoadResource(res, &size); + + // Sigh, here we go... We want to deploy to four platforms: Linux, Windows, OS X, mobile+web. + // These platforms are basically disjunctive in the OpenGL versions and profiles that they + // support: mobile+web support GLES2, Windows can only be guaranteed to support GL1 without + // vendor's drivers installed but supports D3D9+ natively, Linux supports GL3.2+ and/or + // GLES2+ depending on whether we run on X11 or Wayland, and OS X supports either a legacy + // profile or a GL3.2 core profile or (on 10.9+) a GL4.1 core profile. + // The platforms barely have a common subset of features: + // * mobile+web and Windows (D3D9 through ANGLE) are strictly GLES2/GLSL1.0; + // * OS X legacy compatibility profile has GLSL1.2 only shaders, and GL3.2 core profile + // that has GLSL1.0 shaders compatible with GLES2 makes mandatory the use of vertex array + // objects, which cannot be used in GLES2 at all; similarly GL3.2 core has GL_RED but not + // GL_ALPHA whereas GLES2 has GL_ALPHA but not GL_RED. + // * GTK does not work on anything prior to GL3.0/GLES2.0; it does not permit explicitly + // asking for a compatibility profile, i.e. you can only ask for 3.2+; and it does not + // permit asking for a GLES profile prior to GTK 3.22, which will get into Ubuntu + // no earlier than late 2017. This is despite the fact that if only GTK defaulted + // to the compatibility profile, everything would have just worked as Mesa is + // very permissive. + // While we're at it, let's remember that GLES2 has *only* glDepthRangef, GL3.2 has *only* + // glDepthRange, and GL4.1+ has both glDepthRangef and glDepthRange. Also, that GLSL1.0 + // makes `precision highp float;` mandatory in fragment shaders, and GLSL1.2 removes + // the `precision` keyword entirely, because that's clearly how minor versions work. + // Christ, what a trash fire. + + const char *prelude; +#if defined(HAVE_GLES) + prelude = R"( +#version 100 +#define TEX_ALPHA a +precision highp float; +)"; +#else + prelude = R"( +#version 120 +#define TEX_ALPHA r +)"; +#endif + std::string src(resData, size); + src = prelude + src; + + GLuint shader = glCreateShader(type); + ssassert(shader != 0, "glCreateShader failed"); + + const GLint glSize[] = { (int)src.length() }; + const GLchar* glSource[] = { src.c_str() }; + glShaderSource(shader, 1, glSource, glSize); + glCompileShader(shader); + + GLint infoLen = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if(infoLen > 1) { + std::string infoStr(infoLen, '\0'); + glGetShaderInfoLog(shader, infoLen, NULL, &infoStr[0]); + dbp(infoStr.c_str()); + } + + GLint compiled = 0; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + if(!compiled) { + dbp("Failed to compile shader:\n" + "----8<----8<----8<----8<----8<----\n" + "%s\n" + "----8<----8<----8<----8<----8<----\n", + src.c_str()); + } + ssassert(compiled, "Cannot compile shader"); + + return shader; +} + +void Shader::Init(const std::string &vertexRes, const std::string &fragmentRes, + const std::vector > &locations) { + GLuint vert = CompileShader(vertexRes, GL_VERTEX_SHADER); + GLuint frag = CompileShader(fragmentRes, GL_FRAGMENT_SHADER); + + program = glCreateProgram(); + ssassert(program != 0, "glCreateProgram failed"); + + glAttachShader(program, vert); + glAttachShader(program, frag); + for(const auto &l : locations) { + glBindAttribLocation(program, l.first, l.second.c_str()); + } + glLinkProgram(program); + + GLint infoLen = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLen); + if(infoLen > 1) { + std::string infoStr(infoLen, '\0'); + glGetProgramInfoLog(program, infoLen, NULL, &infoStr[0]); + dbp(infoStr.c_str()); + } + + GLint linked = 0; + glGetProgramiv(program, GL_LINK_STATUS, &linked); + ssassert(linked, "Cannot link shader"); +} + +void Shader::Clear() { + glDeleteProgram(program); +} + +void Shader::SetUniformMatrix(const char *name, const double *md) { + Enable(); + float mf[16]; + for(int i = 0; i < 16; i++) mf[i] = (float)md[i]; + glUniformMatrix4fv(glGetUniformLocation(program, name), 1, false, mf); +} + +void Shader::SetUniformVector(const char *name, const Vector &v) { + Enable(); + glUniform3f(glGetUniformLocation(program, name), (float)v.x, (float)v.y, (float)v.z); +} + +void Shader::SetUniformVector(const char *name, const Vector4f &v) { + Enable(); + glUniform4f(glGetUniformLocation(program, name), v.x, v.y, v.z, v.w); +} + +void Shader::SetUniformColor(const char *name, RgbaColor c) { + Enable(); + glUniform4f(glGetUniformLocation(program, name), c.redF(), c.greenF(), c.blueF(), c.alphaF()); +} + +void Shader::SetUniformFloat(const char *name, float v) { + Enable(); + glUniform1f(glGetUniformLocation(program, name), v); +} + +void Shader::SetUniformInt(const char *name, GLint v) { + Enable(); + glUniform1i(glGetUniformLocation(program, name), v); +} + +void Shader::SetUniformTextureUnit(const char *name, GLint index) { + Enable(); + glUniform1i(glGetUniformLocation(program, name), index); +} + +void Shader::Enable() const { + glUseProgram(program); +} + +void Shader::Disable() const { + glUseProgram(0); +} + +//----------------------------------------------------------------------------- +// Mesh rendering +//----------------------------------------------------------------------------- + +void MeshRenderer::Init() { + lightShader.Init( + "shaders/mesh.vert", "shaders/mesh.frag", + { + { ATTRIB_POS, "pos" }, + { ATTRIB_NOR, "nor" }, + { ATTRIB_COL, "col" }, + } + ); + + fillShader.Init( + "shaders/mesh_fill.vert", "shaders/mesh_fill.frag", + { + { ATTRIB_POS, "pos" }, + } + ); + fillShader.SetUniformTextureUnit("texture_", 0); + + selectedShader = &lightShader; +} + +void MeshRenderer::Clear() { + lightShader.Clear(); + fillShader.Clear(); +} + +MeshRenderer::Handle MeshRenderer::Add(const SMesh &m, bool dynamic) { + Handle handle; + glGenBuffers(1, &handle.vertexBuffer); + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + + MeshVertex *vertices = new MeshVertex[m.l.n * 3]; + for(int i = 0; i < m.l.n; i++) { + const STriangle &t = m.l[i]; + vertices[i * 3 + 0].pos = Vector3f::From(t.a); + vertices[i * 3 + 1].pos = Vector3f::From(t.b); + vertices[i * 3 + 2].pos = Vector3f::From(t.c); + + if(t.an.EqualsExactly(Vector::From(0, 0, 0))) { + Vector3f normal = Vector3f::From(t.Normal()); + vertices[i * 3 + 0].nor = normal; + vertices[i * 3 + 1].nor = normal; + vertices[i * 3 + 2].nor = normal; + } else { + vertices[i * 3 + 0].nor = Vector3f::From(t.an); + vertices[i * 3 + 1].nor = Vector3f::From(t.bn); + vertices[i * 3 + 2].nor = Vector3f::From(t.cn); + } + + for(int j = 0; j < 3; j++) { + vertices[i * 3 + j].col = Vector4f::From(t.meta.color); + } + + } + glBufferData(GL_ARRAY_BUFFER, m.l.n * 3 * sizeof(MeshVertex), + vertices, dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); + handle.size = m.l.n * 3; + delete []vertices; + + return handle; +} + +void MeshRenderer::Remove(const MeshRenderer::Handle &handle) { + glDeleteBuffers(1, &handle.vertexBuffer); +} + +void MeshRenderer::Draw(const MeshRenderer::Handle &handle, + bool useColors, RgbaColor overrideColor) { + if(handle.size == 0) return; + + selectedShader->Enable(); + + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + + glEnableVertexAttribArray(ATTRIB_POS); + glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), + (void *)offsetof(MeshVertex, pos)); + + if(selectedShader == &lightShader) { + glEnableVertexAttribArray(ATTRIB_NOR); + glVertexAttribPointer(ATTRIB_NOR, 3, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), + (void *)offsetof(MeshVertex, nor)); + if(useColors) { + glEnableVertexAttribArray(ATTRIB_COL); + glVertexAttribPointer(ATTRIB_COL, 4, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), + (void *)offsetof(MeshVertex, col)); + } else { + glVertexAttrib4f(ATTRIB_COL, overrideColor.redF(), overrideColor.greenF(), overrideColor.blueF(), overrideColor.alphaF()); + } + } + + glDrawArrays(GL_TRIANGLES, 0, handle.size); + + glDisableVertexAttribArray(ATTRIB_POS); + if(selectedShader == &lightShader) { + glDisableVertexAttribArray(ATTRIB_NOR); + if(useColors) glDisableVertexAttribArray(ATTRIB_COL); + } + + glBindBuffer(GL_ARRAY_BUFFER, 0); + + selectedShader->Disable(); +} + +void MeshRenderer::Draw(const SMesh &mesh, bool useColors, RgbaColor overrideColor) { + Handle handle = Add(mesh, /*dynamic=*/true); + Draw(handle, useColors, overrideColor); + Remove(handle); +} + +void MeshRenderer::SetModelview(double *matrix) { + lightShader.SetUniformMatrix("modelview", matrix); + fillShader.SetUniformMatrix("modelview", matrix); +} + +void MeshRenderer::SetProjection(double *matrix) { + lightShader.SetUniformMatrix("projection", matrix); + fillShader.SetUniformMatrix("projection", matrix); +} + +void MeshRenderer::UseShaded(const Lighting &lighting) { + Vector dir0 = lighting.lightDirection[0]; + Vector dir1 = lighting.lightDirection[1]; + dir0.z = -dir0.z; + dir1.z = -dir1.z; + + lightShader.SetUniformVector("lightDir0", dir0); + lightShader.SetUniformFloat("lightInt0", (float)lighting.lightIntensity[0]); + lightShader.SetUniformVector("lightDir1", dir1); + lightShader.SetUniformFloat("lightInt1", (float)lighting.lightIntensity[1]); + lightShader.SetUniformFloat("ambient", (float)lighting.ambientIntensity); + selectedShader = &lightShader; +} + +void MeshRenderer::UseFilled(const Canvas::Fill &fill) { + fillShader.SetUniformColor("color", fill.color); + selectedShader = &fillShader; +} + +//----------------------------------------------------------------------------- +// Arrangement of stipple patterns into textures +//----------------------------------------------------------------------------- + +static double Frac(double x) { + return x - floor(x); +} + +static RgbaColor EncodeLengthAsFloat(double v) { + v = max(0.0, min(1.0, v)); + double er = v; + double eg = Frac(255.0 * v); + double eb = Frac(65025.0 * v); + double ea = Frac(160581375.0 * v); + + double r = er - eg / 255.0; + double g = eg - eb / 255.0; + double b = eb - ea / 255.0; + return RgbaColor::From((int)floor( r * 255.0 + 0.5), + (int)floor( g * 255.0 + 0.5), + (int)floor( b * 255.0 + 0.5), + (int)floor(ea * 255.0 + 0.5)); +} + +GLuint Generate(const std::vector &pattern) { + double patternLen = 0.0; + for(double s : pattern) { + patternLen += s; + } + + GLuint texture; + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + + GLint size = 0; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); + size /= 2; + + RgbaColor *textureData = new RgbaColor[size]; + int mipCount = (int)log2(size) + 1; + for(int mip = 0; mip < mipCount; mip++) { + int dashI = 0; + double dashT = 0.0; + for(int i = 0; i < size; i++) { + if(pattern.empty()) { + textureData[i] = EncodeLengthAsFloat(0.0); + continue; + } + + double t = (double)i / (double)(size - 1); + while(t - LENGTH_EPS > dashT + pattern[dashI] / patternLen) { + dashT += pattern[dashI] / patternLen; + dashI++; + } + double dashW = pattern[dashI] / patternLen; + if(dashI % 2 == 0) { + textureData[i] = EncodeLengthAsFloat(0.0); + } else { + double value; + if(t - dashT < pattern[dashI] / patternLen / 2.0) { + value = t - dashT; + } else { + value = dashT + dashW - t; + } + value = value * patternLen; + textureData[i] = EncodeLengthAsFloat(value); + } + } + glTexImage2D(GL_TEXTURE_2D, mip, GL_RGBA, size, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, + textureData); + size /= 2; + } + delete []textureData; + + return texture; +} + +void StippleAtlas::Init() { + for(uint32_t i = 0; i <= (uint32_t)StipplePattern::LAST; i++) { + patterns.push_back(Generate(StipplePatternDashes((StipplePattern)i))); + } +} + +void StippleAtlas::Clear() { + for(GLuint p : patterns) { + glDeleteTextures(1, &p); + } +} + +GLint StippleAtlas::GetTexture(StipplePattern pattern) const { + return patterns[(uint32_t)pattern]; +} + +double StippleAtlas::GetLength(StipplePattern pattern) const { + if(pattern == StipplePattern::CONTINUOUS) { + return 1.0; + } + return StipplePatternLength(pattern); +} + +//----------------------------------------------------------------------------- +// Edge rendering +//----------------------------------------------------------------------------- + +void EdgeRenderer::Init(const StippleAtlas *a) { + atlas = a; + shader.Init( + "shaders/edge.vert", "shaders/edge.frag", + { + { ATTRIB_POS, "pos" }, + { ATTRIB_LOC, "loc" }, + { ATTRIB_TAN, "tgt" } + } + ); +} + +void EdgeRenderer::Clear() { + shader.Clear(); +} + +EdgeRenderer::Handle EdgeRenderer::Add(const SEdgeList &edges, bool dynamic) { + Handle handle; + glGenBuffers(1, &handle.vertexBuffer); + glGenBuffers(1, &handle.indexBuffer); + + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle.indexBuffer); + + EdgeVertex *vertices = new EdgeVertex[edges.l.n * 8]; + uint32_t *indices = new uint32_t[edges.l.n * 6 * 3]; + double phase = 0.0; + uint32_t curVertex = 0; + uint32_t curIndex = 0; + for(int i = 0; i < edges.l.n; i++) { + const SEdge &curr = edges.l[i]; + const SEdge &next = edges.l[(i + 1) % edges.l.n]; + + // 3d positions + Vector3f a = Vector3f::From(curr.a); + Vector3f b = Vector3f::From(curr.b); + + // tangent + Vector3f tan = Vector3f::From(curr.b.Minus(curr.a)); + + // length + double len = curr.b.Minus(curr.a).Magnitude(); + + // make line start cap + for(int j = 0; j < 2; j++) { + vertices[curVertex + j].pos = a; + vertices[curVertex + j].tan = tan; + } + vertices[curVertex + 0].loc = Vector3f::From(-1.0f, -1.0f, float(phase)); + vertices[curVertex + 1].loc = Vector3f::From(-1.0f, +1.0f, float(phase)); + + indices[curIndex++] = curVertex + 0; + indices[curIndex++] = curVertex + 1; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 1; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 3; + + curVertex += 2; + + // make line body + vertices[curVertex + 0].pos = a; + vertices[curVertex + 1].pos = a; + vertices[curVertex + 2].pos = b; + vertices[curVertex + 3].pos = b; + + for(int j = 0; j < 4; j++) { + vertices[curVertex + j].tan = tan; + } + + vertices[curVertex + 0].loc = Vector3f::From( 0.0f, -1.0f, float(phase)); + vertices[curVertex + 1].loc = Vector3f::From( 0.0f, +1.0f, float(phase)); + vertices[curVertex + 2].loc = Vector3f::From( 0.0f, +1.0f, float(phase + len)); + vertices[curVertex + 3].loc = Vector3f::From( 0.0f, -1.0f, float(phase + len)); + + indices[curIndex++] = curVertex + 0; + indices[curIndex++] = curVertex + 1; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 0; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 3; + + curVertex += 4; + + // make line end cap + for(int j = 0; j < 2; j++) { + vertices[curVertex + j].pos = b; + vertices[curVertex + j].tan = tan; + } + + vertices[curVertex + 0].loc = Vector3f::From(+1.0, +1.0, float(phase + len)); + vertices[curVertex + 1].loc = Vector3f::From(+1.0, -1.0, float(phase + len)); + + indices[curIndex++] = curVertex - 2; + indices[curIndex++] = curVertex - 1; + indices[curIndex++] = curVertex; + indices[curIndex++] = curVertex - 1; + indices[curIndex++] = curVertex; + indices[curIndex++] = curVertex + 1; + + curVertex += 2; + + // phase stitching + if(curr.a.EqualsExactly(next.a) || + curr.a.EqualsExactly(next.b) || + curr.b.EqualsExactly(next.a) || + curr.b.EqualsExactly(next.b)) + { + phase += len; + } else { + phase = 0.0; + } + } + handle.size = curIndex; + GLenum mode = dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; + glBufferData(GL_ARRAY_BUFFER, curVertex * sizeof(EdgeVertex), vertices, mode); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, curIndex * sizeof(uint32_t), indices, mode); + delete []vertices; + delete []indices; + + return handle; +} + +void EdgeRenderer::Remove(const EdgeRenderer::Handle &handle) { + glDeleteBuffers(1, &handle.vertexBuffer); + glDeleteBuffers(1, &handle.indexBuffer); +} + +void EdgeRenderer::Draw(const EdgeRenderer::Handle &handle) { + if(handle.size == 0) return; + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, atlas->GetTexture(pattern)); + shader.SetUniformTextureUnit("pattern", 1); + shader.SetUniformFloat("patternLen", (float)atlas->GetLength(pattern)); + + shader.Enable(); + + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle.indexBuffer); + + glEnableVertexAttribArray(ATTRIB_POS); + glEnableVertexAttribArray(ATTRIB_LOC); + glEnableVertexAttribArray(ATTRIB_TAN); + + glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(EdgeVertex), (void *)offsetof(EdgeVertex, pos)); + glVertexAttribPointer(ATTRIB_LOC, 3, GL_FLOAT, GL_FALSE, sizeof(EdgeVertex), (void *)offsetof(EdgeVertex, loc)); + glVertexAttribPointer(ATTRIB_TAN, 3, GL_FLOAT, GL_FALSE, sizeof(EdgeVertex), (void *)offsetof(EdgeVertex, tan)); + glDrawElements(GL_TRIANGLES, handle.size, GL_UNSIGNED_INT, NULL); + + glDisableVertexAttribArray(ATTRIB_POS); + glDisableVertexAttribArray(ATTRIB_LOC); + glDisableVertexAttribArray(ATTRIB_TAN); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + shader.Disable(); +} + +void EdgeRenderer::Draw(const SEdgeList &edges) { + Handle handle = Add(edges, /*dynamic=*/true); + Draw(handle); + Remove(handle); +} + +void EdgeRenderer::SetModelview(const double *matrix) { + shader.SetUniformMatrix("modelview", matrix); +} + +void EdgeRenderer::SetProjection(const double *matrix) { + shader.SetUniformMatrix("projection", matrix); +} + +void EdgeRenderer::SetStroke(const Canvas::Stroke &stroke, double pixel) { + double unitScale = stroke.unit == Canvas::Unit::PX ? pixel : 1.0; + shader.SetUniformFloat("width", float(stroke.width * unitScale / 2.0)); + shader.SetUniformColor("color", stroke.color); + shader.SetUniformFloat("patternScale", float(stroke.stippleScale * unitScale * 2.0)); + shader.SetUniformFloat("pixel", (float)pixel); + pattern = stroke.stipplePattern; +} + +//----------------------------------------------------------------------------- +// Outline rendering +//----------------------------------------------------------------------------- + +void OutlineRenderer::Init(const StippleAtlas *a) { + atlas = a; + shader.Init( + "shaders/outline.vert", "shaders/edge.frag", + { + { ATTRIB_POS, "pos" }, + { ATTRIB_LOC, "loc" }, + { ATTRIB_TAN, "tgt" }, + { ATTRIB_NOL, "nol" }, + { ATTRIB_NOR, "nor" } + } + ); +} + +void OutlineRenderer::Clear() { + shader.Clear(); +} + +OutlineRenderer::Handle OutlineRenderer::Add(const SOutlineList &outlines, bool dynamic) { + Handle handle; + glGenBuffers(1, &handle.vertexBuffer); + glGenBuffers(1, &handle.indexBuffer); + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle.indexBuffer); + + OutlineVertex *vertices = new OutlineVertex[outlines.l.n * 8]; + uint32_t *indices = new uint32_t[outlines.l.n * 6 * 3]; + double phase = 0.0; + uint32_t curVertex = 0; + uint32_t curIndex = 0; + + for(int i = 0; i < outlines.l.n; i++) { + const SOutline &curr = outlines.l[i]; + const SOutline &next = outlines.l[(i + 1) % outlines.l.n]; + + // 3d positions + Vector3f a = Vector3f::From(curr.a); + Vector3f b = Vector3f::From(curr.b); + Vector3f nl = Vector3f::From(curr.nl); + Vector3f nr = Vector3f::From(curr.nr); + + // tangent + Vector3f tan = Vector3f::From(curr.b.Minus(curr.a)); + + // length + double len = curr.b.Minus(curr.a).Magnitude(); + float tag = (float)curr.tag; + + // make line start cap + for(int j = 0; j < 2; j++) { + vertices[curVertex + j].pos = a; + vertices[curVertex + j].nol = nl; + vertices[curVertex + j].nor = nr; + vertices[curVertex + j].tan = tan; + } + + vertices[curVertex + 0].loc = Vector4f::From(-1.0f, -1.0f, float(phase), (float)tag); + vertices[curVertex + 1].loc = Vector4f::From(-1.0f, +1.0f, float(phase), (float)tag); + + indices[curIndex++] = curVertex; + indices[curIndex++] = curVertex + 1; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 1; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 3; + + curVertex += 2; + + // make line body + vertices[curVertex + 0].pos = a; + vertices[curVertex + 1].pos = a; + vertices[curVertex + 2].pos = b; + vertices[curVertex + 3].pos = b; + + for(int j = 0; j < 4; j++) { + vertices[curVertex + j].nol = nl; + vertices[curVertex + j].nor = nr; + vertices[curVertex + j].tan = tan; + } + + vertices[curVertex + 0].loc = Vector4f::From( 0.0f, -1.0f, float(phase), (float)tag); + vertices[curVertex + 1].loc = Vector4f::From( 0.0f, +1.0f, float(phase), (float)tag); + vertices[curVertex + 2].loc = Vector4f::From( 0.0f, +1.0f, + float(phase + len), (float)tag); + vertices[curVertex + 3].loc = Vector4f::From( 0.0f, -1.0f, + float(phase + len), (float)tag); + + indices[curIndex++] = curVertex + 0; + indices[curIndex++] = curVertex + 1; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 0; + indices[curIndex++] = curVertex + 2; + indices[curIndex++] = curVertex + 3; + + curVertex += 4; + + // make line end cap + for(int j = 0; j < 2; j++) { + vertices[curVertex + j].pos = b; + vertices[curVertex + j].nol = nl; + vertices[curVertex + j].nor = nr; + vertices[curVertex + j].tan = tan; + } + + vertices[curVertex + 0].loc = Vector4f::From(+1.0f, +1.0f, float(phase + len), (float)tag); + vertices[curVertex + 1].loc = Vector4f::From(+1.0f, -1.0f, float(phase + len), (float)tag); + + indices[curIndex++] = curVertex - 2; + indices[curIndex++] = curVertex - 1; + indices[curIndex++] = curVertex; + indices[curIndex++] = curVertex - 1; + indices[curIndex++] = curVertex; + indices[curIndex++] = curVertex + 1; + + curVertex += 2; + + // phase stitching + if(curr.a.EqualsExactly(next.a) || + curr.a.EqualsExactly(next.b) || + curr.b.EqualsExactly(next.a) || + curr.b.EqualsExactly(next.b)) + { + phase += len; + } else { + phase = 0.0; + } + } + handle.size = curIndex; + GLenum mode = dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; + glBufferData(GL_ARRAY_BUFFER, curVertex * sizeof(OutlineVertex), vertices, mode); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, curIndex * sizeof(uint32_t), indices, mode); + + delete []vertices; + delete []indices; + return handle; +} + +void OutlineRenderer::Remove(const OutlineRenderer::Handle &handle) { + glDeleteBuffers(1, &handle.vertexBuffer); + glDeleteBuffers(1, &handle.indexBuffer); +} + +void OutlineRenderer::Draw(const OutlineRenderer::Handle &handle, Canvas::DrawOutlinesAs mode) { + if(handle.size == 0) return; + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, atlas->GetTexture(pattern)); + shader.SetUniformTextureUnit("pattern", 1); + shader.SetUniformFloat("patternLen", (float)atlas->GetLength(pattern)); + shader.SetUniformInt("mode", (GLint)mode); + + shader.Enable(); + + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle.indexBuffer); + + glEnableVertexAttribArray(ATTRIB_POS); + glEnableVertexAttribArray(ATTRIB_LOC); + glEnableVertexAttribArray(ATTRIB_TAN); + glEnableVertexAttribArray(ATTRIB_NOL); + glEnableVertexAttribArray(ATTRIB_NOR); + + glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(OutlineVertex), + (void *)offsetof(OutlineVertex, pos)); + glVertexAttribPointer(ATTRIB_LOC, 4, GL_FLOAT, GL_FALSE, sizeof(OutlineVertex), + (void *)offsetof(OutlineVertex, loc)); + glVertexAttribPointer(ATTRIB_TAN, 3, GL_FLOAT, GL_FALSE, sizeof(OutlineVertex), + (void *)offsetof(OutlineVertex, tan)); + glVertexAttribPointer(ATTRIB_NOL, 3, GL_FLOAT, GL_FALSE, sizeof(OutlineVertex), + (void *)offsetof(OutlineVertex, nol)); + glVertexAttribPointer(ATTRIB_NOR, 3, GL_FLOAT, GL_FALSE, sizeof(OutlineVertex), + (void *)offsetof(OutlineVertex, nor)); + glDrawElements(GL_TRIANGLES, handle.size, GL_UNSIGNED_INT, NULL); + + glDisableVertexAttribArray(ATTRIB_POS); + glDisableVertexAttribArray(ATTRIB_LOC); + glDisableVertexAttribArray(ATTRIB_TAN); + glDisableVertexAttribArray(ATTRIB_NOL); + glDisableVertexAttribArray(ATTRIB_NOR); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + shader.Disable(); +} + +void OutlineRenderer::Draw(const SOutlineList &outlines, Canvas::DrawOutlinesAs drawAs) { + Handle handle = Add(outlines, /*dynamic=*/true); + Draw(handle, drawAs); + Remove(handle); +} + +void OutlineRenderer::SetModelview(const double *matrix) { + shader.SetUniformMatrix("modelview", matrix); +} + +void OutlineRenderer::SetProjection(const double *matrix) { + shader.SetUniformMatrix("projection", matrix); +} + +void OutlineRenderer::SetStroke(const Canvas::Stroke &stroke, double pixel) { + double unitScale = (stroke.unit == Canvas::Unit::PX) ? pixel : 1.0; + shader.SetUniformFloat("width", (float)(stroke.width * unitScale / 2.0)); + shader.SetUniformColor("color", stroke.color); + shader.SetUniformFloat("patternScale", (float)(stroke.stippleScale * unitScale * 2.0)); + shader.SetUniformFloat("pixel", (float)pixel); + pattern = stroke.stipplePattern; +} + +//----------------------------------------------------------------------------- +// Indexed mesh storage +//----------------------------------------------------------------------------- + +void SIndexedMesh::AddPoint(const Vector &p) { + uint32_t vstart = vertices.size(); + vertices.resize(vertices.size() + 4); + + vertices[vstart + 0].pos = Vector3f::From(p); + vertices[vstart + 0].tex = Vector2f::From(-1.0f, -1.0f); + vertices[vstart + 1].pos = Vector3f::From(p); + vertices[vstart + 1].tex = Vector2f::From(+1.0f, -1.0f); + vertices[vstart + 2].pos = Vector3f::From(p); + vertices[vstart + 2].tex = Vector2f::From(+1.0f, +1.0f); + vertices[vstart + 3].pos = Vector3f::From(p); + vertices[vstart + 3].tex = Vector2f::From(-1.0f, +1.0f); + + size_t istart = indices.size(); + indices.resize(indices.size() + 6); + + indices[istart + 0] = vstart + 0; + indices[istart + 1] = vstart + 1; + indices[istart + 2] = vstart + 2; + indices[istart + 3] = vstart + 0; + indices[istart + 4] = vstart + 2; + indices[istart + 5] = vstart + 3; +} + +void SIndexedMesh::AddQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d) { + uint32_t vstart = vertices.size(); + vertices.resize(vertices.size() + 4); + + vertices[vstart + 0].pos = Vector3f::From(a); + vertices[vstart + 1].pos = Vector3f::From(b); + vertices[vstart + 2].pos = Vector3f::From(c); + vertices[vstart + 3].pos = Vector3f::From(d); + + size_t istart = indices.size(); + indices.resize(indices.size() + 6); + + indices[istart + 0] = vstart + 0; + indices[istart + 1] = vstart + 1; + indices[istart + 2] = vstart + 2; + indices[istart + 3] = vstart + 0; + indices[istart + 4] = vstart + 2; + indices[istart + 5] = vstart + 3; +} + +void SIndexedMesh::AddPixmap(const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb) { + uint32_t vstart = vertices.size(); + vertices.resize(vertices.size() + 4); + + vertices[vstart + 0].pos = Vector3f::From(o); + vertices[vstart + 0].tex = Vector2f::From(ta.x, ta.y); + + vertices[vstart + 1].pos = Vector3f::From(o.Plus(v)); + vertices[vstart + 1].tex = Vector2f::From(ta.x, tb.y); + + vertices[vstart + 2].pos = Vector3f::From(o.Plus(u).Plus(v)); + vertices[vstart + 2].tex = Vector2f::From(tb.x, tb.y); + + vertices[vstart + 3].pos = Vector3f::From(o.Plus(u)); + vertices[vstart + 3].tex = Vector2f::From(tb.x, ta.y); + + size_t istart = indices.size(); + indices.resize(indices.size() + 6); + + indices[istart + 0] = vstart + 0; + indices[istart + 1] = vstart + 1; + indices[istart + 2] = vstart + 2; + indices[istart + 3] = vstart + 0; + indices[istart + 4] = vstart + 2; + indices[istart + 5] = vstart + 3; +} + +void SIndexedMesh::Clear() { + vertices.clear(); + indices.clear(); +} + +//----------------------------------------------------------------------------- +// Indexed mesh rendering +//----------------------------------------------------------------------------- + +void IndexedMeshRenderer::Init() { + colShader.Init( + "shaders/imesh.vert", "shaders/imesh.frag", + { + { ATTRIB_POS, "pos" } + } + ); + texShader.Init( + "shaders/imesh_tex.vert", "shaders/imesh_tex.frag", + { + { ATTRIB_POS, "pos" }, + { ATTRIB_TEX, "tex" } + } + ); + texaShader.Init( + "shaders/imesh_tex.vert", "shaders/imesh_texa.frag", + { + { ATTRIB_POS, "pos" }, + { ATTRIB_TEX, "tex" } + } + ); + pointShader.Init( + "shaders/imesh_point.vert", "shaders/imesh_point.frag", + { + { ATTRIB_POS, "pos" }, + { ATTRIB_TEX, "loc" } + } + ); + + texShader.SetUniformTextureUnit("texture_", 0); + texaShader.SetUniformTextureUnit("texture_", 0); + selectedShader = &colShader; +} + +void IndexedMeshRenderer::Clear() { + texShader.Clear(); + texaShader.Clear(); + colShader.Clear(); + pointShader.Clear(); +} + +IndexedMeshRenderer::Handle IndexedMeshRenderer::Add(const SIndexedMesh &m, bool dynamic) { + Handle handle; + glGenBuffers(1, &handle.vertexBuffer); + glGenBuffers(1, &handle.indexBuffer); + + GLenum mode = dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + glBufferData(GL_ARRAY_BUFFER, m.vertices.size() * sizeof(SIndexedMesh::Vertex), + m.vertices.data(), mode); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle.indexBuffer); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, m.indices.size() * sizeof(uint32_t), + m.indices.data(), mode); + handle.size = m.indices.size(); + return handle; +} + +void IndexedMeshRenderer::Remove(const IndexedMeshRenderer::Handle &handle) { + glDeleteBuffers(1, &handle.vertexBuffer); + glDeleteBuffers(1, &handle.indexBuffer); +} + +void IndexedMeshRenderer::Draw(const IndexedMeshRenderer::Handle &handle) { + if(handle.size == 0) return; + + selectedShader->Enable(); + + glBindBuffer(GL_ARRAY_BUFFER, handle.vertexBuffer); + glEnableVertexAttribArray(ATTRIB_POS); + glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(SIndexedMesh::Vertex), + (void *)offsetof(SIndexedMesh::Vertex, pos)); + if(NeedsTexture()) { + glEnableVertexAttribArray(ATTRIB_TEX); + glVertexAttribPointer(ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, sizeof(SIndexedMesh::Vertex), + (void *)offsetof(SIndexedMesh::Vertex, tex)); + } + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle.indexBuffer); + glDrawElements(GL_TRIANGLES, handle.size, GL_UNSIGNED_INT, NULL); + + glDisableVertexAttribArray(ATTRIB_POS); + if(NeedsTexture()) glDisableVertexAttribArray(ATTRIB_TEX); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + selectedShader->Disable(); +} + +void IndexedMeshRenderer::Draw(const SIndexedMesh &mesh) { + Handle handle = Add(mesh, /*dynamic=*/true) ; + Draw(handle); + Remove(handle); +} + +bool IndexedMeshRenderer::NeedsTexture() const { + return selectedShader == &texShader || + selectedShader == &texaShader || + selectedShader == &pointShader; +} + +void IndexedMeshRenderer::SetModelview(const double *matrix) { + colShader.SetUniformMatrix("modelview", matrix); + texShader.SetUniformMatrix("modelview", matrix); + texaShader.SetUniformMatrix("modelview", matrix); + pointShader.SetUniformMatrix("modelview", matrix); +} + +void IndexedMeshRenderer::SetProjection(const double *matrix) { + colShader.SetUniformMatrix("projection", matrix); + texShader.SetUniformMatrix("projection", matrix); + texaShader.SetUniformMatrix("projection", matrix); + pointShader.SetUniformMatrix("projection", matrix); +} + +void IndexedMeshRenderer::UseFilled(const Canvas::Fill &fill) { + if(fill.texture) { + selectedShader = (fill.texture->format == Pixmap::Format::A) ? &texaShader : &texShader; + } else { + selectedShader = &colShader; + } + selectedShader->SetUniformColor("color", fill.color); +} + +void IndexedMeshRenderer::UsePoint(const Canvas::Stroke &stroke, double pixel) { + pointShader.SetUniformColor("color", stroke.color); + pointShader.SetUniformFloat("width", (float)(stroke.width * pixel / 2.0)); + pointShader.SetUniformFloat("pixel", (float)pixel); + selectedShader = &pointShader; +} + +} diff --git a/src/render/gl3shader.h b/src/render/gl3shader.h new file mode 100644 index 0000000..19f7312 --- /dev/null +++ b/src/render/gl3shader.h @@ -0,0 +1,271 @@ +//----------------------------------------------------------------------------- +// OpenGL ES 2.0 and OpenGL 3.0 shader interface. +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +#ifndef SOLVESPACE_GL3SHADER_H +#define SOLVESPACE_GL3SHADER_H + +#if defined(WIN32) || defined(__EMSCRIPTEN__) +# define GL_APICALL /*static linkage*/ +# define GL_GLEXT_PROTOTYPES +# include +# include +# define HAVE_GLES +#elif defined(__APPLE__) +# include +#else +# define GL_GLEXT_PROTOTYPES +# include +# include +#endif + +#include +#include + +#include "sketch.h" + +#if !defined(HAVE_GLES) +// glDepthRange is in GL1+ but not GLES2, glDepthRangef is in GL4.1+ and GLES2. +// Consistency! +# define glClearDepthf glClearDepth +# define glDepthRangef glDepthRange +#endif + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Floating-point data structures; the layout of these must match shaders +//----------------------------------------------------------------------------- + +class Vector2f { +public: + float x, y; + + static Vector2f From(float x, float y); + static Vector2f From(double x, double y); + static Vector2f FromInt(uint32_t x, uint32_t y); +}; + +class Vector3f { +public: + float x, y, z; + + static Vector3f From(float x, float y, float z); + static Vector3f From(const Vector &v); + static Vector3f From(const RgbaColor &c); +}; + +class Vector4f { +public: + float x, y, z, w; + + static Vector4f From(float x, float y, float z, float w); + static Vector4f From(const Vector &v, float w); + static Vector4f FromInt(uint32_t x, uint32_t y, uint32_t z, uint32_t w); + static Vector4f From(const RgbaColor &c); +}; + +//----------------------------------------------------------------------------- +// Wrappers for our shaders +//----------------------------------------------------------------------------- + +class Shader { +public: + GLuint program = 0; + + void Init(const std::string &vertexRes, + const std::string &fragmentRes, + const std::vector> &locations = {}); + void Clear(); + + void SetUniformMatrix(const char *name, const double *md); + void SetUniformVector(const char *name, const Vector &v); + void SetUniformVector(const char *name, const Vector4f &v); + void SetUniformColor(const char *name, RgbaColor c); + void SetUniformFloat(const char *name, float v); + void SetUniformInt(const char *name, GLint v); + void SetUniformTextureUnit(const char *name, GLint index); + void Enable() const; + void Disable() const; +}; + +class MeshRenderer { +public: + const GLint ATTRIB_POS = 0; + const GLint ATTRIB_NOR = 1; + const GLint ATTRIB_COL = 2; + + struct MeshVertex { + Vector3f pos; + Vector3f nor; + Vector4f col; + }; + + struct Handle { + GLuint vertexBuffer; + GLsizei size; + }; + + Shader lightShader; + Shader fillShader; + Shader *selectedShader = NULL; + + void Init(); + void Clear(); + + Handle Add(const SMesh &m, bool dynamic = false); + void Remove(const Handle &handle); + void Draw(const Handle &handle, bool useColors = true, RgbaColor overrideColor = {}); + void Draw(const SMesh &mesh, bool useColors = true, RgbaColor overrideColor = {}); + + void SetModelview(double *matrix); + void SetProjection(double *matrix); + + void UseShaded(const Lighting &lighting); + void UseFilled(const Canvas::Fill &fill); +}; + +class StippleAtlas { +public: + std::vector patterns; + + void Init(); + void Clear(); + + GLint GetTexture(StipplePattern pattern) const; + double GetLength(StipplePattern pattern) const; +}; + +class EdgeRenderer { +public: + const GLint ATTRIB_POS = 0; + const GLint ATTRIB_LOC = 1; + const GLint ATTRIB_TAN = 2; + + struct EdgeVertex { + Vector3f pos; + Vector3f loc; + Vector3f tan; + }; + + struct Handle { + GLuint vertexBuffer; + GLuint indexBuffer; + GLsizei size; + }; + + Shader shader; + + const StippleAtlas *atlas = NULL; + StipplePattern pattern = StipplePattern::CONTINUOUS; + + void Init(const StippleAtlas *atlas); + void Clear(); + + Handle Add(const SEdgeList &edges, bool dynamic = false); + void Remove(const Handle &handle); + void Draw(const Handle &handle); + void Draw(const SEdgeList &edges); + + void SetModelview(const double *matrix); + void SetProjection(const double *matrix); + void SetStroke(const Canvas::Stroke &stroke, double pixel); +}; + +class OutlineRenderer { +public: + const GLint ATTRIB_POS = 0; + const GLint ATTRIB_LOC = 1; + const GLint ATTRIB_TAN = 2; + const GLint ATTRIB_NOL = 3; + const GLint ATTRIB_NOR = 4; + + struct OutlineVertex { + Vector3f pos; + Vector4f loc; + Vector3f tan; + Vector3f nol; + Vector3f nor; + }; + + struct Handle { + GLuint vertexBuffer; + GLuint indexBuffer; + GLsizei size; + }; + + Shader shader; + + const StippleAtlas *atlas = NULL; + StipplePattern pattern = StipplePattern::CONTINUOUS; + + void Init(const StippleAtlas *atlas); + void Clear(); + + Handle Add(const SOutlineList &outlines, bool dynamic = false); + void Remove(const Handle &handle); + void Draw(const Handle &handle, Canvas::DrawOutlinesAs mode); + void Draw(const SOutlineList &outlines, Canvas::DrawOutlinesAs mode); + + void SetModelview(const double *matrix); + void SetProjection(const double *matrix); + void SetStroke(const Canvas::Stroke &stroke, double pixel); +}; + +class SIndexedMesh { +public: + struct Vertex { + Vector3f pos; + Vector2f tex; + }; + + std::vector vertices; + std::vector indices; + + void AddPoint(const Vector &p); + void AddQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d); + void AddPixmap(const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb); + + void Clear(); +}; + +class IndexedMeshRenderer { +public: + const GLint ATTRIB_POS = 0; + const GLint ATTRIB_TEX = 1; + + struct Handle { + GLuint vertexBuffer; + GLuint indexBuffer; + GLsizei size; + }; + + Shader texShader; + Shader texaShader; + Shader colShader; + Shader pointShader; + + Shader *selectedShader = NULL; + + void Init(); + void Clear(); + + Handle Add(const SIndexedMesh &m, bool dynamic = false); + void Remove(const Handle &handle); + void Draw(const Handle &handle); + void Draw(const SIndexedMesh &mesh); + + void SetModelview(const double *matrix); + void SetProjection(const double *matrix); + + bool NeedsTexture() const; + + void UseFilled(const Canvas::Fill &fill); + void UsePoint(const Canvas::Stroke &stroke, double pixel); +}; + +} + +#endif diff --git a/src/render/render.cpp b/src/render/render.cpp new file mode 100644 index 0000000..89434c2 --- /dev/null +++ b/src/render/render.cpp @@ -0,0 +1,459 @@ +//----------------------------------------------------------------------------- +// Backend-agnostic rendering interface, and various backends we use. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Camera transformations. +//----------------------------------------------------------------------------- + +Point2d Camera::ProjectPoint(Vector p) const { + Vector p3 = ProjectPoint3(p); + Point2d p2 = { p3.x, p3.y }; + return p2; +} + +Vector Camera::ProjectPoint3(Vector p) const { + double w; + Vector r = ProjectPoint4(p, &w); + return r.ScaledBy(scale/w); +} + +Vector Camera::ProjectPoint4(Vector p, double *w) const { + p = p.Plus(offset); + + Vector r; + r.x = p.Dot(projRight); + r.y = p.Dot(projUp); + r.z = p.Dot(projUp.Cross(projRight)); + + *w = 1 + r.z*tangent*scale; + return r; +} + +Vector Camera::UnProjectPoint(Point2d p) const { + Vector orig = offset.ScaledBy(-1); + + // Note that we're ignoring the effects of perspective. Since our returned + // point has the same component normal to the screen as the offset, it + // will have z = 0 after the rotation is applied, thus w = 1. So this is + // correct. + orig = orig.Plus(projRight.ScaledBy(p.x / scale)).Plus( + projUp. ScaledBy(p.y / scale)); + return orig; +} + +Vector Camera::UnProjectPoint3(Vector p) const { + p.z = p.z / (scale - p.z * tangent * scale); + double w = 1 + p.z * tangent * scale; + p.x *= w / scale; + p.y *= w / scale; + + Vector orig = offset.ScaledBy(-1); + orig = orig.Plus(projRight.ScaledBy(p.x)).Plus( + projUp. ScaledBy(p.y).Plus( + projUp.Cross(projRight). ScaledBy(p.z))); + return orig; +} + +Vector Camera::VectorFromProjs(Vector rightUpForward) const { + Vector n = projRight.Cross(projUp); + + Vector r = (projRight.ScaledBy(rightUpForward.x)); + r = r.Plus(projUp.ScaledBy(rightUpForward.y)); + r = r.Plus(n.ScaledBy(rightUpForward.z)); + return r; +} + +Vector Camera::AlignToPixelGrid(Vector v) const { + if(!gridFit) return v; + + v = ProjectPoint3(v); + v.x = floor(v.x) + 0.5; + v.y = floor(v.y) + 0.5; + return UnProjectPoint3(v); +} + +SBezier Camera::ProjectBezier(SBezier b) const { + Quaternion q = Quaternion::From(projRight, projUp); + q = q.Inverse(); + // we want Q*(p - o) = Q*p - Q*o + b = b.TransformedBy(q.Rotate(offset).ScaledBy(scale), q, scale); + for(int i = 0; i <= b.deg; i++) { + Vector4 ct = Vector4::From(b.weight[i], b.ctrl[i]); + // so the desired curve, before perspective, is + // (x/w, y/w, z/w) + // and after perspective is + // ((x/w)/(1 - (z/w)*tangent, ... + // = (x/(w - z*tangent), ... + // so we want to let w' = w - z*tangent + ct.w = ct.w - ct.z*tangent; + + b.ctrl[i] = ct.PerspectiveProject(); + b.weight[i] = ct.w; + } + return b; +} + +void Camera::LoadIdentity() { + offset = { 0.0, 0.0, 0.0 }; + projRight = { 1.0, 0.0, 0.0 }; + projUp = { 0.0, 1.0, 0.0 }; + scale = 1.0; + tangent = 0.0; +} + +void Camera::NormalizeProjectionVectors() { + if(projRight.Magnitude() < LENGTH_EPS) { + projRight = Vector::From(1, 0, 0); + } + + Vector norm = projRight.Cross(projUp); + // If projRight and projUp somehow ended up parallel, then pick an + // arbitrary projUp normal to projRight. + if(norm.Magnitude() < LENGTH_EPS) { + norm = projRight.Normal(0); + } + projUp = norm.Cross(projRight); + + projUp = projUp.WithMagnitude(1); + projRight = projRight.WithMagnitude(1); +} + +//----------------------------------------------------------------------------- +// Stroke and fill caching. +//----------------------------------------------------------------------------- + +bool Canvas::Stroke::Equals(const Stroke &other) const { + return (layer == other.layer && + zIndex == other.zIndex && + color.Equals(other.color) && + width == other.width && + unit == other.unit && + stipplePattern == other.stipplePattern && + stippleScale == other.stippleScale); +} + +double Canvas::Stroke::WidthMm(const Camera &camera) const { + switch(unit) { + case Canvas::Unit::MM: + return width; + case Canvas::Unit::PX: + return width / camera.scale; + default: + ssassert(false, "Unexpected unit"); + } +} + +double Canvas::Stroke::WidthPx(const Camera &camera) const { + switch(unit) { + case Canvas::Unit::MM: + return width * camera.scale; + case Canvas::Unit::PX: + return width; + default: + ssassert(false, "Unexpected unit"); + } +} + +double Canvas::Stroke::StippleScaleMm(const Camera &camera) const { + switch(unit) { + case Canvas::Unit::MM: + return stippleScale; + case Canvas::Unit::PX: + return stippleScale / camera.scale; + default: + ssassert(false, "Unexpected unit"); + } +} + +double Canvas::Stroke::StippleScalePx(const Camera &camera) const { + switch(unit) { + case Canvas::Unit::MM: + return stippleScale * camera.scale; + case Canvas::Unit::PX: + return stippleScale; + default: + ssassert(false, "Unexpected unit"); + } +} + +bool Canvas::Fill::Equals(const Fill &other) const { + return (layer == other.layer && + zIndex == other.zIndex && + color.Equals(other.color) && + pattern == other.pattern && + texture == other.texture); +} + +void Canvas::Clear() { + strokes.Clear(); + fills.Clear(); +} + +Canvas::hStroke Canvas::GetStroke(const Stroke &stroke) { + for(const Stroke &s : strokes) { + if(s.Equals(stroke)) return s.h; + } + Stroke strokeCopy = stroke; + return strokes.AddAndAssignId(&strokeCopy); +} + +Canvas::hFill Canvas::GetFill(const Fill &fill) { + for(const Fill &f : fills) { + if(f.Equals(fill)) return f.h; + } + Fill fillCopy = fill; + return fills.AddAndAssignId(&fillCopy); +} + +BitmapFont *Canvas::GetBitmapFont() { + if(bitmapFont.IsEmpty()) { + bitmapFont = BitmapFont::Create(); + } + return &bitmapFont; +} + +std::shared_ptr Canvas::CreateBatch() { + return std::shared_ptr(); +} + +//----------------------------------------------------------------------------- +// An interface for view-independent visualization +//----------------------------------------------------------------------------- + +const Camera &BatchCanvas::GetCamera() const { + ssassert(false, "Geometry drawn on BatchCanvas must be independent from camera"); +} + +//----------------------------------------------------------------------------- +// A wrapper around Canvas that simplifies drawing UI in screen coordinates +//----------------------------------------------------------------------------- + +void UiCanvas::DrawLine(int x1, int y1, int x2, int y2, RgbaColor color, int width, int zIndex) { + Vector va = { (double)x1 + 0.5, (double)Flip(y1) + 0.5, 0.0 }, + vb = { (double)x2 + 0.5, (double)Flip(y2) + 0.5, 0.0 }; + + Canvas::Stroke stroke = {}; + stroke.layer = Canvas::Layer::NORMAL; + stroke.zIndex = zIndex; + stroke.width = (double)width; + stroke.color = color; + stroke.unit = Canvas::Unit::PX; + Canvas::hStroke hcs = canvas->GetStroke(stroke); + + canvas->DrawLine(va, vb, hcs); +} + +void UiCanvas::DrawRect(int l, int r, int t, int b, RgbaColor fillColor, RgbaColor outlineColor, + int zIndex) { + Vector va = { (double)l + 0.5, (double)Flip(b) + 0.5, 0.0 }, + vb = { (double)l + 0.5, (double)Flip(t) + 0.5, 0.0 }, + vc = { (double)r + 0.5, (double)Flip(t) + 0.5, 0.0 }, + vd = { (double)r + 0.5, (double)Flip(b) + 0.5, 0.0 }; + + if(!fillColor.IsEmpty()) { + Canvas::Fill fill = {}; + fill.layer = Canvas::Layer::NORMAL; + fill.zIndex = zIndex; + fill.color = fillColor; + Canvas::hFill hcf = canvas->GetFill(fill); + + canvas->DrawQuad(va, vb, vc, vd, hcf); + } + + if(!outlineColor.IsEmpty()) { + Canvas::Stroke stroke = {}; + stroke.layer = Canvas::Layer::NORMAL; + stroke.zIndex = zIndex; + stroke.width = 1.0; + stroke.color = outlineColor; + stroke.unit = Canvas::Unit::PX; + Canvas::hStroke hcs = canvas->GetStroke(stroke); + + canvas->DrawLine(va, vb, hcs); + canvas->DrawLine(vb, vc, hcs); + canvas->DrawLine(vc, vd, hcs); + canvas->DrawLine(vd, va, hcs); + } +} + +void UiCanvas::DrawPixmap(std::shared_ptr pm, int x, int y, int zIndex) { + Canvas::Fill fill = {}; + fill.layer = Canvas::Layer::NORMAL; + fill.zIndex = zIndex; + fill.color = { 255, 255, 255, 255 }; + Canvas::hFill hcf = canvas->GetFill(fill); + + canvas->DrawPixmap(pm, + { (double)x, (double)(flip ? Flip(y) - pm->height : y), 0.0 }, + { (double)pm->width, 0.0, 0.0 }, + { 0.0, (double)pm->height, 0.0 }, + { 0.0, 1.0 }, + { 1.0, 0.0 }, + hcf); +} + +void UiCanvas::DrawBitmapChar(char32_t codepoint, int x, int y, RgbaColor color, int zIndex) { + BitmapFont *font = canvas->GetBitmapFont(); + + Canvas::Fill fill = {}; + fill.layer = Canvas::Layer::NORMAL; + fill.zIndex = zIndex; + fill.color = color; + Canvas::hFill hcf = canvas->GetFill(fill); + + if(codepoint >= 0xe000 && codepoint <= 0xefff) { + // Special character, like a checkbox or a radio button + x -= 3; + } + + double s0, t0, s1, t1; + size_t w, h; + font->LocateGlyph(codepoint, &s0, &t0, &s1, &t1, &w, &h); + if(font->textureUpdated) { + // LocateGlyph modified the texture, reload it. + canvas->InvalidatePixmap(font->texture); + font->textureUpdated = false; + } + + canvas->DrawPixmap(font->texture, + { (double)x, (double)Flip(y), 0.0 }, + { (double)w, 0.0, 0.0 }, + { 0.0, (double) h, 0.0 }, + { s0, t1 }, + { s1, t0 }, + hcf); +} + +void UiCanvas::DrawBitmapText(const std::string &str, int x, int y, RgbaColor color, int zIndex) { + BitmapFont *font = canvas->GetBitmapFont(); + + for(char32_t codepoint : ReadUTF8(str)) { + DrawBitmapChar(codepoint, x, y, color, zIndex); + x += (int)font->GetWidth(codepoint) * 8; + } +} + +//----------------------------------------------------------------------------- +// A canvas that performs picking against drawn geometry. +//----------------------------------------------------------------------------- + +void ObjectPicker::DoCompare(double depth, double distance, int zIndex, int comparePosition) { + if(distance > selRadius) return; + if((zIndex == maxZIndex && distance < minDistance) || (zIndex > maxZIndex)) { + minDepth = depth; + minDistance = distance; + maxZIndex = zIndex; + position = comparePosition; + } +} + +void ObjectPicker::DoQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + int zIndex, int comparePosition) { + Point2d corners[4] = { + camera.ProjectPoint(a), + camera.ProjectPoint(b), + camera.ProjectPoint(c), + camera.ProjectPoint(d) + }; + double minNegative = VERY_NEGATIVE, + maxPositive = VERY_POSITIVE; + for(int i = 0; i < 4; i++) { + Point2d ap = corners[i], + bp = corners[(i + 1) % 4]; + double distance = point.DistanceToLineSigned(ap, bp.Minus(ap), /*asSegment=*/true); + if(distance < 0) minNegative = std::max(minNegative, distance); + if(distance > 0) maxPositive = std::min(maxPositive, distance); + } + + bool insideQuad = (minNegative == VERY_NEGATIVE || maxPositive == VERY_POSITIVE); + if(insideQuad) { + DoCompare(0, 0.0, zIndex, comparePosition); + } else { + double distance = std::min(fabs(minNegative), fabs(maxPositive)); + DoCompare(0, distance, zIndex, comparePosition); + } +} + +void ObjectPicker::DrawLine(const Vector &a, const Vector &b, hStroke hcs) { + Stroke *stroke = strokes.FindById(hcs); + Point2d ap = camera.ProjectPoint(a); + Point2d bp = camera.ProjectPoint(b); + double distance = point.DistanceToLine(ap, bp.Minus(ap), /*asSegment=*/true); + double depth = 0.5 * (camera.ProjectPoint3(a).z + camera.ProjectPoint3(b).z) ; + DoCompare(depth, distance - stroke->width / 2.0, stroke->zIndex); +} + +void ObjectPicker::DrawEdges(const SEdgeList &el, hStroke hcs) { + Stroke *stroke = strokes.FindById(hcs); + for(const SEdge &e : el.l) { + Point2d ap = camera.ProjectPoint(e.a); + Point2d bp = camera.ProjectPoint(e.b); + double distance = point.DistanceToLine(ap, bp.Minus(ap), /*asSegment=*/true); + double depth = 0.5 * (camera.ProjectPoint3(e.a).z + camera.ProjectPoint3(e.b).z) ; + DoCompare(depth, distance - stroke->width / 2.0, stroke->zIndex, e.auxB); + } +} + +void ObjectPicker::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) { + ssassert(false, "Not implemented"); +} + +void ObjectPicker::DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) { + Stroke *stroke = strokes.FindById(hcs); + double w = VectorFont::Builtin()-> GetWidth(height, text), + h = VectorFont::Builtin()->GetHeight(height); + DoQuad(o, + o.Plus(v.ScaledBy(h)), + o.Plus(u.ScaledBy(w)).Plus(v.ScaledBy(h)), + o.Plus(u.ScaledBy(w)), + stroke->zIndex); +} + +void ObjectPicker::DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) { + Fill *fill = fills.FindById(hcf); + DoQuad(a, b, c, d, fill->zIndex); +} + +void ObjectPicker::DrawPoint(const Vector &o, Canvas::hStroke hcs) { + Stroke *stroke = strokes.FindById(hcs); + double distance = point.DistanceTo(camera.ProjectPoint(o)) - stroke->width / 2; + double depth = camera.ProjectPoint3(o).z; + DoCompare(depth, distance, stroke->zIndex); +} + +void ObjectPicker::DrawPolygon(const SPolygon &p, hFill hcf) { + ssassert(false, "Not implemented"); +} + +void ObjectPicker::DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) { + ssassert(false, "Not implemented"); +} + +void ObjectPicker::DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) { + ssassert(false, "Not implemented"); +} + +void ObjectPicker::DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, Canvas::hFill hcf) { + DrawQuad(o, o.Plus(u), o.Plus(u).Plus(v), o.Plus(v), hcf); +} + +bool ObjectPicker::Pick(const std::function &drawFn) { + minDepth = VERY_POSITIVE; + minDistance = VERY_POSITIVE; + maxZIndex = INT_MIN; + + drawFn(); + return minDistance < selRadius; +} +} diff --git a/src/render/render.h b/src/render/render.h new file mode 100644 index 0000000..6a4ef62 --- /dev/null +++ b/src/render/render.h @@ -0,0 +1,408 @@ +//----------------------------------------------------------------------------- +// Backend-agnostic rendering interface, and various backends we use. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_RENDER_H +#define SOLVESPACE_RENDER_H + +#include +#include +#include +#include +#include +#include + +#include "dsc.h" +#include "resource.h" +#include "srf/surface.h" + +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Interfaces common for all renderers +//----------------------------------------------------------------------------- + +class Pixmap; + +enum class StipplePattern : uint32_t; + +// A mapping from 3d sketch coordinates to 2d screen coordinates, using +// an axonometric projection. +class Camera { +public: + double width; + double height; + double pixelRatio; + bool gridFit; + Vector offset; + Vector projRight; + Vector projUp; + double scale; + double tangent; + + bool IsPerspective() const { return tangent != 0.0; } + + Point2d ProjectPoint(Vector p) const; + Vector ProjectPoint3(Vector p) const; + Vector ProjectPoint4(Vector p, double *w) const; + Vector UnProjectPoint(Point2d p) const; + Vector UnProjectPoint3(Vector p) const; + Vector VectorFromProjs(Vector rightUpForward) const; + Vector AlignToPixelGrid(Vector v) const; + + SBezier ProjectBezier(SBezier b) const; + + void LoadIdentity(); + void NormalizeProjectionVectors(); +}; + +// A description of scene lighting. +class Lighting { +public: + RgbaColor backgroundColor; + double ambientIntensity; + double lightIntensity[2]; + Vector lightDirection[2]; +}; + +class BatchCanvas; + +// An interface for populating a drawing area with geometry. +class Canvas { +public: + // Stroke and fill styles are addressed with handles to be able to quickly + // group geometry into indexed draw calls. + class hStroke { + public: + uint32_t v; + }; + + class hFill { + public: + uint32_t v; + }; + + // The layer of a geometry describes how it occludes other geometry. + // Within a layer, geometry with higher z-index occludes geometry with lower z-index, + // or geometry drawn earlier if z-indexes match. + enum class Layer { + NORMAL, // Occluded by geometry with lower Z coordinate + OCCLUDED, // Only drawn over geometry with lower Z coordinate + DEPTH_ONLY, // Like NORMAL, but only affects future occlusion, not color + BACK, // Always drawn below all other geometry + FRONT, // Always drawn above all other geometry + LAST = FRONT + }; + + // The outlines are the collection of all edges that may be drawn. + // Outlines can be classified as emphasized or not; emphasized outlines indicate an abrupt + // change in the surface curvature. These are indicated by the SOutline tag. + // Outlines can also be classified as contour or not; contour outlines indicate the boundary + // of the filled mesh. Whether an outline is a part of contour or not depends on point of view. + enum class DrawOutlinesAs { + EMPHASIZED_AND_CONTOUR = 0, // Both emphasized and contour outlines + EMPHASIZED_WITHOUT_CONTOUR = 1, // Emphasized outlines except those also belonging to contour + CONTOUR_ONLY = 2 // Contour outlines only + }; + + // Stroke widths, etc, can be scale-invariant (in pixels) or scale-dependent (in millimeters). + enum class Unit { + MM, + PX + }; + + class Stroke { + public: + hStroke h; + + Layer layer; + int zIndex; + RgbaColor color; + double width; + Unit unit; + StipplePattern stipplePattern; + double stippleScale; + + void Clear() { *this = {}; } + bool Equals(const Stroke &other) const; + + double WidthMm(const Camera &camera) const; + double WidthPx(const Camera &camera) const; + double StippleScaleMm(const Camera &camera) const; + double StippleScalePx(const Camera &camera) const; + }; + + enum class FillPattern { + SOLID, CHECKERED_A, CHECKERED_B + }; + + class Fill { + public: + hFill h; + + Layer layer; + int zIndex; + RgbaColor color; + FillPattern pattern; + std::shared_ptr texture; + + void Clear() { *this = {}; } + bool Equals(const Fill &other) const; + }; + + IdList strokes = {}; + IdList fills = {}; + BitmapFont bitmapFont = {}; + + virtual void Clear(); + virtual ~Canvas() = default; + + hStroke GetStroke(const Stroke &stroke); + hFill GetFill(const Fill &fill); + BitmapFont *GetBitmapFont(); + + virtual const Camera &GetCamera() const = 0; + + virtual void DrawLine(const Vector &a, const Vector &b, hStroke hcs) = 0; + virtual void DrawEdges(const SEdgeList &el, hStroke hcs) = 0; + virtual bool DrawBeziers(const SBezierList &bl, hStroke hcs) = 0; + virtual void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) = 0; + virtual void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) = 0; + + virtual void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) = 0; + virtual void DrawPoint(const Vector &o, hStroke hcs) = 0; + virtual void DrawPolygon(const SPolygon &p, hFill hcf) = 0; + virtual void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack = {}) = 0; + virtual void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) = 0; + + virtual void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) = 0; + virtual void InvalidatePixmap(std::shared_ptr pm) = 0; + + virtual std::shared_ptr CreateBatch(); +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +template<> +struct IsHandleOracle : std::true_type {}; + + +// An interface for view-dependent visualization. +class ViewportCanvas : public Canvas { +public: + virtual void SetCamera(const Camera &camera) = 0; + virtual void SetLighting(const Lighting &lighting) = 0; + + virtual void StartFrame() = 0; + virtual void FlushFrame() = 0; + virtual void FinishFrame() = 0; + virtual std::shared_ptr ReadFrame() = 0; + + virtual void GetIdent(const char **vendor, const char **renderer, const char **version) = 0; +}; + +// An interface for view-independent visualization. +class BatchCanvas : public Canvas { +public: + const Camera &GetCamera() const override; + + virtual void Finalize() = 0; + virtual void Draw() = 0; +}; + +// A wrapper around Canvas that simplifies drawing UI in screen coordinates. +class UiCanvas { +public: + std::shared_ptr canvas; + bool flip = false; + + void DrawLine(int x1, int y1, int x2, int y2, RgbaColor color, int width = 1, + int zIndex = 0); + void DrawRect(int l, int r, int t, int b, RgbaColor fillColor, RgbaColor outlineColor, + int zIndex = 0); + void DrawPixmap(std::shared_ptr pm, int x, int y, + int zIndex = 0); + void DrawBitmapChar(char32_t codepoint, int x, int y, RgbaColor color, + int zIndex = 0); + void DrawBitmapText(const std::string &str, int x, int y, RgbaColor color, + int zIndex = 0); + + int Flip(int y) const { return flip ? (int)canvas->GetCamera().height - y : y; } +}; + +// A canvas that performs picking against drawn geometry. +class ObjectPicker : public Canvas { +public: + Camera camera = {}; + // Configuration. + Point2d point = {}; + double selRadius = 0.0; + // Picking state. + double minDistance = 0.0; + double minDepth = 1e10; + int maxZIndex = 0; + uint32_t position = 0; + + const Camera &GetCamera() const override { return camera; } + + void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override; + void DrawEdges(const SEdgeList &el, hStroke hcs) override; + bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { return false; } + void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override; + void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) override; + + void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) override; + void DrawPoint(const Vector &o, hStroke hcs) override; + void DrawPolygon(const SPolygon &p, hFill hcf) override; + void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) override; + void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) override; + + void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) override; + void InvalidatePixmap(std::shared_ptr pm) override {} + + void DoCompare(double depth, double distance, int zIndex, int comparePosition = 0); + void DoQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + int zIndex, int comparePosition = 0); + + bool Pick(const std::function &drawFn); +}; + +template +using handle_map = std::map; + +// A canvas that renders onto a 2d surface, performing z-index sorting, occlusion testing, etc, +// on the CPU. +class SurfaceRenderer : public ViewportCanvas { +public: + Camera camera = {}; + Lighting lighting = {}; + // Chord tolerance, for converting beziers to pwl. + double chordTolerance = 0.0; + // Render lists. + handle_map edges; + handle_map beziers; + SMesh mesh = {}; + // State. + BBox bbox = {}; + + void Clear() override; + + // Canvas interface. + const Camera &GetCamera() const override { return camera; } + + // ViewportCanvas interface. + void SetCamera(const Camera &cam) override { this->camera = cam; } + void SetLighting(const Lighting &light) override { this->lighting = light; } + + void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override; + void DrawEdges(const SEdgeList &el, hStroke hcs) override; + bool DrawBeziers(const SBezierList &bl, hStroke hcs) override; + void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override; + void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) override; + + void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) override; + void DrawPoint(const Vector &o, hStroke hcs) override; + void DrawPolygon(const SPolygon &p, hFill hcf) override; + void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) override; + void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) override; + + void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) override; + void InvalidatePixmap(std::shared_ptr pm) override; + + // Geometry manipulation. + void CalculateBBox(); + void ConvertBeziersToEdges(); + void CullOccludedStrokes(); + + // Renderer operations. + void OutputInPaintOrder(); + + virtual bool CanOutputCurves() const = 0; + virtual bool CanOutputTriangles() const = 0; + + virtual void OutputStart() = 0; + virtual void OutputBezier(const SBezier &b, hStroke hcs) = 0; + virtual void OutputTriangle(const STriangle &tr) = 0; + virtual void OutputEnd() = 0; + + void OutputBezierAsNonrationalCubic(const SBezier &b, hStroke hcs); +}; + +//----------------------------------------------------------------------------- +// 2d renderers +//----------------------------------------------------------------------------- + +class CairoRenderer : public SurfaceRenderer { +public: + cairo_t *context = NULL; + // Renderer configuration. + bool antialias = false; + // Renderer state. + struct { + hStroke hcs; + } current = {}; + + void Clear() override; + + void StartFrame() override {} + void FlushFrame() override; + void FinishFrame() override {} + std::shared_ptr ReadFrame() override; + + void GetIdent(const char **vendor, const char **renderer, const char **version) override; + + void SelectStroke(hStroke hcs); + void MoveTo(Vector p); + void FinishPath(); + + bool CanOutputCurves() const override { return true; } + bool CanOutputTriangles() const override { return true; } + + void OutputStart() override; + void OutputBezier(const SBezier &b, hStroke hcs) override; + void OutputTriangle(const STriangle &tr) override; + void OutputEnd() override; +}; + +class CairoPixmapRenderer final : public CairoRenderer { +public: + std::shared_ptr pixmap; + + cairo_surface_t *surface = NULL; + + void Init(); + void Clear() override; + + std::shared_ptr ReadFrame() override; +}; + +//----------------------------------------------------------------------------- +// Factories +//----------------------------------------------------------------------------- + +std::shared_ptr CreateRenderer(); + +} // namespace SolveSpace + +#endif diff --git a/src/render/render2d.cpp b/src/render/render2d.cpp new file mode 100644 index 0000000..732e3ca --- /dev/null +++ b/src/render/render2d.cpp @@ -0,0 +1,413 @@ +//----------------------------------------------------------------------------- +// Rendering projections to 2d surfaces: z-sorting, occlusion testing, etc. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +// FIXME: The export coordinate system has a different handedness than display +// coordinate system; lighting and occlusion calculations are right-handed. +static Vector ProjectPoint3RH(const Camera &camera, Vector p) { + p = p.Plus(camera.offset); + + Vector r; + r.x = p.Dot(camera.projRight); + r.y = p.Dot(camera.projUp); + r.z = p.Dot(camera.projRight.Cross(camera.projUp)); + + double w = 1 + r.z*camera.tangent*camera.scale; + return r.ScaledBy(camera.scale/w); +} + +//----------------------------------------------------------------------------- +// Accumulation of geometry +//----------------------------------------------------------------------------- + +void SurfaceRenderer::DrawLine(const Vector &a, const Vector &b, hStroke hcs) { + edges[hcs].AddEdge(ProjectPoint3RH(camera, a), + ProjectPoint3RH(camera, b)); +} + +void SurfaceRenderer::DrawEdges(const SEdgeList &el, hStroke hcs) { + for(const SEdge &e : el.l) { + edges[hcs].AddEdge(ProjectPoint3RH(camera, e.a), + ProjectPoint3RH(camera, e.b)); + } +} + +bool SurfaceRenderer::DrawBeziers(const SBezierList &bl, hStroke hcs) { + if(!CanOutputCurves()) + return false; + + for(const SBezier &b : bl.l) { + SBezier pb = camera.ProjectBezier(b); + beziers[hcs].l.Add(&pb); + } + return true; +} + +void SurfaceRenderer::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) { + Vector projDir = camera.projRight.Cross(camera.projUp); + for(const SOutline &o : ol.l) { + if(drawAs == DrawOutlinesAs::EMPHASIZED_AND_CONTOUR && + !(o.IsVisible(projDir) || o.tag != 0)) + continue; + if(drawAs == DrawOutlinesAs::EMPHASIZED_WITHOUT_CONTOUR && + !(!o.IsVisible(projDir) && o.tag != 0)) + continue; + if(drawAs == DrawOutlinesAs::CONTOUR_ONLY && + !(o.IsVisible(projDir))) + continue; + + edges[hcs].AddEdge(ProjectPoint3RH(camera, o.a), + ProjectPoint3RH(camera, o.b)); + } +} + +void SurfaceRenderer::DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) { + auto traceEdge = [&](Vector a, Vector b) { + edges[hcs].AddEdge(ProjectPoint3RH(camera, a), + ProjectPoint3RH(camera, b)); + }; + VectorFont::Builtin()->Trace(height, o, u, v, text, traceEdge, camera); +} + +void SurfaceRenderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) { + Fill *fill = fills.FindById(hcf); + ssassert(fill->layer == Layer::NORMAL || + fill->layer == Layer::DEPTH_ONLY || + fill->layer == Layer::FRONT || + fill->layer == Layer::BACK, "Unexpected mesh layer"); + + Vector zOffset = {}; + if(fill->layer == Layer::BACK) { + zOffset.z -= 1e6; + } else if(fill->layer == Layer::FRONT) { + zOffset.z += 1e6; + } + zOffset.z += camera.scale * fill->zIndex; + + STriMeta meta = {}; + if(fill->layer != Layer::DEPTH_ONLY) { + meta.color = fill->color; + } + Vector ta = ProjectPoint3RH(camera, a).Plus(zOffset), + tb = ProjectPoint3RH(camera, b).Plus(zOffset), + tc = ProjectPoint3RH(camera, c).Plus(zOffset), + td = ProjectPoint3RH(camera, d).Plus(zOffset); + mesh.AddTriangle(meta, tc, tb, ta); + mesh.AddTriangle(meta, ta, td, tc); +} + +void SurfaceRenderer::DrawPoint(const Vector &o, Canvas::hStroke hcs) { + Stroke *stroke = strokes.FindById(hcs); + + Fill fill = {}; + fill.layer = stroke->layer; + fill.zIndex = stroke->zIndex; + fill.color = stroke->color; + hFill hcf = GetFill(fill); + + Vector u = camera.projRight.ScaledBy(stroke->width/2.0/camera.scale), + v = camera.projUp.ScaledBy(stroke->width/2.0/camera.scale); + DrawQuad(o.Minus(u).Minus(v), o.Minus(u).Plus(v), + o.Plus(u).Plus(v), o.Plus(u).Minus(v), hcf); +} + +void SurfaceRenderer::DrawPolygon(const SPolygon &p, hFill hcf) { + SMesh m = {}; + p.TriangulateInto(&m); + DrawMesh(m, hcf, {}); + m.Clear(); +} + +void SurfaceRenderer::DrawMesh(const SMesh &m, + hFill hcfFront, hFill hcfBack) { + Fill *fill = fills.FindById(hcfFront); + ssassert(fill->layer == Layer::NORMAL || + fill->layer == Layer::DEPTH_ONLY, "Unexpected mesh layer"); + + Vector l0 = (lighting.lightDirection[0]).WithMagnitude(1), + l1 = (lighting.lightDirection[1]).WithMagnitude(1); + for(STriangle tr : m.l) { + tr.a = ProjectPoint3RH(camera, tr.a); + tr.b = ProjectPoint3RH(camera, tr.b); + tr.c = ProjectPoint3RH(camera, tr.c); + + if(CanOutputTriangles() && fill->layer == Layer::NORMAL) { + if(fill->color.IsEmpty()) { + // Compute lighting, since we're going to draw the shaded triangles. + Vector n = tr.Normal().WithMagnitude(1); + double intensity = lighting.ambientIntensity + + max(0.0, (lighting.lightIntensity[0])*(n.Dot(l0))) + + max(0.0, (lighting.lightIntensity[1])*(n.Dot(l1))); + double r = min(1.0, tr.meta.color.redF() * intensity), + g = min(1.0, tr.meta.color.greenF() * intensity), + b = min(1.0, tr.meta.color.blueF() * intensity); + tr.meta.color = RGBf(r, g, b); + } else { + // We're going to draw this triangle, but it's not shaded. + tr.meta.color = fill->color; + } + } else { + // This triangle is just for occlusion testing. + tr.meta.color = {}; + } + mesh.AddTriangle(&tr); + } +} + +void SurfaceRenderer::DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) { + Fill *fill = fills.FindById(hcf); + ssassert(fill->layer == Layer::NORMAL || + fill->layer == Layer::DEPTH_ONLY, "Unexpected mesh layer"); + + Vector zOffset = {}; + zOffset.z += camera.scale * fill->zIndex; + + size_t facesSize = faces.size(); + for(STriangle tr : m.l) { + uint32_t face = tr.meta.face; + for(size_t j = 0; j < facesSize; j++) { + if(faces[j] != face) continue; + if(!fill->color.IsEmpty()) { + tr.meta.color = fill->color; + } + mesh.AddTriangle(tr.meta, + ProjectPoint3RH(camera, tr.a).Plus(zOffset), + ProjectPoint3RH(camera, tr.b).Plus(zOffset), + ProjectPoint3RH(camera, tr.c).Plus(zOffset)); + break; + } + } +} + +void SurfaceRenderer::DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) { + dbp("Not implemented"); +} + +void SurfaceRenderer::InvalidatePixmap(std::shared_ptr pm) { + dbp("Not implemented"); +} + +//----------------------------------------------------------------------------- +// Processing of geometry +//----------------------------------------------------------------------------- + +void SurfaceRenderer::CalculateBBox() { + bbox.minp = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); + bbox.maxp = Vector::From(VERY_NEGATIVE, VERY_NEGATIVE, VERY_NEGATIVE); + + for(auto &it : edges) { + SEdgeList &el = it.second; + for(SEdge &e : el.l) { + bbox.Include(e.a); + bbox.Include(e.b); + } + } + + for(auto &it : beziers) { + SBezierList &bl = it.second; + for(SBezier &b : bl.l) { + for(int i = 0; i <= b.deg; i++) { + bbox.Include(b.ctrl[i]); + } + } + } + + for(STriangle &tr : mesh.l) { + for(int i = 0; i < 3; i++) { + bbox.Include(tr.vertices[i]); + } + } +} + + +void SurfaceRenderer::ConvertBeziersToEdges() { + for(auto &it : beziers) { + hStroke hcs = it.first; + SBezierList &bl = it.second; + + SEdgeList &el = edges[hcs]; + for(const SBezier &b : bl.l) { + if(b.deg == 1) { + el.AddEdge(b.ctrl[0], b.ctrl[1]); + } else { + List lv = {}; + b.MakePwlInto(&lv, chordTolerance); + for(int i = 1; i < lv.n; i++) { + el.AddEdge(lv[i-1], lv[i]); + } + lv.Clear(); + } + } + bl.l.Clear(); + } + beziers.clear(); +} + +void SurfaceRenderer::CullOccludedStrokes() { + // Perform occlusion testing, if necessary. + if(mesh.l.IsEmpty()) + return; + + // We can't perform hidden line removal on exact curves. + ConvertBeziersToEdges(); + + // Remove hidden lines (on NORMAL layers), or remove visible lines (on OCCLUDED layers). + SKdNode *root = SKdNode::From(&mesh); + root->ClearTags(); + + int cnt = 1234; + for(auto &eit : edges) { + hStroke hcs = eit.first; + SEdgeList &el = eit.second; + + Stroke *stroke = strokes.FindById(hcs); + if(stroke->layer != Layer::NORMAL && + stroke->layer != Layer::OCCLUDED) continue; + + SEdgeList nel = {}; + for(const SEdge &e : el.l) { + SEdgeList oel = {}; + oel.AddEdge(e.a, e.b); + root->OcclusionTestLine(e, &oel, cnt); + + if(stroke->layer == Layer::OCCLUDED) { + for(SEdge &oe : oel.l) { + oe.tag = !oe.tag; + } + } + oel.l.RemoveTagged(); + + oel.MergeCollinearSegments(e.a, e.b); + for(const SEdge &oe : oel.l) { + nel.AddEdge(oe.a, oe.b); + } + + oel.Clear(); + cnt++; + } + + el.l.Clear(); + el.l = nel.l; + } +} + +void SurfaceRenderer::OutputInPaintOrder() { + // Sort our strokes in paint order. + std::vector> paintOrder; + paintOrder.emplace_back(Layer::NORMAL, 0); // mesh + for(const Stroke &cs : strokes) { + paintOrder.emplace_back(cs.layer, cs.zIndex); + } + + const Layer stackup[] = { + Layer::BACK, Layer::NORMAL, Layer::DEPTH_ONLY, Layer::OCCLUDED, Layer::FRONT + }; + std::sort(paintOrder.begin(), paintOrder.end(), + [&](std::pair a, std::pair b) { + Layer aLayer = a.first, + bLayer = b.first; + int aZIndex = a.second, + bZIndex = b.second; + + size_t aLayerIndex = + std::find(std::begin(stackup), std::end(stackup), aLayer) - std::begin(stackup); + size_t bLayerIndex = + std::find(std::begin(stackup), std::end(stackup), bLayer) - std::begin(stackup); + if(aLayerIndex == bLayerIndex) { + return aZIndex < bZIndex; + } else { + return aLayerIndex < bLayerIndex; + } + }); + + auto last = std::unique(paintOrder.begin(), paintOrder.end()); + paintOrder.erase(last, paintOrder.end()); + + // Output geometry in paint order. + OutputStart(); + for(auto &it : paintOrder) { + Layer layer = it.first; + int zIndex = it.second; + + if(layer == Layer::NORMAL && zIndex == 0) { + SMesh mp = {}; + SBsp3 *bsp = SBsp3::FromMesh(&mesh); + if(bsp) bsp->GenerateInPaintOrder(&mp); + + for(const STriangle &tr : mp.l) { + // Cull back-facing and invisible triangles. + if(tr.Normal().z < 0) continue; + if(tr.meta.color.IsEmpty()) continue; + OutputTriangle(tr); + } + + mp.Clear(); + } + + for(const auto &eit : edges) { + hStroke hcs = eit.first; + const SEdgeList &el = eit.second; + + Stroke *stroke = strokes.FindById(hcs); + if(stroke->layer != layer || stroke->zIndex != zIndex) continue; + + for(const SEdge &e : el.l) { + OutputBezier(SBezier::From(e.a, e.b), hcs); + } + } + + for(auto &bit : beziers) { + hStroke hcs = bit.first; + const SBezierList &bl = bit.second; + + Stroke *stroke = strokes.FindById(hcs); + if(stroke->layer != layer || stroke->zIndex != zIndex) continue; + + for(const SBezier &b : bl.l) { + OutputBezier(b, hcs); + } + } + } + OutputEnd(); +} + +void SurfaceRenderer::Clear() { + Canvas::Clear(); + + for(auto &eit : edges) { + SEdgeList &el = eit.second; + el.l.Clear(); + } + edges.clear(); + + for(auto &bit : beziers) { + SBezierList &bl = bit.second; + bl.l.Clear(); + } + beziers.clear(); + + mesh.Clear(); +} + +void SurfaceRenderer::OutputBezierAsNonrationalCubic(const SBezier &b, hStroke hcs) { + // Arbitrary choice of tolerance; make it a little finer than pwl tolerance since + // it should be easier to achieve that with the smooth curves. + SBezierList bl; + b.MakeNonrationalCubicInto(&bl, chordTolerance / 2); + for(const SBezier &cb : bl.l) { + OutputBezier(cb, hcs); + } + bl.Clear(); +} + +} diff --git a/src/render/rendercairo.cpp b/src/render/rendercairo.cpp new file mode 100644 index 0000000..e59de31 --- /dev/null +++ b/src/render/rendercairo.cpp @@ -0,0 +1,173 @@ +//----------------------------------------------------------------------------- +// A rendering backend that draws on a Cairo surface. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include +#include "solvespace.h" + +namespace SolveSpace { + +void CairoRenderer::Clear() { + SurfaceRenderer::Clear(); + + if(context != NULL) cairo_destroy(context); + context = NULL; +} + +void CairoRenderer::GetIdent(const char **vendor, const char **renderer, const char **version) { + *vendor = "Cairo"; + *renderer = "Cairo"; + *version = cairo_version_string(); +} + +void CairoRenderer::FlushFrame() { + CullOccludedStrokes(); + OutputInPaintOrder(); + + cairo_surface_flush(cairo_get_target(context)); +} + +std::shared_ptr CairoRenderer::ReadFrame() { + ssassert(false, "generic Cairo renderer does not support pixmap readout"); +} + +void CairoRenderer::OutputStart() { + cairo_save(context); + + RgbaColor bgColor = lighting.backgroundColor; + cairo_rectangle(context, 0.0, 0.0, (double)camera.width, (double)camera.height); + cairo_set_source_rgba(context, bgColor.redF(), bgColor.greenF(), bgColor.blueF(), + bgColor.alphaF()); + cairo_fill(context); + + cairo_translate(context, camera.width / 2.0, camera.height / 2.0); + + // Avoid pixel boundaries; when not using antialiasing, we would otherwise + // get numerically unstable output. + cairo_translate(context, 0.1, 0.1); + + cairo_set_line_join(context, CAIRO_LINE_JOIN_ROUND); + cairo_set_line_cap(context, CAIRO_LINE_CAP_ROUND); +} + +void CairoRenderer::OutputEnd() { + FinishPath(); + + cairo_restore(context); +} + +void CairoRenderer::SelectStroke(hStroke hcs) { + if(current.hcs == hcs) return; + FinishPath(); + + Stroke *stroke = strokes.FindById(hcs); + current.hcs = hcs; + + RgbaColor color = stroke->color; + std::vector dashes = StipplePatternDashes(stroke->stipplePattern); + for(double &dash : dashes) { + dash *= stroke->StippleScalePx(camera); + } + cairo_set_line_width(context, stroke->WidthPx(camera)); + cairo_set_dash(context, dashes.data(), (int)dashes.size(), 0); + cairo_set_source_rgba(context, color.redF(), color.greenF(), color.blueF(), + color.alphaF()); + if(antialias) { + cairo_set_antialias(context, CAIRO_ANTIALIAS_GRAY); + } else { + cairo_set_antialias(context, CAIRO_ANTIALIAS_NONE); + } +} + +void CairoRenderer::MoveTo(Vector p) { + Point2d pos; + cairo_get_current_point(context, &pos.x, &pos.y); + if(cairo_has_current_point(context) && pos.Equals(p.ProjectXy())) return; + FinishPath(); + + cairo_move_to(context, p.x, p.y); +} + +void CairoRenderer::FinishPath() { + if(!cairo_has_current_point(context)) return; + + cairo_stroke(context); +} + +void CairoRenderer::OutputBezier(const SBezier &b, hStroke hcs) { + SelectStroke(hcs); + + Vector c, n = Vector::From(0, 0, 1); + double r; + if(b.deg == 1) { + MoveTo(b.ctrl[0]); + cairo_line_to(context, + b.ctrl[1].x, b.ctrl[1].y); + } else if(b.IsCircle(n, &c, &r)) { + MoveTo(b.ctrl[0]); + double theta0 = atan2(b.ctrl[0].y - c.y, b.ctrl[0].x - c.x), + theta1 = atan2(b.ctrl[2].y - c.y, b.ctrl[2].x - c.x), + dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI); + if(dtheta > 0) { + cairo_arc(context, + c.x, c.y, r, theta0, theta1); + } else { + cairo_arc_negative(context, + c.x, c.y, r, theta0, theta1); + } + } else if(b.deg == 3 && !b.IsRational()) { + MoveTo(b.ctrl[0]); + cairo_curve_to(context, + b.ctrl[1].x, b.ctrl[1].y, + b.ctrl[2].x, b.ctrl[2].y, + b.ctrl[3].x, b.ctrl[3].y); + } else { + OutputBezierAsNonrationalCubic(b, hcs); + } +} + +void CairoRenderer::OutputTriangle(const STriangle &tr) { + FinishPath(); + current.hcs = {}; + + RgbaColor color = tr.meta.color; + cairo_set_source_rgba(context, color.redF(), color.greenF(), color.blueF(), + color.alphaF()); + cairo_set_antialias(context, CAIRO_ANTIALIAS_NONE); + cairo_move_to(context, tr.a.x, tr.a.y); + cairo_line_to(context, tr.b.x, tr.b.y); + cairo_line_to(context, tr.c.x, tr.c.y); + cairo_fill(context); +} + +void CairoPixmapRenderer::Init() { + Clear(); + + pixmap = std::make_shared(); + pixmap->format = Pixmap::Format::BGRA; + pixmap->width = (size_t)camera.width; + pixmap->height = (size_t)camera.height; + pixmap->stride = cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, (int)camera.width); + pixmap->data = std::vector(pixmap->stride * pixmap->height); + surface = + cairo_image_surface_create_for_data(&pixmap->data[0], CAIRO_FORMAT_RGB24, + pixmap->width, pixmap->height, + pixmap->stride); + context = cairo_create(surface); +} + +void CairoPixmapRenderer::Clear() { + CairoRenderer::Clear(); + + if(surface != NULL) cairo_surface_destroy(surface); + surface = NULL; +} + +std::shared_ptr CairoPixmapRenderer::ReadFrame() { + std::shared_ptr result = pixmap->Copy(); + result->ConvertTo(Pixmap::Format::RGBA); + return result; +} + +} diff --git a/src/render/rendergl1.cpp b/src/render/rendergl1.cpp new file mode 100644 index 0000000..a915c2b --- /dev/null +++ b/src/render/rendergl1.cpp @@ -0,0 +1,857 @@ +//----------------------------------------------------------------------------- +// OpenGL 1 based rendering interface. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include "solvespace.h" + +#ifdef WIN32 +// Include after solvespace.h to avoid identifier clashes. +# include // required by GL headers +#endif +#ifdef __APPLE__ +# include +# include +#else +# include +# include +#endif + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Checks for buggy OpenGL renderers +//----------------------------------------------------------------------------- + +// Intel GPUs with Mesa on *nix render thin lines poorly. +static bool HasIntelThinLineQuirk() +{ + static bool quirkChecked, quirkEnabled; + if(!quirkChecked) { + const char *ident = (const char*)glGetString(GL_VENDOR); + if(ident != NULL) { + quirkChecked = true; + quirkEnabled = !strcmp(ident, "Intel Open Source Technology Center"); + } + } + return quirkEnabled; +} + +// The default Windows GL renderer really does implement GL 1.1, +// and cannot handle non-power-of-2 textures, which is legal. +static bool HasGl1V1Quirk() +{ + static bool quirkChecked, quirkEnabled; + if(!quirkChecked) { + const char *ident = (const char*)glGetString(GL_VERSION); + if(ident != NULL) { + quirkChecked = true; + quirkEnabled = !strcmp(ident, "1.1.0"); + } + } + return quirkEnabled; +} + +//----------------------------------------------------------------------------- +// Thin wrappers around OpenGL functions to fix bugs, adapt them to our +// data structures, etc. +//----------------------------------------------------------------------------- + +static inline void ssglNormal3v(Vector n) { + glNormal3d(n.x, n.y, n.z); +} + +static inline void ssglVertex3v(Vector v) { + glVertex3d(v.x, v.y, v.z); +} + +void ssglLineWidth(double width) { + if(HasIntelThinLineQuirk() && width < 1.6) + width = 1.6; + + glLineWidth((GLfloat)width); +} + +static inline void ssglColorRGBA(RgbaColor color) { + glColor4d(color.redF(), color.greenF(), color.blueF(), color.alphaF()); +} + +static inline void ssglMaterialRGBA(GLenum side, RgbaColor color) { + GLfloat mpb[] = { color.redF(), color.greenF(), color.blueF(), color.alphaF() }; + glMaterialfv(side, GL_AMBIENT_AND_DIFFUSE, mpb); +} + +static void ssglDepthRange(Canvas::Layer layer, int zIndex) { + switch(layer) { + case Canvas::Layer::NORMAL: + case Canvas::Layer::FRONT: + case Canvas::Layer::BACK: + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + break; + + case Canvas::Layer::DEPTH_ONLY: + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + break; + + case Canvas::Layer::OCCLUDED: + glDepthFunc(GL_GREATER); + glDepthMask(GL_FALSE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + break; + } + + switch(layer) { + case Canvas::Layer::FRONT: + glDepthRange(0.0, 0.0); + break; + + case Canvas::Layer::BACK: + glDepthRange(1.0, 1.0); + break; + + case Canvas::Layer::NORMAL: + case Canvas::Layer::DEPTH_ONLY: + case Canvas::Layer::OCCLUDED: + // The size of this step depends on the resolution of the Z buffer; for + // a 16-bit buffer, this should be fine. + double offset = 1.0 / (65535 * 0.8) * zIndex; + glDepthRange(0.1 - offset, 1.0 - offset); + break; + } +} + +static void ssglFillPattern(Canvas::FillPattern pattern) { + static bool Init; + static GLubyte MaskA[(32*32)/8]; + static GLubyte MaskB[(32*32)/8]; + if(!Init) { + int x, y; + for(x = 0; x < 32; x++) { + for(y = 0; y < 32; y++) { + int i = y*4 + x/8, b = x % 8; + int ym = y % 4, xm = x % 4; + for(int k = 0; k < 2; k++) { + if(xm >= 1 && xm <= 2 && ym >= 1 && ym <= 2) { + (k == 0 ? MaskB : MaskA)[i] |= (0x80 >> b); + } + ym = (ym + 2) % 4; xm = (xm + 2) % 4; + } + } + } + Init = true; + } + + switch(pattern) { + case Canvas::FillPattern::SOLID: + glDisable(GL_POLYGON_STIPPLE); + break; + + case Canvas::FillPattern::CHECKERED_A: + glEnable(GL_POLYGON_STIPPLE); + glPolygonStipple(MaskA); + break; + + case Canvas::FillPattern::CHECKERED_B: + glEnable(GL_POLYGON_STIPPLE); + glPolygonStipple(MaskB); + break; + } +} + +//----------------------------------------------------------------------------- +// OpenGL 1 / compatibility profile based renderer +//----------------------------------------------------------------------------- + +class OpenGl1Renderer final : public ViewportCanvas { +public: + Camera camera; + Lighting lighting; + // Cached OpenGL state. + struct { + bool drawing; + GLenum mode; + hStroke hcs; + Stroke *stroke; + hFill hcf; + Fill *fill; + std::weak_ptr texture; + } current; + + // List-initialize current to work around MSVC bug 746973. + OpenGl1Renderer() : camera(), lighting(), current({}) {} + + const Camera &GetCamera() const override { return camera; } + + void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override; + void DrawEdges(const SEdgeList &el, hStroke hcs) override; + bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { return false; } + void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override; + void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) override; + + void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) override; + void DrawPoint(const Vector &o, hStroke hcs) override; + void DrawPolygon(const SPolygon &p, hFill hcf) override; + void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) override; + void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) override; + void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) override; + void InvalidatePixmap(std::shared_ptr pm) override; + + void SelectPrimitive(unsigned mode); + void UnSelectPrimitive(); + Stroke *SelectStroke(hStroke hcs); + Fill *SelectFill(hFill hcf); + void SelectTexture(std::shared_ptr pm); + void DoFatLineEndcap(const Vector &p, const Vector &u, const Vector &v); + void DoFatLine(const Vector &a, const Vector &b, double width); + void DoLine(const Vector &a, const Vector &b, hStroke hcs); + void DoPoint(Vector p, double radius); + void DoStippledLine(const Vector &a, const Vector &b, hStroke hcs, double phase = 0.0); + + void UpdateProjection(); + void SetCamera(const Camera &camera) override; + void SetLighting(const Lighting &lighting) override; + + void StartFrame() override; + void FlushFrame() override; + void FinishFrame() override; + std::shared_ptr ReadFrame() override; + + void GetIdent(const char **vendor, const char **renderer, const char **version) override; +}; + +//----------------------------------------------------------------------------- +// A simple OpenGL state tracker to group consecutive draw calls. +//----------------------------------------------------------------------------- + +void OpenGl1Renderer::SelectPrimitive(GLenum mode) { + if(current.drawing && current.mode == mode) { + return; + } else if(current.drawing) { + glEnd(); + } + glBegin(mode); + current.drawing = true; + current.mode = mode; +} + +void OpenGl1Renderer::UnSelectPrimitive() { + if(!current.drawing) return; + glEnd(); + current.drawing = false; +} + +Canvas::Stroke *OpenGl1Renderer::SelectStroke(hStroke hcs) { + if(current.hcs == hcs) return current.stroke; + + Stroke *stroke = strokes.FindById(hcs); + UnSelectPrimitive(); + ssglColorRGBA(stroke->color); + ssglDepthRange(stroke->layer, stroke->zIndex); + ssglLineWidth(stroke->WidthPx(camera)); + // Fat lines and points are quads affected by glPolygonStipple, so make sure + // they are displayed correctly. + ssglFillPattern(FillPattern::SOLID); + glDisable(GL_TEXTURE_2D); + + current.hcs = hcs; + current.stroke = stroke; + current.hcf = {}; + current.fill = NULL; + current.texture.reset(); + return stroke; +} + +Canvas::Fill *OpenGl1Renderer::SelectFill(hFill hcf) { + if(current.hcf == hcf) return current.fill; + + Fill *fill = fills.FindById(hcf); + UnSelectPrimitive(); + ssglColorRGBA(fill->color); + ssglDepthRange(fill->layer, fill->zIndex); + ssglFillPattern(fill->pattern); + glDisable(GL_TEXTURE_2D); + + current.hcs = {}; + current.stroke = NULL; + current.hcf = hcf; + current.fill = fill; + current.texture.reset(); + return fill; +} + +static int RoundUpToPowerOfTwo(int v) +{ + for(int i = 0; i < 31; i++) { + int vt = (1 << i); + if(vt >= v) { + return vt; + } + } + return 0; +} + +void OpenGl1Renderer::SelectTexture(std::shared_ptr pm) { + if(current.texture.lock() == pm) return; + + glBindTexture(GL_TEXTURE_2D, 1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + GLenum format = 0; + switch(pm->format) { + case Pixmap::Format::RGBA: format = GL_RGBA; break; + case Pixmap::Format::RGB: format = GL_RGB; break; + case Pixmap::Format::A: format = GL_ALPHA; break; + case Pixmap::Format::BGRA: + case Pixmap::Format::BGR: + ssassert(false, "Unexpected pixmap format"); + } + + if(!HasGl1V1Quirk()) { + glTexImage2D(GL_TEXTURE_2D, 0, format, pm->width, pm->height, 0, + format, GL_UNSIGNED_BYTE, &pm->data[0]); + } else { + GLsizei width = RoundUpToPowerOfTwo(pm->width); + GLsizei height = RoundUpToPowerOfTwo(pm->height); + glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, + format, GL_UNSIGNED_BYTE, 0); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, pm->width, pm->height, + format, GL_UNSIGNED_BYTE, &pm->data[0]); + } + + glEnable(GL_TEXTURE_2D); + + current.texture = pm; +} + +//----------------------------------------------------------------------------- +// OpenGL's GL_LINES mode does not work on lines thicker than about 3 px, +// so we have to draw thicker lines using triangles. +//----------------------------------------------------------------------------- + +void OpenGl1Renderer::DoFatLineEndcap(const Vector &p, const Vector &u, const Vector &v) { + // A table of cos and sin of (pi*i/10 + pi/2), as i goes from 0 to 10 + static const double Circle[11][2] = { + { 0.0000, 1.0000 }, + { -0.3090, 0.9511 }, + { -0.5878, 0.8090 }, + { -0.8090, 0.5878 }, + { -0.9511, 0.3090 }, + { -1.0000, 0.0000 }, + { -0.9511, -0.3090 }, + { -0.8090, -0.5878 }, + { -0.5878, -0.8090 }, + { -0.3090, -0.9511 }, + { 0.0000, -1.0000 }, + }; + + SelectPrimitive(GL_TRIANGLE_FAN); + for(auto pc : Circle) { + double c = pc[0], s = pc[1]; + ssglVertex3v(p.Plus(u.ScaledBy(c)).Plus(v.ScaledBy(s))); + } + UnSelectPrimitive(); +} + +void OpenGl1Renderer::DoFatLine(const Vector &a, const Vector &b, double width) { + // The half-width of the line we're drawing. + double hw = width / 2; + Vector ab = b.Minus(a); + Vector gn = (camera.projRight).Cross(camera.projUp); + Vector abn = (ab.Cross(gn)).WithMagnitude(1); + abn = abn.Minus(gn.ScaledBy(gn.Dot(abn))); + // So now abn is normal to the projection of ab into the screen, so the + // line will always have constant thickness as the view is rotated. + + abn = abn.WithMagnitude(hw); + ab = gn.Cross(abn); + ab = ab. WithMagnitude(hw); + + // The body of a line is a quad + SelectPrimitive(GL_QUADS); + ssglVertex3v(a.Plus (abn)); + ssglVertex3v(b.Plus (abn)); + ssglVertex3v(b.Minus(abn)); + ssglVertex3v(a.Minus(abn)); + // And the line has two semi-circular end caps. + DoFatLineEndcap(a, ab, abn); + DoFatLineEndcap(b, ab.ScaledBy(-1), abn); +} + +void OpenGl1Renderer::DoLine(const Vector &a, const Vector &b, hStroke hcs) { + if(a.Equals(b)) return; + + Stroke *stroke = SelectStroke(hcs); + if(stroke->WidthPx(camera) <= 3.0) { + SelectPrimitive(GL_LINES); + ssglVertex3v(a); + ssglVertex3v(b); + } else { + DoFatLine(a, b, stroke->WidthPx(camera) / camera.scale); + } +} + +void OpenGl1Renderer::DoPoint(Vector p, double d) { + if(d <= 3.0) { + Vector u = camera.projRight.WithMagnitude(d / 2.0 / camera.scale); + + SelectPrimitive(GL_LINES); + ssglVertex3v(p.Minus(u)); + ssglVertex3v(p.Plus(u)); + } else { + Vector u = camera.projRight.WithMagnitude(d / 2.0 / camera.scale); + Vector v = camera.projUp.WithMagnitude(d / 2.0 / camera.scale); + + DoFatLineEndcap(p, u, v); + DoFatLineEndcap(p, u.ScaledBy(-1.0), v); + } +} + +void OpenGl1Renderer::DoStippledLine(const Vector &a, const Vector &b, hStroke hcs, double phase) { + Stroke *stroke = SelectStroke(hcs); + + if(stroke->stipplePattern == StipplePattern::CONTINUOUS) { + DoLine(a, b, hcs); + return; + } + + double scale = stroke->StippleScaleMm(camera); + const std::vector &dashes = StipplePatternDashes(stroke->stipplePattern); + double length = StipplePatternLength(stroke->stipplePattern) * scale; + + phase -= floor(phase / length) * length; + + double curPhase = 0.0; + size_t curDash; + for(curDash = 0; curDash < dashes.size(); curDash++) { + curPhase += dashes[curDash] * scale; + if(phase < curPhase) break; + } + + Vector dir = b.Minus(a); + double len = dir.Magnitude(); + dir = dir.WithMagnitude(1.0); + + double cur = 0.0; + Vector curPos = a; + double width = stroke->WidthMm(camera); + + double curDashLen = (curPhase - phase) / scale; + while(cur < len) { + double next = std::min(len, cur + curDashLen * scale); + Vector nextPos = curPos.Plus(dir.ScaledBy(next - cur)); + if(curDash % 2 == 0) { + if(curDashLen <= LENGTH_EPS) { + DoPoint(curPos, width); + } else { + DoLine(curPos, nextPos, hcs); + } + } + cur = next; + curPos = nextPos; + curDash++; + curDashLen = dashes[curDash % dashes.size()]; + } +} + +//----------------------------------------------------------------------------- +// A canvas implemented using OpenGL 3 immediate mode. +//----------------------------------------------------------------------------- + +void OpenGl1Renderer::DrawLine(const Vector &a, const Vector &b, hStroke hcs) { + DoStippledLine(a, b, hcs); +} + +void OpenGl1Renderer::DrawEdges(const SEdgeList &el, hStroke hcs) { + double phase = 0.0; + for(const SEdge *e = el.l.First(); e; e = el.l.NextAfter(e)) { + DoStippledLine(e->a, e->b, hcs, phase); + phase += e->a.Minus(e->b).Magnitude(); + } +} + +void OpenGl1Renderer::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) { + Vector projDir = camera.projRight.Cross(camera.projUp); + double phase = 0.0; + switch(drawAs) { + case DrawOutlinesAs::EMPHASIZED_AND_CONTOUR: + for(const SOutline &o : ol.l) { + if(o.IsVisible(projDir) || o.tag != 0) { + DoStippledLine(o.a, o.b, hcs, phase); + } + phase += o.a.Minus(o.b).Magnitude(); + } + break; + + case DrawOutlinesAs::EMPHASIZED_WITHOUT_CONTOUR: + for(const SOutline &o : ol.l) { + if(!o.IsVisible(projDir) && o.tag != 0) { + DoStippledLine(o.a, o.b, hcs, phase); + } + phase += o.a.Minus(o.b).Magnitude(); + } + break; + + case DrawOutlinesAs::CONTOUR_ONLY: + for(const SOutline &o : ol.l) { + if(o.IsVisible(projDir)) { + DoStippledLine(o.a, o.b, hcs, phase); + } + phase += o.a.Minus(o.b).Magnitude(); + } + break; + } +} + +void OpenGl1Renderer::DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) { + auto traceEdge = [&](Vector a, Vector b) { DoStippledLine(a, b, hcs); }; + VectorFont::Builtin()->Trace(height, o, u, v, text, traceEdge, camera); +} + +void OpenGl1Renderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) { + SelectFill(hcf); + SelectPrimitive(GL_QUADS); + ssglVertex3v(a); + ssglVertex3v(b); + ssglVertex3v(c); + ssglVertex3v(d); +} + +void OpenGl1Renderer::DrawPoint(const Vector &o, Canvas::hStroke hcs) { + Stroke *stroke = SelectStroke(hcs); + + Canvas::Fill fill = {}; + fill.layer = stroke->layer; + fill.zIndex = stroke->zIndex; + fill.color = stroke->color; + hFill hcf = GetFill(fill); + + Vector r = camera.projRight.ScaledBy(stroke->width/2.0/camera.scale); + Vector u = camera.projUp.ScaledBy(stroke->width/2.0/camera.scale); + Vector a = o.Plus (r).Plus (u), + b = o.Plus (r).Minus(u), + c = o.Minus(r).Minus(u), + d = o.Minus(r).Plus (u); + DrawQuad(a, b, c, d, hcf); +} + +#ifdef WIN32 +#define SSGL_CALLBACK CALLBACK +#else +#define SSGL_CALLBACK +#endif +typedef void(SSGL_CALLBACK *GLUCallback)(); + +using CombineVec = std::vector>; + +static void SSGL_CALLBACK Vertex(Vector *p) { + ssglVertex3v(*p); +} +static void SSGL_CALLBACK Combine(double coords[3], void *vertexData[4], + float weight[4], void **outData, void *inData) { + Vector *n = new Vector; + n->x = coords[0]; + n->y = coords[1]; + n->z = coords[2]; + + *outData = n; + CombineVec *vec = static_cast(inData); + vec->emplace_back(n); +} +void OpenGl1Renderer::DrawPolygon(const SPolygon &p, hFill hcf) { + UnSelectPrimitive(); + SelectFill(hcf); + + GLUtesselator *gt = gluNewTess(); + gluTessCallback(gt, GLU_TESS_BEGIN, (GLUCallback) glBegin); + gluTessCallback(gt, GLU_TESS_VERTEX, (GLUCallback) Vertex); + gluTessCallback(gt, GLU_TESS_END, (GLUCallback) glEnd); + gluTessCallback(gt, GLU_TESS_COMBINE_DATA, (GLUCallback) Combine); + + gluTessProperty(gt, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); + + ssglNormal3v(p.normal); + gluTessNormal(gt, p.normal.x, p.normal.y, p.normal.z); + + CombineVec vecs; + gluTessBeginPolygon(gt, &vecs); + for(const SContour &sc : p.l) { + gluTessBeginContour(gt); + for(const SPoint &sp : sc.l) { + double ap[3] = { sp.p.x, sp.p.y, sp.p.z }; + gluTessVertex(gt, ap, (GLvoid *) &sp.p); + } + gluTessEndContour(gt); + } + gluTessEndPolygon(gt); + + gluDeleteTess(gt); +} + +void OpenGl1Renderer::DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) { + UnSelectPrimitive(); + + RgbaColor frontColor = {}, + backColor = {}; + + Fill *frontFill = SelectFill(hcfFront); + frontColor = frontFill->color; + + ssglMaterialRGBA(GL_FRONT, frontFill->color); + if(hcfBack.v != 0) { + Fill *backFill = fills.FindById(hcfBack); + backColor = backFill->color; + ssassert(frontFill->layer == backFill->layer && + frontFill->zIndex == backFill->zIndex, + "frontFill and backFill should belong to the same depth range"); + ssassert(frontFill->pattern == backFill->pattern, + "frontFill and backFill should have the same pattern"); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1); + ssglMaterialRGBA(GL_BACK, backFill->color); + } else { + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + } + + RgbaColor triangleColor = {}; + glEnable(GL_LIGHTING); + glBegin(GL_TRIANGLES); + for(const STriangle &tr : m.l) { + if(frontColor.IsEmpty() || backColor.IsEmpty()) { + if(triangleColor.IsEmpty() || !triangleColor.Equals(tr.meta.color)) { + triangleColor = tr.meta.color; + if(frontColor.IsEmpty()) { + ssglMaterialRGBA(GL_FRONT, triangleColor); + } + if(backColor.IsEmpty()) { + ssglMaterialRGBA(GL_BACK, triangleColor); + } + } + } + + if(tr.an.EqualsExactly(Vector::From(0, 0, 0))) { + // Compute the normal from the vertices + ssglNormal3v(tr.Normal()); + ssglVertex3v(tr.a); + ssglVertex3v(tr.b); + ssglVertex3v(tr.c); + } else { + // Use the exact normals that are specified + ssglNormal3v(tr.an); + ssglVertex3v(tr.a); + ssglNormal3v(tr.bn); + ssglVertex3v(tr.b); + ssglNormal3v(tr.cn); + ssglVertex3v(tr.c); + } + } + glEnd(); + glDisable(GL_LIGHTING); +} + +void OpenGl1Renderer::DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) { + SelectFill(hcf); + SelectPrimitive(GL_TRIANGLES); + size_t facesSize = faces.size(); + for(const STriangle &tr : m.l) { + uint32_t face = tr.meta.face; + for(size_t j = 0; j < facesSize; j++) { + if(faces[j] != face) continue; + ssglVertex3v(tr.a); + ssglVertex3v(tr.b); + ssglVertex3v(tr.c); + break; + } + } +} + +void OpenGl1Renderer::DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) { + double xfactor = 1.0, + yfactor = 1.0; + if(HasGl1V1Quirk()) { + xfactor = (double)pm->width / RoundUpToPowerOfTwo(pm->width); + yfactor = (double)pm->height / RoundUpToPowerOfTwo(pm->height); + } + + UnSelectPrimitive(); + SelectFill(hcf); + SelectTexture(pm); + SelectPrimitive(GL_QUADS); + glTexCoord2d(ta.x * xfactor, ta.y * yfactor); + ssglVertex3v(o); + glTexCoord2d(ta.x * xfactor, tb.y * yfactor); + ssglVertex3v(o.Plus(v)); + glTexCoord2d(tb.x * xfactor, tb.y * yfactor); + ssglVertex3v(o.Plus(u).Plus(v)); + glTexCoord2d(tb.x * xfactor, ta.y * yfactor); + ssglVertex3v(o.Plus(u)); +} + +void OpenGl1Renderer::InvalidatePixmap(std::shared_ptr pm) { + if(current.texture.lock() == pm) { + current.texture.reset(); + } +} + +void OpenGl1Renderer::UpdateProjection() { + UnSelectPrimitive(); + + glViewport(0, 0, + (GLsizei)(camera.width * camera.pixelRatio), + (GLsizei)(camera.height * camera.pixelRatio)); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glScaled(camera.scale * 2.0 / camera.width, + camera.scale * 2.0 / camera.height, + camera.scale * 1.0 / 30000); + + double mat[16]; + // Last thing before display is to apply the perspective + double clp = camera.tangent * camera.scale; + MakeMatrix(mat, 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, clp, 1); + glMultMatrixd(mat); + + // Before that, we apply the rotation + Vector projRight = camera.projRight, + projUp = camera.projUp, + n = camera.projUp.Cross(camera.projRight); + MakeMatrix(mat, projRight.x, projRight.y, projRight.z, 0, + projUp.x, projUp.y, projUp.z, 0, + n.x, n.y, n.z, 0, + 0, 0, 0, 1); + glMultMatrixd(mat); + + // And before that, the translation + Vector offset = camera.offset; + MakeMatrix(mat, 1, 0, 0, offset.x, + 0, 1, 0, offset.y, + 0, 0, 1, offset.z, + 0, 0, 0, 1); + glMultMatrixd(mat); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); +} + +void OpenGl1Renderer::StartFrame() { + glEnable(GL_NORMALIZE); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + // don't enable GL_POLYGON_SMOOTH; that looks ugly on some graphics cards, + // drawn with leaks in the mesh + + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); + + if(EXACT(lighting.lightIntensity[0] != 0.0)) { + glEnable(GL_LIGHT0); + GLfloat f = (GLfloat)lighting.lightIntensity[0]; + GLfloat li0[] = { f, f, f, 1.0f }; + glLightfv(GL_LIGHT0, GL_DIFFUSE, li0); + glLightfv(GL_LIGHT0, GL_SPECULAR, li0); + + Vector ld = camera.VectorFromProjs(lighting.lightDirection[0]); + GLfloat ld0[4] = { (GLfloat)ld.x, (GLfloat)ld.y, (GLfloat)ld.z, 0 }; + glLightfv(GL_LIGHT0, GL_POSITION, ld0); + } + + if(EXACT(lighting.lightIntensity[1] != 0.0)) { + glEnable(GL_LIGHT1); + GLfloat f = (GLfloat)lighting.lightIntensity[1]; + GLfloat li0[] = { f, f, f, 1.0f }; + glLightfv(GL_LIGHT1, GL_DIFFUSE, li0); + glLightfv(GL_LIGHT1, GL_SPECULAR, li0); + + Vector ld = camera.VectorFromProjs(lighting.lightDirection[1]); + GLfloat ld0[4] = { (GLfloat)ld.x, (GLfloat)ld.y, (GLfloat)ld.z, 0 }; + glLightfv(GL_LIGHT1, GL_POSITION, ld0); + } + + if(EXACT(lighting.ambientIntensity != 0.0)) { + GLfloat ambient[4] = { (float)lighting.ambientIntensity, + (float)lighting.ambientIntensity, + (float)lighting.ambientIntensity, 1 }; + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); + } + + glClearColor(lighting.backgroundColor.redF(), lighting.backgroundColor.greenF(), + lighting.backgroundColor.blueF(), lighting.backgroundColor.alphaF()); + glClear(GL_COLOR_BUFFER_BIT); + + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); +} + +void OpenGl1Renderer::FlushFrame() { + UnSelectPrimitive(); + + glFlush(); +} + +void OpenGl1Renderer::FinishFrame() { + glFinish(); + + GLenum error = glGetError(); + if(error != GL_NO_ERROR) { + dbp("glGetError() == 0x%X %s", error, gluErrorString(error)); + } +} + +std::shared_ptr OpenGl1Renderer::ReadFrame() { + int width = (int)(camera.width * camera.pixelRatio); + int height = (int)(camera.height * camera.pixelRatio); + std::shared_ptr pixmap = + Pixmap::Create(Pixmap::Format::RGB, (size_t)width, (size_t)height); + glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixmap->data[0]); + ssassert(glGetError() == GL_NO_ERROR, "Unexpected glReadPixels error"); + return pixmap; +} + +void OpenGl1Renderer::GetIdent(const char **vendor, const char **renderer, const char **version) { + *vendor = (const char *)glGetString(GL_VENDOR); + *renderer = (const char *)glGetString(GL_RENDERER); + *version = (const char *)glGetString(GL_VERSION); +} + +void OpenGl1Renderer::SetCamera(const Camera &c) { + camera = c; + UpdateProjection(); +} + +void OpenGl1Renderer::SetLighting(const Lighting &l) { + lighting = l; +} + +std::shared_ptr CreateRenderer() { + return std::shared_ptr(new OpenGl1Renderer()); +} + +} diff --git a/src/render/rendergl3.cpp b/src/render/rendergl3.cpp new file mode 100644 index 0000000..4816496 --- /dev/null +++ b/src/render/rendergl3.cpp @@ -0,0 +1,1102 @@ +//----------------------------------------------------------------------------- +// OpenGL ES 2.0 and OpenGL 3.0 based rendering interface. +// +// Copyright 2016 Aleksey Egorov +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include "gl3shader.h" + +namespace SolveSpace { + +class TextureCache { +public: + std::map, GLuint, + std::owner_less>> items; + + bool Lookup(std::shared_ptr ptr, GLuint *result) { + auto it = items.find(ptr); + if(it == items.end()) { + GLuint id; + glGenTextures(1, &id); + items[ptr] = id; + *result = id; + return false; + } + + *result = it->second; + return true; + } + + void CleanupUnused() { + for(auto it = items.begin(); it != items.end();) { + if(it->first.expired()) { + glDeleteTextures(1, &it->second); + it = items.erase(it); + continue; + } + it++; + } + } +}; + +// A canvas that uses the core OpenGL 3 profile, for desktop systems. +class OpenGl3Renderer final : public ViewportCanvas { +public: + struct SEdgeListItem { + hStroke h; + SEdgeList lines; + + void Clear() { lines.Clear(); } + }; + + struct SMeshListItem { + hFill h; + SIndexedMesh mesh; + + void Clear() { mesh.Clear(); } + }; + + struct SPointListItem { + hStroke h; + SIndexedMesh points; + + void Clear() { points.Clear(); } + }; + + IdList lines; + IdList meshes; + IdList points; + + TextureCache pixmapCache; + std::shared_ptr masks[3]; + + bool initialized; + StippleAtlas atlas; + MeshRenderer meshRenderer; + IndexedMeshRenderer imeshRenderer; + EdgeRenderer edgeRenderer; + OutlineRenderer outlineRenderer; + + Camera camera; + Lighting lighting; + // Cached OpenGL state. + struct { + hStroke hcs; + Stroke *stroke; + hFill hcf; + Fill *fill; + std::weak_ptr texture; + } current; + const char *vendor = ""; + const char *renderer = ""; + const char *version = ""; + + // List-initialize current to work around MSVC bug 746973. + OpenGl3Renderer() : + lines(), meshes(), points(), pixmapCache(), masks(), + initialized(), atlas(), meshRenderer(), imeshRenderer(), + edgeRenderer(), outlineRenderer(), camera(), lighting(), + current({}) {} + + void Init(); + + const Camera &GetCamera() const override { return camera; } + + void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override; + void DrawEdges(const SEdgeList &el, hStroke hcs) override; + bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { return false; } + void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs mode) override; + void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) override; + + void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) override; + void DrawPoint(const Vector &o, hStroke hs) override; + void DrawPolygon(const SPolygon &p, hFill hcf) override; + void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) override; + void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) override; + void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) override; + void InvalidatePixmap(std::shared_ptr pm) override; + + std::shared_ptr CreateBatch() override; + + Stroke *SelectStroke(hStroke hcs); + Fill *SelectFill(hFill hcf); + void SelectMask(FillPattern pattern); + void SelectTexture(std::shared_ptr pm); + void DoFatLineEndcap(const Vector &p, const Vector &u, const Vector &v); + void DoFatLine(const Vector &a, const Vector &b, double width); + void DoLine(const Vector &a, const Vector &b, hStroke hcs); + void DoPoint(Vector p, hStroke hs); + void DoStippledLine(const Vector &a, const Vector &b, hStroke hcs); + + void UpdateProjection(); + void SetCamera(const Camera &c) override; + void SetLighting(const Lighting &l) override; + + void StartFrame() override; + void FlushFrame() override; + void FinishFrame() override; + void Clear() override; + std::shared_ptr ReadFrame() override; + + void GetIdent(const char **vendor, const char **renderer, const char **version) override; +}; + +//----------------------------------------------------------------------------- +// Thin wrappers around OpenGL functions to fix bugs, adapt them to our +// data structures, etc. +//----------------------------------------------------------------------------- + +static void ssglDepthRange(Canvas::Layer layer, int zIndex) { + switch(layer) { + case Canvas::Layer::NORMAL: + case Canvas::Layer::FRONT: + case Canvas::Layer::BACK: + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + break; + + case Canvas::Layer::DEPTH_ONLY: + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + break; + + case Canvas::Layer::OCCLUDED: + glDepthFunc(GL_GREATER); + glDepthMask(GL_FALSE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + break; + } + + switch(layer) { + case Canvas::Layer::FRONT: + glDepthRangef(0.0f, 0.0f); + break; + + case Canvas::Layer::BACK: + glDepthRangef(1.0f, 1.0f); + break; + + case Canvas::Layer::NORMAL: + case Canvas::Layer::DEPTH_ONLY: + case Canvas::Layer::OCCLUDED: + // The size of this step depends on the resolution of the Z buffer; for + // a 16-bit buffer, this should be fine. + double offset = 1.0 / (65535 * 0.8) * zIndex; + glDepthRangef((float)(0.1 - offset), (float)(1.0 - offset)); + break; + } +} + +//----------------------------------------------------------------------------- +// A simple OpenGL state tracker to group consecutive draw calls. +//----------------------------------------------------------------------------- + +Canvas::Stroke *OpenGl3Renderer::SelectStroke(hStroke hcs) { + if(current.hcs == hcs) return current.stroke; + + Stroke *stroke = strokes.FindById(hcs); + ssglDepthRange(stroke->layer, stroke->zIndex); + + current.hcs = hcs; + current.stroke = stroke; + current.hcf = {}; + current.fill = NULL; + current.texture.reset(); + return stroke; +} + +void OpenGl3Renderer::SelectMask(FillPattern pattern) { + if(!masks[0]) { + masks[0] = Pixmap::Create(Pixmap::Format::A, 32, 32); + masks[1] = Pixmap::Create(Pixmap::Format::A, 32, 32); + masks[2] = Pixmap::Create(Pixmap::Format::A, 32, 32); + + for(int x = 0; x < 32; x++) { + for(int y = 0; y < 32; y++) { + masks[0]->data[y * 32 + x] = ((x / 2) % 2 == 0 && (y / 2) % 2 == 0) ? 0xFF : 0x00; + masks[1]->data[y * 32 + x] = ((x / 2) % 2 == 1 && (y / 2) % 2 == 1) ? 0xFF : 0x00; + masks[2]->data[y * 32 + x] = 0xFF; + } + } + } + + switch(pattern) { + case Canvas::FillPattern::SOLID: + SelectTexture(masks[2]); + break; + + case Canvas::FillPattern::CHECKERED_A: + SelectTexture(masks[0]); + break; + + case Canvas::FillPattern::CHECKERED_B: + SelectTexture(masks[1]); + break; + + default: ssassert(false, "Unexpected fill pattern"); + } +} + +Canvas::Fill *OpenGl3Renderer::SelectFill(hFill hcf) { + if(current.hcf == hcf) return current.fill; + + Fill *fill = fills.FindById(hcf); + ssglDepthRange(fill->layer, fill->zIndex); + + current.hcs = {}; + current.stroke = NULL; + current.hcf = hcf; + current.fill = fill; + if(fill->pattern != FillPattern::SOLID) { + SelectMask(fill->pattern); + } else if(fill->texture) { + SelectTexture(fill->texture); + } else { + SelectMask(FillPattern::SOLID); + } + return fill; +} + +static bool IsPowerOfTwo(size_t n) { + return (n & (n - 1)) == 0; +} + +void OpenGl3Renderer::InvalidatePixmap(std::shared_ptr pm) { + GLuint id; + pixmapCache.Lookup(pm, &id); + glBindTexture(GL_TEXTURE_2D, id); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + if(IsPowerOfTwo(pm->width) && IsPowerOfTwo(pm->height)) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + } + + GLenum format = 0; + switch(pm->format) { + case Pixmap::Format::RGBA: format = GL_RGBA; break; + case Pixmap::Format::RGB: format = GL_RGB; break; +#if defined(HAVE_GLES) + case Pixmap::Format::A: format = GL_ALPHA; break; +#else + case Pixmap::Format::A: format = GL_RED; break; +#endif + case Pixmap::Format::BGRA: + case Pixmap::Format::BGR: + ssassert(false, "Unexpected pixmap format"); + } + glTexImage2D(GL_TEXTURE_2D, 0, format, pm->width, pm->height, 0, + format, GL_UNSIGNED_BYTE, &pm->data[0]); +} + +void OpenGl3Renderer::SelectTexture(std::shared_ptr pm) { + if(current.texture.lock() == pm) return; + + GLuint id; + if(!pixmapCache.Lookup(pm, &id)) { + InvalidatePixmap(pm); + } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, id); + current.texture = pm; +} + +void OpenGl3Renderer::DoLine(const Vector &a, const Vector &b, hStroke hcs) { + SEdgeListItem *eli = lines.FindByIdNoOops(hcs); + if(eli == NULL) { + SEdgeListItem item = {}; + item.h = hcs; + lines.Add(&item); + eli = lines.FindByIdNoOops(hcs); + } + + eli->lines.AddEdge(a, b); +} + +void OpenGl3Renderer::DoPoint(Vector p, hStroke hs) { + SPointListItem *pli = points.FindByIdNoOops(hs); + if(pli == NULL) { + SPointListItem item = {}; + item.h = hs; + points.Add(&item); + pli = points.FindByIdNoOops(hs); + } + + pli->points.AddPoint(p); +} + +void OpenGl3Renderer::DoStippledLine(const Vector &a, const Vector &b, hStroke hcs) { + Stroke *stroke = strokes.FindById(hcs); + if(stroke->stipplePattern != StipplePattern::FREEHAND && + stroke->stipplePattern != StipplePattern::ZIGZAG) + { + DoLine(a, b, hcs); + return; + } + + const char *patternSeq = NULL; + Stroke s = *stroke; + s.stipplePattern = StipplePattern::CONTINUOUS; + hcs = GetStroke(s); + switch(stroke->stipplePattern) { + case StipplePattern::CONTINUOUS: DoLine(a, b, hcs); return; + case StipplePattern::SHORT_DASH: patternSeq = "- "; break; + case StipplePattern::DASH: patternSeq = "- "; break; + case StipplePattern::LONG_DASH: patternSeq = "_ "; break; + case StipplePattern::DASH_DOT: patternSeq = "-."; break; + case StipplePattern::DASH_DOT_DOT: patternSeq = "-.."; break; + case StipplePattern::DOT: patternSeq = "."; break; + case StipplePattern::FREEHAND: patternSeq = "~"; break; + case StipplePattern::ZIGZAG: patternSeq = "~__"; break; + } + + Vector dir = b.Minus(a); + double len = dir.Magnitude(); + dir = dir.WithMagnitude(1.0); + + const char *si = patternSeq; + double end = len; + double ss = stroke->stippleScale / 2.0; + do { + double start = end; + switch(*si) { + case ' ': + end -= 1.0 * ss; + break; + + case '-': + start = max(start - 0.5 * ss, 0.0); + end = max(start - 2.0 * ss, 0.0); + if(start == end) break; + DoLine(a.Plus(dir.ScaledBy(start)), a.Plus(dir.ScaledBy(end)), hcs); + end = max(end - 0.5 * ss, 0.0); + break; + + case '_': + end = max(end - 4.0 * ss, 0.0); + DoLine(a.Plus(dir.ScaledBy(start)), a.Plus(dir.ScaledBy(end)), hcs); + break; + + case '.': + end = max(end - 0.5 * ss, 0.0); + if(end == 0.0) break; + DoPoint(a.Plus(dir.ScaledBy(end)), hcs); + end = max(end - 0.5 * ss, 0.0); + break; + + case '~': { + Vector ab = b.Minus(a); + Vector gn = (camera.projRight).Cross(camera.projUp); + Vector abn = (ab.Cross(gn)).WithMagnitude(1); + abn = abn.Minus(gn.ScaledBy(gn.Dot(abn))); + double pws = 2.0 * stroke->width / camera.scale; + + end = max(end - 0.5 * ss, 0.0); + Vector aa = a.Plus(dir.ScaledBy(start)); + Vector bb = a.Plus(dir.ScaledBy(end)) + .Plus(abn.ScaledBy(pws * (start - end) / (0.5 * ss))); + DoLine(aa, bb, hcs); + if(end == 0.0) break; + + start = end; + end = max(end - 1.0 * ss, 0.0); + aa = a.Plus(dir.ScaledBy(end)) + .Plus(abn.ScaledBy(pws)) + .Minus(abn.ScaledBy(2.0 * pws * (start - end) / ss)); + DoLine(bb, aa, hcs); + if(end == 0.0) break; + + start = end; + end = max(end - 0.5 * ss, 0.0); + bb = a.Plus(dir.ScaledBy(end)) + .Minus(abn.ScaledBy(pws)) + .Plus(abn.ScaledBy(pws * (start - end) / (0.5 * ss))); + DoLine(aa, bb, hcs); + break; + } + + default: ssassert(false, "Unexpected stipple pattern element"); + } + if(*(++si) == 0) si = patternSeq; + } while(end > 0.0); +} + +//----------------------------------------------------------------------------- +// A canvas implemented using OpenGL 3 vertex buffer objects. +//----------------------------------------------------------------------------- + +void OpenGl3Renderer::Init() { + atlas.Init(); + edgeRenderer.Init(&atlas); + outlineRenderer.Init(&atlas); + meshRenderer.Init(); + imeshRenderer.Init(); + + vendor = (const char *)glGetString(GL_VENDOR); + renderer = (const char *)glGetString(GL_RENDERER); + version = (const char *)glGetString(GL_VERSION); + +#if !defined(HAVE_GLES) && !defined(__APPLE__) + GLuint array; + glGenVertexArrays(1, &array); + glBindVertexArray(array); +#endif + UpdateProjection(); +} + +void OpenGl3Renderer::DrawLine(const Vector &a, const Vector &b, hStroke hcs) { + DoStippledLine(a, b, hcs); +} + +void OpenGl3Renderer::DrawEdges(const SEdgeList &el, hStroke hcs) { + for(const SEdge &e : el.l) { + DoStippledLine(e.a, e.b, hcs); + } +} + +void OpenGl3Renderer::DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs mode) { + if(ol.l.IsEmpty()) + return; + + Stroke *stroke = SelectStroke(hcs); + ssassert(stroke->stipplePattern != StipplePattern::ZIGZAG && + stroke->stipplePattern != StipplePattern::FREEHAND, + "ZIGZAG and FREEHAND not supported for outlines"); + + outlineRenderer.SetStroke(*stroke, 1.0 / camera.scale); + outlineRenderer.Draw(ol, mode); +} + +void OpenGl3Renderer::DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) { + SEdgeListItem *eli = lines.FindByIdNoOops(hcs); + if(eli == NULL) { + SEdgeListItem item = {}; + item.h = hcs; + lines.Add(&item); + eli = lines.FindByIdNoOops(hcs); + } + SEdgeList &lines = eli->lines; + auto traceEdge = [&](Vector a, Vector b) { lines.AddEdge(a, b); }; + VectorFont::Builtin()->Trace(height, o, u, v, text, traceEdge, camera); +} + +void OpenGl3Renderer::DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) { + SMeshListItem *li = meshes.FindByIdNoOops(hcf); + if(li == NULL) { + SMeshListItem item = {}; + item.h = hcf; + meshes.Add(&item); + li = meshes.FindByIdNoOops(hcf); + } + li->mesh.AddQuad(a, b, c, d); +} + +void OpenGl3Renderer::DrawPoint(const Vector &o, hStroke hs) { + DoPoint(o, hs); +} + +void OpenGl3Renderer::DrawPolygon(const SPolygon &p, hFill hcf) { + Fill *fill = SelectFill(hcf); + + SMesh m = {}; + p.TriangulateInto(&m); + meshRenderer.UseFilled(*fill); + meshRenderer.Draw(m); + m.Clear(); +} + +void OpenGl3Renderer::DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack) { + ssassert(false, "Not implemented"); +} + +void OpenGl3Renderer::DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) { + if(faces.empty()) return; + + Fill *fill = SelectFill(hcf); + + SMesh facesMesh = {}; + for(uint32_t f : faces) { + for(const STriangle &t : m.l) { + if(f != t.meta.face) continue; + facesMesh.l.Add(&t); + } + } + + meshRenderer.UseFilled(*fill); + meshRenderer.Draw(facesMesh); + facesMesh.Clear(); +} + +void OpenGl3Renderer::DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) { + Fill fill = *fills.FindById(hcf); + fill.texture = pm; + hcf = GetFill(fill); + + SMeshListItem *mli = meshes.FindByIdNoOops(hcf); + if(mli == NULL) { + SMeshListItem item = {}; + item.h = hcf; + meshes.Add(&item); + mli = meshes.FindByIdNoOops(hcf); + } + + mli->mesh.AddPixmap(o, u, v, ta, tb); +} + +void OpenGl3Renderer::UpdateProjection() { + glViewport(0, 0, + (int)(camera.width * camera.pixelRatio), + (int)(camera.height * camera.pixelRatio)); + + double mat1[16]; + double mat2[16]; + + double sx = camera.scale * 2.0 / camera.width; + double sy = camera.scale * 2.0 / camera.height; + double sz = camera.scale * 1.0 / 30000; + + MakeMatrix(mat1, + sx, 0, 0, 0, + 0, sy, 0, 0, + 0, 0, sz, 0, + 0, 0, 0, 1 + ); + + // Last thing before display is to apply the perspective + double clp = camera.tangent * camera.scale; + MakeMatrix(mat2, + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, clp, 1 + ); + + double projection[16]; + MultMatrix(mat1, mat2, projection); + + // Before that, we apply the rotation + Vector u = camera.projRight, + v = camera.projUp, + n = camera.projUp.Cross(camera.projRight); + MakeMatrix(mat1, + u.x, u.y, u.z, 0, + v.x, v.y, v.z, 0, + n.x, n.y, n.z, 0, + 0, 0, 0, 1 + ); + + // And before that, the translation + Vector o = camera.offset; + MakeMatrix(mat2, + 1, 0, 0, o.x, + 0, 1, 0, o.y, + 0, 0, 1, o.z, + 0, 0, 0, 1 + ); + + double modelview[16]; + MultMatrix(mat1, mat2, modelview); + + imeshRenderer.SetProjection(projection); + imeshRenderer.SetModelview(modelview); + meshRenderer.SetProjection(projection); + meshRenderer.SetModelview(modelview); + edgeRenderer.SetProjection(projection); + edgeRenderer.SetModelview(modelview); + outlineRenderer.SetProjection(projection); + outlineRenderer.SetModelview(modelview); + + glClearDepthf(1.0f); + glClear(GL_DEPTH_BUFFER_BIT); +} + +void OpenGl3Renderer::StartFrame() { + if(!initialized) { + Init(); + initialized = true; + } + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); + + RgbaColor backgroundColor = lighting.backgroundColor; + glClearColor(backgroundColor.redF(), backgroundColor.greenF(), + backgroundColor.blueF(), backgroundColor.alphaF()); + glClearDepthf(1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glFrontFace(GL_CW); +} + +void OpenGl3Renderer::FlushFrame() { + for(SMeshListItem &li : meshes) { + Fill *fill = SelectFill(li.h); + + imeshRenderer.UseFilled(*fill); + imeshRenderer.Draw(li.mesh); + li.mesh.Clear(); + } + meshes.Clear(); + + for(SEdgeListItem &eli : lines) { + Stroke *stroke = SelectStroke(eli.h); + + edgeRenderer.SetStroke(*stroke, 1.0 / camera.scale); + edgeRenderer.Draw(eli.lines); + eli.lines.Clear(); + } + lines.Clear(); + + for(SPointListItem &li : points) { + Stroke *stroke = SelectStroke(li.h); + + imeshRenderer.UsePoint(*stroke, 1.0 / camera.scale); + imeshRenderer.Draw(li.points); + li.points.Clear(); + } + points.Clear(); + + glFlush(); +} + +void OpenGl3Renderer::FinishFrame() { + glFinish(); + + GLenum error = glGetError(); + if(error != GL_NO_ERROR) { + dbp("glGetError() == 0x%X", error); + } +} + +void OpenGl3Renderer::Clear() { + ViewportCanvas::Clear(); + pixmapCache.CleanupUnused(); +} + +std::shared_ptr OpenGl3Renderer::ReadFrame() { + int width = (int)(camera.width * camera.pixelRatio); + int height = (int)(camera.height * camera.pixelRatio); + std::shared_ptr pixmap = + Pixmap::Create(Pixmap::Format::RGBA, (size_t)width, (size_t)height); + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, &pixmap->data[0]); + ssassert(glGetError() == GL_NO_ERROR, "Unexpected glReadPixels error"); + return pixmap; +} + +void OpenGl3Renderer::GetIdent(const char **vendor, const char **renderer, const char **version) { + *vendor = this->vendor; + *renderer = this->renderer; + *version = this->version; +} + +void OpenGl3Renderer::SetCamera(const Camera &c) { + camera = c; + if(initialized) { + UpdateProjection(); + } +} + +void OpenGl3Renderer::SetLighting(const Lighting &l) { + lighting = l; +} + +//----------------------------------------------------------------------------- +// A batch canvas implemented using OpenGL 3 vertex buffer objects. +//----------------------------------------------------------------------------- + +class DrawCall { +public: + virtual Canvas::Layer GetLayer() const = 0; + virtual int GetZIndex() const = 0; + + virtual void Draw(OpenGl3Renderer *renderer) = 0; + virtual void Remove(OpenGl3Renderer *renderer) = 0; +}; + +class EdgeDrawCall final : public DrawCall { +public: + // Key + Canvas::Stroke stroke; + // Data + EdgeRenderer::Handle handle; + + Canvas::Layer GetLayer() const override { return stroke.layer; } + int GetZIndex() const override { return stroke.zIndex; } + + static std::shared_ptr Create(OpenGl3Renderer *renderer, const SEdgeList &el, + Canvas::Stroke *stroke) { + EdgeDrawCall *dc = new EdgeDrawCall(); + dc->stroke = *stroke; + dc->handle = renderer->edgeRenderer.Add(el); + return std::shared_ptr(dc); + } + + void Draw(OpenGl3Renderer *renderer) override { + ssglDepthRange(stroke.layer, stroke.zIndex); + renderer->edgeRenderer.SetStroke(stroke, 1.0 / renderer->camera.scale); + renderer->edgeRenderer.Draw(handle); + } + + void Remove(OpenGl3Renderer *renderer) override { + renderer->edgeRenderer.Remove(handle); + } +}; + +class OutlineDrawCall final : public DrawCall { +public: + // Key + Canvas::Stroke stroke; + // Data + OutlineRenderer::Handle handle; + Canvas::DrawOutlinesAs drawAs; + + Canvas::Layer GetLayer() const override { return stroke.layer; } + int GetZIndex() const override { return stroke.zIndex; } + + static std::shared_ptr Create(OpenGl3Renderer *renderer, const SOutlineList &ol, + Canvas::Stroke *stroke, + Canvas::DrawOutlinesAs drawAs) { + OutlineDrawCall *dc = new OutlineDrawCall(); + dc->stroke = *stroke; + dc->handle = renderer->outlineRenderer.Add(ol); + dc->drawAs = drawAs; + return std::shared_ptr(dc); + } + + void Draw(OpenGl3Renderer *renderer) override { + ssglDepthRange(stroke.layer, stroke.zIndex); + renderer->outlineRenderer.SetStroke(stroke, 1.0 / renderer->camera.scale); + renderer->outlineRenderer.Draw(handle, drawAs); + } + + void Remove(OpenGl3Renderer *renderer) override { + renderer->outlineRenderer.Remove(handle); + } +}; + +class PointDrawCall final : public DrawCall { +public: + // Key + Canvas::Stroke stroke; + // Data + IndexedMeshRenderer::Handle handle; + + Canvas::Layer GetLayer() const override { return stroke.layer; } + int GetZIndex() const override { return stroke.zIndex; } + + static std::shared_ptr Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh, + Canvas::Stroke *stroke) { + PointDrawCall *dc = new PointDrawCall(); + dc->stroke = *stroke; + dc->handle = renderer->imeshRenderer.Add(mesh); + return std::shared_ptr(dc); + } + + void Draw(OpenGl3Renderer *renderer) override { + ssglDepthRange(stroke.layer, stroke.zIndex); + renderer->imeshRenderer.UsePoint(stroke, 1.0 / renderer->camera.scale); + renderer->imeshRenderer.Draw(handle); + } + + void Remove(OpenGl3Renderer *renderer) override { + renderer->imeshRenderer.Remove(handle); + } +}; + +class PixmapDrawCall final : public DrawCall { +public: + // Key + Canvas::Fill fill; + // Data + IndexedMeshRenderer::Handle handle; + + Canvas::Layer GetLayer() const override { return fill.layer; } + int GetZIndex() const override { return fill.zIndex; } + + static std::shared_ptr Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh, + Canvas::Fill *fill) { + PixmapDrawCall *dc = new PixmapDrawCall(); + dc->fill = *fill; + dc->handle = renderer->imeshRenderer.Add(mesh); + return std::shared_ptr(dc); + } + + void Draw(OpenGl3Renderer *renderer) override { + ssglDepthRange(fill.layer, fill.zIndex); + if(fill.pattern != Canvas::FillPattern::SOLID) { + renderer->SelectMask(fill.pattern); + } else if(fill.texture) { + renderer->SelectTexture(fill.texture); + } else { + renderer->SelectMask(Canvas::FillPattern::SOLID); + } + renderer->imeshRenderer.UseFilled(fill); + renderer->imeshRenderer.Draw(handle); + } + + void Remove(OpenGl3Renderer *renderer) override { + renderer->imeshRenderer.Remove(handle); + } +}; + +class MeshDrawCall final : public DrawCall { +public: + // Key + Canvas::Fill fillFront; + // Data + MeshRenderer::Handle handle; + Canvas::Fill fillBack; + bool hasFillBack; + bool isShaded; + + Canvas::Layer GetLayer() const override { return fillFront.layer; } + int GetZIndex() const override { return fillFront.zIndex; } + + static std::shared_ptr Create(OpenGl3Renderer *renderer, const SMesh &m, + Canvas::Fill *fillFront, Canvas::Fill *fillBack = NULL, + bool isShaded = false) { + MeshDrawCall *dc = new MeshDrawCall(); + dc->fillFront = *fillFront; + dc->handle = renderer->meshRenderer.Add(m); + dc->fillBack = *fillBack; + dc->isShaded = isShaded; + dc->hasFillBack = (fillBack != NULL); + return std::shared_ptr(dc); + } + + void DrawFace(OpenGl3Renderer *renderer, GLenum cullFace, const Canvas::Fill &fill) { + glCullFace(cullFace); + ssglDepthRange(fill.layer, fill.zIndex); + if(fill.pattern != Canvas::FillPattern::SOLID) { + renderer->SelectMask(fill.pattern); + } else if(fill.texture) { + renderer->SelectTexture(fill.texture); + } else { + renderer->SelectMask(Canvas::FillPattern::SOLID); + } + if(isShaded) { + renderer->meshRenderer.UseShaded(renderer->lighting); + } else { + renderer->meshRenderer.UseFilled(fill); + } + renderer->meshRenderer.Draw(handle, /*useColors=*/fill.color.IsEmpty(), fill.color); + } + + void Draw(OpenGl3Renderer *renderer) override { + glEnable(GL_CULL_FACE); + if(hasFillBack) + DrawFace(renderer, GL_BACK, fillBack); + DrawFace(renderer, GL_FRONT, fillFront); + glDisable(GL_CULL_FACE); + } + + void Remove(OpenGl3Renderer *renderer) override { + renderer->meshRenderer.Remove(handle); + } +}; + +struct CompareDrawCall { + bool operator()(const std::shared_ptr &a, const std::shared_ptr &b) const { + const Canvas::Layer stackup[] = { + Canvas::Layer::BACK, + Canvas::Layer::DEPTH_ONLY, + Canvas::Layer::NORMAL, + Canvas::Layer::OCCLUDED, + Canvas::Layer::FRONT + }; + + int aLayerIndex = + std::find(std::begin(stackup), std::end(stackup), a->GetLayer()) - std::begin(stackup); + int bLayerIndex = + std::find(std::begin(stackup), std::end(stackup), b->GetLayer()) - std::begin(stackup); + if(aLayerIndex == bLayerIndex) { + return a->GetZIndex() < b->GetZIndex(); + } else { + return aLayerIndex < bLayerIndex; + } + } +}; + +class OpenGl3RendererBatch final : public BatchCanvas { +public: + struct EdgeBuffer { + hStroke h; + SEdgeList edges; + + void Clear() { + edges.Clear(); + } + }; + + struct PointBuffer { + hStroke h; + SIndexedMesh points; + + void Clear() { + points.Clear(); + } + }; + + OpenGl3Renderer *renderer; + + IdList edgeBuffer; + IdList pointBuffer; + + std::multiset, CompareDrawCall> drawCalls; + + OpenGl3RendererBatch() : renderer(), edgeBuffer(), pointBuffer() {} + + void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override { + EdgeBuffer *eb = edgeBuffer.FindByIdNoOops(hcs); + if(!eb) { + EdgeBuffer neb = {}; + neb.h = hcs; + edgeBuffer.Add(&neb); + eb = edgeBuffer.FindById(hcs); + } + + eb->edges.AddEdge(a, b); + } + + void DrawEdges(const SEdgeList &el, hStroke hcs) override { + EdgeBuffer *eb = edgeBuffer.FindByIdNoOops(hcs); + if(!eb) { + EdgeBuffer neb = {}; + neb.h = hcs; + edgeBuffer.Add(&neb); + eb = edgeBuffer.FindById(hcs); + } + + for(const SEdge &e : el.l) { + eb->edges.AddEdge(e.a, e.b); + } + } + + bool DrawBeziers(const SBezierList &bl, hStroke hcs) override { + return false; + } + + void DrawOutlines(const SOutlineList &ol, hStroke hcs, DrawOutlinesAs drawAs) override { + drawCalls.emplace(OutlineDrawCall::Create(renderer, ol, strokes.FindById(hcs), drawAs)); + } + + void DrawVectorText(const std::string &text, double height, + const Vector &o, const Vector &u, const Vector &v, + hStroke hcs) override { + ssassert(false, "Not implemented"); + } + + void DrawQuad(const Vector &a, const Vector &b, const Vector &c, const Vector &d, + hFill hcf) override { + ssassert(false, "Not implemented"); + } + + void DrawPoint(const Vector &o, hStroke hcs) override { + PointBuffer *pb = pointBuffer.FindByIdNoOops(hcs); + if(!pb) { + PointBuffer npb = {}; + npb.h = hcs; + pointBuffer.Add(&npb); + pb = pointBuffer.FindById(hcs); + } + + pb->points.AddPoint(o); + } + + void DrawPolygon(const SPolygon &p, hFill hcf) override { + SMesh m = {}; + p.TriangulateInto(&m); + drawCalls.emplace(MeshDrawCall::Create(renderer, m, fills.FindById(hcf), + fills.FindById(hcf))); + m.Clear(); + } + + void DrawMesh(const SMesh &m, hFill hcfFront, hFill hcfBack = {}) override { + drawCalls.emplace(MeshDrawCall::Create(renderer, m, fills.FindById(hcfFront), + fills.FindByIdNoOops(hcfBack), + /*isShaded=*/true)); + } + + void DrawFaces(const SMesh &m, const std::vector &faces, hFill hcf) override { + ssassert(false, "Not implemented"); + } + + void DrawPixmap(std::shared_ptr pm, + const Vector &o, const Vector &u, const Vector &v, + const Point2d &ta, const Point2d &tb, hFill hcf) override { + Fill fill = *fills.FindById(hcf); + fill.texture = pm; + hcf = GetFill(fill); + + SIndexedMesh mesh = {}; + mesh.AddPixmap(o, u, v, ta, tb); + drawCalls.emplace(PixmapDrawCall::Create(renderer, mesh, fills.FindByIdNoOops(hcf))); + mesh.Clear(); + } + + void InvalidatePixmap(std::shared_ptr pm) override { + ssassert(false, "Not implemented"); + } + + void Finalize() override { + for(const EdgeBuffer &eb : edgeBuffer) { + drawCalls.emplace(EdgeDrawCall::Create(renderer, eb.edges, strokes.FindById(eb.h))); + } + edgeBuffer.Clear(); + + for(const PointBuffer &pb : pointBuffer) { + drawCalls.emplace(PointDrawCall::Create(renderer, pb.points, strokes.FindById(pb.h))); + } + pointBuffer.Clear(); + } + + void Draw() override { + renderer->current = {}; + + for(std::shared_ptr dc : drawCalls) { + dc->Draw(renderer); + } + } + + void Clear() override { + for(std::shared_ptr dc : drawCalls) { + dc->Remove(renderer); + } + drawCalls.clear(); + } +}; + +//----------------------------------------------------------------------------- +// Factory functions. +//----------------------------------------------------------------------------- + +std::shared_ptr OpenGl3Renderer::CreateBatch() { + OpenGl3RendererBatch *batch = new OpenGl3RendererBatch(); + batch->renderer = this; + return std::shared_ptr(batch); +} + +std::shared_ptr CreateRenderer() { + return std::shared_ptr(new OpenGl3Renderer()); +} + +} diff --git a/src/request.cpp b/src/request.cpp new file mode 100644 index 0000000..cb5e3f3 --- /dev/null +++ b/src/request.cpp @@ -0,0 +1,250 @@ +//----------------------------------------------------------------------------- +// Implementation of our Request class; a request is a user-created thing +// that will generate an entity (line, curve) when the sketch is generated, +// in the same way that other entities are generated automatically, like +// by an extrude or a step and repeat. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +const hRequest Request::HREQUEST_REFERENCE_XY = { 1 }; +const hRequest Request::HREQUEST_REFERENCE_YZ = { 2 }; +const hRequest Request::HREQUEST_REFERENCE_ZX = { 3 }; + +struct EntReqMapping { + Request::Type reqType; + Entity::Type entType; + int points; + bool useExtraPoints; + bool hasNormal; + bool hasDistance; +}; +static const EntReqMapping EntReqMap[] = { +// request type entity type pts xtra? norml dist +{ Request::Type::WORKPLANE, Entity::Type::WORKPLANE, 1, false, true, false }, +{ Request::Type::DATUM_POINT, (Entity::Type)0, 1, false, false, false }, +{ Request::Type::LINE_SEGMENT, Entity::Type::LINE_SEGMENT, 2, false, false, false }, +{ Request::Type::CUBIC, Entity::Type::CUBIC, 4, true, false, false }, +{ Request::Type::CUBIC_PERIODIC, Entity::Type::CUBIC_PERIODIC, 3, true, false, false }, +{ Request::Type::CIRCLE, Entity::Type::CIRCLE, 1, false, true, true }, +{ Request::Type::ARC_OF_CIRCLE, Entity::Type::ARC_OF_CIRCLE, 3, false, true, false }, +{ Request::Type::TTF_TEXT, Entity::Type::TTF_TEXT, 4, false, true, false }, +{ Request::Type::IMAGE, Entity::Type::IMAGE, 4, false, true, false }, +}; + +static void CopyEntityInfo(const EntReqMapping *te, int extraPoints, + Entity::Type *ent, Request::Type *req, + int *pts, bool *hasNormal, bool *hasDistance) +{ + int points = te->points; + if(te->useExtraPoints) points += extraPoints; + + if(ent) *ent = te->entType; + if(req) *req = te->reqType; + if(pts) *pts = points; + if(hasNormal) *hasNormal = te->hasNormal; + if(hasDistance) *hasDistance = te->hasDistance; +} + +void EntReqTable::GetRequestInfo(Request::Type req, int extraPoints, + Entity::Type *ent, int *pts, bool *hasNormal, bool *hasDistance) +{ + for(const EntReqMapping &te : EntReqMap) { + if(req == te.reqType) { + CopyEntityInfo(&te, extraPoints, ent, NULL, pts, hasNormal, hasDistance); + return; + } + } + ssassert(false, "No request info"); +} + +bool EntReqTable::GetEntityInfo(Entity::Type ent, int extraPoints, + Request::Type *req, int *pts, bool *hasNormal, bool *hasDistance) +{ + for(const EntReqMapping &te : EntReqMap) { + if(ent == te.entType) { + CopyEntityInfo(&te, extraPoints, NULL, req, pts, hasNormal, hasDistance); + return true; + } + } + return false; +} + +Request::Type EntReqTable::GetRequestForEntity(Entity::Type ent) { + Request::Type req; + ssassert(GetEntityInfo(ent, 0, &req, NULL, NULL, NULL), + "No entity for request"); + return req; +} + +void Request::Generate(EntityList *entity, ParamList *param) +{ + int points = 0; + Entity::Type et = (Entity::Type)0; + bool hasNormal = false; + bool hasDistance = false; + int i; + + // Request-specific generation. + switch(type) { + case Type::TTF_TEXT: { + // `extraPoints` is storing kerning boolean + double actualAspectRatio = SS.fonts.AspectRatio(font, str, extraPoints); + if(EXACT(actualAspectRatio != 0.0)) { + // We could load the font, so use the actual value. + aspectRatio = actualAspectRatio; + } + if(EXACT(aspectRatio == 0.0)) { + // We couldn't load the font and we don't have anything saved, + // so just use 1:1, which is valid for the missing font symbol anyhow. + aspectRatio = 1.0; + } + break; + } + + case Type::IMAGE: { + auto image = SS.images.find(file); + if(image != SS.images.end()) { + std::shared_ptr pixmap = (*image).second; + if(pixmap != NULL) { + aspectRatio = (double)pixmap->width / (double)pixmap->height; + } + } + if(EXACT(aspectRatio == 0.0)) { + aspectRatio = 1.0; + } + break; + } + + default: // most requests don't do anything else + break; + } + + Entity e = {}; + EntReqTable::GetRequestInfo(type, extraPoints, &et, &points, &hasNormal, &hasDistance); + + // Generate the entity that's specific to this request. + e.type = et; + e.extraPoints = extraPoints; + e.group = group; + e.style = style; + e.workplane = workplane; + e.construction = construction; + e.str = str; + e.font = font; + e.file = file; + e.aspectRatio = aspectRatio; + e.h = h.entity(0); + + // And generate entities for the points + for(i = 0; i < points; i++) { + Entity p = {}; + p.workplane = workplane; + // points start from entity 1, except for datum point case + p.h = h.entity(i+((et != (Entity::Type)0) ? 1 : 0)); + p.group = group; + p.style = style; + p.construction = e.construction; + if(workplane == Entity::FREE_IN_3D) { + p.type = Entity::Type::POINT_IN_3D; + // params for x y z + p.param[0] = AddParam(param, h.param(16 + 3*i + 0)); + p.param[1] = AddParam(param, h.param(16 + 3*i + 1)); + p.param[2] = AddParam(param, h.param(16 + 3*i + 2)); + } else { + p.type = Entity::Type::POINT_IN_2D; + // params for u v + p.param[0] = AddParam(param, h.param(16 + 3*i + 0)); + p.param[1] = AddParam(param, h.param(16 + 3*i + 1)); + } + entity->Add(&p); + e.point[i] = p.h; + } + if(hasNormal) { + Entity n = {}; + n.workplane = workplane; + n.h = h.entity(32); + n.group = group; + n.style = style; + n.construction = e.construction; + if(workplane == Entity::FREE_IN_3D) { + n.type = Entity::Type::NORMAL_IN_3D; + n.param[0] = AddParam(param, h.param(32+0)); + n.param[1] = AddParam(param, h.param(32+1)); + n.param[2] = AddParam(param, h.param(32+2)); + n.param[3] = AddParam(param, h.param(32+3)); + } else { + n.type = Entity::Type::NORMAL_IN_2D; + // and this is just a copy of the workplane quaternion, + // so no params required + } + ssassert(points >= 1, "Positioning a normal requires a point"); + // The point determines where the normal gets displayed on-screen; + // it's entirely cosmetic. + n.point[0] = e.point[0]; + entity->Add(&n); + e.normal = n.h; + } + if(hasDistance) { + Entity d = {}; + d.workplane = workplane; + d.h = h.entity(64); + d.group = group; + d.style = style; + d.type = Entity::Type::DISTANCE; + d.param[0] = AddParam(param, h.param(64)); + entity->Add(&d); + e.distance = d.h; + } + + if(et != (Entity::Type)0) entity->Add(&e); +} + +std::string Request::DescriptionString() const { + const char *s = ""; + if(h == Request::HREQUEST_REFERENCE_XY) { + s = "#XY"; + } else if(h == Request::HREQUEST_REFERENCE_YZ) { + s = "#YZ"; + } else if(h == Request::HREQUEST_REFERENCE_ZX) { + s = "#ZX"; + } else { + switch(type) { + case Type::WORKPLANE: s = "workplane"; break; + case Type::DATUM_POINT: s = "datum-point"; break; + case Type::LINE_SEGMENT: s = "line-segment"; break; + case Type::CUBIC: s = "cubic-bezier"; break; + case Type::CUBIC_PERIODIC: s = "periodic-cubic"; break; + case Type::CIRCLE: s = "circle"; break; + case Type::ARC_OF_CIRCLE: s = "arc-of-circle"; break; + case Type::TTF_TEXT: s = "ttf-text"; break; + case Type::IMAGE: s = "image"; break; + } + } + ssassert(s != NULL, "Unexpected request type"); + return ssprintf("r%03x-%s", h.v, s); +} + +int Request::IndexOfPoint(hEntity he) const { + if(type == Type::DATUM_POINT) { + return (he == h.entity(0)) ? 0 : -1; + } + for(int i = 0; i < MAX_POINTS_IN_ENTITY; i++) { + if(he == h.entity(i + 1)) { + return i; + } + } + return -1; +} + +hParam Request::AddParam(ParamList *param, hParam hp) { + Param pa = {}; + pa.h = hp; + param->Add(&pa); + return hp; +} + +} // namespace SolveSpace diff --git a/src/resource.cpp b/src/resource.cpp new file mode 100644 index 0000000..8921d7a --- /dev/null +++ b/src/resource.cpp @@ -0,0 +1,1587 @@ +//----------------------------------------------------------------------------- +// Discovery and loading of our resources (icons, fonts, templates, etc). +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include +#include +#include +#include "solvespace.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Resource loading functions +//----------------------------------------------------------------------------- + +std::string LoadString(const std::string &name) { + size_t size; + const void *data = Platform::LoadResource(name, &size); + std::string result(static_cast(data), size); + + // When editing resources under Windows, Windows newlines may sneak in. + // Any files with them won't be merged, but ignoring them during development + // helps external contributors. + result.erase(std::remove(result.begin(), result.end(), '\r'), + result.end()); + + return result; +} + +std::string LoadStringFromGzip(const std::string &name) { + size_t deflatedSize; + const void *data = Platform::LoadResource(name, &deflatedSize); + + z_stream stream; + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + const int windowBits = /*maximum window*/ 15 + /*decode gzip header*/16; + ssassert(inflateInit2(&stream, windowBits) == Z_OK, "Cannot start inflation"); + + // Extract length mod 2**32 from the gzip trailer. + std::string result; + ssassert(deflatedSize >= 4, "Resource too small to have gzip trailer"); + + // *(uint32_t *) may perform an unaligned access, so do a memcpy. + uint32_t inflatedSize; + memcpy(&inflatedSize, (uint8_t *)((uintptr_t)data + deflatedSize - 4), sizeof(uint32_t)); + result.resize(inflatedSize); + + stream.next_in = (Bytef *)data; + stream.avail_in = (uInt)deflatedSize; + stream.next_out = (Bytef *)&result[0]; + stream.avail_out = (uInt)result.length(); + ssassert(inflate(&stream, Z_NO_FLUSH) == Z_STREAM_END, "Cannot inflate resource"); + ssassert(stream.avail_out == 0, "Inflated resource larger than what trailer indicates"); + + inflateEnd(&stream); + + return result; +} + +std::shared_ptr LoadPng(const std::string &name) { + size_t size; + const void *data = Platform::LoadResource(name, &size); + + std::shared_ptr pixmap = Pixmap::FromPng(static_cast(data), size); + ssassert(pixmap != nullptr, "Cannot load pixmap"); + + return pixmap; +} + +//----------------------------------------------------------------------------- +// Pixmap manipulation +//----------------------------------------------------------------------------- + +size_t Pixmap::GetBytesPerPixel() const { + switch(format) { + case Format::RGBA: return 4; + case Format::BGRA: return 4; + case Format::RGB: return 3; + case Format::BGR: return 3; + case Format::A: return 1; + } + ssassert(false, "Unexpected pixmap format"); +} + +RgbaColor Pixmap::GetPixel(size_t x, size_t y) const { + const uint8_t *pixel = &data[y * stride + x * GetBytesPerPixel()]; + + switch(format) { + case Format::RGBA: + return RgbaColor::From(pixel[0], pixel[1], pixel[2], pixel[3]); + + case Format::RGB: + return RgbaColor::From(pixel[0], pixel[1], pixel[2], 255); + + case Format::BGRA: + return RgbaColor::From(pixel[2], pixel[1], pixel[0], pixel[3]); + + case Format::BGR: + return RgbaColor::From(pixel[2], pixel[1], pixel[0], 255); + + case Format::A: + return RgbaColor::From( 255, 255, 255, pixel[0]); + } + ssassert(false, "Unexpected resource format"); +} + +void Pixmap::SetPixel(size_t x, size_t y, RgbaColor color) { + uint8_t *pixel = &data[y * stride + x * GetBytesPerPixel()]; + + switch(format) { + case Format::RGBA: + pixel[0] = color.red; + pixel[1] = color.green; + pixel[2] = color.blue; + pixel[3] = color.alpha; + break; + + case Format::RGB: + pixel[0] = color.red; + pixel[1] = color.green; + pixel[2] = color.blue; + break; + + case Format::BGRA: + pixel[0] = color.blue; + pixel[1] = color.green; + pixel[2] = color.red; + pixel[3] = color.alpha; + break; + + case Format::BGR: + pixel[0] = color.blue; + pixel[1] = color.green; + pixel[2] = color.red; + break; + + case Format::A: + pixel[0] = color.alpha; + break; + } +} + +void Pixmap::ConvertTo(Format newFormat) { + switch(format) { + case Format::RGBA: + ssassert(newFormat == Format::BGRA, "Unexpected target format"); + break; + + case Format::BGRA: + ssassert(newFormat == Format::RGBA, "Unexpected target format"); + break; + + case Format::RGB: + ssassert(newFormat == Format::BGR, "Unexpected target format"); + break; + + case Format::BGR: + ssassert(newFormat == Format::RGB, "Unexpected target format"); + break; + + case Format::A: + ssassert(false, "Unexpected target format"); + } + + size_t bpp = GetBytesPerPixel(); + for(size_t j = 0; j != height; j++) { + uint8_t *row = &data[j * stride]; + for(size_t i = 0; i != width * bpp; i += bpp) { + // This handles both RGB<>BGR and RGBA<>BGRA. + std::swap(row[i], row[i + 2]); + } + } + + format = newFormat; +} + +static std::shared_ptr ReadPngIntoPixmap(png_struct *png_ptr, png_info *info_ptr, + bool flip) { + png_read_png(png_ptr, info_ptr, + PNG_TRANSFORM_EXPAND | PNG_TRANSFORM_GRAY_TO_RGB | PNG_TRANSFORM_SCALE_16, NULL); + + std::shared_ptr pixmap = std::make_shared(); + pixmap->width = png_get_image_width(png_ptr, info_ptr); + pixmap->height = png_get_image_height(png_ptr, info_ptr); + if((png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA) != 0) { + pixmap->format = Pixmap::Format::RGBA; + } else { + pixmap->format = Pixmap::Format::RGB; + } + + size_t stride = pixmap->width * pixmap->GetBytesPerPixel(); + if(stride % 4 != 0) stride += 4 - stride % 4; + pixmap->stride = stride; + + pixmap->data = std::vector(pixmap->stride * pixmap->height); + uint8_t **rows = png_get_rows(png_ptr, info_ptr); + for(size_t y = 0; y < pixmap->height; y++) { + uint8_t *srcRow = flip ? rows[pixmap->height - y - 1] : rows[y]; + memcpy(&pixmap->data[pixmap->stride * y], srcRow, + pixmap->width * pixmap->GetBytesPerPixel()); + } + + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + return pixmap; +} + +std::shared_ptr Pixmap::FromPng(const uint8_t *data, size_t size, bool flip) { + struct Slice { const uint8_t *data; size_t size; }; + Slice dataSlice = { data, size }; + png_struct *png_ptr = NULL; + png_info *info_ptr = NULL; + + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if(!png_ptr) goto exit; + info_ptr = png_create_info_struct(png_ptr); + if(!info_ptr) goto exit; + + if(setjmp(png_jmpbuf(png_ptr))) goto exit; + + png_set_read_fn(png_ptr, &dataSlice, + [](png_struct *png_ptr, uint8_t *data, size_t size) { + Slice *dataSlice = (Slice *)png_get_io_ptr(png_ptr); + if(size <= dataSlice->size) { + memcpy(data, dataSlice->data, size); + dataSlice->data += size; + dataSlice->size -= size; + } else { + png_error(png_ptr, "EOF"); + } + }); + + return ReadPngIntoPixmap(png_ptr, info_ptr, flip); + +exit: + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + return nullptr; +} + +std::shared_ptr Pixmap::ReadPng(FILE *f, bool flip) { + png_struct *png_ptr = NULL; + png_info *info_ptr = NULL; + + uint8_t header[8]; + if(fread(header, 1, sizeof(header), f) != sizeof(header)) goto exit; + if(png_sig_cmp(header, 0, sizeof(header))) goto exit; + + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if(!png_ptr) goto exit; + info_ptr = png_create_info_struct(png_ptr); + if(!info_ptr) goto exit; + + if(setjmp(png_jmpbuf(png_ptr))) goto exit; + + png_init_io(png_ptr, f); + png_set_sig_bytes(png_ptr, sizeof(header)); + + return ReadPngIntoPixmap(png_ptr, info_ptr, flip); + +exit: + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + return nullptr; +} + +std::shared_ptr Pixmap::ReadPng(const Platform::Path &filename, bool flip) { + FILE *f = OpenFile(filename, "rb"); + if(!f) return NULL; + std::shared_ptr pixmap = ReadPng(f, flip); + fclose(f); + return pixmap; +} + +bool Pixmap::WritePng(FILE *f, bool flip) { + colorType = 0; + bgr = false; + switch(format) { + case Format::RGBA: colorType = PNG_COLOR_TYPE_RGBA; bgr = false; break; + case Format::BGRA: colorType = PNG_COLOR_TYPE_RGBA; bgr = true; break; + case Format::RGB: colorType = PNG_COLOR_TYPE_RGB; bgr = false; break; + case Format::BGR: colorType = PNG_COLOR_TYPE_RGB; bgr = true; break; + case Format::A: colorType = PNG_COLOR_TYPE_GRAY; bgr = false; break; + } + + std::vector rows; + for(size_t y = 0; y < height; y++) { + if(flip) { + rows.push_back(&data[stride * (height - y - 1)]); + } else { + rows.push_back(&data[stride * y]); + } + } + + png_struct *png_ptr = NULL; + png_info *info_ptr = NULL; + + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if(!png_ptr) goto exit; + info_ptr = png_create_info_struct(png_ptr); + if(!info_ptr) goto exit; + + if(setjmp(png_jmpbuf(png_ptr))) goto exit; + + png_init_io(png_ptr, f); + png_set_IHDR(png_ptr, info_ptr, + (png_uint_32)width, (png_uint_32)height, 8, colorType, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); + if(bgr) png_set_bgr(png_ptr); + png_write_info(png_ptr, info_ptr); + png_write_image(png_ptr, &rows[0]); + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + return true; + +exit: + png_destroy_write_struct(&png_ptr, &info_ptr); + return false; +} + +bool Pixmap::WritePng(const Platform::Path &filename, bool flip) { + FILE *f = OpenFile(filename, "wb"); + if(!f) return false; + bool success = WritePng(f, flip); + fclose(f); + return success; +} + +bool Pixmap::Equals(const Pixmap &other) const { + if(format != other.format || width != other.width || height != other.height) { + return false; + } + + size_t rowLength = width * GetBytesPerPixel(); + for(size_t y = 0; y < height; y++) { + if(memcmp(&data[y * stride], &other.data[y * other.stride], rowLength)) { + return false; + } + } + + return true; +} + +std::shared_ptr Pixmap::Create(Format format, size_t width, size_t height) { + std::shared_ptr pixmap = std::make_shared(); + pixmap->format = format; + pixmap->width = width; + pixmap->height = height; + // Align to fulfill OpenGL texture requirements. + size_t stride = pixmap->width * pixmap->GetBytesPerPixel(); + if(stride % 4 != 0) stride += 4 - stride % 4; + pixmap->stride = stride; + pixmap->data = std::vector(pixmap->stride * pixmap->height); + return pixmap; +} + +std::shared_ptr Pixmap::Copy() { + std::shared_ptr pixmap = std::make_shared(); + pixmap->format = format; + pixmap->width = width; + pixmap->height = height; + pixmap->stride = stride; + pixmap->data = data; + return pixmap; +} + +//----------------------------------------------------------------------------- +// ASCII sequence parsing +//----------------------------------------------------------------------------- + +class ASCIIReader { +public: + std::string::const_iterator pos, end; + + static ASCIIReader From(const std::string &str) { + return ASCIIReader({ str.cbegin(), str.cend() }); + } + + bool AtEnd() const { + return pos == end; + } + + bool SkipSpace() { + bool skipped = false; + while(!AtEnd()) { + char c = *pos; + if(!(c == ' ' || c == '\t' || c == '\n')) break; + skipped = true; + pos++; + } + return skipped; + } + + char PeekChar() { + ssassert(!AtEnd(), "Unexpected EOF"); + return *pos; + } + + char ReadChar() { + ssassert(!AtEnd(), "Unexpected EOF"); + return *pos++; + } + + bool TryChar(char c) { + if(AtEnd()) { + return false; + } else if(*pos == c) { + pos++; + return true; + } else { + return false; + } + } + + void ExpectChar(char c) { + if(!TryChar(c)) { + dbp("Expecting character '%c'", c); + ssassert(false, "Unexpected character"); + } + } + + bool TryString(const std::string &s) { + if((size_t)(end - pos) >= s.size() && std::string(pos, pos + s.size()) == s) { + pos += s.size(); + return true; + } else { + return false; + } + } + + void ExpectString(const std::string &s) { + if(!TryString(s)) { + dbp("Expecting string '%s'", s.c_str()); + ssassert(false, "Unexpected string"); + } + } + + size_t CountUntilEol() const { + return std::find(pos, end, '\n') - pos; + } + + void SkipUntilEol() { + pos = std::find(pos, end, '\n'); + } + + std::string ReadUntilEol() { + auto eol = std::find(pos, end, '\n'); + std::string result(pos, eol); + if(eol != end) { + pos = eol + 1; + } else { + pos = end; + } + return result; + } + + uint8_t Read4HexBits() { + char c = ReadChar(); + if(c >= '0' && c <= '9') { + return c - '0'; + } else if(c >= 'a' && c <= 'f') { + return 10 + (c - 'a'); + } else if(c >= 'A' && c <= 'F') { + return 10 + (c - 'A'); + } else ssassert(false, "Unexpected hex digit"); + } + + uint8_t Read8HexBits() { + uint8_t h = Read4HexBits(), + l = Read4HexBits(); + return (h << 4) + l; + } + + uint16_t Read16HexBits() { + uint16_t h = Read8HexBits(), + l = Read8HexBits(); + return (h << 8) + l; + } + + long ReadIntegerDecimal(int base = 10) { + char *endptr; + long l = strtol(&*pos, &endptr, base); + ssassert(&*pos != endptr, "Cannot read an integer number"); + pos += endptr - &*pos; + return l; + } + + double ReadFloatDecimal() { + char *endptr; + double d = strtod(&*pos, &endptr); + ssassert(&*pos != endptr, "Cannot read a floating-point number"); + pos += endptr - &*pos; + return d; + } + + bool TryRegex(const std::regex &re, std::smatch *m) { + if(std::regex_search(pos, end, *m, re, std::regex_constants::match_continuous)) { + pos += m->length(); + return true; + } else { + return false; + } + } + + void ExpectRegex(const std::regex &re, std::smatch *m) { + ssassert(TryRegex(re, m), "Unmatched regex"); + } +}; + +//----------------------------------------------------------------------------- +// Bitmap font manipulation +//----------------------------------------------------------------------------- + +static uint8_t *BitmapFontTextureRow(std::shared_ptr texture, + uint16_t position, size_t y) { + // position = 0; + size_t col = position % (texture->width / 16), + row = position / (texture->width / 16); + return &texture->data[texture->stride * (16 * row + y) + 16 * col]; +} + +BitmapFont BitmapFont::From(std::string &&unifontData) { + BitmapFont font = {}; + font.unifontData = std::move(unifontData); + font.texture = Pixmap::Create(Pixmap::Format::A, 1024, 1024); + + return font; +} + +void BitmapFont::AddGlyph(char32_t codepoint, std::shared_ptr pixmap) { + ssassert((pixmap->width == 8 || pixmap->width == 16) && pixmap->height == 16, + "Unexpected pixmap dimensions"); + ssassert(pixmap->format == Pixmap::Format::RGB, + "Unexpected pixmap format"); + ssassert(glyphs.find(codepoint) == glyphs.end(), + "Glyph with this codepoint already exists"); + ssassert(nextPosition != 0xffff, + "Too many glyphs for current texture size"); + + BitmapFont::Glyph glyph = {}; + glyph.advanceCells = (uint8_t)(pixmap->width / 8); + glyph.position = nextPosition++; + glyphs.emplace(codepoint, glyph); + + for(size_t y = 0; y < pixmap->height; y++) { + uint8_t *row = BitmapFontTextureRow(texture, glyph.position, y); + for(size_t x = 0; x < pixmap->width; x++) { + if((pixmap->GetPixel(x, y).ToPackedInt() & 0xffffff) != 0) { + row[x] = 255; + } + } + } +} + +const BitmapFont::Glyph &BitmapFont::GetGlyph(char32_t codepoint) { + auto it = glyphs.find(codepoint); + if(it != glyphs.end()) { + return (*it).second; + } + + ssassert(nextPosition != 0xffff, + "Too many glyphs for current texture size"); + + // Find the hex representation in the (sorted) Unifont file. + auto first = unifontData.cbegin(), + last = unifontData.cend(); + while(first < last) { + auto mid = first + (last - first) / 2; + while(mid != unifontData.cbegin()) { + if(*mid == '\n') { + mid++; + break; + } + mid--; + } + + ASCIIReader reader = { mid, unifontData.cend() }; + if(reader.AtEnd()) break; + + // Read the codepoint. + char32_t foundCodepoint = reader.Read16HexBits(); + reader.ExpectChar(':'); + + if(foundCodepoint > codepoint) { + last = mid - 1; + continue; // and first stays the same + } + if(foundCodepoint < codepoint) { + first = mid + 1; + while(first != unifontData.cend()) { + if(*first == '\n') { + first++; + break; + } + first++; + } + continue; // and last stays the same + } + + // Found the codepoint. + Glyph glyph = {}; + glyph.position = nextPosition++; + + // Read glyph bits. + unsigned short glyphBits[16]; + size_t glyphLength = reader.CountUntilEol(); + if(glyphLength == 4 * 16) { + glyph.advanceCells = 2; + for(size_t i = 0; i < 16; i++) { + glyphBits[i] = reader.Read16HexBits(); + } + } else if(glyphLength == 2 * 16) { + glyph.advanceCells = 1; + for(size_t i = 0; i < 16; i++) { + glyphBits[i] = (uint16_t)reader.Read8HexBits() << 8; + } + } else ssassert(false, "Unexpected glyph bitmap length"); + + // Fill in the texture (one texture byte per glyph bit). + for(size_t y = 0; y < 16; y++) { + uint8_t *row = BitmapFontTextureRow(texture, glyph.position, y); + for(size_t x = 0; x < 16; x++) { + if(glyphBits[y] & (1 << (15 - x))) { + row[x] = 255; + } + } + } + + it = glyphs.emplace(codepoint, glyph).first; + + textureUpdated = true; + return (*it).second; + } + + // Glyph doesn't exist; return replacement glyph instead. + ssassert(codepoint != 0xfffd, "Cannot parse replacement glyph"); + return GetGlyph(0xfffd); +} + +void BitmapFont::LocateGlyph(char32_t codepoint, + double *s0, double *t0, double *s1, double *t1, + size_t *w, size_t *h) { + const Glyph &glyph = GetGlyph(codepoint); + *w = glyph.advanceCells * 8; + *h = 16; + *s0 = (16.0 * (glyph.position % (texture->width / 16))) / texture->width; + *s1 = *s0 + (double)(*w) / texture->width; + *t0 = (16.0 * (glyph.position / (texture->width / 16))) / texture->height; + *t1 = *t0 + (double)(*h) / texture->height; +} + +size_t BitmapFont::GetWidth(char32_t codepoint) { + if(codepoint >= 0xe000 && codepoint <= 0xefff) { + // These are special-cased because checkboxes predate support for 2 cell wide + // characters; and so all Printf() calls pad them with spaces. + return 1; + } + + return GetGlyph(codepoint).advanceCells; +} + +size_t BitmapFont::GetWidth(const std::string &str) { + size_t width = 0; + for(char32_t codepoint : ReadUTF8(str)) { + width += GetWidth(codepoint); + } + return width; +} + +BitmapFont BitmapFont::Create() { + BitmapFont Font = BitmapFont::From(LoadStringFromGzip("fonts/unifont.hex.gz")); + // Unifont doesn't have a glyph for U+0020. + Font.AddGlyph(0x0020, Pixmap::Create(Pixmap::Format::RGB, 8, 16)); + Font.AddGlyph(0xE000, LoadPng("fonts/private/0-check-false.png")); + Font.AddGlyph(0xE001, LoadPng("fonts/private/1-check-true.png")); + Font.AddGlyph(0xE002, LoadPng("fonts/private/2-radio-false.png")); + Font.AddGlyph(0xE003, LoadPng("fonts/private/3-radio-true.png")); + Font.AddGlyph(0xE004, LoadPng("fonts/private/4-stipple-dot.png")); + Font.AddGlyph(0xE005, LoadPng("fonts/private/5-stipple-dash-long.png")); + Font.AddGlyph(0xE006, LoadPng("fonts/private/6-stipple-dash.png")); + Font.AddGlyph(0xE007, LoadPng("fonts/private/7-stipple-zigzag.png")); + return Font; +} + +//----------------------------------------------------------------------------- +// Vector font manipulation +//----------------------------------------------------------------------------- + +const static int ARC_POINTS = 8; +static void MakePwlArc(VectorFont::Contour *contour, bool isReversed, + const Point2d &cp, double radius, double a1, double a2) { + if(radius < LENGTH_EPS) return; + + double aSign = 1.0; + if(isReversed) { + if(a1 <= a2 + LENGTH_EPS) a1 += 2.0 * M_PI; + aSign = -1.0; + } else { + if(a2 <= a1 + LENGTH_EPS) a2 += 2.0 * M_PI; + } + + double aStep = aSign * fabs(a2 - a1) / (double)ARC_POINTS; + for(int i = 0; i <= ARC_POINTS; i++) { + contour->points.emplace_back(cp.Plus(Point2d::FromPolar(radius, a1 + aStep * i))); + } +} + +static void MakePwlBulge(VectorFont::Contour *contour, const Point2d &v, double bulge) { + bool reversed = bulge < 0.0; + double alpha = atan(bulge) * 4.0; + const Point2d &point = contour->points.back(); + + Point2d middle = point.Plus(v).ScaledBy(0.5); + double dist = point.DistanceTo(v) / 2.0; + double angle = point.AngleTo(v); + + // alpha can't be 0.0 at this point + double radius = fabs(dist / sin(alpha / 2.0)); + double wu = fabs(radius*radius - dist*dist); + double h = sqrt(wu); + + if(bulge > 0.0) { + angle += M_PI_2; + } else { + angle -= M_PI_2; + } + + if(fabs(alpha) > M_PI) { + h = -h; + } + + Point2d center = Point2d::FromPolar(h, angle).Plus(middle); + double a1 = center.AngleTo(point); + double a2 = center.AngleTo(v); + MakePwlArc(contour, reversed, center, radius, a1, a2); +} + +static void GetGlyphBBox(const VectorFont::Glyph &glyph, + double *rminx, double *rmaxx, double *rminy, double *rmaxy) { + double minx = 0.0, maxx = 0.0, miny = 0.0, maxy = 0.0; + if(!glyph.contours.empty()) { + const Point2d &start = glyph.contours[0].points[0]; + minx = maxx = start.x; + miny = maxy = start.y; + for(const VectorFont::Contour &c : glyph.contours) { + for(const Point2d &p : c.points) { + maxx = std::max(maxx, p.x); + minx = std::min(minx, p.x); + maxy = std::max(maxy, p.y); + miny = std::min(miny, p.y); + } + } + } + + if(rminx) *rminx = minx; + if(rmaxx) *rmaxx = maxx; + if(rminy) *rminy = miny; + if(rmaxy) *rmaxy = maxy; +} + +VectorFont VectorFont::From(std::string &&lffData) { + VectorFont font = {}; + font.lffData = std::move(lffData); + + ASCIIReader reader = ASCIIReader::From(font.lffData); + std::smatch m; + while(reader.TryRegex(std::regex("#\\s*(\\w+)\\s*:\\s*(.+?)\n"), &m)) { + std::string name = m.str(1), + value = m.str(2); + std::transform(name.begin(), name.end(), name.begin(), ::tolower); + if(name == "letterspacing") { + font.rightSideBearing = std::stod(value); + } else if(name == "wordspacing") { + Glyph space = {}; + space.advanceWidth = std::stod(value); + font.glyphs.emplace(' ', std::move(space)); + } + } + + GetGlyphBBox(font.GetGlyph('A'), nullptr, nullptr, nullptr, &font.capHeight); + GetGlyphBBox(font.GetGlyph('h'), nullptr, nullptr, nullptr, &font.ascender); + GetGlyphBBox(font.GetGlyph('p'), nullptr, nullptr, &font.descender, nullptr); + + ssassert(!font.IsEmpty(), "Expected to load a font"); + return font; +} + +const VectorFont::Glyph &VectorFont::GetGlyph(char32_t codepoint) { + auto it = glyphs.find(codepoint); + if(it != glyphs.end()) { + return (*it).second; + } + + auto firstGlyph = std::find(lffData.cbegin(), lffData.cend(), '['); + ssassert(firstGlyph != lffData.cend(), "Vector font contains no glyphs"); + + // Find the serialized representation in the (sorted) lff file. + auto first = firstGlyph, + last = lffData.cend(); + while(first <= last) { + auto mid = first + (last - first) / 2; + while(mid > first) { + if(*mid == '[' && *(mid - 1) == '\n') break; + mid--; + } + + ASCIIReader reader = { mid, lffData.cend() }; + if(reader.AtEnd()) break; + + // Read the codepoint. + reader.ExpectChar('['); + char32_t foundCodepoint = reader.Read16HexBits(); + reader.ExpectChar(']'); + reader.SkipUntilEol(); + + if(foundCodepoint > codepoint) { + last = mid - 1; + continue; // and first stays the same + } + if(foundCodepoint < codepoint) { + first = mid + 1; + while(first != lffData.cend()) { + if(*first == '[' && *(first - 1) == '\n') break; + first++; + } + continue; // and last stays the same + } + + // Found the codepoint. + VectorFont::Glyph glyph = {}; + + // Read glyph contours. + while(!reader.AtEnd()) { + if(reader.TryChar('\n')) { + // Skip. + } else if(reader.TryChar('[')) { + // End of glyph. + if(glyph.contours.back().points.empty()) { + // Remove an useless empty contour, if any. + glyph.contours.pop_back(); + } + break; + } else if(reader.TryChar('C')) { + // Another character is referenced in this one. + char32_t baseCodepoint = reader.Read16HexBits(); + const VectorFont::Glyph &baseGlyph = GetGlyph(baseCodepoint); + std::copy(baseGlyph.contours.begin(), baseGlyph.contours.end(), + std::back_inserter(glyph.contours)); + } else { + Contour contour; + do { + Point2d p; + p.x = reader.ReadFloatDecimal(); + reader.ExpectChar(','); + p.y = reader.ReadFloatDecimal(); + + if(reader.TryChar(',')) { + // Point with a bulge. + reader.ExpectChar('A'); + double bulge = reader.ReadFloatDecimal(); + MakePwlBulge(&contour, p, bulge); + } else { + // Just a point. + contour.points.emplace_back(std::move(p)); + } + } while(reader.TryChar(';')); + reader.ExpectChar('\n'); + glyph.contours.emplace_back(std::move(contour)); + } + } + + // Calculate metrics. + GetGlyphBBox(glyph, &glyph.leftSideBearing, &glyph.boundingWidth, nullptr, nullptr); + glyph.advanceWidth = glyph.leftSideBearing + glyph.boundingWidth + rightSideBearing; + + it = glyphs.emplace(codepoint, std::move(glyph)).first; + return (*it).second; + } + + // Glyph doesn't exist; return replacement glyph instead. + ssassert(codepoint != 0xfffd, "Cannot parse replacement glyph"); + return GetGlyph(0xfffd); +} + +VectorFont *VectorFont::Builtin() { + static VectorFont Font; + if(Font.IsEmpty()) { + Font = VectorFont::From(LoadStringFromGzip("fonts/unicode.lff.gz")); + } + return &Font; +} + +double VectorFont::GetCapHeight(double forCapHeight) const { + ssassert(!IsEmpty(), "Expected a loaded font"); + + return forCapHeight; +} + +double VectorFont::GetHeight(double forCapHeight) const { + ssassert(!IsEmpty(), "Expected a loaded font"); + + return (ascender - descender) * (forCapHeight / capHeight); +} + +double VectorFont::GetWidth(double forCapHeight, const std::string &str) { + ssassert(!IsEmpty(), "Expected a loaded font"); + + double width = 0; + for(char32_t codepoint : ReadUTF8(str)) { + width += GetGlyph(codepoint).advanceWidth; + } + width -= rightSideBearing; + return width * (forCapHeight / capHeight); +} + +Vector VectorFont::GetExtents(double forCapHeight, const std::string &str) { + Vector ex = {}; + ex.x = GetWidth(forCapHeight, str); + ex.y = GetHeight(forCapHeight); + return ex; +} + +void VectorFont::Trace(double forCapHeight, Vector o, Vector u, Vector v, const std::string &str, + const std::function &traceEdge) { + ssassert(!IsEmpty(), "Expected a loaded font"); + + double scale = (forCapHeight / capHeight); + u = u.ScaledBy(scale); + v = v.ScaledBy(scale); + + for(char32_t codepoint : ReadUTF8(str)) { + const Glyph &glyph = GetGlyph(codepoint); + + for(const VectorFont::Contour &contour : glyph.contours) { + Vector prevp; + bool penUp = true; + for(const Point2d &pt : contour.points) { + Vector p = o.Plus(u.ScaledBy(pt.x)) + .Plus(v.ScaledBy(pt.y)); + if(!penUp) traceEdge(prevp, p); + prevp = p; + penUp = false; + } + } + + o = o.Plus(u.ScaledBy(glyph.advanceWidth)); + } +} + +void VectorFont::Trace(double forCapHeight, Vector o, Vector u, Vector v, const std::string &str, + const std::function &traceEdge, const Camera &camera) { + ssassert(!IsEmpty(), "Expected a loaded font"); + + // Perform grid-fitting only when the text is parallel to the view plane. + if(camera.gridFit && !(u.WithMagnitude(1).Equals(camera.projRight) && + v.WithMagnitude(1).Equals(camera.projUp))) { + return Trace(forCapHeight, o, u, v, str, traceEdge); + } + + double scale = forCapHeight / capHeight; + u = u.ScaledBy(scale); + v = v.ScaledBy(scale); + + for(char32_t codepoint : ReadUTF8(str)) { + const Glyph &glyph = GetGlyph(codepoint); + double actualWidth = std::max(1.0, glyph.boundingWidth); + + // Align (o+lsb), (o+lsb+u) and (o+lsb+v) to pixel grid. + Vector ao = o.Plus(u.ScaledBy(glyph.leftSideBearing)); + Vector au = ao.Plus(u.ScaledBy(actualWidth)); + Vector av = ao.Plus(v.ScaledBy(capHeight)); + + ao = camera.AlignToPixelGrid(ao); + au = camera.AlignToPixelGrid(au); + av = camera.AlignToPixelGrid(av); + + au = au.Minus(ao).ScaledBy(1.0 / actualWidth); + av = av.Minus(ao).ScaledBy(1.0 / capHeight); + + for(const VectorFont::Contour &contour : glyph.contours) { + Vector prevp; + bool penUp = true; + for(const Point2d &pt : contour.points) { + Vector p = ao.Plus(au.ScaledBy(pt.x - glyph.leftSideBearing)) + .Plus(av.ScaledBy(pt.y)); + if(!penUp) traceEdge(prevp, p); + prevp = p; + penUp = false; + } + } + + o = o.Plus(u.ScaledBy(glyph.advanceWidth)); + } +} + +//----------------------------------------------------------------------------- +// Gettext plural expression evaluation +//----------------------------------------------------------------------------- + +class PluralExpr { +public: + class Token { + public: + enum class Type { + END, + VALUE, + BINARY_OP, + QUERY, + COLON, + PAREN_LEFT, + PAREN_RIGHT, + }; + + // Only valid for type == BINARY_OP. + enum class Op { + NONE, + // comparison + EQ, // == + NEQ, // != + LT, // < + GT, // > + LE, // <= + GE, // >= + // logical + AND, // && + OR, // || + // arithmetic + MOD, // % + }; + + Type type; + Op op; + unsigned value; + + int Precedence(); + }; + + ASCIIReader reader; + std::vector stack; + unsigned value; + + Token Lex(); + + Token PopToken(); + void Reduce(); + void Eval(); + + static unsigned Eval(const std::string &s, unsigned n); +}; + +int PluralExpr::Token::Precedence() { + switch(type) { + case Type::BINARY_OP: + switch(op) { + case Op::MOD: + return 7; + + case Op::LT: + case Op::GT: + case Op::LE: + case Op::GE: + return 6; + + case Op::EQ: + case Op::NEQ: + return 5; + + case Op::AND: + return 4; + + case Op::OR: + return 3; + + case Op::NONE: + ; + } + ssassert(false, "Unexpected operator"); + + case Type::QUERY: + case Type::COLON: + return 1; + + case Type::VALUE: + return 0; + + default: + ssassert(false, "Unexpected token op"); + } +} + +PluralExpr::Token PluralExpr::Lex() { + Token t = {}; + + reader.SkipSpace(); + + char c = reader.PeekChar(); + if(c >= '0' && c <= '9') { + t.type = Token::Type::VALUE; + t.value = reader.ReadIntegerDecimal(); + } else if(reader.TryChar('n')) { + t.type = Token::Type::VALUE; + t.value = value; + } else if(reader.TryChar('%')) { + t.type = Token::Type::BINARY_OP; + t.op = Token::Op::MOD; + } else if(reader.TryChar('<')) { + t.type = Token::Type::BINARY_OP; + if(reader.TryChar('=')) { + t.op = Token::Op::LE; + } else { + t.op = Token::Op::LT; + } + } else if(reader.TryChar('>')) { + t.type = Token::Type::BINARY_OP; + if(reader.TryChar('=')) { + t.op = Token::Op::GE; + } else { + t.op = Token::Op::GT; + } + } else if(reader.TryChar('!')) { + reader.ExpectChar('='); + t.type = Token::Type::BINARY_OP; + t.op = Token::Op::NEQ; + } else if(reader.TryChar('=')) { + reader.ExpectChar('='); + t.type = Token::Type::BINARY_OP; + t.op = Token::Op::EQ; + } else if(reader.TryChar('&')) { + reader.ExpectChar('&'); + t.type = Token::Type::BINARY_OP; + t.op = Token::Op::AND; + } else if(reader.TryChar('|')) { + reader.ExpectChar('|'); + t.type = Token::Type::BINARY_OP; + t.op = Token::Op::OR; + } else if(reader.TryChar('?')) { + t.type = Token::Type::QUERY; + } else if(reader.TryChar(':')) { + t.type = Token::Type::COLON; + } else if(reader.TryChar('(')) { + t.type = Token::Type::PAREN_LEFT; + } else if(reader.TryChar(')')) { + t.type = Token::Type::PAREN_RIGHT; + } else if(reader.AtEnd()) { + t.type = Token::Type::END; + } else { + ssassert(false, "Unexpected character"); + } + + return t; +} + +PluralExpr::Token PluralExpr::PopToken() { + ssassert(!stack.empty(), "Expected a non-empty stack"); + Token t = stack.back(); + stack.pop_back(); + return t; +} + +void PluralExpr::Reduce() { + Token r; + r.type = Token::Type::VALUE; + + Token a = PopToken(); + ssassert(a.type == Token::Type::VALUE, "Expected 1st operand to be a value"); + + Token op = PopToken(); + switch(op.type) { + case Token::Type::BINARY_OP: { + Token b = PopToken(); + ssassert(b.type == Token::Type::VALUE, "Expected 2nd operand to be a value"); + + switch(op.op) { + case Token::Op::EQ: + r.value = (a.value == b.value ? 1 : 0); + break; + case Token::Op::NEQ: + r.value = (a.value != b.value ? 1 : 0); + break; + case Token::Op::LT: + r.value = (b.value < a.value ? 1 : 0); + break; + case Token::Op::GT: + r.value = (b.value > a.value ? 1 : 0); + break; + case Token::Op::LE: + r.value = (b.value <= a.value ? 1 : 0); + break; + case Token::Op::GE: + r.value = (b.value >= a.value ? 1 : 0); + break; + case Token::Op::AND: + r.value = a.value && b.value; + break; + case Token::Op::OR: + r.value = a.value || b.value; + break; + case Token::Op::MOD: + r.value = b.value % a.value; + break; + case Token::Op::NONE: + ssassert(false, "Unexpected operator"); + } + break; + } + + case Token::Type::COLON: { + Token b = PopToken(); + ssassert(PopToken().type == Token::Type::QUERY, "Expected ?"); + Token c = PopToken(); + r.value = c.value ? b.value : a.value; + break; + } + + default: + ssassert(false, "Unexpected operator type"); + } + + stack.push_back(r); +} + +void PluralExpr::Eval() { + while(true) { + Token t = Lex(); + switch(t.type) { + case Token::Type::END: + case Token::Type::PAREN_RIGHT: + while(stack.size() > 1 && + stack.end()[-2].type != Token::Type::PAREN_LEFT) { + Reduce(); + } + if(t.type == Token::Type::PAREN_RIGHT) { + ssassert(stack.size() > 1, "Expected ("); + stack.push_back(t); + } + return; + + case Token::Type::PAREN_LEFT: + stack.push_back(t); + Eval(); + if(stack.back().type != Token::Type::PAREN_RIGHT) { + ssassert(false, "Expected )"); + } + stack.pop_back(); + stack.erase(stack.end() - 2); + break; + + case Token::Type::VALUE: + stack.push_back(t); + break; + + case Token::Type::BINARY_OP: + case Token::Type::QUERY: + case Token::Type::COLON: + while(stack.size() > 1 && + stack.end()[-2].type != Token::Type::PAREN_LEFT && + t.Precedence() < stack.end()[-2].Precedence()) { + Reduce(); + } + stack.push_back(t); + break; + } + } +} + +unsigned PluralExpr::Eval(const std::string &s, unsigned n) { + PluralExpr expr = {}; + expr.reader = ASCIIReader::From(s); + expr.value = n; + expr.Eval(); + + Token t = expr.PopToken(); + ssassert(t.type == Token::Type::VALUE, "Expected a value"); + return t.value; +} + +//----------------------------------------------------------------------------- +// Gettext message keys +//----------------------------------------------------------------------------- + +class TranslationKey { +public: + bool hasContext; + std::string context; + std::string ident; +}; + +struct TranslationKeyLess { + bool operator()(const TranslationKey &a, const TranslationKey &b) const { + return a.hasContext < b.hasContext || + (a.hasContext == b.hasContext && a.context < b.context) || + (a.hasContext == b.hasContext && a.context == b.context && a.ident < b.ident); + } +}; + +//----------------------------------------------------------------------------- +// Gettext .po file parsing +//----------------------------------------------------------------------------- + +class GettextParser { +public: + ASCIIReader reader; + + unsigned pluralCount; + std::string pluralExpr; + + std::map, TranslationKeyLess> messages; + + void SkipSpace(); + std::string ReadString(); + void ParseHeader(const std::string &header); + void Parse(); +}; + +void GettextParser::SkipSpace() { + while(!reader.AtEnd()) { + if(reader.TryChar('#')) { + reader.SkipUntilEol(); + } else if(!reader.SkipSpace()) { + break; + } + } +} + +std::string GettextParser::ReadString() { + SkipSpace(); + reader.ExpectChar('"'); + + std::string result; + while(true) { + if(reader.AtEnd()) { + ssassert(false, "Unexpected EOF within a string"); + } else if(reader.TryChar('\"')) { + SkipSpace(); + if(!reader.TryChar('\"')) { + break; + } + } else if(reader.TryChar('\\')) { + if(reader.TryChar('\\')) { + result += '\\'; + } else if(reader.TryChar('n')) { + result += '\n'; + } else if(reader.TryChar('t')) { + result += '\t'; + } else if(reader.TryChar('"')) { + result += '"'; + } else { + ssassert(false, "Unexpected escape sequence"); + } + } else { + result += reader.ReadChar(); + } + } + return result; +} + +void GettextParser::ParseHeader(const std::string &header) { + ASCIIReader reader = ASCIIReader::From(header); + while(!reader.AtEnd()) { + reader.SkipSpace(); + if(reader.TryString("Plural-Forms:")) { + reader.SkipSpace(); + reader.ExpectString("nplurals="); + reader.SkipSpace(); + pluralCount = reader.ReadIntegerDecimal(); + reader.SkipSpace(); + reader.ExpectString(";"); + reader.SkipSpace(); + reader.ExpectString("plural="); + pluralExpr = reader.ReadUntilEol(); + } else { + reader.SkipUntilEol(); + } + } +} + +void GettextParser::Parse() { + // Default to a single form, in case a header is missing. + pluralCount = 1; + pluralExpr = "0"; + + SkipSpace(); + while(!reader.AtEnd()) { + TranslationKey key = {}; + + if(reader.TryString("msgctxt")) { + key.hasContext = true; + key.context = ReadString(); + } + + reader.ExpectString("msgid"); + key.ident = ReadString(); + + if(reader.TryString("msgid_plural")) { + ReadString(); // we don't need it + } + + std::vector msgstrs; + while(reader.TryString("msgstr")) { + if(reader.TryChar('[')) { + unsigned index = reader.ReadIntegerDecimal(); + reader.ExpectChar(']'); + if(msgstrs.size() <= index) { + msgstrs.resize(index + 1); + } + msgstrs[index] = ReadString(); + } else { + msgstrs.emplace_back(ReadString()); + break; + } + } + + if(key.ident.empty()) { + ssassert(msgstrs.size() == 1, + "Expected exactly one header msgstr"); + ParseHeader(msgstrs[0]); + } else { + ssassert(msgstrs.size() == 1 || + msgstrs.size() == pluralCount, + "Expected msgstr count to match plural form count"); + messages.emplace(key, msgstrs); + } + } +} + +//----------------------------------------------------------------------------- +// Translation management +//----------------------------------------------------------------------------- + +class Translation { +public: + unsigned pluralCount; + std::string pluralExpr; + + std::map, TranslationKeyLess> messages; + + static Translation From(const std::string &poData); + + const std::string &Translate(const TranslationKey &key); + const std::string &TranslatePlural(const TranslationKey &key, unsigned n); +}; + +Translation Translation::From(const std::string &poData) { + GettextParser parser = {}; + parser.reader = ASCIIReader::From(poData); + parser.Parse(); + + Translation trans = {}; + trans.pluralCount = parser.pluralCount; + trans.pluralExpr = parser.pluralExpr; + trans.messages = parser.messages; + return trans; +} + +const std::string &Translation::Translate(const TranslationKey &key) { + auto it = messages.find(key); + if(it == messages.end()) { + dbp("Missing (absent) translation for %s'%s'", key.context.c_str(), key.ident.c_str()); + messages[key].emplace_back(key.ident); + it = messages.find(key); + } + if(it->second[0].empty()) { + dbp("Missing (empty) translation for %s'%s'", key.context.c_str(), key.ident.c_str()); + it->second[0] = key.ident; + } + if(it->second.size() != 1) { + dbp("Incorrect use of translated message %s'%s'", key.context.c_str(), key.ident.c_str()); + ssassert(false, "Using a message with a plural form without a number"); + } + return it->second[0]; +} + +const std::string &Translation::TranslatePlural(const TranslationKey &key, unsigned n) { + unsigned pluralForm = PluralExpr::Eval(pluralExpr, n); + + auto it = messages.find(key); + if(it == messages.end()) { + dbp("Missing (absent) translation for %s'%s'", key.context.c_str(), key.ident.c_str()); + for(unsigned i = 0; i < pluralCount; i++) { + messages[key].emplace_back(key.ident); + } + it = messages.find(key); + } + if(it->second[pluralForm].empty()) { + dbp("Missing (empty) translation for %s'%s'[%d]", + key.context.c_str(), key.ident.c_str(), pluralForm); + it->second[pluralForm] = key.ident; + } + return it->second[pluralForm]; +} + +//----------------------------------------------------------------------------- +// Locale management +//----------------------------------------------------------------------------- + +static std::set locales; +static std::map translations; +static Translation dummyTranslation; +static Translation *currentTranslation = &dummyTranslation; + +const std::set &Locales() { + if(!locales.empty()) return locales; + + std::string localeList = LoadString("locales.txt"); + ASCIIReader reader = ASCIIReader::From(localeList); + while(!reader.AtEnd()) { + reader.SkipSpace(); + if(reader.TryChar('#')) { + reader.SkipUntilEol(); + continue; + } + + std::smatch m; + reader.ExpectRegex(std::regex("([a-z]{2})-([A-Z]{2}),([0-9A-F]{4}),(.+?)\n"), &m); + Locale locale = {}; + locale.language = m.str(1); + locale.region = m.str(2); + locale.lcid = std::stoi(m.str(3), NULL, 16); + locale.displayName = m.str(4); + locales.emplace(locale); + } + return locales; +} + +template +bool SetLocale(Predicate pred) { + auto it = std::find_if(Locales().begin(), Locales().end(), pred); + if(it != locales.end()) { + std::string filename = "locales/" + it->language + "_" + it->region + ".po"; + translations[*it] = Translation::From(LoadString(filename)); + currentTranslation = &translations[*it]; + return true; + } else { + return false; + } +} + +bool SetLocale(const std::string &name) { + return SetLocale([&](const Locale &locale) { + if(name == locale.language + "-" + locale.region) { + return true; + } else if(name == locale.language + "_" + locale.region) { + return true; + } else if(name == locale.language) { + return true; + } else { + return false; + } + }); +} + +bool SetLocale(uint16_t lcid) { + return SetLocale([&](const Locale &locale) { + return locale.lcid == lcid; + }); +} + +const std::string &Translate(const char *msgid) { + TranslationKey key = {}; + key.ident = msgid; + return currentTranslation->Translate(key); +} + +const std::string &Translate(const char *msgctxt, const char *msgid) { + TranslationKey key = {}; + key.hasContext = true; + key.context = msgctxt; + key.ident = msgid; + return currentTranslation->Translate(key); +} + +const std::string &TranslatePlural(const char *msgid, unsigned n) { + TranslationKey key = {}; + key.ident = msgid; + return currentTranslation->TranslatePlural(key, n); +} + +const std::string &TranslatePlural(const char *msgctxt, const char *msgid, unsigned n) { + TranslationKey key = {}; + key.hasContext = true; + key.context = msgctxt; + key.ident = msgid; + return currentTranslation->TranslatePlural(key, n); +} + +} diff --git a/src/resource.h b/src/resource.h new file mode 100644 index 0000000..35ed289 --- /dev/null +++ b/src/resource.h @@ -0,0 +1,127 @@ +//----------------------------------------------------------------------------- +// Discovery and loading of our resources (icons, fonts, templates, etc). +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_RESOURCE_H +#define SOLVESPACE_RESOURCE_H + +#include +#include +#include +#include +#include +#include + +namespace SolveSpace { + +class Camera; +class Point2d; +class Pixmap; +class Vector; +class RgbaColor; +namespace Platform { + class Path; +} // namespace Platform + +std::string LoadString(const std::string &name); +std::string LoadStringFromGzip(const std::string &name); +std::shared_ptr LoadPng(const std::string &name); + +class Pixmap { +public: + enum class Format { BGRA, RGBA, BGR, RGB, A }; + + Format format; + size_t width; + size_t height; + size_t stride; + std::vector data; + int colorType; + bool bgr; + + static std::shared_ptr Create(Format format, size_t width, size_t height); + static std::shared_ptr FromPng(const uint8_t *data, size_t size, bool flip = false); + + static std::shared_ptr ReadPng(FILE *f, bool flip = false); + static std::shared_ptr ReadPng(const Platform::Path &filename, bool flip = false); + bool WritePng(FILE *f, bool flip = false); + bool WritePng(const Platform::Path &filename, bool flip = false); + + size_t GetBytesPerPixel() const; + RgbaColor GetPixel(size_t x, size_t y) const; + bool Equals(const Pixmap &other) const; + + void ConvertTo(Format newFormat); + void SetPixel(size_t x, size_t y, RgbaColor color); + + std::shared_ptr Copy(); +}; + +class BitmapFont { +public: + struct Glyph { + uint8_t advanceCells; + uint16_t position; + }; + + std::string unifontData; + std::map glyphs; + std::shared_ptr texture; + bool textureUpdated; + uint16_t nextPosition; + + static BitmapFont From(std::string &&unifontData); + static BitmapFont Create(); + + bool IsEmpty() const { return unifontData.empty(); } + const Glyph &GetGlyph(char32_t codepoint); + void LocateGlyph(char32_t codepoint, double *s0, double *t0, double *s1, double *t1, + size_t *advanceWidth, size_t *boundingHeight); + + void AddGlyph(char32_t codepoint, std::shared_ptr pixmap); + + size_t GetWidth(char32_t codepoint); + size_t GetWidth(const std::string &str); +}; + +class VectorFont { +public: + struct Contour { + std::vector points; + }; + + struct Glyph { + std::vector contours; + double leftSideBearing; + double boundingWidth; + double advanceWidth; + }; + + std::string lffData; + std::map glyphs; + double rightSideBearing; + double capHeight; + double ascender; + double descender; + + static VectorFont From(std::string &&lffData); + static VectorFont *Builtin(); + + bool IsEmpty() const { return lffData.empty(); } + const Glyph &GetGlyph(char32_t codepoint); + + double GetCapHeight(double forCapHeight) const; + double GetHeight(double forCapHeight) const; + double GetWidth(double forCapHeight, const std::string &str); + Vector GetExtents(double forCapHeight, const std::string &str); + + void Trace(double forCapHeight, Vector o, Vector u, Vector v, const std::string &str, + const std::function &traceEdge); + void Trace(double forCapHeight, Vector o, Vector u, Vector v, const std::string &str, + const std::function &traceEdge, const Camera &camera); +}; + +} +#endif diff --git a/src/sketch.h b/src/sketch.h new file mode 100644 index 0000000..324d566 --- /dev/null +++ b/src/sketch.h @@ -0,0 +1,1002 @@ +//----------------------------------------------------------------------------- +// The parametric structure of our sketch, in multiple groups, that generate +// geometric entities and surfaces. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_SKETCH_H +#define SOLVESPACE_SKETCH_H + +#include +#include +#include +#include +#include + +#include "dsc.h" +#include "param.h" +#include "polygon.h" +#include "platform/platform.h" +#include "platform/gui.h" +#include "srf/surface.h" +#include "render/render.h" + +namespace SolveSpace { + +class hConstraint; + +class Expr; +class ExprVector; +class ExprQuaternion; + +enum class SolveResult : uint32_t; + +enum class PolyError : uint32_t { + GOOD = 0, + NOT_CLOSED = 1, + NOT_COPLANAR = 2, + SELF_INTERSECTING = 3, + ZERO_LEN_EDGE = 4 +}; + +enum class StipplePattern : uint32_t { + CONTINUOUS = 0, + SHORT_DASH = 1, + DASH = 2, + LONG_DASH = 3, + DASH_DOT = 4, + DASH_DOT_DOT = 5, + DOT = 6, + FREEHAND = 7, + ZIGZAG = 8, + + LAST = ZIGZAG +}; + +const std::vector &StipplePatternDashes(StipplePattern pattern); +double StipplePatternLength(StipplePattern pattern); + +enum class Command : uint32_t; + +// All of the hWhatever handles are a 32-bit ID, that is used to represent +// some data structure in the sketch. +class hEquation { +public: + uint32_t v; + + inline bool isFromConstraint() const; + inline hConstraint constraint() const; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class hGroup { +public: + // bits 15: 0 -- group index + uint32_t v; + + inline hEntity entity(int i) const; + inline hParam param(int i) const; + inline hEquation equation(int i) const; +}; + +template<> +struct IsHandleOracle
: std::true_type {}; + +class hRequest { +public: + // bits 15: 0 -- request index + uint32_t v; + + inline hEntity entity(int i) const; + inline hParam param(int i) const; + + inline bool IsFromReferences() const; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class hEntity { +public: + // bits 15: 0 -- entity index + // 31:16 -- request index + uint32_t v; + + inline bool isFromRequest() const; + inline hRequest request() const; + inline hGroup group() const; + inline hEquation equation(int i) const; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class Equation { +public: + int tag; + hEquation h; + + Expr *e; + + void Clear() {} +}; + +class hStyle { +public: + uint32_t v; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class Entity; +using EntityList = IdList; + +struct EntityId { + uint32_t v; // entity ID, starting from 0 +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +struct EntityKey { + hEntity input; + int copyNumber; + // (input, copyNumber) gets mapped to hGroup::entity(i) +}; +struct EntityKeyHash { + size_t operator()(const EntityKey &k) const { + size_t h1 = std::hash{}(k.input.v), + h2 = std::hash{}(k.copyNumber); + return h1 ^ (h2 << 1); + } +}; +struct EntityKeyEqual { + bool operator()(const EntityKey &a, const EntityKey &b) const { + return std::tie(a.input, a.copyNumber) == std::tie(b.input, b.copyNumber); + } +}; +typedef std::unordered_map EntityMap; + +// A set of requests. Every request must have an associated group. +class Group { +public: + static const hGroup HGROUP_REFERENCES; + + int tag; + hGroup h; + + enum class CopyAs { + NUMERIC, + N_TRANS, + N_ROT_AA, + N_ROT_TRANS, + N_ROT_AXIS_TRANS, + }; + + enum class Type : uint32_t { + DRAWING_3D = 5000, + DRAWING_WORKPLANE = 5001, + EXTRUDE = 5100, + LATHE = 5101, + REVOLVE = 5102, + HELIX = 5103, + ROTATE = 5200, + TRANSLATE = 5201, + LINKED = 5300 + }; + Group::Type type; + + int order; + + hGroup opA; + hGroup opB; + bool visible; + bool suppress; + bool relaxConstraints; + bool allowRedundant; + bool suppressDofCalculation; + bool allDimsReference; + double scale; + + bool clean; + bool dofCheckOk; + hEntity activeWorkplane; + double valA; + double valB; + double valC; + RgbaColor color; + + struct { + SolveResult how; + int dof; + int findToFixTimeout; + bool timeout; + List remove; + } solved; + + enum class Subtype : uint32_t { + // For drawings in 2d + WORKPLANE_BY_POINT_ORTHO = 6000, + WORKPLANE_BY_LINE_SEGMENTS = 6001, + WORKPLANE_BY_POINT_NORMAL = 6002, + //WORKPLANE_BY_POINT_FACE = 6003, + //WORKPLANE_BY_FACE = 6004, + // For extrudes, translates, and rotates + ONE_SIDED = 7000, + TWO_SIDED = 7001, + ONE_SKEWED = 7004, + TWO_SKEWED = 7005 + }; + Group::Subtype subtype; + + bool skipFirst; // for step and repeat ops + + struct { + Quaternion q; + hEntity origin; + hEntity entityB; + hEntity entityC; + bool swapUV; + bool negateU; + bool negateV; + } predef; + + SPolygon polyLoops; + SBezierLoopSetSet bezierLoops; + SBezierLoopSet bezierOpens; + + struct { + PolyError how; + SEdge notClosedAt; + Vector errorPointAt; + } polyError; + + bool booleanFailed; + + SShell thisShell; + SShell runningShell; + + SMesh thisMesh; + SMesh runningMesh; + + bool displayDirty; + SMesh displayMesh; + SOutlineList displayOutlines; + + enum class CombineAs : uint32_t { + UNION = 0, + DIFFERENCE = 1, + ASSEMBLE = 2, + INTERSECTION = 3 + }; + CombineAs meshCombine; + + bool forceToMesh; + + EntityMap remap; + + Platform::Path linkFile; + SMesh impMesh; + SShell impShell; + EntityList impEntity; + + std::string name; + + + void Activate(); + std::string DescriptionString(); + void Clear(); + + static void AddParam(ParamList *param, hParam hp, double v); + void Generate(EntityList *entity, ParamList *param); + bool IsSolvedOkay(); + void TransformImportedBy(Vector t, Quaternion q); + bool IsTriangleMeshAssembly() const; + bool IsForcedToMeshBySource() const; + bool IsForcedToMesh() const; + // When a request generates entities from entities, and the source + // entities may have come from multiple requests, it's necessary to + // remap the entity ID so that it's still unique. We do this with a + // mapping list. + enum { + REMAP_LAST = 1000, + REMAP_TOP = 1001, + REMAP_BOTTOM = 1002, + REMAP_PT_TO_LINE = 1003, + REMAP_LINE_TO_FACE = 1004, + REMAP_LATHE_START = 1006, + REMAP_LATHE_END = 1007, + REMAP_PT_TO_ARC = 1008, + REMAP_PT_TO_NORMAL = 1009, + REMAP_LATHE_ARC_CENTER = 1010, + }; + hEntity Remap(hEntity in, int copyNumber); + void MakeExtrusionLines(EntityList *el, hEntity in); + void MakeLatheCircles(EntityList *el, ParamList *param, hEntity in, Vector pt, Vector axis); + void MakeLatheSurfacesSelectable(EntityList *el, hEntity in, Vector axis); + void MakeRevolveEndFaces(EntityList *el, hEntity pt, int ai, int af); + void MakeExtrusionTopBottomFaces(EntityList *el, hEntity pt); + void CopyEntity(EntityList *el, + Entity *ep, int timesApplied, int remap, + hParam dx, hParam dy, hParam dz, + hParam qw, hParam qvx, hParam qvy, hParam qvz, hParam dist, + CopyAs as); + + void AddEq(IdList *l, Expr *expr, int index); + void GenerateEquations(IdList *l); + bool IsVisible(); + size_t GetNumConstraints(); + Vector ExtrusionGetVector(); + void ExtrusionForceVectorTo(const Vector &v); + + // Assembling the curves into loops, and into a piecewise linear polygon + // at the same time. + void AssembleLoops(bool *allClosed, bool *allCoplanar, bool *allNonZeroLen); + void GenerateLoops(); + // And the mesh stuff + Group *PreviousGroup() const; + Group *RunningMeshGroup() const; + bool IsMeshGroup(); + + void GenerateShellAndMesh(); + template void GenerateForStepAndRepeat(T *steps, T *outs, Group::CombineAs forWhat); + template void GenerateForBoolean(T *a, T *b, T *o, Group::CombineAs how); + void GenerateDisplayItems(); + + enum class DrawMeshAs { DEFAULT, HOVERED, SELECTED }; + void DrawMesh(DrawMeshAs how, Canvas *canvas); + void Draw(Canvas *canvas); + void DrawPolyError(Canvas *canvas); + void DrawFilledPaths(Canvas *canvas); + void DrawContourAreaLabels(Canvas *canvas); + bool ShouldDrawExploded() const; + + SPolygon GetPolygon(); + + static void MenuGroup(Command id); + static void MenuGroup(Command id, Platform::Path linkFile); +}; + +// A user request for some primitive or derived operation; for example a +// line, or a step and repeat. +class Request { +public: + // Some predefined requests, that are present in every sketch. + static const hRequest HREQUEST_REFERENCE_XY; + static const hRequest HREQUEST_REFERENCE_YZ; + static const hRequest HREQUEST_REFERENCE_ZX; + + int tag; + hRequest h; + + // Types of requests + enum class Type : uint32_t { + WORKPLANE = 100, + DATUM_POINT = 101, + LINE_SEGMENT = 200, + CUBIC = 300, + CUBIC_PERIODIC = 301, + CIRCLE = 400, + ARC_OF_CIRCLE = 500, + TTF_TEXT = 600, + IMAGE = 700 + }; + + Request::Type type; + int extraPoints; + + hEntity workplane; // or Entity::FREE_IN_3D + hGroup group; + hStyle style; + + bool construction; + + std::string str; + std::string font; + Platform::Path file; + double aspectRatio; + int groupRequestIndex; + + static hParam AddParam(ParamList *param, hParam hp); + void Generate(EntityList *entity, ParamList *param); + + std::string DescriptionString() const; + int IndexOfPoint(hEntity he) const; + + void Clear() {} +}; + +#define MAX_POINTS_IN_ENTITY (12) +class EntityBase { +public: + int tag; + hEntity h; + + static const hEntity FREE_IN_3D; + static const hEntity NO_ENTITY; + + enum class Type : uint32_t { + POINT_IN_3D = 2000, + POINT_IN_2D = 2001, + POINT_N_TRANS = 2010, + POINT_N_ROT_TRANS = 2011, + POINT_N_COPY = 2012, + POINT_N_ROT_AA = 2013, + POINT_N_ROT_AXIS_TRANS = 2014, + + NORMAL_IN_3D = 3000, + NORMAL_IN_2D = 3001, + NORMAL_N_COPY = 3010, + NORMAL_N_ROT = 3011, + NORMAL_N_ROT_AA = 3012, + + DISTANCE = 4000, + DISTANCE_N_COPY = 4001, + + FACE_NORMAL_PT = 5000, + FACE_XPROD = 5001, + FACE_N_ROT_TRANS = 5002, + FACE_N_TRANS = 5003, + FACE_N_ROT_AA = 5004, + FACE_ROT_NORMAL_PT = 5005, + FACE_N_ROT_AXIS_TRANS = 5006, + + WORKPLANE = 10000, + LINE_SEGMENT = 11000, + CUBIC = 12000, + CUBIC_PERIODIC = 12001, + CIRCLE = 13000, + ARC_OF_CIRCLE = 14000, + TTF_TEXT = 15000, + IMAGE = 16000 + }; + + Type type; + + hGroup group; + hEntity workplane; // or Entity::FREE_IN_3D + + // When it comes time to draw an entity, we look here to get the + // defining variables. + hEntity point[MAX_POINTS_IN_ENTITY]; + int extraPoints; + hEntity normal; + hEntity distance; + // The only types that have their own params are points, normals, + // and directions. + hParam param[8]; + + // Transformed points/normals/distances have their numerical base + Vector numPoint; + Quaternion numNormal; + double numDistance; + + std::string str; + std::string font; + Platform::Path file; + double aspectRatio; + + // For entities that are derived by a transformation, the number of + // times to apply the transformation. + int timesApplied; + + Quaternion GetAxisAngleQuaternion(int param0) const; + ExprQuaternion GetAxisAngleQuaternionExprs(int param0) const; + + bool IsCircle() const; + Expr *CircleGetRadiusExpr() const; + double CircleGetRadiusNum() const; + void ArcGetAngles(double *thetaa, double *thetab, double *dtheta) const; + + bool HasVector() const; + ExprVector VectorGetExprs() const; + ExprVector VectorGetExprsInWorkplane(hEntity wrkpl) const; + Vector VectorGetNum() const; + Vector VectorGetRefPoint() const; + Vector VectorGetStartPoint() const; + + // For distances + bool IsDistance() const; + double DistanceGetNum() const; + Expr *DistanceGetExpr() const; + void DistanceForceTo(double v); + + bool IsWorkplane() const; + // The plane is points P such that P dot (xn, yn, zn) - d = 0 + void WorkplaneGetPlaneExprs(ExprVector *n, Expr **d) const; + ExprVector WorkplaneGetOffsetExprs() const; + Vector WorkplaneGetOffset() const; + EntityBase *Normal() const; + + bool IsFace() const; + ExprVector FaceGetNormalExprs() const; + Vector FaceGetNormalNum() const; + ExprVector FaceGetPointExprs() const; + Vector FaceGetPointNum() const; + + bool IsPoint() const; + // Applies for any of the point types + Vector PointGetNum() const; + ExprVector PointGetExprs() const; + void PointGetExprsInWorkplane(hEntity wrkpl, Expr **u, Expr **v) const; + ExprVector PointGetExprsInWorkplane(hEntity wrkpl) const; + void PointForceTo(Vector v); + void PointForceParamTo(Vector v); + // These apply only the POINT_N_ROT_TRANS, which has an assoc rotation + Quaternion PointGetQuaternion() const; + void PointForceQuaternionTo(Quaternion q); + + bool IsNormal() const; + // Applies for any of the normal types + Quaternion NormalGetNum() const; + ExprQuaternion NormalGetExprs() const; + void NormalForceTo(Quaternion q); + + Vector NormalU() const; + Vector NormalV() const; + Vector NormalN() const; + ExprVector NormalExprsU() const; + ExprVector NormalExprsV() const; + ExprVector NormalExprsN() const; + + Vector CubicGetStartNum() const; + Vector CubicGetFinishNum() const; + ExprVector CubicGetStartTangentExprs() const; + ExprVector CubicGetFinishTangentExprs() const; + Vector CubicGetStartTangentNum() const; + Vector CubicGetFinishTangentNum() const; + + bool HasEndpoints() const; + Vector EndpointStart() const; + Vector EndpointFinish() const; + bool IsInPlane(Vector norm, double distance) const; + + void RectGetPointsExprs(ExprVector *eap, ExprVector *ebp) const; + + void AddEq(IdList *l, Expr *expr, int index) const; + void GenerateEquations(IdList *l) const; + + void Clear() {} +}; + +class Entity : public EntityBase { +public: + // Necessary for Entity e = {} to zero-initialize, since + // classes with base classes are not aggregates and + // the default constructor does not initialize members. + // + // Note EntityBase({}); without explicitly value-initializing + // the base class, MSVC2013 will default-initialize it, leaving + // POD members with indeterminate value. + Entity() : EntityBase({}), forceHidden(), actPoint(), actNormal(), + actDistance(), actVisible(), style(), construction(), + beziers(), edges(), edgesChordTol(), screenBBox(), screenBBoxValid() {}; + + // A linked entity that was hidden in the source file ends up hidden + // here too. + bool forceHidden; + + // All points/normals/distances have their numerical value; this is + // a convenience, to simplify the link/assembly code, so that the + // part is entirely described by the entities. + Vector actPoint; + Quaternion actNormal; + double actDistance; + // and the shown state also gets saved here, for later import + bool actVisible; + + hStyle style; + bool construction; + + SBezierList beziers; + SEdgeList edges; + double edgesChordTol; + BBox screenBBox; + bool screenBBoxValid; + + bool IsStylable() const; + bool IsVisible() const; + bool CanBeDragged() const; + + enum class DrawAs { DEFAULT, OVERLAY, HIDDEN, HOVERED, SELECTED }; + void Draw(DrawAs how, Canvas *canvas); + void GetReferencePoints(std::vector *refs); + int GetPositionOfPoint(const Camera &camera, Point2d p); + + void ComputeInterpolatingSpline(SBezierList *sbl, bool periodic) const; + void GenerateBezierCurves(SBezierList *sbl) const; + void GenerateEdges(SEdgeList *el); + + SBezierList *GetOrGenerateBezierCurves(); + SEdgeList *GetOrGenerateEdges(); + BBox GetOrGenerateScreenBBox(bool *hasBBox); + + void CalculateNumerical(bool forExport); + + std::string DescriptionString() const; + + void Clear() { + beziers.l.Clear(); + edges.l.Clear(); + } + + bool ShouldDrawExploded() const; + Vector ExplodeOffset() const; + Vector PointGetDrawNum() const; +}; + +class EntReqTable { +public: + static void GetRequestInfo(Request::Type req, int extraPoints, + EntityBase::Type *ent, int *pts, bool *hasNormal, bool *hasDistance); + static bool GetEntityInfo(EntityBase::Type ent, int extraPoints, + Request::Type *req, int *pts, bool *hasNormal, bool *hasDistance); + static Request::Type GetRequestForEntity(EntityBase::Type ent); +}; + +class hConstraint { +public: + uint32_t v; + + inline hEquation equation(int i) const; + inline hParam param(int i) const; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class ConstraintBase { +public: + int tag; + hConstraint h; + + static const hConstraint NO_CONSTRAINT; + + enum class Type : uint32_t { + POINTS_COINCIDENT = 20, + PT_PT_DISTANCE = 30, + PT_PLANE_DISTANCE = 31, + PT_LINE_DISTANCE = 32, + PT_FACE_DISTANCE = 33, + PROJ_PT_DISTANCE = 34, + PT_IN_PLANE = 41, + PT_ON_LINE = 42, + PT_ON_FACE = 43, + EQUAL_LENGTH_LINES = 50, + LENGTH_RATIO = 51, + EQ_LEN_PT_LINE_D = 52, + EQ_PT_LN_DISTANCES = 53, + EQUAL_ANGLE = 54, + EQUAL_LINE_ARC_LEN = 55, + LENGTH_DIFFERENCE = 56, + SYMMETRIC = 60, + SYMMETRIC_HORIZ = 61, + SYMMETRIC_VERT = 62, + SYMMETRIC_LINE = 63, + AT_MIDPOINT = 70, + HORIZONTAL = 80, + VERTICAL = 81, + DIAMETER = 90, + PT_ON_CIRCLE = 100, + SAME_ORIENTATION = 110, + ANGLE = 120, + PARALLEL = 121, + PERPENDICULAR = 122, + ARC_LINE_TANGENT = 123, + CUBIC_LINE_TANGENT = 124, + CURVE_CURVE_TANGENT = 125, + EQUAL_RADIUS = 130, + WHERE_DRAGGED = 200, + ARC_ARC_LEN_RATIO = 210, + ARC_LINE_LEN_RATIO = 211, + ARC_ARC_DIFFERENCE = 212, + ARC_LINE_DIFFERENCE = 213, + COMMENT = 1000 + }; + + Type type; + + hGroup group; + hEntity workplane; + + // These are the parameters for the constraint. + double valA; + hParam valP; + hEntity ptA; + hEntity ptB; + hEntity entityA; + hEntity entityB; + hEntity entityC; + hEntity entityD; + bool other; + bool other2; + + bool reference; // a ref dimension, that generates no eqs + std::string comment; // since comments are represented as constraints + + bool Equals(const ConstraintBase &c) const { + return type == c.type && group == c.group && workplane == c.workplane && + valA == c.valA && valP == c.valP && ptA == c.ptA && ptB == c.ptB && + entityA == c.entityA && entityB == c.entityB && + entityC == c.entityC && entityD == c.entityD && + other == c.other && other2 == c.other2 && reference == c.reference && + comment == c.comment; + } + + bool HasLabel() const; + bool IsProjectible() const; + + void Generate(ParamList *param); + + void GenerateEquations(IdList *entity, + bool forReference = false) const; + // Some helpers when generating symbolic constraint equations + void ModifyToSatisfy(); + void AddEq(IdList *l, Expr *expr, int index) const; + void AddEq(IdList *l, const ExprVector &v, int baseIndex = 0) const; + static Expr *DirectionCosine(hEntity wrkpl, ExprVector ae, ExprVector be); + static Expr *Distance(hEntity workplane, hEntity pa, hEntity pb); + static Expr *PointLineDistance(hEntity workplane, hEntity pt, hEntity ln); + static Expr *PointPlaneDistance(ExprVector p, hEntity plane); + static ExprVector VectorsParallel3d(ExprVector a, ExprVector b, hParam p); + static ExprVector PointInThreeSpace(hEntity workplane, Expr *u, Expr *v); + + void Clear() {} +}; + +class Constraint : public ConstraintBase { +public: + // See Entity::Entity(). + Constraint() : ConstraintBase({}), disp() {} + + // These define how the constraint is drawn on-screen. + struct { + Vector offset; + hStyle style; + } disp; + + bool IsVisible() const; + bool IsStylable() const; + hStyle GetStyle() const; + bool HasLabel() const; + std::string Label() const; + + enum class DrawAs { DEFAULT, HOVERED, SELECTED }; + void Draw(DrawAs how, Canvas *canvas); + Vector GetLabelPos(const Camera &camera); + void GetReferencePoints(const Camera &camera, std::vector *refs); + + void DoLayout(DrawAs how, Canvas *canvas, + Vector *labelPos, std::vector *refs); + void DoLine(Canvas *canvas, Canvas::hStroke hcs, Vector a, Vector b); + void DoStippledLine(Canvas *canvas, Canvas::hStroke hcs, Vector a, Vector b); + bool DoLineExtend(Canvas *canvas, Canvas::hStroke hcs, + Vector p0, Vector p1, Vector pt, double salient); + void DoArcForAngle(Canvas *canvas, Canvas::hStroke hcs, + Vector a0, Vector da, Vector b0, Vector db, + Vector offset, Vector *ref, bool trim, Vector explodeOffset); + void DoArrow(Canvas *canvas, Canvas::hStroke hcs, + Vector p, Vector dir, Vector n, double width, double angle, double da); + void DoLineWithArrows(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector a, Vector b, bool onlyOneExt); + int DoLineTrimmedAgainstBox(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector a, Vector b, bool extend, + Vector gr, Vector gu, double swidth, double sheight); + int DoLineTrimmedAgainstBox(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector a, Vector b, bool extend = true); + void DoLabel(Canvas *canvas, Canvas::hStroke hcs, + Vector ref, Vector *labelPos, Vector gr, Vector gu); + void DoProjectedPoint(Canvas *canvas, Canvas::hStroke hcs, Vector *p); + void DoProjectedPoint(Canvas *canvas, Canvas::hStroke hcs, Vector *p, Vector n, Vector o); + + void DoEqualLenTicks(Canvas *canvas, Canvas::hStroke hcs, + Vector a, Vector b, Vector gn, Vector *refp); + void DoEqualRadiusTicks(Canvas *canvas, Canvas::hStroke hcs, + hEntity he, Vector *refp); + + std::string DescriptionString() const; + + bool ShouldDrawExploded() const; + + static hConstraint AddConstraint(Constraint *c, bool rememberForUndo = true); + static void MenuConstrain(Command id); + static void DeleteAllConstraintsFor(Constraint::Type type, hEntity entityA, hEntity ptA); + + static hConstraint ConstrainCoincident(hEntity ptA, hEntity ptB); + static hConstraint Constrain(Constraint::Type type, hEntity ptA, hEntity ptB, hEntity entityA, + hEntity entityB = Entity::NO_ENTITY, bool other = false, + bool other2 = false); + static hConstraint TryConstrain(Constraint::Type type, hEntity ptA, hEntity ptB, + hEntity entityA, hEntity entityB = Entity::NO_ENTITY, + bool other = false, bool other2 = false); + static bool ConstrainArcLineTangent(Constraint *c, Entity *line, Entity *arc, + Entity *arcendpoint); + static bool ConstrainCubicLineTangent(Constraint *c, Entity *line, Entity *cubic, + Entity *curveendpoint); + static bool ConstrainCurveCurveTangent(Constraint *c, Entity *eA, Entity *eB, Entity *p1, + Entity *p2); +}; + +class Style { +public: + int tag; + hStyle h; + + enum { + // If an entity has no style, then it will be colored according to + // whether the group that it's in is active or not, whether it's + // construction or not, and so on. + NO_STYLE = 0, + + ACTIVE_GRP = 1, + CONSTRUCTION = 2, + INACTIVE_GRP = 3, + DATUM = 4, + SOLID_EDGE = 5, + CONSTRAINT = 6, + SELECTED = 7, + HOVERED = 8, + CONTOUR_FILL = 9, + NORMALS = 10, + ANALYZE = 11, + DRAW_ERROR = 12, + DIM_SOLID = 13, + HIDDEN_EDGE = 14, + OUTLINE = 15, + + FIRST_CUSTOM = 0x100 + }; + + std::string name; + + enum class UnitsAs : uint32_t { + PIXELS = 0, + MM = 1 + }; + double width; + UnitsAs widthAs; + double textHeight; + UnitsAs textHeightAs; + enum class TextOrigin : uint32_t { + NONE = 0x00, + LEFT = 0x01, + RIGHT = 0x02, + BOT = 0x04, + TOP = 0x08 + }; + TextOrigin textOrigin; + double textAngle; + RgbaColor color; + bool filled; + RgbaColor fillColor; + bool visible; + bool exportable; + StipplePattern stippleType; + double stippleScale; + int zIndex; + + // The default styles, for entities that don't have a style assigned yet, + // and for datums and such. + typedef struct { + hStyle h; + const char *cnfPrefix; + RgbaColor color; + double width; + int zIndex; + bool exportable; + StipplePattern stippleType; + } Default; + static const Default Defaults[]; + + static std::string CnfColor(const std::string &prefix); + static std::string CnfWidth(const std::string &prefix); + static std::string CnfStippleType(const std::string &prefix); + static std::string CnfStippleScale(const std::string &prefix); + static std::string CnfTextHeight(const std::string &prefix); + static std::string CnfPrefixToName(const std::string &prefix); + static std::string CnfExportable(const std::string &prefix); + + static void CreateAllDefaultStyles(); + static void CreateDefaultStyle(hStyle h); + static void FillDefaultStyle(Style *s, const Default *d = NULL, bool factory = false); + static void FreezeDefaultStyles(Platform::SettingsRef settings); + static void LoadFactoryDefaults(); + + static void AssignSelectionToStyle(uint32_t v); + static uint32_t CreateCustomStyle(bool rememberForUndo = true); + + static RgbaColor RewriteColor(RgbaColor rgb); + + static Style *Get(hStyle hs); + static RgbaColor Color(hStyle hs, bool forExport=false); + static RgbaColor Color(int hs, bool forExport=false); + static RgbaColor FillColor(hStyle hs, bool forExport=false); + static double Width(hStyle hs); + static double Width(int hs); + static double WidthMm(int hs); + static double TextHeight(hStyle hs); + static double DefaultTextHeight(); + static Canvas::Stroke Stroke(hStyle hs); + static Canvas::Stroke Stroke(int hs); + static bool Exportable(int hs); + static hStyle ForEntity(hEntity he); + static StipplePattern PatternType(hStyle hs); + static double StippleScale(hStyle hs); + static double StippleScaleMm(hStyle hs); + static std::string StipplePatternName(hStyle hs); + static std::string StipplePatternName(StipplePattern stippleType); + static StipplePattern StipplePatternFromString(std::string name); + + std::string DescriptionString() const; + + void Clear() {} +}; + + +inline hEntity hGroup::entity(int i) const + { hEntity r; r.v = 0x80000000 | (v << 16) | (uint32_t)i; return r; } +inline hParam hGroup::param(int i) const + { hParam r; r.v = 0x80000000 | (v << 16) | (uint32_t)i; return r; } +inline hEquation hGroup::equation(int i) const + { hEquation r; r.v = (v << 16) | 0x80000000 | (uint32_t)i; return r; } + +inline bool hRequest::IsFromReferences() const { + if(*this == Request::HREQUEST_REFERENCE_XY) return true; + if(*this == Request::HREQUEST_REFERENCE_YZ) return true; + if(*this == Request::HREQUEST_REFERENCE_ZX) return true; + return false; +} +inline hEntity hRequest::entity(int i) const + { hEntity r; r.v = (v << 16) | (uint32_t)i; return r; } +inline hParam hRequest::param(int i) const + { hParam r; r.v = (v << 16) | (uint32_t)i; return r; } + +inline bool hEntity::isFromRequest() const + { if(v & 0x80000000) return false; else return true; } +inline hRequest hEntity::request() const + { hRequest r; r.v = (v >> 16); return r; } +inline hGroup hEntity::group() const + { hGroup r; r.v = (v >> 16) & 0x3fff; return r; } +inline hEquation hEntity::equation(int i) const + { hEquation r; r.v = v | 0x40000000 | (uint32_t)i; return r; } + +inline hRequest hParam::request() const + { hRequest r; r.v = (v >> 16); return r; } + + +inline hEquation hConstraint::equation(int i) const + { hEquation r; r.v = (v << 16) | (uint32_t)i; return r; } +inline hParam hConstraint::param(int i) const + { hParam r; r.v = v | 0x40000000 | (uint32_t)i; return r; } + +inline bool hEquation::isFromConstraint() const + { if(v & 0xc0000000) return false; else return true; } +inline hConstraint hEquation::constraint() const + { hConstraint r; r.v = (v >> 16); return r; } + +// The format for entities stored on the clipboard. +class ClipboardRequest { +public: + Request::Type type; + int extraPoints; + hStyle style; + std::string str; + std::string font; + Platform::Path file; + bool construction; + + Vector point[MAX_POINTS_IN_ENTITY]; + double distance; + + hEntity oldEnt; + hEntity oldPointEnt[MAX_POINTS_IN_ENTITY]; + hRequest newReq; +}; + +} // namespace SolveSpace + +#endif diff --git a/src/slvs/CMakeLists.txt b/src/slvs/CMakeLists.txt new file mode 100644 index 0000000..d931f8f --- /dev/null +++ b/src/slvs/CMakeLists.txt @@ -0,0 +1,80 @@ +include(GNUInstallDirs) + +# libslvs +add_library(slvs-interface INTERFACE) +target_sources(slvs-interface INTERFACE lib.cpp) +target_compile_definitions(slvs-interface INTERFACE -DLIBRARY) +target_include_directories(slvs-interface INTERFACE ${CMAKE_SOURCE_DIR}/include) +target_link_libraries(slvs-interface INTERFACE slvs-solver mimalloc-static) + +if(ENABLE_PYTHON_LIB) + add_custom_command( + OUTPUT cylib.c + COMMAND cython lib.pyx -o ${CMAKE_CURRENT_BINARY_DIR}/cylib.c --include-dir ${CMAKE_SOURCE_DIR}/include --module-name solvespace + DEPENDS lib.pyx + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) + Python_add_library(slvs-py MODULE cylib.c) + set_target_properties(slvs-py PROPERTIES POSITION_INDEPENDENT_CODE ON) + target_compile_definitions(slvs-py PRIVATE -DSTATIC_LIB) + target_link_libraries( + slvs-py + PRIVATE + slvs-interface + Python::Module + ) + set_target_properties(slvs-py PROPERTIES LIBRARY_OUTPUT_NAME solvespace) + if(SKBUILD) + install(TARGETS slvs-py + DESTINATION ${SKBUILD_PROJECT_NAME} + COMPONENT python + ) + else() + install(TARGETS slvs-py + DESTINATION "slvs" + COMPONENT python + ) + install( + DIRECTORY ${CMAKE_SOURCE_DIR}/python/slvs/ + DESTINATION "slvs" + COMPONENT python + ) + endif() +endif() + +if(EMSCRIPTEN) + add_executable(slvs-wasm jslib.cpp) + target_compile_features(slvs-wasm PRIVATE cxx_std_17) + target_link_libraries(slvs-wasm PRIVATE slvs-interface embind) + target_link_options(slvs-wasm PRIVATE + "SHELL:-s MODULARIZE=1" + "SHELL:-s EXPORT_NAME=solvespace" + "SHELL:-s SINGLE_FILE=1" + "SHELL:-s INITIAL_MEMORY=512MB" + "SHELL:-s ALLOW_MEMORY_GROWTH" + -O3 + -flto + --closure 1) + set_target_properties(slvs-wasm PROPERTIES OUTPUT_NAME "slvs" SUFFIX ".js") +endif() + +add_library(slvs SHARED) +target_compile_definitions(slvs PRIVATE -DEXPORT_DLL) +target_link_libraries(slvs PRIVATE slvs-interface) +set_target_properties(slvs PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_include_directories(slvs PUBLIC ${CMAKE_SOURCE_DIR}/include) + +set_target_properties(slvs PROPERTIES + PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/slvs.h + VERSION ${PROJECT_VERSION} + SOVERSION 1 +) + +# if(NOT WIN32) +install(TARGETS slvs + COMPONENT slvs + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# endif() diff --git a/src/slvs/jslib.cpp b/src/slvs/jslib.cpp new file mode 100644 index 0000000..82074ff --- /dev/null +++ b/src/slvs/jslib.cpp @@ -0,0 +1,210 @@ +#include "slvs.h" +#include + +#include "solvespace.h" + +using namespace SolveSpace; + +struct JsSolveResult { + int result; + int dof; + size_t nbad; + emscripten::val bad; +}; + +static JsSolveResult solveSketch(Slvs_hGroup g, bool calculateFaileds) { + JsSolveResult jsResult = {}; + Slvs_hConstraint *c = nullptr; + Slvs_SolveResult ret = Slvs_SolveSketch(g, calculateFaileds ? &c : nullptr); + if(c) { + jsResult.bad = emscripten::val::global("Uint32Array").new_(ret.nbad); + jsResult.bad.call("set", emscripten::typed_memory_view(ret.nbad, c)); + free(c); + } + jsResult.result = ret.result; + jsResult.dof = ret.dof; + jsResult.nbad = ret.nbad; + return jsResult; +} + +EMSCRIPTEN_BINDINGS(slvs) { + emscripten::constant("C_POINTS_COINCIDENT", SLVS_C_POINTS_COINCIDENT); + emscripten::constant("C_PT_PT_DISTANCE", SLVS_C_PT_PT_DISTANCE); + emscripten::constant("C_PT_PLANE_DISTANCE", SLVS_C_PT_PLANE_DISTANCE); + emscripten::constant("C_PT_LINE_DISTANCE", SLVS_C_PT_LINE_DISTANCE); + emscripten::constant("C_PT_FACE_DISTANCE", SLVS_C_PT_FACE_DISTANCE); + emscripten::constant("C_PT_IN_PLANE", SLVS_C_PT_IN_PLANE); + emscripten::constant("C_PT_ON_LINE", SLVS_C_PT_ON_LINE); + emscripten::constant("C_PT_ON_FACE", SLVS_C_PT_ON_FACE); + emscripten::constant("C_EQUAL_LENGTH_LINES", SLVS_C_EQUAL_LENGTH_LINES); + emscripten::constant("C_LENGTH_RATIO", SLVS_C_LENGTH_RATIO); + emscripten::constant("C_EQ_LEN_PT_LINE_D", SLVS_C_EQ_LEN_PT_LINE_D); + emscripten::constant("C_EQ_PT_LN_DISTANCES", SLVS_C_EQ_PT_LN_DISTANCES); + emscripten::constant("C_EQUAL_ANGLE", SLVS_C_EQUAL_ANGLE); + emscripten::constant("C_EQUAL_LINE_ARC_LEN", SLVS_C_EQUAL_LINE_ARC_LEN); + emscripten::constant("C_SYMMETRIC", SLVS_C_SYMMETRIC); + emscripten::constant("C_SYMMETRIC_HORIZ", SLVS_C_SYMMETRIC_HORIZ); + emscripten::constant("C_SYMMETRIC_VERT", SLVS_C_SYMMETRIC_VERT); + emscripten::constant("C_SYMMETRIC_LINE", SLVS_C_SYMMETRIC_LINE); + emscripten::constant("C_AT_MIDPOINT", SLVS_C_AT_MIDPOINT); + emscripten::constant("C_HORIZONTAL", SLVS_C_HORIZONTAL); + emscripten::constant("C_VERTICAL", SLVS_C_VERTICAL); + emscripten::constant("C_DIAMETER", SLVS_C_DIAMETER); + emscripten::constant("C_PT_ON_CIRCLE", SLVS_C_PT_ON_CIRCLE); + emscripten::constant("C_SAME_ORIENTATION", SLVS_C_SAME_ORIENTATION); + emscripten::constant("C_ANGLE", SLVS_C_ANGLE); + emscripten::constant("C_PARALLEL", SLVS_C_PARALLEL); + emscripten::constant("C_PERPENDICULAR", SLVS_C_PERPENDICULAR); + emscripten::constant("C_ARC_LINE_TANGENT", SLVS_C_ARC_LINE_TANGENT); + emscripten::constant("C_CUBIC_LINE_TANGENT", SLVS_C_CUBIC_LINE_TANGENT); + emscripten::constant("C_EQUAL_RADIUS", SLVS_C_EQUAL_RADIUS); + emscripten::constant("C_PROJ_PT_DISTANCE", SLVS_C_PROJ_PT_DISTANCE); + emscripten::constant("C_WHERE_DRAGGED", SLVS_C_WHERE_DRAGGED); + emscripten::constant("C_CURVE_CURVE_TANGENT", SLVS_C_CURVE_CURVE_TANGENT); + emscripten::constant("C_LENGTH_DIFFERENCE", SLVS_C_LENGTH_DIFFERENCE); + emscripten::constant("C_ARC_ARC_LEN_RATIO", SLVS_C_ARC_ARC_LEN_RATIO); + emscripten::constant("C_ARC_LINE_LEN_RATIO", SLVS_C_ARC_LINE_LEN_RATIO); + emscripten::constant("C_ARC_ARC_DIFFERENCE", SLVS_C_ARC_ARC_DIFFERENCE); + emscripten::constant("C_ARC_LINE_DIFFERENCE", SLVS_C_ARC_LINE_DIFFERENCE); + + emscripten::constant("E_POINT_IN_3D", SLVS_E_POINT_IN_3D); + emscripten::constant("E_POINT_IN_2D", SLVS_E_POINT_IN_2D); + emscripten::constant("E_NORMAL_IN_3D", SLVS_E_NORMAL_IN_3D); + emscripten::constant("E_NORMAL_IN_2D", SLVS_E_NORMAL_IN_2D); + emscripten::constant("E_DISTANCE", SLVS_E_DISTANCE); + emscripten::constant("E_WORKPLANE", SLVS_E_WORKPLANE); + emscripten::constant("E_LINE_SEGMENT", SLVS_E_LINE_SEGMENT); + emscripten::constant("E_CUBIC", SLVS_E_CUBIC); + emscripten::constant("E_CIRCLE", SLVS_E_CIRCLE); + emscripten::constant("E_ARC_OF_CIRCLE", SLVS_E_ARC_OF_CIRCLE); + + emscripten::constant("E_NONE", SLVS_E_NONE); + emscripten::constant("E_FREE_IN_3D", SLVS_E_FREE_IN_3D); + + emscripten::constant("RESULT_OKAY", SLVS_RESULT_OKAY); + emscripten::constant("RESULT_INCONSISTENT", SLVS_RESULT_INCONSISTENT); + emscripten::constant("RESULT_DIDNT_CONVERGE", SLVS_RESULT_DIDNT_CONVERGE); + emscripten::constant("RESULT_TOO_MANY_UNKNOWNS", SLVS_RESULT_TOO_MANY_UNKNOWNS); + emscripten::constant("RESULT_REDUNDANT_OKAY", SLVS_RESULT_REDUNDANT_OKAY); + + emscripten::value_array>("array_uint32_4") + .element(emscripten::index<0>()) + .element(emscripten::index<1>()) + .element(emscripten::index<3>()) + .element(emscripten::index<4>()); + + emscripten::value_object("Slvs_Entity") + .field("h", &Slvs_Entity::h) + .field("group", &Slvs_Entity::group) + .field("type", &Slvs_Entity::type) + .field("wrkpl", &Slvs_Entity::wrkpl) + .field("point", &Slvs_Entity::point) + .field("normal", &Slvs_Entity::normal) + .field("distance", &Slvs_Entity::distance) + .field("param", &Slvs_Entity::param); + + emscripten::value_object("Slvs_Constraint") + .field("h", &Slvs_Constraint::h) + .field("group", &Slvs_Constraint::group) + .field("type", &Slvs_Constraint::type) + .field("wrkpl", &Slvs_Constraint::wrkpl) + .field("valA", &Slvs_Constraint::valA) + .field("ptA", &Slvs_Constraint::ptA) + .field("ptB", &Slvs_Constraint::ptB) + .field("entityA", &Slvs_Constraint::entityA) + .field("entityB", &Slvs_Constraint::entityB) + .field("entityC", &Slvs_Constraint::entityC) + .field("entityD", &Slvs_Constraint::entityD) + .field("other", &Slvs_Constraint::other) + .field("other2", &Slvs_Constraint::other2); + + emscripten::value_object("Slvs_SolveResult") + .field("result", &JsSolveResult::result) + .field("dof", &JsSolveResult::dof) + .field("nbad", &JsSolveResult::nbad) + .field("bad", &JsSolveResult::bad); + + emscripten::class_("Quaternion") + .constructor<>() + .function("plus", &Quaternion::Plus) + .function("minus", &Quaternion::Minus) + .function("scaledBy", &Quaternion::ScaledBy) + .function("magnitude", &Quaternion::Magnitude) + .function("withMagnitude", &Quaternion::WithMagnitude) + .function("toThe", &Quaternion::ToThe) + .function("inverse", &Quaternion::Inverse) + .function("times", &Quaternion::Times) + .function("mirror", &Quaternion::Mirror) + .function("rotationU", &Quaternion::RotationU) + .function("rotationV", &Quaternion::RotationV) + .function("rotationN", &Quaternion::RotationN) + .property("w", &Quaternion::w) + .property("vx", &Quaternion::vx) + .property("vy", &Quaternion::vy) + .property("vz", &Quaternion::vz) + .class_function("from", emscripten::select_overload(&Quaternion::From)); + + emscripten::class_("Vector") + .constructor<>() + .property("x", &Vector::x) + .property("y", &Vector::y) + .property("z", &Vector::z); + + emscripten::function("isFreeIn3D", &Slvs_IsFreeIn3D); + emscripten::function("is3D", &Slvs_Is3D); + emscripten::function("isNone", &Slvs_IsNone); + emscripten::function("isPoint2D", &Slvs_IsPoint2D); + emscripten::function("isPoint3D", &Slvs_IsPoint3D); + emscripten::function("isNormal2D", &Slvs_IsNormal2D); + emscripten::function("isNormal3D", &Slvs_IsNormal3D); + emscripten::function("isLine", &Slvs_IsLine); + emscripten::function("isLine2D", &Slvs_IsLine2D); + emscripten::function("isLine3D", &Slvs_IsLine3D); + emscripten::function("isCubic", &Slvs_IsCubic); + emscripten::function("isArc", &Slvs_IsArc); + emscripten::function("isWorkplane", &Slvs_IsWorkplane); + emscripten::function("isDistance", &Slvs_IsDistance); + emscripten::function("isPoint", &Slvs_IsPoint); + + emscripten::function("addPoint2D", &Slvs_AddPoint2D); + emscripten::function("addPoint3D", &Slvs_AddPoint3D); + emscripten::function("addNormal2D", &Slvs_AddNormal2D); + emscripten::function("addNormal3D", &Slvs_AddNormal3D); + emscripten::function("addDistance", &Slvs_AddDistance); + emscripten::function("addLine2D", &Slvs_AddLine2D); + emscripten::function("addLine3D", &Slvs_AddLine3D); + emscripten::function("addCubic", &Slvs_AddCubic); + emscripten::function("addArc", &Slvs_AddArc); + emscripten::function("addCircle", &Slvs_AddCircle); + emscripten::function("addWorkplane", &Slvs_AddWorkplane); + emscripten::function("addBase2D", &Slvs_AddBase2D); + + emscripten::function("addConstraint", &Slvs_AddConstraint); + emscripten::function("coincident", &Slvs_Coincident); + emscripten::function("distance", &Slvs_Distance); + emscripten::function("equal", &Slvs_Equal); + emscripten::function("equalAngle", &Slvs_EqualAngle); + emscripten::function("equalPointToLine", &Slvs_EqualPointToLine); + emscripten::function("ratio", &Slvs_Ratio); + emscripten::function("symmetric", &Slvs_Symmetric); + emscripten::function("symmetricH", &Slvs_SymmetricH); + emscripten::function("symmetricV", &Slvs_SymmetricV); + emscripten::function("midpoint", &Slvs_Midpoint); + emscripten::function("horizontal", &Slvs_Horizontal); + emscripten::function("vertical", &Slvs_Vertical); + emscripten::function("diameter", &Slvs_Diameter); + emscripten::function("sameOrientation", &Slvs_SameOrientation); + emscripten::function("angle", &Slvs_Angle); + emscripten::function("perpendicular", &Slvs_Perpendicular); + emscripten::function("parallel", &Slvs_Parallel); + emscripten::function("tangent", &Slvs_Tangent); + emscripten::function("distanceProj", &Slvs_DistanceProj); + emscripten::function("lengthDiff", &Slvs_LengthDiff); + emscripten::function("dragged", &Slvs_Dragged); + + emscripten::function("getParamValue", &Slvs_GetParamValue); + emscripten::function("setParamValue", &Slvs_SetParamValue); + emscripten::function("markDragged", &Slvs_MarkDragged); + emscripten::function("solveSketch", &solveSketch); + emscripten::function("clearSketch", &Slvs_ClearSketch); +} diff --git a/src/slvs/lib.cpp b/src/slvs/lib.cpp new file mode 100644 index 0000000..56c7c24 --- /dev/null +++ b/src/slvs/lib.cpp @@ -0,0 +1,1124 @@ +//----------------------------------------------------------------------------- +// A library wrapper around SolveSpace, to permit someone to use its constraint +// solver without coupling their program too much to SolveSpace's internals. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include +#include "solvespace.h" +#include +#include + +namespace SolveSpace { + +Sketch SK = {}; + +void Platform::FatalError(const std::string &message) { + fprintf(stderr, "%s", message.c_str()); + abort(); +} + +void Group::GenerateEquations(IdList *) { + // Nothing to do for now. +} + +} // namespace SolveSpace + +using namespace SolveSpace; + +static System SYS; +static ParamSet dragged; + +extern "C" { + +static ConstraintBase::Type Slvs_CTypeToConstraintBaseType(int type) { + switch(type) { +case SLVS_C_POINTS_COINCIDENT: return ConstraintBase::Type::POINTS_COINCIDENT; +case SLVS_C_PT_PT_DISTANCE: return ConstraintBase::Type::PT_PT_DISTANCE; +case SLVS_C_PT_PLANE_DISTANCE: return ConstraintBase::Type::PT_PLANE_DISTANCE; +case SLVS_C_PT_LINE_DISTANCE: return ConstraintBase::Type::PT_LINE_DISTANCE; +case SLVS_C_PT_FACE_DISTANCE: return ConstraintBase::Type::PT_FACE_DISTANCE; +case SLVS_C_PT_IN_PLANE: return ConstraintBase::Type::PT_IN_PLANE; +case SLVS_C_PT_ON_LINE: return ConstraintBase::Type::PT_ON_LINE; +case SLVS_C_PT_ON_FACE: return ConstraintBase::Type::PT_ON_FACE; +case SLVS_C_EQUAL_LENGTH_LINES: return ConstraintBase::Type::EQUAL_LENGTH_LINES; +case SLVS_C_LENGTH_RATIO: return ConstraintBase::Type::LENGTH_RATIO; +case SLVS_C_ARC_ARC_LEN_RATIO: return ConstraintBase::Type::ARC_ARC_LEN_RATIO; +case SLVS_C_ARC_LINE_LEN_RATIO: return ConstraintBase::Type::ARC_LINE_LEN_RATIO; +case SLVS_C_EQ_LEN_PT_LINE_D: return ConstraintBase::Type::EQ_LEN_PT_LINE_D; +case SLVS_C_EQ_PT_LN_DISTANCES: return ConstraintBase::Type::EQ_PT_LN_DISTANCES; +case SLVS_C_EQUAL_ANGLE: return ConstraintBase::Type::EQUAL_ANGLE; +case SLVS_C_EQUAL_LINE_ARC_LEN: return ConstraintBase::Type::EQUAL_LINE_ARC_LEN; +case SLVS_C_LENGTH_DIFFERENCE: return ConstraintBase::Type::LENGTH_DIFFERENCE; +case SLVS_C_ARC_ARC_DIFFERENCE: return ConstraintBase::Type::ARC_ARC_DIFFERENCE; +case SLVS_C_ARC_LINE_DIFFERENCE: return ConstraintBase::Type::ARC_LINE_DIFFERENCE; +case SLVS_C_SYMMETRIC: return ConstraintBase::Type::SYMMETRIC; +case SLVS_C_SYMMETRIC_HORIZ: return ConstraintBase::Type::SYMMETRIC_HORIZ; +case SLVS_C_SYMMETRIC_VERT: return ConstraintBase::Type::SYMMETRIC_VERT; +case SLVS_C_SYMMETRIC_LINE: return ConstraintBase::Type::SYMMETRIC_LINE; +case SLVS_C_AT_MIDPOINT: return ConstraintBase::Type::AT_MIDPOINT; +case SLVS_C_HORIZONTAL: return ConstraintBase::Type::HORIZONTAL; +case SLVS_C_VERTICAL: return ConstraintBase::Type::VERTICAL; +case SLVS_C_DIAMETER: return ConstraintBase::Type::DIAMETER; +case SLVS_C_PT_ON_CIRCLE: return ConstraintBase::Type::PT_ON_CIRCLE; +case SLVS_C_SAME_ORIENTATION: return ConstraintBase::Type::SAME_ORIENTATION; +case SLVS_C_ANGLE: return ConstraintBase::Type::ANGLE; +case SLVS_C_PARALLEL: return ConstraintBase::Type::PARALLEL; +case SLVS_C_PERPENDICULAR: return ConstraintBase::Type::PERPENDICULAR; +case SLVS_C_ARC_LINE_TANGENT: return ConstraintBase::Type::ARC_LINE_TANGENT; +case SLVS_C_CUBIC_LINE_TANGENT: return ConstraintBase::Type::CUBIC_LINE_TANGENT; +case SLVS_C_EQUAL_RADIUS: return ConstraintBase::Type::EQUAL_RADIUS; +case SLVS_C_PROJ_PT_DISTANCE: return ConstraintBase::Type::PROJ_PT_DISTANCE; +case SLVS_C_WHERE_DRAGGED: return ConstraintBase::Type::WHERE_DRAGGED; +case SLVS_C_CURVE_CURVE_TANGENT: return ConstraintBase::Type::CURVE_CURVE_TANGENT; +default: Platform::FatalError("bad constraint type " + std::to_string(type)); + } +} + +static EntityBase::Type Slvs_CTypeToEntityBaseType(int type) { + switch(type) { +case SLVS_E_POINT_IN_3D: return EntityBase::Type::POINT_IN_3D; +case SLVS_E_POINT_IN_2D: return EntityBase::Type::POINT_IN_2D; +case SLVS_E_NORMAL_IN_3D: return EntityBase::Type::NORMAL_IN_3D; +case SLVS_E_NORMAL_IN_2D: return EntityBase::Type::NORMAL_IN_2D; +case SLVS_E_DISTANCE: return EntityBase::Type::DISTANCE; +case SLVS_E_WORKPLANE: return EntityBase::Type::WORKPLANE; +case SLVS_E_LINE_SEGMENT: return EntityBase::Type::LINE_SEGMENT; +case SLVS_E_CUBIC: return EntityBase::Type::CUBIC; +case SLVS_E_CIRCLE: return EntityBase::Type::CIRCLE; +case SLVS_E_ARC_OF_CIRCLE: return EntityBase::Type::ARC_OF_CIRCLE; +default: Platform::FatalError("bad entity type " + std::to_string(type)); + } +} + +static bool Slvs_CanInitiallySatisfy(const ConstraintBase &c) { + switch(c.type) { + case ConstraintBase::Type::CUBIC_LINE_TANGENT: + case ConstraintBase::Type::PARALLEL: + // Can't initially satisfy if not projected onto a workplane + return c.workplane != EntityBase::FREE_IN_3D; + + case ConstraintBase::Type::PT_PT_DISTANCE: + case ConstraintBase::Type::PROJ_PT_DISTANCE: + case ConstraintBase::Type::PT_LINE_DISTANCE: + case ConstraintBase::Type::PT_PLANE_DISTANCE: + case ConstraintBase::Type::PT_FACE_DISTANCE: + case ConstraintBase::Type::EQUAL_LENGTH_LINES: + case ConstraintBase::Type::EQ_LEN_PT_LINE_D: + case ConstraintBase::Type::EQ_PT_LN_DISTANCES: + case ConstraintBase::Type::LENGTH_RATIO: + case ConstraintBase::Type::ARC_ARC_LEN_RATIO: + case ConstraintBase::Type::ARC_LINE_LEN_RATIO: + case ConstraintBase::Type::LENGTH_DIFFERENCE: + case ConstraintBase::Type::ARC_ARC_DIFFERENCE: + case ConstraintBase::Type::ARC_LINE_DIFFERENCE: + case ConstraintBase::Type::DIAMETER: + case ConstraintBase::Type::EQUAL_RADIUS: + case ConstraintBase::Type::EQUAL_LINE_ARC_LEN: + case ConstraintBase::Type::PT_IN_PLANE: + case ConstraintBase::Type::PT_ON_FACE: + case ConstraintBase::Type::PT_ON_CIRCLE: + case ConstraintBase::Type::HORIZONTAL: + case ConstraintBase::Type::VERTICAL: + case ConstraintBase::Type::PERPENDICULAR: + case ConstraintBase::Type::ANGLE: + case ConstraintBase::Type::EQUAL_ANGLE: + case ConstraintBase::Type::ARC_LINE_TANGENT: + case ConstraintBase::Type::CURVE_CURVE_TANGENT: + return true; + + case ConstraintBase::Type::AT_MIDPOINT: + // Can initially satisfy if between a line segment and a workplane + return c.ptA == EntityBase::NO_ENTITY; + + case ConstraintBase::Type::POINTS_COINCIDENT: + case ConstraintBase::Type::PT_ON_LINE: + case ConstraintBase::Type::SYMMETRIC: + case ConstraintBase::Type::SYMMETRIC_HORIZ: + case ConstraintBase::Type::SYMMETRIC_VERT: + case ConstraintBase::Type::SYMMETRIC_LINE: + case ConstraintBase::Type::SAME_ORIENTATION: + case ConstraintBase::Type::WHERE_DRAGGED: + case ConstraintBase::Type::COMMENT: + // Can't initially satisfy these constraints + return false; + } + ssassert(false, "Unexpected constraint type"); +} + +bool Slvs_IsFreeIn3D(Slvs_Entity e) { + return e.h == SLVS_FREE_IN_3D; +} + +bool Slvs_Is3D(Slvs_Entity e) { + return e.wrkpl == SLVS_FREE_IN_3D; +} + +bool Slvs_IsNone(Slvs_Entity e) { + return e.h == 0; +} + +bool Slvs_IsPoint2D(Slvs_Entity e) { + return e.type == SLVS_E_POINT_IN_2D; +} + +bool Slvs_IsPoint3D(Slvs_Entity e) { + return e.type == SLVS_E_POINT_IN_3D; +} + +bool Slvs_IsNormal2D(Slvs_Entity e) { + return e.type == SLVS_E_NORMAL_IN_2D; +} + +bool Slvs_IsNormal3D(Slvs_Entity e) { + return e.type == SLVS_E_NORMAL_IN_3D; +} + +bool Slvs_IsLine(Slvs_Entity e) { + return e.type == SLVS_E_LINE_SEGMENT; +} + +bool Slvs_IsLine2D(Slvs_Entity e) { + return e.type == SLVS_E_LINE_SEGMENT && !Slvs_Is3D(e); +} + +bool Slvs_IsLine3D(Slvs_Entity e) { + return e.type == SLVS_E_LINE_SEGMENT && Slvs_Is3D(e); +} + +bool Slvs_IsCubic(Slvs_Entity e) { + return e.type == SLVS_E_CUBIC; +} + +bool Slvs_IsArc(Slvs_Entity e) { + return e.type == SLVS_E_ARC_OF_CIRCLE; +} + +bool Slvs_IsWorkplane(Slvs_Entity e) { + return e.type == SLVS_E_WORKPLANE; +} + +bool Slvs_IsDistance(Slvs_Entity e) { + return e.type == SLVS_E_DISTANCE; +} + +bool Slvs_IsPoint(Slvs_Entity e) { + switch(e.type) { + case SLVS_E_POINT_IN_3D: + case SLVS_E_POINT_IN_2D: + return true; + default: + return false; + } +} + +bool Slvs_IsCircle(Slvs_Entity e) { + return e.type == SLVS_E_CIRCLE || e.type == SLVS_E_ARC_OF_CIRCLE; +} + +Slvs_hParam Slvs_AddParam(double val) { + Param pa = {}; + pa.val = val; + SK.param.AddAndAssignId(&pa); + return pa.h.v; +} + +// entities +Slvs_Entity Slvs_AddPoint2D(uint32_t grouph, double u, double v, Slvs_Entity workplane) { + Slvs_hParam uph = Slvs_AddParam(u); + Slvs_hParam vph = Slvs_AddParam(v); + EntityBase e = {}; + e.type = EntityBase::Type::POINT_IN_2D; + e.group.v = grouph; + e.workplane.v = workplane.h; + e.param[0].v = uph; + e.param[1].v = vph; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_POINT_IN_2D; + ce.group = grouph; + ce.wrkpl = workplane.h; + ce.param[0] = uph; + ce.param[1] = vph; + return ce; +} + +Slvs_Entity Slvs_AddPoint3D(uint32_t grouph, double x, double y, double z) { + Slvs_hParam xph = Slvs_AddParam(x); + Slvs_hParam yph = Slvs_AddParam(y); + Slvs_hParam zph = Slvs_AddParam(z); + EntityBase e = {}; + e.type = EntityBase::Type::POINT_IN_3D; + e.group.v = grouph; + e.workplane.v = EntityBase::FREE_IN_3D.v; + e.param[0].v = xph; + e.param[1].v = yph; + e.param[2].v = zph; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_POINT_IN_3D; + ce.group = grouph; + ce.wrkpl = SLVS_FREE_IN_3D; + ce.param[0] = xph; + ce.param[1] = yph; + ce.param[2] = zph; + return ce; +} + +Slvs_Entity Slvs_AddNormal2D(uint32_t grouph, Slvs_Entity workplane) { + if(!Slvs_IsWorkplane(workplane)) { + Platform::FatalError("workplane argument is not a workplane"); + } + EntityBase e = {}; + e.type = EntityBase::Type::NORMAL_IN_2D; + e.group.v = grouph; + e.workplane.v = workplane.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_NORMAL_IN_2D; + ce.group = grouph; + ce.wrkpl = workplane.h; + return ce; +} + +Slvs_Entity Slvs_AddNormal3D(uint32_t grouph, double qw, double qx, double qy, double qz) { + Slvs_hParam wph = Slvs_AddParam(qw); + Slvs_hParam xph = Slvs_AddParam(qx); + Slvs_hParam yph = Slvs_AddParam(qy); + Slvs_hParam zph = Slvs_AddParam(qz); + EntityBase e = {}; + e.type = EntityBase::Type::NORMAL_IN_3D; + e.group.v = grouph; + e.workplane.v = EntityBase::FREE_IN_3D.v; + e.param[0].v = wph; + e.param[1].v = xph; + e.param[2].v = yph; + e.param[3].v = zph; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_NORMAL_IN_3D; + ce.group = grouph; + ce.wrkpl = SLVS_FREE_IN_3D; + ce.param[0] = wph; + ce.param[1] = xph; + ce.param[2] = yph; + ce.param[3] = zph; + return ce; +} + +Slvs_Entity Slvs_AddDistance(uint32_t grouph, double value, Slvs_Entity workplane) { + if(!Slvs_IsWorkplane(workplane)) { + Platform::FatalError("workplane argument is not a workplane"); + } + Slvs_hParam valueph = Slvs_AddParam(value); + EntityBase e = {}; + e.type = EntityBase::Type::DISTANCE; + e.group.v = grouph; + e.workplane.v = workplane.h; + e.param[0].v = valueph; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_DISTANCE; + ce.group = grouph; + ce.wrkpl = workplane.h; + ce.param[0] = valueph; + return ce; +} + +Slvs_Entity Slvs_AddLine2D(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) { + if(!Slvs_IsWorkplane(workplane)) { + Platform::FatalError("workplane argument is not a workplane"); + } else if(!Slvs_IsPoint2D(ptA)) { + Platform::FatalError("ptA argument is not a 2d point"); + } else if(!Slvs_IsPoint2D(ptB)) { + Platform::FatalError("ptB argument is not a 2d point"); + } + EntityBase e = {}; + e.type = EntityBase::Type::LINE_SEGMENT; + e.group.v = grouph; + e.workplane.v = workplane.h; + e.point[0].v = ptA.h; + e.point[1].v = ptB.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_LINE_SEGMENT; + ce.group = grouph; + ce.wrkpl = workplane.h; + ce.point[0] = ptA.h; + ce.point[1] = ptB.h; + return ce; +} + +Slvs_Entity Slvs_AddLine3D(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB) { + if(!Slvs_IsPoint3D(ptA)) { + Platform::FatalError("ptA argument is not a 3d point"); + } else if(!Slvs_IsPoint3D(ptB)) { + Platform::FatalError("ptB argument is not a 3d point"); + } + EntityBase e = {}; + e.type = EntityBase::Type::LINE_SEGMENT; + e.group.v = grouph; + e.workplane.v = EntityBase::FREE_IN_3D.v; + e.point[0].v = ptA.h; + e.point[1].v = ptB.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_LINE_SEGMENT; + ce.group = grouph; + ce.wrkpl = SLVS_FREE_IN_3D; + ce.point[0] = ptA.h; + ce.point[1] = ptB.h; + return ce; +} + +Slvs_Entity Slvs_AddCubic(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity ptC, Slvs_Entity ptD, Slvs_Entity workplane) { + if(!Slvs_IsWorkplane(workplane)) { + Platform::FatalError("workplane argument is not a workplane"); + } else if(!Slvs_IsPoint2D(ptA)) { + Platform::FatalError("ptA argument is not a 2d point"); + } else if(!Slvs_IsPoint2D(ptB)) { + Platform::FatalError("ptB argument is not a 2d point"); + } else if(!Slvs_IsPoint2D(ptC)) { + Platform::FatalError("ptC argument is not a 2d point"); + } else if(!Slvs_IsPoint2D(ptD)) { + Platform::FatalError("ptD argument is not a 2d point"); + } + EntityBase e = {}; + e.type = EntityBase::Type::CUBIC; + e.group.v = grouph; + e.workplane.v = workplane.h; + e.point[0].v = ptA.h; + e.point[1].v = ptB.h; + e.point[2].v = ptC.h; + e.point[3].v = ptD.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_CUBIC; + ce.group = grouph; + ce.wrkpl = workplane.h; + ce.point[0] = ptA.h; + ce.point[1] = ptB.h; + ce.point[2] = ptC.h; + ce.point[3] = ptD.h; + return ce; +} + + +Slvs_Entity Slvs_AddArc(uint32_t grouph, Slvs_Entity normal, Slvs_Entity center, Slvs_Entity start, Slvs_Entity end, + Slvs_Entity workplane) { + if(!Slvs_IsWorkplane(workplane)) { + Platform::FatalError("workplane argument is not a workplane"); + } else if(!Slvs_IsNormal3D(normal)) { + Platform::FatalError("normal argument is not a 3d normal"); + } else if(!Slvs_IsPoint2D(center)) { + Platform::FatalError("center argument is not a 2d point"); + } else if(!Slvs_IsPoint2D(start)) { + Platform::FatalError("start argument is not a 2d point"); + } else if(!Slvs_IsPoint2D(end)) { + Platform::FatalError("end argument is not a 2d point"); + } + EntityBase e = {}; + e.type = EntityBase::Type::ARC_OF_CIRCLE; + e.group.v = grouph; + e.workplane.v = workplane.h; + e.normal.v = normal.h; + e.point[0].v = center.h; + e.point[1].v = start.h; + e.point[2].v = end.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_ARC_OF_CIRCLE; + ce.group = grouph; + ce.wrkpl = workplane.h; + ce.normal = normal.h; + ce.point[0] = center.h; + ce.point[1] = start.h; + ce.point[2] = end.h; + return ce; +} + +Slvs_Entity Slvs_AddCircle(uint32_t grouph, Slvs_Entity normal, Slvs_Entity center, Slvs_Entity radius, + Slvs_Entity workplane) { + if(!Slvs_IsWorkplane(workplane)) { + Platform::FatalError("workplane argument is not a workplane"); + } else if(!Slvs_IsNormal3D(normal)) { + Platform::FatalError("normal argument is not a 3d normal"); + } else if(!Slvs_IsPoint2D(center)) { + Platform::FatalError("center argument is not a 2d point"); + } else if(!Slvs_IsDistance(radius)) { + Platform::FatalError("radius argument is not a distance"); + } + EntityBase e = {}; + e.type = EntityBase::Type::CIRCLE; + e.group.v = grouph; + e.workplane.v = workplane.h; + e.normal.v = normal.h; + e.point[0].v = center.h; + e.distance.v = radius.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_CIRCLE; + ce.group = grouph; + ce.wrkpl = workplane.h; + ce.normal = normal.h; + ce.point[0] = center.h; + ce.distance = radius.h; + return ce; +} + +Slvs_Entity Slvs_AddWorkplane(uint32_t grouph, Slvs_Entity origin, Slvs_Entity nm) { + EntityBase e = {}; + e.type = EntityBase::Type::WORKPLANE; + e.group.v = grouph; + e.workplane.v = SLVS_FREE_IN_3D; + e.point[0].v = origin.h; + e.normal.v = nm.h; + SK.entity.AddAndAssignId(&e); + + Slvs_Entity ce = Slvs_Entity {}; + ce.h = e.h.v; + ce.type = SLVS_E_WORKPLANE; + ce.group = grouph; + ce.wrkpl = SLVS_FREE_IN_3D; + ce.point[0] = origin.h; + ce.normal = nm.h; + return ce; +} + +Slvs_Entity Slvs_AddBase2D(uint32_t grouph) { + Vector u = Vector::From(1, 0, 0); + Vector v = Vector::From(0, 1, 0); + Quaternion q = Quaternion::From(u, v); + Slvs_Entity nm = Slvs_AddNormal3D(grouph, q.w, q.vx, q.vy, q.vz); + return Slvs_AddWorkplane(grouph, Slvs_AddPoint3D(grouph, 0, 0, 0), nm); +} + +// constraints + +Slvs_Constraint Slvs_AddConstraint(uint32_t grouph, + int type, Slvs_Entity workplane, double val, Slvs_Entity ptA, + Slvs_Entity ptB = SLVS_E_NONE, Slvs_Entity entityA = SLVS_E_NONE, + Slvs_Entity entityB = SLVS_E_NONE, Slvs_Entity entityC = SLVS_E_NONE, + Slvs_Entity entityD = SLVS_E_NONE, int other = 0, int other2 = 0) { + ConstraintBase c = {}; + c.type = Slvs_CTypeToConstraintBaseType(type); + c.group.v = grouph; + c.workplane.v = workplane.h; + c.valA = val; + c.ptA.v = ptA.h; + c.ptB.v = ptB.h; + c.entityA.v = entityA.h; + c.entityB.v = entityB.h; + c.entityC.v = entityC.h; + c.entityD.v = entityD.h; + c.other = other ? true : false; + c.other2 = other2 ? true : false; + SK.constraint.AddAndAssignId(&c); + + Slvs_Constraint cc = Slvs_Constraint {}; + cc.h = c.h.v; + cc.type = type; + cc.group = grouph; + cc.wrkpl = workplane.h; + cc.valA = val; + cc.ptA = ptA.h; + cc.ptB = ptB.h; + cc.entityA = entityA.h; + cc.entityB = entityB.h; + cc.entityC = entityC.h; + cc.entityD = entityD.h; + cc.other = other ? true : false; + cc.other2 = other2 ? true : false; + return cc; +} + +Slvs_Constraint Slvs_Coincident(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsPoint(entityA) && Slvs_IsPoint(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_POINTS_COINCIDENT, workplane, 0., entityA, entityB); + } else if(Slvs_IsPoint(entityA) && Slvs_IsWorkplane(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_PT_IN_PLANE, SLVS_E_FREE_IN_3D, 0., entityA, SLVS_E_NONE, entityB); + } else if(Slvs_IsPoint(entityA) && Slvs_IsLine(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_PT_ON_LINE, workplane, 0., entityA, SLVS_E_NONE, entityB); + } else if(Slvs_IsPoint(entityA) && (Slvs_IsCircle(entityB) || Slvs_IsArc(entityB))) { + return Slvs_AddConstraint(grouph, SLVS_C_PT_ON_CIRCLE, workplane, 0., entityA, SLVS_E_NONE, entityB); + } + Platform::FatalError("Invalid arguments for coincident constraint"); +} + +Slvs_Constraint Slvs_Distance(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane) { + if(Slvs_IsPoint(entityA) && Slvs_IsPoint(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_PT_PT_DISTANCE, workplane, value, entityA, entityB); + } else if(Slvs_IsPoint(entityA) && Slvs_IsWorkplane(entityB) && Slvs_Is3D(workplane)) { + return Slvs_AddConstraint(grouph, SLVS_C_PT_PLANE_DISTANCE, entityB, value, entityA, SLVS_E_NONE, entityB); + } else if(Slvs_IsPoint(entityA) && Slvs_IsLine(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_PT_LINE_DISTANCE, workplane, value, entityA, SLVS_E_NONE, entityB); + } + Platform::FatalError("Invalid arguments for distance constraint"); +} + +Slvs_Constraint Slvs_Equal(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsLine(entityA) && Slvs_IsLine(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_EQUAL_LENGTH_LINES, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } else if(Slvs_IsLine(entityA) && (Slvs_IsArc(entityB) || Slvs_IsCircle(entityB))) { + return Slvs_AddConstraint(grouph, SLVS_C_EQUAL_LINE_ARC_LEN, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } else if((Slvs_IsArc(entityA) || Slvs_IsCircle(entityA)) && (Slvs_IsArc(entityB) || Slvs_IsCircle(entityB))) { + return Slvs_AddConstraint(grouph, SLVS_C_EQUAL_RADIUS, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } + Platform::FatalError("Invalid arguments for equal constraint"); +} + +Slvs_Constraint Slvs_EqualAngle(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, Slvs_Entity entityD, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsLine2D(entityA) && Slvs_IsLine2D(entityB) && Slvs_IsLine2D(entityC) && Slvs_IsLine2D(entityD) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_EQUAL_ANGLE, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB, entityC, entityD); + } + Platform::FatalError("Invalid arguments for equal angle constraint"); +} + +Slvs_Constraint Slvs_EqualPointToLine(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, Slvs_Entity entityD, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsPoint2D(entityA) && Slvs_IsLine2D(entityB) && Slvs_IsPoint2D(entityC) && Slvs_IsLine2D(entityD) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_EQ_PT_LN_DISTANCES, workplane, 0., entityA, entityB, entityC, entityD); + } + Platform::FatalError("Invalid arguments for equal point to line constraint"); +} + +Slvs_Constraint Slvs_Ratio(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsLine2D(entityA) && Slvs_IsLine2D(entityB) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_LENGTH_RATIO, workplane, value, SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } + Platform::FatalError("Invalid arguments for ratio constraint"); +} + +Slvs_Constraint Slvs_Symmetric(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC = SLVS_E_NONE, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsPoint3D(entityA) && Slvs_IsPoint3D(entityB) && Slvs_IsWorkplane(entityC) && Slvs_IsFreeIn3D(workplane)) { + return Slvs_AddConstraint(grouph, SLVS_C_SYMMETRIC, workplane, 0., entityA, entityB, entityC); + } else if(Slvs_IsPoint2D(entityA) && Slvs_IsPoint2D(entityB) && Slvs_IsWorkplane(entityC) && Slvs_IsFreeIn3D(workplane)) { + return Slvs_AddConstraint(grouph, SLVS_C_SYMMETRIC, entityC, 0., entityA, entityB, entityC); + } else if(Slvs_IsPoint2D(entityA) && Slvs_IsPoint2D(entityB) && Slvs_IsLine(entityC)) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("3d workplane given for a 2d constraint"); + } + return Slvs_AddConstraint(grouph, SLVS_C_SYMMETRIC_LINE, workplane, 0., entityA, entityB, entityC); + } + Platform::FatalError("Invalid arguments for symmetric constraint"); +} + +Slvs_Constraint Slvs_SymmetricH(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("3d workplane given for a 2d constraint"); + } else if(Slvs_IsPoint2D(ptA) && Slvs_IsPoint2D(ptB)) { + return Slvs_AddConstraint(grouph, SLVS_C_SYMMETRIC_HORIZ, workplane, 0., ptA, ptB); + } + Platform::FatalError("Invalid arguments for symmetric horizontal constraint"); +} + +Slvs_Constraint Slvs_SymmetricV(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("3d workplane given for a 2d constraint"); + } else if(Slvs_IsPoint2D(ptA) && Slvs_IsPoint2D(ptB)) { + return Slvs_AddConstraint(grouph, SLVS_C_SYMMETRIC_VERT, workplane, 0., ptA, ptB); + } + Platform::FatalError("Invalid arguments for symmetric vertical constraint"); +} + +Slvs_Constraint Slvs_Midpoint(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsPoint(ptA) && Slvs_IsLine(ptB) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_AT_MIDPOINT, workplane, 0., ptA, SLVS_E_NONE, ptB); + } + Platform::FatalError("Invalid arguments for midpoint constraint"); +} + +Slvs_Constraint Slvs_Horizontal(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity workplane, Slvs_Entity entityB = SLVS_E_NONE) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("Horizontal constraint is not supported in 3D"); + } else if(Slvs_IsLine2D(entityA)) { + return Slvs_AddConstraint(grouph, SLVS_C_HORIZONTAL, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA); + } else if(Slvs_IsPoint2D(entityA) && Slvs_IsPoint2D(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_HORIZONTAL, workplane, 0., entityA, entityB); + } + Platform::FatalError("Invalid arguments for horizontal constraint"); +} + +Slvs_Constraint Slvs_Vertical(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity workplane, Slvs_Entity entityB = SLVS_E_NONE) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("Vertical constraint is not supported in 3D"); + } else if(Slvs_IsLine2D(entityA)) { + return Slvs_AddConstraint(grouph, SLVS_C_VERTICAL, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA); + } else if(Slvs_IsPoint2D(entityA) && Slvs_IsPoint2D(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_VERTICAL, workplane, 0., entityA, entityB); + } + Platform::FatalError("Invalid arguments for horizontal constraint"); +} + +Slvs_Constraint Slvs_Diameter(uint32_t grouph, Slvs_Entity entityA, double value) { + if(Slvs_IsArc(entityA) || Slvs_IsCircle(entityA)) { + return Slvs_AddConstraint(grouph, SLVS_C_DIAMETER, SLVS_E_FREE_IN_3D, value, SLVS_E_NONE, SLVS_E_NONE, entityA); + } + Platform::FatalError("Invalid arguments for diameter constraint"); +} + +Slvs_Constraint Slvs_SameOrientation(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB) { + if(Slvs_IsNormal3D(entityA) && Slvs_IsNormal3D(entityB)) { + return Slvs_AddConstraint(grouph, SLVS_C_SAME_ORIENTATION, SLVS_E_FREE_IN_3D, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } + Platform::FatalError("Invalid arguments for same orientation constraint"); +} + +Slvs_Constraint Slvs_Angle(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane = SLVS_E_FREE_IN_3D, int inverse = 0) { + if(Slvs_IsLine2D(entityA) && Slvs_IsLine2D(entityB) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_ANGLE, workplane, value, SLVS_E_NONE, SLVS_E_NONE, entityA, entityB, SLVS_E_NONE, SLVS_E_NONE, inverse); + } + Platform::FatalError("Invalid arguments for angle constraint"); +} + +Slvs_Constraint Slvs_Perpendicular(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane = SLVS_E_FREE_IN_3D, int inverse = 0) { + if(Slvs_IsLine2D(entityA) && Slvs_IsLine2D(entityB) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_PERPENDICULAR, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB, SLVS_E_NONE, SLVS_E_NONE, inverse); + } + Platform::FatalError("Invalid arguments for perpendicular constraint"); +} + +Slvs_Constraint Slvs_Parallel(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsLine2D(entityA) && Slvs_IsLine2D(entityB) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_PARALLEL, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } + Platform::FatalError("Invalid arguments for parallel constraint"); +} + +Slvs_Constraint Slvs_Tangent(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsArc(entityA) && Slvs_IsLine2D(entityB)) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("3d workplane given for a 2d constraint"); + } + Vector a1 = SK.entity.FindById(hEntity { entityA.point[1] })->PointGetNum(), + a2 = SK.entity.FindById(hEntity { entityA.point[2] })->PointGetNum(); + Vector l0 = SK.entity.FindById(hEntity { entityB.point[0] })->PointGetNum(), + l1 = SK.entity.FindById(hEntity { entityB.point[1] })->PointGetNum(); + int other; + if(l0.Equals(a1) || l1.Equals(a1)) { + other = 0; + } else if(l0.Equals(a2) || l1.Equals(a2)) { + other = 1; + } else { + Platform::FatalError("The tangent arc and line segment must share an " + "endpoint. Constrain them with Constrain -> " + "On Point before constraining tangent."); + } + return Slvs_AddConstraint(grouph, SLVS_C_ARC_LINE_TANGENT, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB, SLVS_E_NONE, SLVS_E_NONE, other); + } else if(Slvs_IsCubic(entityA) && Slvs_IsLine2D(entityB) && Slvs_IsFreeIn3D(workplane)) { + EntityBase* skEntityA = SK.entity.FindById(hEntity { entityA.h }); + Vector as = skEntityA->CubicGetStartNum(), af = skEntityA->CubicGetFinishNum(); + Vector l0 = SK.entity.FindById(hEntity { entityB.point[0] })->PointGetNum(), + l1 = SK.entity.FindById(hEntity { entityB.point[1] })->PointGetNum(); + int other; + if(l0.Equals(as) || l1.Equals(as)) { + other = 0; + } else if(l0.Equals(af) || l1.Equals(af)) { + other = 1; + } else { + Platform::FatalError("The tangent cubic and line segment must share an " + "endpoint. Constrain them with Constrain -> " + "On Point before constraining tangent."); + } + return Slvs_AddConstraint(grouph, SLVS_C_CUBIC_LINE_TANGENT, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB, SLVS_E_NONE, SLVS_E_NONE, other); + } else if((Slvs_IsArc(entityA) || Slvs_IsCubic(entityA)) && (Slvs_IsArc(entityB) || Slvs_IsCubic(entityB))) { + if(Slvs_IsFreeIn3D(workplane)) { + Platform::FatalError("3d workplane given for a 2d constraint"); + } + EntityBase* skEntityA = SK.entity.FindById(hEntity { entityA.h }); + EntityBase* skEntityB = SK.entity.FindById(hEntity { entityB.h }); + Vector as = skEntityA->EndpointStart(), af = skEntityA->EndpointFinish(), + bs = skEntityB->EndpointStart(), bf = skEntityB->EndpointFinish(); + int other; + int other2; + if(as.Equals(bs)) { + other = 0; + other2 = 0; + } else if(as.Equals(bf)) { + other = 0; + other2 = 1; + } else if(af.Equals(bs)) { + other = 1; + other2 = 0; + } else if(af.Equals(bf)) { + other = 1; + other2 = 1; + } else { + Platform::FatalError("The curves must share an endpoint. Constrain them " + "with Constrain -> On Point before constraining " + "tangent."); + } + return Slvs_AddConstraint(grouph, SLVS_C_CURVE_CURVE_TANGENT, workplane, 0., SLVS_E_NONE, SLVS_E_NONE, entityA, entityB, SLVS_E_NONE, SLVS_E_NONE, other, other2); + } + Platform::FatalError("Invalid arguments for tangent constraint"); +} + +Slvs_Constraint Slvs_DistanceProj(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity ptB, double value) { + if(Slvs_IsPoint(ptA) && Slvs_IsPoint(ptB)) { + return Slvs_AddConstraint(grouph, SLVS_C_PROJ_PT_DISTANCE, SLVS_E_FREE_IN_3D, value, ptA, ptB); + } + Platform::FatalError("Invalid arguments for projected distance constraint"); +} + +Slvs_Constraint Slvs_LengthDiff(uint32_t grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsLine(entityA) && Slvs_IsLine(entityB) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_LENGTH_DIFFERENCE, workplane, value, SLVS_E_NONE, SLVS_E_NONE, entityA, entityB); + } + Platform::FatalError("Invalid arguments for length difference constraint"); +} + +Slvs_Constraint Slvs_Dragged(uint32_t grouph, Slvs_Entity ptA, Slvs_Entity workplane = SLVS_E_FREE_IN_3D) { + if(Slvs_IsPoint(ptA) && (Slvs_IsWorkplane(workplane) || Slvs_IsFreeIn3D(workplane))) { + return Slvs_AddConstraint(grouph, SLVS_C_WHERE_DRAGGED, workplane, 0., ptA); + } + Platform::FatalError("Invalid arguments for dragged constraint"); +} + +void Slvs_QuaternionU(double qw, double qx, double qy, double qz, + double *x, double *y, double *z) +{ + Quaternion q = Quaternion::From(qw, qx, qy, qz); + Vector v = q.RotationU(); + *x = v.x; + *y = v.y; + *z = v.z; +} + +void Slvs_QuaternionV(double qw, double qx, double qy, double qz, + double *x, double *y, double *z) +{ + Quaternion q = Quaternion::From(qw, qx, qy, qz); + Vector v = q.RotationV(); + *x = v.x; + *y = v.y; + *z = v.z; +} + +void Slvs_QuaternionN(double qw, double qx, double qy, double qz, + double *x, double *y, double *z) +{ + Quaternion q = Quaternion::From(qw, qx, qy, qz); + Vector v = q.RotationN(); + *x = v.x; + *y = v.y; + *z = v.z; +} + +void Slvs_MakeQuaternion(double ux, double uy, double uz, + double vx, double vy, double vz, + double *qw, double *qx, double *qy, double *qz) +{ + Vector u = Vector::From(ux, uy, uz), + v = Vector::From(vx, vy, vz); + Quaternion q = Quaternion::From(u, v); + *qw = q.w; + *qx = q.vx; + *qy = q.vy; + *qz = q.vz; +} + +void Slvs_ClearSketch() +{ + dragged.clear(); + SYS.Clear(); + SK.param.Clear(); + SK.entity.Clear(); + SK.constraint.Clear(); +} + +void Slvs_MarkDragged(Slvs_Entity ptA) { + if(Slvs_IsPoint(ptA)) { + const size_t params = Slvs_IsPoint3D(ptA) ? 3 : 2; + for(size_t i = 0; i < params; ++i) { + hParam p = hParam { ptA.param[i] }; + dragged.insert(p); + } + } else { + SolveSpace::Platform::FatalError("Invalid entity for marking dragged"); + } +} + +Slvs_SolveResult Slvs_SolveSketch(uint32_t shg, Slvs_hConstraint **bad = nullptr) +{ + SYS.Clear(); + + Group g = {}; + g.h.v = shg; + + // add params from entities on sketch + for(EntityBase &ent : SK.entity) { + EntityBase *e = &ent; + // skip entities from other groups + if (e->group.v != shg) { + continue; + } + for (hParam &parh : e->param) { + if (parh.v != 0) { + // get params for this entity and add it to the system + Param *p = SK.GetParam(parh); + p->known = false; + SYS.param.Add(p); + } + } + } + + // add params from constraints + for(ConstraintBase &con : SK.constraint) { + ConstraintBase *c = &con; + if(c->group.v != shg) + continue; + // If we're solving a sketch twice without calling `Slvs_ClearSketch()` in between, + // we already have a constraint param in the sketch, and regeneration would simply + // create another one and orphan the existing one. While this doesn't create any + // correctness issues, it does waste memory, so identify this case and regenerate + // only if we actually need to. + if(c->valP.v) { + SYS.param.Add(SK.GetParam(c->valP)); + continue; + } + // If `valP` is 0, this is either a constraint which doesn't have a param, or one + // which we haven't seen before, so try to regenerate. + // This generates at most a single additional param + c->Generate(&SK.param); + if(c->valP.v) { + SYS.param.Add(SK.GetParam(c->valP)); + + if(Slvs_CanInitiallySatisfy(*c)) { + c->ModifyToSatisfy(); + } + } + } + + // mark dragged params + for(hParam p : dragged) { + SYS.dragged.insert(p); + } + + // for(hParam &par : SYS.dragged) { + // std::cout << "DraggedParam( h:" << par.v << " )\n"; + // } + + // for(Param &par : SYS.param) { + // std::cout << "SysParam( " << par.ToString() << " )\n"; + // } + + // for(EntityBase &ent : SK.entity) { + // std::cout << "SketchEntityBase( " << ent.ToString() << " )\n"; + // } + + // for(ConstraintBase &con : SK.constraint) { + // std::cout << "SketchConstraintBase( " << con.ToString() << " )\n"; + // } + + List badList; + bool andFindBad = bad != nullptr; + + int dof = 0; + SolveResult status = SYS.Solve(&g, &dof, &badList, andFindBad, false, false); + Slvs_SolveResult sr = {}; + sr.dof = dof; + sr.nbad = badList.n; + if(bad) { + if(sr.nbad <= 0) { + *bad = nullptr; + } else { + *bad = static_cast(malloc(sizeof(Slvs_hConstraint) * sr.nbad)); + for(int i = 0; i < sr.nbad; ++i) { + (*bad)[i] = badList[i].v; + } + } + } + sr.result = 0; + switch(status) { + case SolveResult::OKAY: { + sr.result = SLVS_RESULT_OKAY; + return sr; + } + case SolveResult::DIDNT_CONVERGE: { + sr.result = SLVS_RESULT_DIDNT_CONVERGE; + return sr; + } + case SolveResult::REDUNDANT_DIDNT_CONVERGE: { + sr.result = SLVS_RESULT_INCONSISTENT; + return sr; + } + case SolveResult::REDUNDANT_OKAY: { + sr.result = SLVS_RESULT_REDUNDANT_OKAY; + return sr; + } + case SolveResult::TOO_MANY_UNKNOWNS: { + sr.result = SLVS_RESULT_TOO_MANY_UNKNOWNS; + return sr; + } + } + return sr; +} + +double Slvs_GetParamValue(uint32_t ph) +{ + Param* p = SK.param.FindById(hParam { ph }); + return p->val; +} + +void Slvs_SetParamValue(uint32_t ph, double value) +{ + Param* p = SK.param.FindById(hParam { ph }); + p->val = value; +} + +void Slvs_Solve(Slvs_System *ssys, uint32_t shg) +{ + SYS.Clear(); + SK.param.Clear(); + SK.entity.Clear(); + SK.constraint.Clear(); + int i; + for(i = 0; i < ssys->params; i++) { + Slvs_Param *sp = &(ssys->param[i]); + Param p = {}; + + p.h.v = sp->h; + p.val = sp->val; + SK.param.Add(&p); + if(sp->group == shg) { + SYS.param.Add(&p); + } + } + + for(i = 0; i < ssys->entities; i++) { + Slvs_Entity *se = &(ssys->entity[i]); + EntityBase e = {}; + e.type = Slvs_CTypeToEntityBaseType(se->type); + e.h.v = se->h; + e.group.v = se->group; + e.workplane.v = se->wrkpl; + e.point[0].v = se->point[0]; + e.point[1].v = se->point[1]; + e.point[2].v = se->point[2]; + e.point[3].v = se->point[3]; + e.normal.v = se->normal; + e.distance.v = se->distance; + e.param[0].v = se->param[0]; + e.param[1].v = se->param[1]; + e.param[2].v = se->param[2]; + e.param[3].v = se->param[3]; + + SK.entity.Add(&e); + } + ParamList params = {}; + for(i = 0; i < ssys->constraints; i++) { + Slvs_Constraint *sc = &(ssys->constraint[i]); + ConstraintBase c = {}; + c.type = Slvs_CTypeToConstraintBaseType(sc->type); + c.h.v = sc->h; + c.group.v = sc->group; + c.workplane.v = sc->wrkpl; + c.valA = sc->valA; + c.ptA.v = sc->ptA; + c.ptB.v = sc->ptB; + c.entityA.v = sc->entityA; + c.entityB.v = sc->entityB; + c.entityC.v = sc->entityC; + c.entityD.v = sc->entityD; + c.other = (sc->other) ? true : false; + c.other2 = (sc->other2) ? true : false; + + c.Generate(¶ms); + if(!params.IsEmpty()) { + for(Param &p : params) { + p.h = SK.param.AddAndAssignId(&p); + c.valP = p.h; + SYS.param.Add(&p); + } + params.Clear(); + + if(Slvs_CanInitiallySatisfy(c)) { + c.ModifyToSatisfy(); + } + } + + SK.constraint.Add(&c); + } + + for(i = 0; i < ssys->ndragged; i++) { + if(ssys->dragged[i]) { + hParam hp = { ssys->dragged[i] }; + SYS.dragged.insert(hp); + } + } + + Group g = {}; + g.h.v = shg; + + List bad = {}; + + // Now we're finally ready to solve! + bool andFindBad = ssys->calculateFaileds ? true : false; + SolveResult how = SYS.Solve(&g, &(ssys->dof), &bad, andFindBad, /*andFindFree=*/false); + + switch(how) { + case SolveResult::OKAY: + ssys->result = SLVS_RESULT_OKAY; + break; + + case SolveResult::DIDNT_CONVERGE: + ssys->result = SLVS_RESULT_DIDNT_CONVERGE; + break; + + case SolveResult::REDUNDANT_DIDNT_CONVERGE: + ssys->result = SLVS_RESULT_INCONSISTENT; + break; + + case SolveResult::REDUNDANT_OKAY: + ssys->result = SLVS_RESULT_REDUNDANT_OKAY; + break; + + case SolveResult::TOO_MANY_UNKNOWNS: + ssys->result = SLVS_RESULT_TOO_MANY_UNKNOWNS; + break; + } + + // Write the new parameter values back to our caller. + for(i = 0; i < ssys->params; i++) { + Slvs_Param *sp = &(ssys->param[i]); + hParam hp = { sp->h }; + sp->val = SK.GetParam(hp)->val; + } + + if(ssys->failed) { + // Copy over any the list of problematic constraints. + for(i = 0; i < ssys->faileds && i < bad.n; i++) { + ssys->failed[i] = bad[i].v; + } + ssys->faileds = bad.n; + } + + bad.Clear(); + SYS.Clear(); + SK.param.Clear(); + SK.entity.Clear(); + SK.constraint.Clear(); + + Platform::FreeAllTemporary(); +} + +} /* extern "C" */ diff --git a/src/slvs/lib.pyx b/src/slvs/lib.pyx new file mode 100644 index 0000000..84e1b02 --- /dev/null +++ b/src/slvs/lib.pyx @@ -0,0 +1,391 @@ +#cython: language_level=3 +from enum import IntEnum, auto +from libc.stdint cimport uint32_t +from libc.stdlib cimport free + +cdef extern from "slvs.h" nogil: + ctypedef uint32_t Slvs_hEntity + ctypedef uint32_t Slvs_hGroup + ctypedef uint32_t Slvs_hConstraint + ctypedef uint32_t Slvs_hParam + + ctypedef struct Slvs_Entity: + Slvs_hEntity h + Slvs_hGroup group + int type + Slvs_hEntity wrkpl + Slvs_hEntity point[4] + Slvs_hEntity normal + Slvs_hEntity distance + Slvs_hParam param[4] + + ctypedef struct Slvs_Constraint: + Slvs_hConstraint h + Slvs_hGroup group + int type + Slvs_hEntity wrkpl + double valA + Slvs_hEntity ptA + Slvs_hEntity ptB + Slvs_hEntity entityA + Slvs_hEntity entityB + Slvs_hEntity entityC + Slvs_hEntity entityD + int other + int other2 + + ctypedef struct Slvs_SolveResult: + int result + int dof + int nbad + + void Slvs_QuaternionU(double qw, double qx, double qy, double qz, + double *x, double *y, double *z) + void Slvs_QuaternionV(double qw, double qx, double qy, double qz, + double *x, double *y, double *z) + void Slvs_QuaternionN(double qw, double qx, double qy, double qz, + double *x, double *y, double *z) + + void Slvs_MakeQuaternion(double ux, double uy, double uz, + double vx, double vy, double vz, + double *qw, double *qx, double *qy, double *qz) + + Slvs_Entity Slvs_AddPoint2D(Slvs_hGroup grouph, double u, double v, Slvs_Entity workplane) + Slvs_Entity Slvs_AddPoint3D(Slvs_hGroup grouph, double x, double y, double z) + Slvs_Entity Slvs_AddNormal2D(Slvs_hGroup grouph, Slvs_Entity workplane) + Slvs_Entity Slvs_AddNormal3D(Slvs_hGroup grouph, double qw, double qx, double qy, double qz) + Slvs_Entity Slvs_AddDistance(Slvs_hGroup grouph, double value, Slvs_Entity workplane) + Slvs_Entity Slvs_AddLine2D(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) + Slvs_Entity Slvs_AddLine3D(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB) + Slvs_Entity Slvs_AddCubic(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity ptC, Slvs_Entity ptD, Slvs_Entity workplane) + Slvs_Entity Slvs_AddArc(Slvs_hGroup grouph, Slvs_Entity normal, Slvs_Entity center, Slvs_Entity start, Slvs_Entity end, Slvs_Entity workplane) + Slvs_Entity Slvs_AddCircle(Slvs_hGroup grouph, Slvs_Entity normal, Slvs_Entity center, Slvs_Entity radius, Slvs_Entity workplane) + Slvs_Entity Slvs_AddWorkplane(Slvs_hGroup grouph, Slvs_Entity origin, Slvs_Entity nm) + Slvs_Entity Slvs_AddBase2D(Slvs_hGroup grouph) + + Slvs_Constraint Slvs_AddConstraint(Slvs_hGroup grouph, int type, Slvs_Entity workplane, double val, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, Slvs_Entity entityD, int other, int other2) + Slvs_Constraint Slvs_Coincident(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane) + Slvs_Constraint Slvs_Distance(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane) + Slvs_Constraint Slvs_Equal(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane) + Slvs_Constraint Slvs_EqualAngle(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, Slvs_Entity entityD, Slvs_Entity workplane) + Slvs_Constraint Slvs_EqualPointToLine(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, Slvs_Entity entityD, Slvs_Entity workplane) + Slvs_Constraint Slvs_Ratio(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane) + Slvs_Constraint Slvs_Symmetric(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity entityC, Slvs_Entity workplane) + Slvs_Constraint Slvs_SymmetricH(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) + Slvs_Constraint Slvs_SymmetricV(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) + Slvs_Constraint Slvs_Midpoint(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB, Slvs_Entity workplane) + Slvs_Constraint Slvs_Horizontal(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity workplane, Slvs_Entity entityB) + Slvs_Constraint Slvs_Vertical(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity workplane, Slvs_Entity entityB) + Slvs_Constraint Slvs_Diameter(Slvs_hGroup grouph, Slvs_Entity entityA, double value) + Slvs_Constraint Slvs_SameOrientation(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB) + Slvs_Constraint Slvs_Angle(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane, int inverse) + Slvs_Constraint Slvs_Perpendicular(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane, int inverse) + Slvs_Constraint Slvs_Parallel(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane) + Slvs_Constraint Slvs_Tangent(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, Slvs_Entity workplane) + Slvs_Constraint Slvs_DistanceProj(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity ptB, double value) + Slvs_Constraint Slvs_LengthDiff(Slvs_hGroup grouph, Slvs_Entity entityA, Slvs_Entity entityB, double value, Slvs_Entity workplane) + Slvs_Constraint Slvs_Dragged(Slvs_hGroup grouph, Slvs_Entity ptA, Slvs_Entity workplane) + + void Slvs_MarkDragged(Slvs_Entity ptA) + Slvs_SolveResult Slvs_SolveSketch(Slvs_hGroup hg, Slvs_hConstraint **bad) nogil + double Slvs_GetParamValue(int ph) + double Slvs_SetParamValue(int ph, double value) + void Slvs_ClearSketch() + + cdef Slvs_Entity _E_NONE "SLVS_E_NONE" + cdef Slvs_Entity _E_FREE_IN_3D "SLVS_E_FREE_IN_3D" + + cdef int _SLVS_C_POINTS_COINCIDENT "SLVS_C_POINTS_COINCIDENT" + cdef int _SLVS_C_PT_PT_DISTANCE "SLVS_C_PT_PT_DISTANCE" + cdef int _SLVS_C_PT_PLANE_DISTANCE "SLVS_C_PT_PLANE_DISTANCE" + cdef int _SLVS_C_PT_LINE_DISTANCE "SLVS_C_PT_LINE_DISTANCE" + cdef int _SLVS_C_PT_FACE_DISTANCE "SLVS_C_PT_FACE_DISTANCE" + cdef int _SLVS_C_PT_IN_PLANE "SLVS_C_PT_IN_PLANE" + cdef int _SLVS_C_PT_ON_LINE "SLVS_C_PT_ON_LINE" + cdef int _SLVS_C_PT_ON_FACE "SLVS_C_PT_ON_FACE" + cdef int _SLVS_C_EQUAL_LENGTH_LINES "SLVS_C_EQUAL_LENGTH_LINES" + cdef int _SLVS_C_LENGTH_RATIO "SLVS_C_LENGTH_RATIO" + cdef int _SLVS_C_EQ_LEN_PT_LINE_D "SLVS_C_EQ_LEN_PT_LINE_D" + cdef int _SLVS_C_EQ_PT_LN_DISTANCES "SLVS_C_EQ_PT_LN_DISTANCES" + cdef int _SLVS_C_EQUAL_ANGLE "SLVS_C_EQUAL_ANGLE" + cdef int _SLVS_C_EQUAL_LINE_ARC_LEN "SLVS_C_EQUAL_LINE_ARC_LEN" + cdef int _SLVS_C_SYMMETRIC "SLVS_C_SYMMETRIC" + cdef int _SLVS_C_SYMMETRIC_HORIZ "SLVS_C_SYMMETRIC_HORIZ" + cdef int _SLVS_C_SYMMETRIC_VERT "SLVS_C_SYMMETRIC_VERT" + cdef int _SLVS_C_SYMMETRIC_LINE "SLVS_C_SYMMETRIC_LINE" + cdef int _SLVS_C_AT_MIDPOINT "SLVS_C_AT_MIDPOINT" + cdef int _SLVS_C_HORIZONTAL "SLVS_C_HORIZONTAL" + cdef int _SLVS_C_VERTICAL "SLVS_C_VERTICAL" + cdef int _SLVS_C_DIAMETER "SLVS_C_DIAMETER" + cdef int _SLVS_C_PT_ON_CIRCLE "SLVS_C_PT_ON_CIRCLE" + cdef int _SLVS_C_SAME_ORIENTATION "SLVS_C_SAME_ORIENTATION" + cdef int _SLVS_C_ANGLE "SLVS_C_ANGLE" + cdef int _SLVS_C_PARALLEL "SLVS_C_PARALLEL" + cdef int _SLVS_C_PERPENDICULAR "SLVS_C_PERPENDICULAR" + cdef int _SLVS_C_ARC_LINE_TANGENT "SLVS_C_ARC_LINE_TANGENT" + cdef int _SLVS_C_CUBIC_LINE_TANGENT "SLVS_C_CUBIC_LINE_TANGENT" + cdef int _SLVS_C_EQUAL_RADIUS "SLVS_C_EQUAL_RADIUS" + cdef int _SLVS_C_PROJ_PT_DISTANCE "SLVS_C_PROJ_PT_DISTANCE" + cdef int _SLVS_C_WHERE_DRAGGED "SLVS_C_WHERE_DRAGGED" + cdef int _SLVS_C_CURVE_CURVE_TANGENT "SLVS_C_CURVE_CURVE_TANGENT" + cdef int _SLVS_C_LENGTH_DIFFERENCE "SLVS_C_LENGTH_DIFFERENCE" + cdef int _SLVS_C_ARC_ARC_LEN_RATIO "SLVS_C_ARC_ARC_LEN_RATIO" + cdef int _SLVS_C_ARC_LINE_LEN_RATIO "SLVS_C_ARC_LINE_LEN_RATIO" + cdef int _SLVS_C_ARC_ARC_DIFFERENCE "SLVS_C_ARC_ARC_DIFFERENCE" + cdef int _SLVS_C_ARC_LINE_DIFFERENCE "SLVS_C_ARC_LINE_DIFFERENCE" + + cdef int _SLVS_E_POINT_IN_3D "SLVS_E_POINT_IN_3D" + cdef int _SLVS_E_POINT_IN_2D "SLVS_E_POINT_IN_2D" + cdef int _SLVS_E_NORMAL_IN_3D "SLVS_E_NORMAL_IN_3D" + cdef int _SLVS_E_NORMAL_IN_2D "SLVS_E_NORMAL_IN_2D" + cdef int _SLVS_E_DISTANCE "SLVS_E_DISTANCE" + cdef int _SLVS_E_WORKPLANE "SLVS_E_WORKPLANE" + cdef int _SLVS_E_LINE_SEGMENT "SLVS_E_LINE_SEGMENT" + cdef int _SLVS_E_CUBIC "SLVS_E_CUBIC" + cdef int _SLVS_E_CIRCLE "SLVS_E_CIRCLE" + cdef int _SLVS_E_ARC_OF_CIRCLE "SLVS_E_ARC_OF_CIRCLE" + + cdef int _SLVS_RESULT_OKAY "SLVS_RESULT_OKAY" + cdef int _SLVS_RESULT_INCONSISTENT "SLVS_RESULT_INCONSISTENT" + cdef int _SLVS_RESULT_DIDNT_CONVERGE "SLVS_RESULT_DIDNT_CONVERGE" + cdef int _SLVS_RESULT_TOO_MANY_UNKNOWNS "SLVS_RESULT_TOO_MANY_UNKNOWNS" + cdef int _SLVS_RESULT_REDUNDANT_OKAY "SLVS_RESULT_REDUNDANT_OKAY" + +E_NONE = _E_NONE +E_FREE_IN_3D = _E_FREE_IN_3D + +# quaternion +cpdef tuple quaternion_u(double qw, double qx, double qy, double qz): + """Input quaternion, return unit vector of U axis. + Where `qw`, `qx`, `qy`, `qz` are corresponded to the W, X, Y, Z value of + quaternion. + """ + cdef double x, y, z + Slvs_QuaternionU(qw, qx, qy, qz, &x, &y, &z) + return x, y, z + + +cpdef tuple quaternion_v(double qw, double qx, double qy, double qz): + """Input quaternion, return unit vector of V axis. + Signature is same as [quaternion_u](#quaternion_u). + """ + cdef double x, y, z + Slvs_QuaternionV(qw, qx, qy, qz, &x, &y, &z) + return x, y, z + + +cpdef tuple quaternion_n(double qw, double qx, double qy, double qz): + """Input quaternion, return unit vector of normal. + Signature is same as [quaternion_u](#quaternion_u). + """ + cdef double x, y, z + Slvs_QuaternionN(qw, qx, qy, qz, &x, &y, &z) + return x, y, z + + +cpdef tuple make_quaternion(double ux, double uy, double uz, double vx, double vy, double vz): + """Input two unit vector, return quaternion. + Where `ux`, `uy`, `uz` are corresponded to the value of U vector; + `vx`, `vy`, `vz` are corresponded to the value of V vector. + """ + cdef double qw, qx, qy, qz + Slvs_MakeQuaternion(ux, uy, uz, vx, vy, vz, &qw, &qx, &qy, &qz) + return qw, qx, qy, qz + +# entities +def add_point_2d(grouph: int, u: float, v: float, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddPoint2D(grouph, u, v, workplane) + +def add_point_3d(grouph: int, x: float, y: float, z: float) -> Slvs_Entity: + return Slvs_AddPoint3D(grouph, x, y, z) + +def add_normal_2d(grouph: int, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddNormal2D(grouph, workplane) + +def add_normal_3d(grouph: int, qw: float, qx: float, qy: float, qz: float) -> Slvs_Entity: + return Slvs_AddNormal3D(grouph, qw, qx, qy, qz) + +def add_distance(grouph: int, value: float, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddDistance(grouph, value, workplane) + +def add_line_2d(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddLine2D(grouph, ptA, ptB, workplane) + +def add_line_3d(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddLine3D(grouph, ptA, ptB) + +def add_cubic(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity, ptC: Slvs_Entity, ptD: Slvs_Entity, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddCubic(grouph, ptA, ptB, ptC, ptD, workplane) + +def add_arc(grouph: int, normal: Slvs_Entity, center: Slvs_Entity, start: Slvs_Entity, end: Slvs_Entity, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddArc(grouph, normal, center, start, end, workplane) + +def add_circle(grouph: int, normal: Slvs_Entity, center: Slvs_Entity, radius: Slvs_Entity, workplane: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddCircle(grouph, normal, center, radius, workplane) + +def add_workplane(grouph: int, origin: Slvs_Entity, nm: Slvs_Entity) -> Slvs_Entity: + return Slvs_AddWorkplane(grouph, origin, nm) + +def add_base_2d(grouph: int) -> Slvs_Entity: + return Slvs_AddBase2D(grouph) + +# constraints +def add_constraint(grouph: int, c_type: int, workplane: Slvs_Entity, val: float, ptA: Slvs_Entity = E_NONE, + ptB: Slvs_Entity = E_NONE, entityA: Slvs_Entity = E_NONE, + entityB: Slvs_Entity = E_NONE, entityC: Slvs_Entity = E_NONE, + entityD: Slvs_Entity = E_NONE, other: int = 0, other2: int = 0) -> Slvs_Constraint: + return Slvs_AddConstraint(grouph, c_type, workplane, val, ptA, ptB, entityA, entityB, entityC, entityD, other, other2) + +def coincident(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Coincident(grouph, entityA, entityB, workplane) + +def distance(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, value: float, workplane: Slvs_Entity) -> Slvs_Constraint: + return Slvs_Distance(grouph, entityA, entityB, value, workplane) + +def equal(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Equal(grouph, entityA, entityB, workplane) + +def equal_angle(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, entityC: Slvs_Entity, + entityD: Slvs_Entity, + workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_EqualAngle(grouph, entityA, entityB, entityC, entityD, workplane) + +def equal_point_to_line(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, + entityC: Slvs_Entity, entityD: Slvs_Entity, + workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_EqualPointToLine(grouph, entityA, entityB, entityC, entityD, workplane) + +def ratio(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, value: float, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Ratio(grouph, entityA, entityB, value, workplane) + +def symmetric(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, entityC: Slvs_Entity = E_NONE, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Symmetric(grouph, entityA, entityB, entityC, workplane) + +def symmetric_h(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_SymmetricH(grouph, ptA, ptB, workplane) + +def symmetric_v(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_SymmetricV(grouph, ptA, ptB, workplane) + +def midpoint(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Midpoint(grouph, ptA, ptB, workplane) + +def horizontal(grouph: int, entityA: Slvs_Entity, workplane: Slvs_Entity, entityB: Slvs_Entity = E_NONE) -> Slvs_Constraint: + return Slvs_Horizontal(grouph, entityA, workplane, entityB) + +def vertical(grouph: int, entityA: Slvs_Entity, workplane: Slvs_Entity, entityB: Slvs_Entity = E_NONE) -> Slvs_Constraint: + return Slvs_Vertical(grouph, entityA, workplane, entityB) + +def diameter(grouph: int, entityA: Slvs_Entity, value: float) -> Slvs_Constraint: + return Slvs_Diameter(grouph, entityA, value) + +def same_orientation(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity) -> Slvs_Constraint: + return Slvs_SameOrientation(grouph, entityA, entityB) + +def angle(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, value: float, workplane: Slvs_Entity = E_FREE_IN_3D, inverse: bool = False) -> Slvs_Constraint: + return Slvs_Angle(grouph, entityA, entityB, value, workplane, inverse) + +def perpendicular(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D, inverse: bool = False) -> Slvs_Constraint: + return Slvs_Perpendicular(grouph, entityA, entityB, workplane, inverse) + +def parallel(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Parallel(grouph, entityA, entityB, workplane) + +def tangent(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Tangent(grouph, entityA, entityB, workplane) + +def distance_proj(grouph: int, ptA: Slvs_Entity, ptB: Slvs_Entity, value: float) -> Slvs_Constraint: + return Slvs_DistanceProj(grouph, ptA, ptB, value) + +def length_diff(grouph: int, entityA: Slvs_Entity, entityB: Slvs_Entity, value: float, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_LengthDiff(grouph, entityA, entityB, value, workplane) + +def dragged(grouph: int, ptA: Slvs_Entity, workplane: Slvs_Entity = E_FREE_IN_3D) -> Slvs_Constraint: + return Slvs_Dragged(grouph, ptA, workplane) + +# solver +class ResultFlag(IntEnum): + """Symbol of the result flags.""" + OKAY = _SLVS_RESULT_OKAY + INCONSISTENT = _SLVS_RESULT_INCONSISTENT + DIDNT_CONVERGE = _SLVS_RESULT_DIDNT_CONVERGE + TOO_MANY_UNKNOWNS = _SLVS_RESULT_TOO_MANY_UNKNOWNS + REDUNDANT_OKAY = _SLVS_RESULT_REDUNDANT_OKAY + +class ConstraintType(IntEnum): + """Symbol of the constraint types.""" + POINTS_COINCIDENT = _SLVS_C_POINTS_COINCIDENT + PT_PT_DISTANCE = _SLVS_C_PT_PT_DISTANCE + PT_PLANE_DISTANCE = _SLVS_C_PT_PLANE_DISTANCE + PT_LINE_DISTANCE = _SLVS_C_PT_LINE_DISTANCE + PT_FACE_DISTANCE = _SLVS_C_PT_FACE_DISTANCE + PT_IN_PLANE = _SLVS_C_PT_IN_PLANE + PT_ON_LINE = _SLVS_C_PT_ON_LINE + PT_ON_FACE = _SLVS_C_PT_ON_FACE + EQUAL_LENGTH_LINES = _SLVS_C_EQUAL_LENGTH_LINES + LENGTH_RATIO = _SLVS_C_LENGTH_RATIO + EQ_LEN_PT_LINE_D = _SLVS_C_EQ_LEN_PT_LINE_D + EQ_PT_LN_DISTANCES = _SLVS_C_EQ_PT_LN_DISTANCES + EQUAL_ANGLE = _SLVS_C_EQUAL_ANGLE + EQUAL_LINE_ARC_LEN = _SLVS_C_EQUAL_LINE_ARC_LEN + SYMMETRIC = _SLVS_C_SYMMETRIC + SYMMETRIC_HORIZ = _SLVS_C_SYMMETRIC_HORIZ + SYMMETRIC_VERT = _SLVS_C_SYMMETRIC_VERT + SYMMETRIC_LINE = _SLVS_C_SYMMETRIC_LINE + AT_MIDPOINT = _SLVS_C_AT_MIDPOINT + HORIZONTAL = _SLVS_C_HORIZONTAL + VERTICAL = _SLVS_C_VERTICAL + DIAMETER = _SLVS_C_DIAMETER + PT_ON_CIRCLE = _SLVS_C_PT_ON_CIRCLE + SAME_ORIENTATION = _SLVS_C_SAME_ORIENTATION + ANGLE = _SLVS_C_ANGLE + PARALLEL = _SLVS_C_PARALLEL + PERPENDICULAR = _SLVS_C_PERPENDICULAR + ARC_LINE_TANGENT = _SLVS_C_ARC_LINE_TANGENT + CUBIC_LINE_TANGENT = _SLVS_C_CUBIC_LINE_TANGENT + EQUAL_RADIUS = _SLVS_C_EQUAL_RADIUS + PROJ_PT_DISTANCE = _SLVS_C_PROJ_PT_DISTANCE + WHERE_DRAGGED = _SLVS_C_WHERE_DRAGGED + CURVE_CURVE_TANGENT = _SLVS_C_CURVE_CURVE_TANGENT + LENGTH_DIFFERENCE = _SLVS_C_LENGTH_DIFFERENCE + ARC_ARC_LEN_RATIO = _SLVS_C_ARC_ARC_LEN_RATIO + ARC_LINE_LEN_RATIO = _SLVS_C_ARC_LINE_LEN_RATIO + ARC_ARC_DIFFERENCE = _SLVS_C_ARC_ARC_DIFFERENCE + ARC_LINE_DIFFERENCE = _SLVS_C_ARC_LINE_DIFFERENCE + +class EntityType(IntEnum): + POINT_IN_3D = _SLVS_E_POINT_IN_3D + POINT_IN_2D = _SLVS_E_POINT_IN_2D + NORMAL_IN_3D = _SLVS_E_NORMAL_IN_3D + NORMAL_IN_2D = _SLVS_E_NORMAL_IN_2D + DISTANCE = _SLVS_E_DISTANCE + WORKPLANE = _SLVS_E_WORKPLANE + LINE_SEGMENT = _SLVS_E_LINE_SEGMENT + CUBIC = _SLVS_E_CUBIC + CIRCLE = _SLVS_E_CIRCLE + ARC_OF_CIRCLE = _SLVS_E_ARC_OF_CIRCLE + +def mark_dragged(ptA: Slvs_Entity): + Slvs_MarkDragged(ptA) + +def solve_sketch(grouph: int, calculateFaileds: bool): + cdef Slvs_hConstraint *badp = NULL + if not calculateFaileds: + return Slvs_SolveSketch(grouph, NULL) + else: + result = Slvs_SolveSketch(grouph, &badp) + bad = [] + if badp != NULL: + for i in range(0, result.nbad): + bad.append(badp[i]) + free(badp) + return result, bad + +def get_param_value(ph: int): + return Slvs_GetParamValue(ph) + +def set_param_value(ph: int, value: float): + Slvs_SetParamValue(ph, value) + +def clear_sketch(): + Slvs_ClearSketch() diff --git a/src/solvespace.cpp b/src/solvespace.cpp new file mode 100644 index 0000000..887dcbe --- /dev/null +++ b/src/solvespace.cpp @@ -0,0 +1,1236 @@ +//----------------------------------------------------------------------------- +// Entry point in to the program, our registry-stored settings and top-level +// housekeeping when we open, save, and create new files. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" +#include "config.h" + +namespace SolveSpace { + +SolveSpaceUI SS = {}; +Sketch SK = {}; + +void SolveSpaceUI::Init() { +#if !defined(HEADLESS) + // Check that the resource system works. + dbp("%s", LoadString("banner.txt").data()); +#endif + + Platform::SettingsRef settings = Platform::GetSettings(); + + SS.tangentArcRadius = 10.0; + SS.explodeDistance = 1.0; + + // Then, load the registry settings. + // Default list of colors for the model material + modelColor[0] = settings->ThawColor("ModelColor_0", RGBi(150, 150, 150)); + modelColor[1] = settings->ThawColor("ModelColor_1", RGBi(100, 100, 100)); + modelColor[2] = settings->ThawColor("ModelColor_2", RGBi( 30, 30, 30)); + modelColor[3] = settings->ThawColor("ModelColor_3", RGBi(150, 0, 0)); + modelColor[4] = settings->ThawColor("ModelColor_4", RGBi( 0, 100, 0)); + modelColor[5] = settings->ThawColor("ModelColor_5", RGBi( 0, 80, 80)); + modelColor[6] = settings->ThawColor("ModelColor_6", RGBi( 0, 0, 130)); + modelColor[7] = settings->ThawColor("ModelColor_7", RGBi( 80, 0, 80)); + // Light intensities + lightIntensity[0] = settings->ThawFloat("LightIntensity_0", 1.0); + lightIntensity[1] = settings->ThawFloat("LightIntensity_1", 0.5); + ambientIntensity = settings->ThawFloat("Light_Ambient", 0.3); + // Light positions + lightDir[0].x = settings->ThawFloat("LightDir_0_Right", -1.0); + lightDir[0].y = settings->ThawFloat("LightDir_0_Up", 1.0); + lightDir[0].z = settings->ThawFloat("LightDir_0_Forward", 0.0); + lightDir[1].x = settings->ThawFloat("LightDir_1_Right", 1.0); + lightDir[1].y = settings->ThawFloat("LightDir_1_Up", 0.0); + lightDir[1].z = settings->ThawFloat("LightDir_1_Forward", 0.0); + + exportMode = false; + // Chord tolerance + chordTol = settings->ThawFloat("ChordTolerancePct", 0.1); + // Max pwl segments to generate + maxSegments = settings->ThawInt("MaxSegments", 20); + // Chord tolerance + exportChordTol = settings->ThawFloat("ExportChordTolerance", 0.1); + // Max pwl segments to generate + exportMaxSegments = settings->ThawInt("ExportMaxSegments", 64); + // Timeout value for finding redundant constrains (ms) + timeoutRedundantConstr = settings->ThawInt("TimeoutRedundantConstraints", 1000); + // Animation speed calculation base time (ms) + animationSpeed = settings->ThawInt("AnimationSpeed", 800); + // View units + viewUnits = (Unit)settings->ThawInt("ViewUnits", (uint32_t)Unit::MM); + // Number of digits after the decimal point + afterDecimalMm = settings->ThawInt("AfterDecimalMm", 2); + afterDecimalInch = settings->ThawInt("AfterDecimalInch", 3); + afterDecimalDegree = settings->ThawInt("AfterDecimalDegree", 2); + useSIPrefixes = settings->ThawBool("UseSIPrefixes", false); + // Camera tangent (determines perspective) + cameraTangent = settings->ThawFloat("CameraTangent", 0.3f/1e3); + // Grid spacing + gridSpacing = settings->ThawFloat("GridSpacing", 5.0); + // Export scale factor + exportScale = settings->ThawFloat("ExportScale", 1.0); + // Export offset (cutter radius comp) + exportOffset = settings->ThawFloat("ExportOffset", 0.0); + // Dimensions on arcs default to diameter vs radius + arcDimDefaultDiameter = settings->ThawBool("ArcDimDefaultDiameter", false); + // Show full file path in the menu bar + showFullFilePath = settings->ThawBool("ShowFullFilePath", true); + // Rewrite exported colors close to white into black (assuming white bg) + fixExportColors = settings->ThawBool("FixExportColors", true); + // Export background color + exportBackgroundColor = settings->ThawBool("ExportBackgroundColor", false); + // Draw back faces of triangles (when mesh is leaky/self-intersecting) + drawBackFaces = settings->ThawBool("DrawBackFaces", true); + // Use camera mouse navigation + cameraNav = settings->ThawBool("CameraNav", false); + // Use turntable mouse navigation + turntableNav = settings->ThawBool("TurntableNav", false); + // Immediately edit dimension + immediatelyEditDimension = settings->ThawBool("ImmediatelyEditDimension", true); + // Check that contours are closed and not self-intersecting + checkClosedContour = settings->ThawBool("CheckClosedContour", true); + // Enable automatic constrains for lines + automaticLineConstraints = settings->ThawBool("AutomaticLineConstraints", true); + // Draw closed polygons areas + showContourAreas = settings->ThawBool("ShowContourAreas", false); + // Export shaded triangles in a 2d view + exportShadedTriangles = settings->ThawBool("ExportShadedTriangles", true); + // Export pwl curves (instead of exact) always + exportPwlCurves = settings->ThawBool("ExportPwlCurves", false); + // Background color on-screen + backgroundColor = settings->ThawColor("BackgroundColor", RGBi(0, 0, 0)); + // Whether export canvas size is fixed or derived from bbox + exportCanvasSizeAuto = settings->ThawBool("ExportCanvasSizeAuto", true); + // Margins for automatic canvas size + exportMargin.left = settings->ThawFloat("ExportMargin_Left", 5.0); + exportMargin.right = settings->ThawFloat("ExportMargin_Right", 5.0); + exportMargin.bottom = settings->ThawFloat("ExportMargin_Bottom", 5.0); + exportMargin.top = settings->ThawFloat("ExportMargin_Top", 5.0); + // Dimensions for fixed canvas size + exportCanvas.width = settings->ThawFloat("ExportCanvas_Width", 100.0); + exportCanvas.height = settings->ThawFloat("ExportCanvas_Height", 100.0); + exportCanvas.dx = settings->ThawFloat("ExportCanvas_Dx", 5.0); + exportCanvas.dy = settings->ThawFloat("ExportCanvas_Dy", 5.0); + // Extra parameters when exporting G code + gCode.depth = settings->ThawFloat("GCode_Depth", 10.0); + gCode.safeHeight = settings->ThawFloat("GCode_SafeHeight", 5.0); + gCode.passes = settings->ThawInt("GCode_Passes", 1); + gCode.feed = settings->ThawFloat("GCode_Feed", 10.0); + gCode.plungeFeed = settings->ThawFloat("GCode_PlungeFeed", 10.0); + // Show toolbar in the graphics window + showToolbar = settings->ThawBool("ShowToolbar", true); + // Recent files menus + for(size_t i = 0; i < MAX_RECENT; i++) { + std::string rawPath = settings->ThawString("RecentFile_" + std::to_string(i), ""); + if(rawPath.empty()) continue; + recentFiles.push_back(Platform::Path::From(rawPath)); + } + // Autosave timer + autosaveInterval = settings->ThawInt("AutosaveInterval", 5); + // Locale + std::string locale = settings->ThawString("Locale", ""); + if(!locale.empty()) { + SetLocale(locale); + } + + refreshTimer = Platform::CreateTimer(); + refreshTimer->onTimeout = std::bind(&SolveSpaceUI::Refresh, &SS); + + autosaveTimer = Platform::CreateTimer(); + autosaveTimer->onTimeout = std::bind(&SolveSpaceUI::Autosave, &SS); + + // The default styles (colors, line widths, etc.) are also stored in the + // configuration file, but we will automatically load those as we need + // them. + + ScheduleAutosave(); + + NewFile(); + AfterNewFile(); + + if(TW.window && GW.window) { + TW.window->ThawPosition(settings, "TextWindow"); + GW.window->ThawPosition(settings, "GraphicsWindow"); + TW.window->SetVisible(true); + GW.window->SetVisible(true); + GW.window->Focus(); + + // Do this once the window is created. + Request3DConnexionEventsForWindow(GW.window); + } +} + +bool SolveSpaceUI::LoadAutosaveFor(const Platform::Path &filename) { + Platform::Path autosaveFile = filename.WithExtension(BACKUP_EXT); + + FILE *f = OpenFile(autosaveFile, "rb"); + if(!f) + return false; + fclose(f); + + Platform::MessageDialogRef dialog = CreateMessageDialog(GW.window); + + using Platform::MessageDialog; + dialog->SetType(MessageDialog::Type::QUESTION); + dialog->SetTitle(C_("title", "Autosave Available")); + dialog->SetMessage(C_("dialog", "An autosave file is available for this sketch.")); + dialog->SetDescription(C_("dialog", "Do you want to load the autosave file instead?")); + dialog->AddButton(C_("button", "&Load autosave"), MessageDialog::Response::YES, + /*isDefault=*/true); + dialog->AddButton(C_("button", "Do&n't Load"), MessageDialog::Response::NO); + + // FIXME(async): asyncify this call + if(dialog->RunModal() == MessageDialog::Response::YES) { + unsaved = true; + return LoadFromFile(autosaveFile, /*canCancel=*/true); + } + + return false; +} + +bool SolveSpaceUI::Load(const Platform::Path &filename) { + bool autosaveLoaded = LoadAutosaveFor(filename); + bool fileLoaded = autosaveLoaded || LoadFromFile(filename, /*canCancel=*/true); + if(fileLoaded) { + saveFile = filename; + AddToRecentList(filename); + } else { + saveFile.Clear(); + NewFile(); + } + AfterNewFile(); + unsaved = autosaveLoaded; + return fileLoaded; +} + +void SolveSpaceUI::Exit() { + Platform::SettingsRef settings = Platform::GetSettings(); + + GW.window->FreezePosition(settings, "GraphicsWindow"); + TW.window->FreezePosition(settings, "TextWindow"); + + // Recent files + for(size_t i = 0; i < MAX_RECENT; i++) { + std::string rawPath; + if(recentFiles.size() > i) { + rawPath = recentFiles[i].raw; + } + settings->FreezeString("RecentFile_" + std::to_string(i), rawPath); + } + // Model colors + for(size_t i = 0; i < MODEL_COLORS; i++) + settings->FreezeColor("ModelColor_" + std::to_string(i), modelColor[i]); + // Light intensities + settings->FreezeFloat("LightIntensity_0", (float)lightIntensity[0]); + settings->FreezeFloat("LightIntensity_1", (float)lightIntensity[1]); + settings->FreezeFloat("Light_Ambient", (float)ambientIntensity); + // Light directions + settings->FreezeFloat("LightDir_0_Right", (float)lightDir[0].x); + settings->FreezeFloat("LightDir_0_Up", (float)lightDir[0].y); + settings->FreezeFloat("LightDir_0_Forward", (float)lightDir[0].z); + settings->FreezeFloat("LightDir_1_Right", (float)lightDir[1].x); + settings->FreezeFloat("LightDir_1_Up", (float)lightDir[1].y); + settings->FreezeFloat("LightDir_1_Forward", (float)lightDir[1].z); + // Chord tolerance + settings->FreezeFloat("ChordTolerancePct", (float)chordTol); + // Max pwl segments to generate + settings->FreezeInt("MaxSegments", (uint32_t)maxSegments); + // Export Chord tolerance + settings->FreezeFloat("ExportChordTolerance", (float)exportChordTol); + // Export Max pwl segments to generate + settings->FreezeInt("ExportMaxSegments", (uint32_t)exportMaxSegments); + // Timeout for finding which constraints to fix Jacobian + settings->FreezeInt("TimeoutRedundantConstraints", (uint32_t)timeoutRedundantConstr); + // Animation speed + settings->FreezeInt("AnimationSpeed", (uint32_t)animationSpeed); + // View units + settings->FreezeInt("ViewUnits", (uint32_t)viewUnits); + // Number of digits after the decimal point + settings->FreezeInt("AfterDecimalMm", (uint32_t)afterDecimalMm); + settings->FreezeInt("AfterDecimalInch", (uint32_t)afterDecimalInch); + settings->FreezeInt("AfterDecimalDegree", (uint32_t)afterDecimalDegree); + settings->FreezeBool("UseSIPrefixes", useSIPrefixes); + // Camera tangent (determines perspective) + settings->FreezeFloat("CameraTangent", (float)cameraTangent); + // Grid spacing + settings->FreezeFloat("GridSpacing", gridSpacing); + // Export scale + settings->FreezeFloat("ExportScale", exportScale); + // Export offset (cutter radius comp) + settings->FreezeFloat("ExportOffset", exportOffset); + // Rewrite the default arc dimension setting + settings->FreezeBool("ArcDimDefaultDiameter", arcDimDefaultDiameter); + // Show full file path in the menu bar + settings->FreezeBool("ShowFullFilePath", showFullFilePath); + // Rewrite exported colors close to white into black (assuming white bg) + settings->FreezeBool("FixExportColors", fixExportColors); + // Export background color + settings->FreezeBool("ExportBackgroundColor", exportBackgroundColor); + // Draw back faces of triangles (when mesh is leaky/self-intersecting) + settings->FreezeBool("DrawBackFaces", drawBackFaces); + // Draw closed polygons areas + settings->FreezeBool("ShowContourAreas", showContourAreas); + // Check that contours are closed and not self-intersecting + settings->FreezeBool("CheckClosedContour", checkClosedContour); + // Use camera mouse navigation + settings->FreezeBool("CameraNav", cameraNav); + // Use turntable mouse navigation + settings->FreezeBool("TurntableNav", turntableNav); + // Immediately edit dimensions + settings->FreezeBool("ImmediatelyEditDimension", immediatelyEditDimension); + // Enable automatic constrains for lines + settings->FreezeBool("AutomaticLineConstraints", automaticLineConstraints); + // Export shaded triangles in a 2d view + settings->FreezeBool("ExportShadedTriangles", exportShadedTriangles); + // Export pwl curves (instead of exact) always + settings->FreezeBool("ExportPwlCurves", exportPwlCurves); + // Background color on-screen + settings->FreezeColor("BackgroundColor", backgroundColor); + // Whether export canvas size is fixed or derived from bbox + settings->FreezeBool("ExportCanvasSizeAuto", exportCanvasSizeAuto); + // Margins for automatic canvas size + settings->FreezeFloat("ExportMargin_Left", exportMargin.left); + settings->FreezeFloat("ExportMargin_Right", exportMargin.right); + settings->FreezeFloat("ExportMargin_Bottom", exportMargin.bottom); + settings->FreezeFloat("ExportMargin_Top", exportMargin.top); + // Dimensions for fixed canvas size + settings->FreezeFloat("ExportCanvas_Width", exportCanvas.width); + settings->FreezeFloat("ExportCanvas_Height", exportCanvas.height); + settings->FreezeFloat("ExportCanvas_Dx", exportCanvas.dx); + settings->FreezeFloat("ExportCanvas_Dy", exportCanvas.dy); + // Extra parameters when exporting G code + settings->FreezeFloat("GCode_Depth", gCode.depth); + settings->FreezeInt("GCode_Passes", gCode.passes); + settings->FreezeFloat("GCode_Feed", gCode.feed); + settings->FreezeFloat("GCode_PlungeFeed", gCode.plungeFeed); + // Show toolbar in the graphics window + settings->FreezeBool("ShowToolbar", showToolbar); + // Autosave timer + settings->FreezeInt("AutosaveInterval", autosaveInterval); + + // And the default styles, colors and line widths and such. + Style::FreezeDefaultStyles(settings); + + Platform::ExitGui(); +} + +void SolveSpaceUI::Refresh() { + // generateAll must happen bfore updating displays + if(scheduledGenerateAll) { + // Clear the flag so that if the call to GenerateAll is blocked by a Message or Error, + // subsequent refreshes do not try to Generate again. + scheduledGenerateAll = false; + GenerateAll(Generate::DIRTY, /*andFindFree=*/false, /*genForBBox=*/false); + } + if(scheduledShowTW) { + scheduledShowTW = false; + TW.Show(); + } +} + +void SolveSpaceUI::ScheduleGenerateAll() { + scheduledGenerateAll = true; + refreshTimer->RunAfterProcessingEvents(); +} + +void SolveSpaceUI::ScheduleShowTW() { + scheduledShowTW = true; + refreshTimer->RunAfterProcessingEvents(); +} + +void SolveSpaceUI::ScheduleAutosave() { + autosaveTimer->RunAfter(autosaveInterval * 60 * 1000); +} + +double SolveSpaceUI::MmPerUnit() { + switch(viewUnits) { + case Unit::INCHES: return 25.4; + case Unit::FEET_INCHES: return 25.4; // The 'unit' is still inches + case Unit::METERS: return 1000.0; + case Unit::MM: return 1.0; + } + return 1.0; +} +const char *SolveSpaceUI::UnitName() { + switch(viewUnits) { + case Unit::INCHES: return "in"; + case Unit::FEET_INCHES: return "in"; + case Unit::METERS: return "m"; + case Unit::MM: return "mm"; + } + return ""; +} + +std::string SolveSpaceUI::MmToString(double v, bool editable) { + v /= MmPerUnit(); + // The syntax 2' 6" for feet and inches is not something we can (currently) + // parse back from a string so if editable is true, we treat FEET_INCHES the + // same as INCHES and just return the unadorned decimal number of inches. + if(viewUnits == Unit::FEET_INCHES && !editable) { + // Now convert v from inches to 64'ths of an inch, to make rounding easier. + v = floor((v + (1.0 / 128.0)) * 64.0); + int feet = (int)(v / (12.0 * 64.0)); + v = v - (feet * 12.0 * 64.0); + // v is now the feet-less remainder in 1/64 inches + int inches = (int)(v / 64.0); + int numerator = (int)(v - ((double)inches * 64.0)); + int denominator = 64; + // Divide down to smallest denominator where the numerator is still a whole number + while ((numerator != 0) && ((numerator & 1) == 0)) { + numerator /= 2; + denominator /= 2; + } + std::ostringstream str; + if(feet != 0) { + str << feet << "'-"; + } + // For something like 0.5, show 1/2" rather than 0 1/2" + if(!(feet == 0 && inches == 0 && numerator != 0)) { + str << inches; + } + if(numerator != 0) { + str << " " << numerator << "/" << denominator; + } + str << "\""; + return str.str(); + } + + int digits = UnitDigitsAfterDecimal(); + double minimum = 0.5 * pow(10,-digits); + while ((v < minimum) && (v > LENGTH_EPS)) { + digits++; + minimum *= 0.1; + } + return ssprintf("%.*f", digits, v); +} +static const char *DimToString(int dim) { + switch(dim) { + case 3: return "³"; + case 2: return "²"; + case 1: return ""; + default: ssassert(false, "Unexpected dimension"); + } +} +static std::pair SelectSIPrefixMm(int ord, int dim) { +// decide what units to use depending on the order of magnitude of the +// measure in meters and the dimension (1,2,3 lenear, area, volume) + switch(dim) { + case 0: + case 1: + if(ord >= 3) return { 3, "km" }; + else if(ord >= 0) return { 0, "m" }; + else if(ord >= -2) return { -2, "cm" }; + else if(ord >= -3) return { -3, "mm" }; + else if(ord >= -6) return { -6, "µm" }; + else return { -9, "nm" }; + break; + case 2: + if(ord >= 5) return { 3, "km" }; + else if(ord >= 0) return { 0, "m" }; + else if(ord >= -2) return { -2, "cm" }; + else if(ord >= -6) return { -3, "mm" }; + else if(ord >= -13) return { -6, "µm" }; + else return { -9, "nm" }; + break; + case 3: + if(ord >= 7) return { 3, "km" }; + else if(ord >= 0) return { 0, "m" }; + else if(ord >= -5) return { -2, "cm" }; + else if(ord >= -11) return { -3, "mm" }; + else return { -6, "µm" }; + break; + default: + dbp ("dimensions over 3 not supported"); + break; + } + return {0, "m"}; +} +static std::pair SelectSIPrefixInch(int deg) { + if(deg >= 0) return { 0, "in" }; + else if(deg >= -3) return { -3, "mil" }; + else return { -6, "µin" }; +} +std::string SolveSpaceUI::MmToStringSI(double v, int dim) { + bool compact = false; + if(dim == 0) { + if(!useSIPrefixes) return MmToString(v); + compact = true; + dim = 1; + } + + bool inches = (viewUnits == Unit::INCHES) || (viewUnits == Unit::FEET_INCHES); + v /= pow(inches ? 25.4 : 1000, dim); + int vdeg = (int)(log10(fabs(v))); + std::string unit; + if(fabs(v) > 0.0) { + int sdeg = 0; + std::tie(sdeg, unit) = + inches + ? SelectSIPrefixInch(vdeg/dim) + : SelectSIPrefixMm(vdeg, dim); + v /= pow(10.0, sdeg * dim); + } + if(viewUnits == Unit::FEET_INCHES && fabs(v) > pow(12.0, dim)) { + unit = "ft"; + v /= pow(12.0, dim); + } + int pdeg = (int)ceil(log10(fabs(v) + 1e-10)); + return ssprintf("%.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v, + compact ? "" : " ", unit.c_str(), DimToString(dim)); +} +std::string SolveSpaceUI::DegreeToString(double v) { + if(fabs(v - floor(v)) > 1e-10) { + return ssprintf("%.*f", afterDecimalDegree, v); + } else { + return ssprintf("%.0f", v); + } +} +double SolveSpaceUI::ExprToMm(Expr *e) { + return (e->Eval()) * MmPerUnit(); +} +double SolveSpaceUI::StringToMm(const std::string &str) { + return std::stod(str) * MmPerUnit(); +} +double SolveSpaceUI::ChordTolMm() { + if(exportMode) return ExportChordTolMm(); + return chordTolCalculated; +} +double SolveSpaceUI::ExportChordTolMm() { + return exportChordTol / exportScale; +} +int SolveSpaceUI::GetMaxSegments() { + if(exportMode) return exportMaxSegments; + return maxSegments; +} +int SolveSpaceUI::UnitDigitsAfterDecimal() { + return (viewUnits == Unit::INCHES || viewUnits == Unit::FEET_INCHES) ? + afterDecimalInch : afterDecimalMm; +} +void SolveSpaceUI::SetUnitDigitsAfterDecimal(int v) { + if(viewUnits == Unit::INCHES || viewUnits == Unit::FEET_INCHES) { + afterDecimalInch = v; + } else { + afterDecimalMm = v; + } +} + +double SolveSpaceUI::CameraTangent() { + if(!usePerspectiveProj) { + return 0; + } else { + return cameraTangent; + } +} + +void SolveSpaceUI::AfterNewFile() { + // Clear out the traced point, which is no longer valid + traced.point = Entity::NO_ENTITY; + traced.path.l.Clear(); + // and the naked edges + nakedEdges.Clear(); + + // Quit export mode + justExportedInfo.draw = false; + centerOfMass.draw = false; + exportMode = false; + + // GenerateAll() expects the view to be valid, because it uses that to + // fill in default values for extrusion depths etc. (which won't matter + // here, but just don't let it work on garbage) + SS.GW.offset = Vector::From(0, 0, 0); + SS.GW.projRight = Vector::From(1, 0, 0); + SS.GW.projUp = Vector::From(0, 1, 0); + + GenerateAll(Generate::ALL); + + GW.Init(); + TW.Init(); + + unsaved = false; + + GW.ZoomToFit(); + + // Create all the default styles; they'll get created on the fly anyways, + // but can't hurt to do it now. + Style::CreateAllDefaultStyles(); + + UpdateWindowTitles(); +} + +void SolveSpaceUI::AddToRecentList(const Platform::Path &filename) { + auto it = std::find_if(recentFiles.begin(), recentFiles.end(), + [&](const Platform::Path &p) { return p.Equals(filename); }); + if(it != recentFiles.end()) { + recentFiles.erase(it); + } + + if(recentFiles.size() > MAX_RECENT) { + recentFiles.erase(recentFiles.begin() + MAX_RECENT); + } + + recentFiles.insert(recentFiles.begin(), filename); + GW.PopulateRecentFiles(); +} + +bool SolveSpaceUI::GetFilenameAndSave(bool saveAs) { + Platform::SettingsRef settings = Platform::GetSettings(); + Platform::Path newSaveFile = saveFile; + + if(saveAs || saveFile.IsEmpty()) { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(GW.window); + // FIXME(emscripten): + dbp("Calling AddFilter()..."); + dialog->AddFilter(C_("file-type", "SolveSpace models"), { SKETCH_EXT }); + dbp("Calling ThawChoices()..."); + dialog->ThawChoices(settings, "Sketch"); + if(!newSaveFile.IsEmpty()) { + dbp("Calling SetFilename()..."); + dialog->SetFilename(newSaveFile); + } + dbp("Calling RunModal()..."); + if(dialog->RunModal()) { + dbp("Calling FreezeChoices()..."); + dialog->FreezeChoices(settings, "Sketch"); + newSaveFile = dialog->GetFilename(); + } else { + return false; + } + } + + if(SaveToFile(newSaveFile)) { + AddToRecentList(newSaveFile); + RemoveAutosave(); + saveFile = newSaveFile; + unsaved = false; + if (this->OnSaveFinished) { + this->OnSaveFinished(newSaveFile, saveAs, false); + } + return true; + } else { + return false; + } +} + +void SolveSpaceUI::Autosave() +{ + ScheduleAutosave(); + + if(!saveFile.IsEmpty() && unsaved) { + Platform::Path saveFileName = saveFile.WithExtension(BACKUP_EXT); + SaveToFile(saveFileName); + if (this->OnSaveFinished) { + this->OnSaveFinished(saveFileName, false, true); + } + } +} + +void SolveSpaceUI::RemoveAutosave() +{ + Platform::Path autosaveFile = saveFile.WithExtension(BACKUP_EXT); + RemoveFile(autosaveFile); +} + +bool SolveSpaceUI::OkayToStartNewFile() { + if(!unsaved) return true; + + Platform::MessageDialogRef dialog = CreateMessageDialog(GW.window); + + using Platform::MessageDialog; + dialog->SetType(MessageDialog::Type::QUESTION); + dialog->SetTitle(C_("title", "Modified File")); + if(!SS.saveFile.IsEmpty()) { + dialog->SetMessage(ssprintf(C_("dialog", "Do you want to save the changes you made to " + "the sketch “%s”?"), saveFile.raw.c_str())); + } else { + dialog->SetMessage(C_("dialog", "Do you want to save the changes you made to " + "the new sketch?")); + } + dialog->SetDescription(C_("dialog", "Your changes will be lost if you don't save them.")); + dialog->AddButton(C_("button", "&Save"), MessageDialog::Response::YES, + /*isDefault=*/true); + dialog->AddButton(C_("button", "Do&n't Save"), MessageDialog::Response::NO); + dialog->AddButton(C_("button", "&Cancel"), MessageDialog::Response::CANCEL); + + // FIXME(async): asyncify this call + switch(dialog->RunModal()) { + case MessageDialog::Response::YES: + return GetFilenameAndSave(/*saveAs=*/false); + + case MessageDialog::Response::NO: + RemoveAutosave(); + return true; + + default: + return false; + } +} + +void SolveSpaceUI::UpdateWindowTitles() { + if(!GW.window || !TW.window) return; + + if(saveFile.IsEmpty()) { + GW.window->SetTitle(C_("title", "(new sketch)")); + } else { + if(!GW.window->SetTitleForFilename(saveFile)) { + if(SS.showFullFilePath) { + GW.window->SetTitle(saveFile.raw); + } else { + GW.window->SetTitle(saveFile.raw.substr(saveFile.raw.find_last_of("/\\") + 1)); + } + } + } + + TW.window->SetTitle(C_("title", "Property Browser")); +} + +void SolveSpaceUI::MenuFile(Command id) { + Platform::SettingsRef settings = Platform::GetSettings(); + + switch(id) { + case Command::NEW: + if(!SS.OkayToStartNewFile()) break; + + SS.saveFile.Clear(); + SS.NewFile(); + SS.AfterNewFile(); + break; + + case Command::OPEN: { + if(!SS.OkayToStartNewFile()) break; + + Platform::FileDialogRef dialog = Platform::CreateOpenFileDialog(SS.GW.window); + dialog->AddFilters(Platform::SolveSpaceModelFileFilters); + dialog->ThawChoices(settings, "Sketch"); + if(dialog->RunModal()) { + dialog->FreezeChoices(settings, "Sketch"); + SS.Load(dialog->GetFilename()); + } + break; + } + + case Command::SAVE: + SS.GetFilenameAndSave(/*saveAs=*/false); + break; + + case Command::SAVE_AS: + SS.GetFilenameAndSave(/*saveAs=*/true); + break; + + case Command::EXPORT_IMAGE: { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::RasterFileFilters); + dialog->ThawChoices(settings, "ExportImage"); + dialog->SuggestFilename(SS.saveFile); + if(dialog->RunModal()) { + dialog->FreezeChoices(settings, "ExportImage"); + SS.ExportAsPngTo(dialog->GetFilename()); + if (SS.OnSaveFinished) { + SS.OnSaveFinished(dialog->GetFilename(), false, false); + } + } + break; + } + + case Command::EXPORT_VIEW: { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::VectorFileFilters); + dialog->ThawChoices(settings, "ExportView"); + dialog->SuggestFilename(SS.saveFile); + if(!dialog->RunModal()) break; + dialog->FreezeChoices(settings, "ExportView"); + + // If the user is exporting something where it would be + // inappropriate to include the constraints, then warn. + if(SS.GW.showConstraints != GraphicsWindow::ShowConstraintMode::SCM_NOSHOW && + (dialog->GetFilename().HasExtension("txt") || fabs(SS.exportOffset) > LENGTH_EPS)) { + Message(_("Constraints are currently shown, and will be exported " + "in the toolpath. This is probably not what you want; " + "hide them by clicking the link at the top of the " + "text window.")); + } + + SS.ExportViewOrWireframeTo(dialog->GetFilename(), /*exportWireframe=*/false); + if (SS.OnSaveFinished) { + SS.OnSaveFinished(dialog->GetFilename(), false, false); + } + break; + } + + case Command::EXPORT_WIREFRAME: { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::Vector3dFileFilters); + dialog->ThawChoices(settings, "ExportWireframe"); + dialog->SuggestFilename(SS.saveFile); + if(!dialog->RunModal()) break; + dialog->FreezeChoices(settings, "ExportWireframe"); + + SS.ExportViewOrWireframeTo(dialog->GetFilename(), /*exportWireframe*/true); + if (SS.OnSaveFinished) { + SS.OnSaveFinished(dialog->GetFilename(), false, false); + } + break; + } + + case Command::EXPORT_SECTION: { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::VectorFileFilters); + dialog->ThawChoices(settings, "ExportSection"); + dialog->SuggestFilename(SS.saveFile); + if(!dialog->RunModal()) break; + dialog->FreezeChoices(settings, "ExportSection"); + + SS.ExportSectionTo(dialog->GetFilename()); + if (SS.OnSaveFinished) { + SS.OnSaveFinished(dialog->GetFilename(), false, false); + } + break; + } + + case Command::EXPORT_MESH: { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::MeshFileFilters); + dialog->ThawChoices(settings, "ExportMesh"); + dialog->SuggestFilename(SS.saveFile); + if(!dialog->RunModal()) break; + dialog->FreezeChoices(settings, "ExportMesh"); + + SS.ExportMeshTo(dialog->GetFilename()); + if (SS.OnSaveFinished) { + SS.OnSaveFinished(dialog->GetFilename(), false, false); + } + + break; + } + + case Command::EXPORT_SURFACES: { + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::SurfaceFileFilters); + dialog->ThawChoices(settings, "ExportSurfaces"); + dialog->SuggestFilename(SS.saveFile); + if(!dialog->RunModal()) break; + dialog->FreezeChoices(settings, "ExportSurfaces"); + + StepFileWriter sfw = {}; + sfw.ExportSurfacesTo(dialog->GetFilename()); + if (SS.OnSaveFinished) { + SS.OnSaveFinished(dialog->GetFilename(), false, false); + } + break; + } + + case Command::IMPORT: { + Platform::FileDialogRef dialog = Platform::CreateOpenFileDialog(SS.GW.window); + dialog->AddFilters(Platform::ImportFileFilters); + dialog->ThawChoices(settings, "Import"); + if(!dialog->RunModal()) break; + dialog->FreezeChoices(settings, "Import"); + + Platform::Path importFile = dialog->GetFilename(); + if(importFile.HasExtension("dxf")) { + ImportDxf(importFile); + } else if(importFile.HasExtension("dwg")) { + ImportDwg(importFile); + } else { + Error(_("Can't identify file type from file extension of " + "filename '%s'; try .dxf or .dwg."), importFile.raw.c_str()); + break; + } + + SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE); + SS.ScheduleShowTW(); + break; + } + + case Command::EXIT: + if(!SS.OkayToStartNewFile()) break; + SS.Exit(); + break; + + default: ssassert(false, "Unexpected menu ID"); + } + + SS.UpdateWindowTitles(); +} + +void SolveSpaceUI::MenuAnalyze(Command id) { + Platform::SettingsRef settings = Platform::GetSettings(); + + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + + switch(id) { + case Command::STEP_DIM: + if(gs.constraints == 1 && gs.n == 0) { + Constraint *c = SK.GetConstraint(gs.constraint[0]); + if(c->HasLabel() && !c->reference) { + SS.TW.stepDim.finish = c->valA; + SS.TW.stepDim.steps = 10; + SS.TW.stepDim.isDistance = + (c->type != Constraint::Type::ANGLE) && + (c->type != Constraint::Type::LENGTH_RATIO) && + (c->type != Constraint::Type::ARC_ARC_LEN_RATIO) && + (c->type != Constraint::Type::ARC_LINE_LEN_RATIO) && + (c->type != Constraint::Type::LENGTH_DIFFERENCE) && + (c->type != Constraint::Type::ARC_ARC_DIFFERENCE) && + (c->type != Constraint::Type::ARC_LINE_DIFFERENCE) ; + SS.TW.shown.constraint = c->h; + SS.TW.shown.screen = TextWindow::Screen::STEP_DIMENSION; + + // The step params are specified in the text window, + // so force that to be shown. + SS.GW.ForceTextWindowShown(); + + SS.ScheduleShowTW(); + SS.GW.ClearSelection(); + } else { + Error(_("Constraint must have a label, and must not be " + "a reference dimension.")); + } + } else { + Error(_("Bad selection for step dimension; select a constraint.")); + } + break; + + case Command::NAKED_EDGES: { + ShowNakedEdges(/*reportOnlyWhenNotOkay=*/false); + break; + } + + case Command::INTERFERENCE: { + SS.nakedEdges.Clear(); + + SMesh *m = &(SK.GetGroup(SS.GW.activeGroup)->displayMesh); + SKdNode *root = SKdNode::From(m); + bool inters, leaks; + root->MakeCertainEdgesInto(&(SS.nakedEdges), + EdgeKind::SELF_INTER, /*coplanarIsInter=*/false, &inters, &leaks); + + SS.GW.Invalidate(); + + if(inters) { + Error("%d edges interfere with other triangles, bad.", + SS.nakedEdges.l.n); + } else { + Message(_("The assembly does not interfere, good.")); + } + break; + } + + case Command::CENTER_OF_MASS: { + SS.UpdateCenterOfMass(); + SS.centerOfMass.draw = true; + SS.GW.Invalidate(); + break; + } + + case Command::VOLUME: { + Group *g = SK.GetGroup(SS.GW.activeGroup); + double totalVol = g->displayMesh.CalculateVolume(); + std::string msg = ssprintf( + _("The volume of the solid model is:\n\n" + " %s"), + SS.MmToStringSI(totalVol, /*dim=*/3).c_str()); + + SMesh curMesh = {}; + g->thisShell.TriangulateInto(&curMesh); + double curVol = curMesh.CalculateVolume(); + if(curVol > 0.0) { + msg += ssprintf( + _("\nThe volume of current group mesh is:\n\n" + " %s"), + SS.MmToStringSI(curVol, /*dim=*/3).c_str()); + } + + msg += _("\n\nCurved surfaces have been approximated as triangles.\n" + "This introduces error, typically of around 1%."); + Message("%s", msg.c_str()); + break; + } + + case Command::AREA: { + Group *g = SK.GetGroup(SS.GW.activeGroup); + SS.GW.GroupSelection(); + + if(gs.faces > 0) { + std::vector faces; + faces.push_back(gs.face[0].v); + if(gs.faces > 1) faces.push_back(gs.face[1].v); + double area = g->displayMesh.CalculateSurfaceArea(faces); + Message(_("The surface area of the selected faces is:\n\n" + " %s\n\n" + "Curves have been approximated as piecewise linear.\n" + "This introduces error, typically of around 1%%."), + SS.MmToStringSI(area, /*dim=*/2).c_str()); + break; + } + + if(g->polyError.how != PolyError::GOOD) { + Error(_("This group does not contain a correctly-formed " + "2d closed area. It is open, not coplanar, or self-" + "intersecting.")); + break; + } + SEdgeList sel = {}; + g->polyLoops.MakeEdgesInto(&sel); + SPolygon sp = {}; + sel.AssemblePolygon(&sp, NULL, /*keepDir=*/true); + sp.normal = sp.ComputeNormal(); + sp.FixContourDirections(); + double area = sp.SignedArea(); + Message(_("The area of the region sketched in this group is:\n\n" + " %s\n\n" + "Curves have been approximated as piecewise linear.\n" + "This introduces error, typically of around 1%%."), + SS.MmToStringSI(area, /*dim=*/2).c_str()); + sel.Clear(); + sp.Clear(); + break; + } + + case Command::PERIMETER: { + if(gs.n > 0 && gs.n == gs.entities) { + double perimeter = 0.0; + for(int i = 0; i < gs.entities; i++) { + Entity *en = SK.entity.FindById(gs.entity[i]); + SEdgeList *el = en->GetOrGenerateEdges(); + for(const SEdge &e : el->l) { + perimeter += e.b.Minus(e.a).Magnitude(); + } + } + Message(_("The total length of the selected entities is:\n\n" + " %s\n\n" + "Curves have been approximated as piecewise linear.\n" + "This introduces error, typically of around 1%%."), + SS.MmToStringSI(perimeter, /*dim=*/1).c_str()); + } else { + Error(_("Bad selection for perimeter; select line segments, arcs, and curves.")); + } + break; + } + + case Command::SHOW_DOF: + // This works like a normal solve, except that it calculates + // which variables are free/bound at the same time. + SS.GenerateAll(SolveSpaceUI::Generate::ALL, /*andFindFree=*/true); + break; + + case Command::TRACE_PT: + if(gs.points == 1 && gs.n == 1) { + SS.traced.point = gs.point[0]; + SS.GW.ClearSelection(); + } else { + Error(_("Bad selection for trace; select a single point.")); + } + break; + + case Command::STOP_TRACING: { + if (SS.traced.point == Entity::NO_ENTITY) { + break; + } + Platform::FileDialogRef dialog = Platform::CreateSaveFileDialog(SS.GW.window); + dialog->AddFilters(Platform::CsvFileFilters); + dialog->ThawChoices(settings, "Trace"); + dialog->SetFilename(SS.saveFile); + if(dialog->RunModal()) { + dialog->FreezeChoices(settings, "Trace"); + + FILE *f = OpenFile(dialog->GetFilename(), "wb"); + if(f) { + int i; + SContour *sc = &(SS.traced.path); + for(i = 0; i < sc->l.n; i++) { + Vector p = sc->l[i].p; + double s = SS.exportScale; + fprintf(f, "%.10f, %.10f, %.10f\r\n", + p.x/s, p.y/s, p.z/s); + } + fclose(f); + } else { + Error(_("Couldn't write to '%s'"), dialog->GetFilename().raw.c_str()); + } + } + // Clear the trace, and stop tracing + SS.traced.point = Entity::NO_ENTITY; + SS.traced.path.l.Clear(); + SS.GW.Invalidate(); + break; + } + + default: ssassert(false, "Unexpected menu ID"); + } +} + +void SolveSpaceUI::ShowNakedEdges(bool reportOnlyWhenNotOkay) { + SS.nakedEdges.Clear(); + + Group *g = SK.GetGroup(SS.GW.activeGroup); + SMesh *m = &(g->displayMesh); + SKdNode *root = SKdNode::From(m); + bool inters, leaks; + root->MakeCertainEdgesInto(&(SS.nakedEdges), + EdgeKind::NAKED_OR_SELF_INTER, /*coplanarIsInter=*/true, &inters, &leaks); + + if(reportOnlyWhenNotOkay && !inters && !leaks && SS.nakedEdges.l.IsEmpty()) { + return; + } + SS.GW.Invalidate(); + + const char *intersMsg = inters ? + _("The mesh is self-intersecting (NOT okay, invalid).") : + _("The mesh is not self-intersecting (okay, valid)."); + const char *leaksMsg = leaks ? + _("The mesh has naked edges (NOT okay, invalid).") : + _("The mesh is watertight (okay, valid)."); + + std::string cntMsg = ssprintf( + _("\n\nThe model contains %d triangles, from %d surfaces."), + g->displayMesh.l.n, g->runningShell.surface.n); + + if(SS.nakedEdges.l.IsEmpty()) { + Message(_("%s\n\n%s\n\nZero problematic edges, good.%s"), + intersMsg, leaksMsg, cntMsg.c_str()); + } else { + Error(_("%s\n\n%s\n\n%d problematic edges, bad.%s"), + intersMsg, leaksMsg, SS.nakedEdges.l.n, cntMsg.c_str()); + } +} + +void SolveSpaceUI::MenuHelp(Command id) { + switch(id) { + case Command::WEBSITE: + Platform::OpenInBrowser("http://solvespace.com/helpmenu"); + break; + + case Command::ABOUT: + Message(_( +"This is SolveSpace version %s.\n" +"\n" +"For more information, see http://solvespace.com/\n" +"\n" +"SolveSpace is free software: you are free to modify\n" +"and/or redistribute it under the terms of the GNU\n" +"General Public License (GPL) version 3 or later.\n" +"\n" +"There is NO WARRANTY, to the extent permitted by\n" +"law. For details, visit http://gnu.org/licenses/\n" +"\n" +"© 2008-%d Jonathan Westhues and other authors.\n"), +PACKAGE_VERSION, 2026); + break; + + case Command::GITHUB: + Platform::OpenInBrowser(GIT_HASH_URL); + break; + + default: ssassert(false, "Unexpected menu ID"); + } +} + +void SolveSpaceUI::Clear() { + sys.Clear(); + for(int i = 0; i < MAX_UNDO; i++) { + if(i < undo.cnt) undo.d[i].Clear(); + if(i < redo.cnt) redo.d[i].Clear(); + } + TW.window = NULL; + GW.openRecentMenu = NULL; + GW.linkRecentMenu = NULL; + GW.showGridMenuItem = NULL; + GW.dimSolidModelMenuItem = NULL; + GW.perspectiveProjMenuItem = NULL; + GW.explodeMenuItem = NULL; + GW.showToolbarMenuItem = NULL; + GW.showTextWndMenuItem = NULL; + GW.fullScreenMenuItem = NULL; + GW.unitsMmMenuItem = NULL; + GW.unitsMetersMenuItem = NULL; + GW.unitsInchesMenuItem = NULL; + GW.unitsFeetInchesMenuItem = NULL; + GW.inWorkplaneMenuItem = NULL; + GW.in3dMenuItem = NULL; + GW.undoMenuItem = NULL; + GW.redoMenuItem = NULL; + GW.window = NULL; +} + +void Sketch::Clear() { + group.Clear(); + groupOrder.Clear(); + constraint.Clear(); + request.Clear(); + style.Clear(); + entity.Clear(); + param.Clear(); +} + +BBox Sketch::CalculateEntityBBox(bool includingInvisible) { + BBox box = {}; + bool first = true; + + auto includePoint = [&](const Vector &point) { + if(first) { + box.minp = point; + box.maxp = point; + first = false; + } else { + box.Include(point); + } + }; + + for(const Entity &e : entity) { + if(e.construction) continue; + if(!(includingInvisible || e.IsVisible())) continue; + + // arc center point shouldn't be included in bounding box calculation + if(e.IsPoint() && e.h.isFromRequest()) { + Request *r = SK.GetRequest(e.h.request()); + if(r->type == Request::Type::ARC_OF_CIRCLE && e.h == r->h.entity(1)) { + continue; + } + } + + if(e.IsPoint()) { + includePoint(e.PointGetNum()); + continue; + } + + switch(e.type) { + // Circles and arcs are special cases. We calculate their bounds + // based on Bezier curve bounds. This is not exact for arcs, + // but the implementation is rather simple. + case Entity::Type::CIRCLE: + case Entity::Type::ARC_OF_CIRCLE: { + SBezierList sbl = {}; + e.GenerateBezierCurves(&sbl); + + for(const SBezier &sb : sbl.l) { + for(int j = 0; j <= sb.deg; j++) { + includePoint(sb.ctrl[j]); + } + } + sbl.Clear(); + continue; + } + + default: + continue; + } + } + + return box; +} + +Group *Sketch::GetRunningMeshGroupFor(hGroup h) { + Group *g = GetGroup(h); + while(g != NULL) { + if(g->IsMeshGroup()) { + return g; + } + g = g->PreviousGroup(); + } + return NULL; +} + +} // namespace SolveSpace diff --git a/src/solvespace.h b/src/solvespace.h new file mode 100644 index 0000000..572c48d --- /dev/null +++ b/src/solvespace.h @@ -0,0 +1,749 @@ +//----------------------------------------------------------------------------- +// All declarations not grouped specially elsewhere. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_H +#define SOLVESPACE_H + +#include +#include +#include +#include + +#define EIGEN_NO_DEBUG +#undef Success +#include + +#include "dsc.h" +#include "polygon.h" +#include "srf/surface.h" +#include "render/render.h" +#include "expr.h" +#include "sketch.h" +#include "ttf.h" +#include "ui.h" + +#include "platform/platform.h" + +namespace SolveSpace { + +using std::min; +using std::max; +using std::swap; +using std::fabs; + +enum class Unit : uint32_t { + MM = 0, + INCHES, + METERS, + FEET_INCHES +}; + +class Pixmap; + +enum class SolveResult : uint32_t { + OKAY = 0, + DIDNT_CONVERGE = 10, + REDUNDANT_OKAY = 11, + REDUNDANT_DIDNT_CONVERGE = 12, + TOO_MANY_UNKNOWNS = 20 +}; + +// Utility functions that are provided in the platform-independent code. +class utf8_iterator { + const char *p, *n; +public: + using iterator_category = std::forward_iterator_tag; + using value_type = char32_t; + using difference_type = std::ptrdiff_t; + using pointer = char32_t*; + using reference = char32_t&; + + utf8_iterator(const char *p) : p(p), n(NULL) {} + bool operator==(const utf8_iterator &i) const { return p==i.p; } + bool operator!=(const utf8_iterator &i) const { return p!=i.p; } + ptrdiff_t operator- (const utf8_iterator &i) const { return p -i.p; } + utf8_iterator& operator++() { **this; p=n; n=NULL; return *this; } + utf8_iterator operator++(int) { utf8_iterator t(*this); operator++(); return t; } + char32_t operator*(); + const char* ptr() const { return p; } +}; +class ReadUTF8 { + const std::string &str; +public: + ReadUTF8(const std::string &str) : str(str) {} + utf8_iterator begin() const { return utf8_iterator(&str[0]); } + utf8_iterator end() const { return utf8_iterator(&str[0] + str.length()); } +}; + +class System { +public: + enum { MAX_UNKNOWNS = 2048 }; + + EntityList entity; + ParamList param; + IdList eq; + + // A list of parameters that are being dragged; these are the ones that + // we should put as close as possible to their initial positions. + ParamSet dragged; + + enum { + // In general, the tag indicates the subsys that a variable/equation + // has been assigned to; these are exceptions for variables: + VAR_SUBSTITUTED = 10000, + VAR_DOF_TEST = 10001, + // and for equations: + EQ_SUBSTITUTED = 20000 + }; + + // The system Jacobian matrix + struct { + // The corresponding equation for each row + std::vector eq; + + // The corresponding parameter for each column + std::vector param; + + // We're solving AX = B + int m, n; + struct { + // This only observes the Expr - does not own them! + Eigen::SparseMatrix sym; + Eigen::SparseMatrix num; + } A; + + Eigen::VectorXd X; + + struct { + // This only observes the Expr - does not own them! + std::vector sym; + Eigen::VectorXd num; + } B; + } mat; + + static const double CONVERGE_TOLERANCE; + int CalculateRank(); + bool TestRank(int *dof = NULL, int *rank = NULL); + static bool SolveLinearSystem(const Eigen::SparseMatrix &A, + const Eigen::VectorXd &B, Eigen::VectorXd *X); + bool SolveLeastSquares(); + + bool WriteJacobian(int tag); + void EvalJacobian(); + + void WriteEquationsExceptFor(hConstraint hc, Group *g); + void FindWhichToRemoveToFixJacobian(Group *g, List *bad, + bool forceDofCheck); + SubstitutionMap SolveBySubstitution(); + + bool IsDragged(hParam p); + + bool NewtonSolve(); + + void MarkParamsFree(bool findFree); + + SolveResult Solve(Group *g, int *dof = NULL, List *bad = NULL, + bool andFindBad = false, bool andFindFree = false, + bool forceDofCheck = false); + + SolveResult SolveRank(Group *g, int *rank = NULL, int *dof = NULL, + List *bad = NULL, + bool andFindBad = false, bool andFindFree = false); + + void Clear(); +}; + +class StepFileWriter { +public: + bool HasCartesianPointAnAlias(int number, Vector v, int vertex, + bool *vertex_has_alias = nullptr); + int InsertPoint(int number); + int InsertVertex(int number); + bool HasBSplineCurveAnAlias(int number, std::vector points); + int InsertCurve(int number); + bool HasEdgeCurveAnAlias(int number, int prevFinish, int thisFinish, int curveId, + bool *flip = nullptr); + int InsertEdgeCurve(int number); + bool HasOrientedEdgeAnAlias(int number, int edgeCurveId, bool flip); + int InsertOrientedEdge(int number); + void ExportSurfacesTo(const Platform::Path &filename); + void WriteHeader(); + void WriteProductHeader(); + int ExportCurve(SBezier *sb); + int ExportCurveLoop(SBezierLoop *loop, bool inner); + void ExportSurface(SSurface *ss, SBezierList *sbl); + void WriteWireframe(); + void WriteFooter(); + + List curves; + List advancedFaces; + FILE *f; + int id; + + // Structs to keep track of duplicated entities. + // Basic alias. + typedef struct { + int reference; + std::vector aliases; + } alias_t; + + // Cartesian points. + typedef struct { + alias_t alias; + alias_t vertexAlias; + Vector v; + } pointAliases_t; + + // Curves. + typedef struct { + alias_t alias; + std::vector memberPoints; + RgbaColor color; + } curveAliases_t; + + // Edges. + typedef struct { + alias_t alias; + int prevFinish; + int thisFinish; + int curveId; + RgbaColor color; + } edgeCurveAliases_t; + + // Edges. + typedef struct { + alias_t alias; + int edgeCurveId; + bool flip; + } orientedEdgeAliases_t; + + std::vector pointAliases; + std::vector edgeCurveAliases; + std::vector curveAliases; + std::vector orientedEdgeAliases; + bool exportParts = true; + RgbaColor currentColor; +}; + +class VectorFileWriter { +protected: + Vector u, v, n, origin; + double cameraTan, scale; + +public: + FILE *f; + Platform::Path filename; + Vector ptMin, ptMax; + + static double MmToPts(double mm); + + static VectorFileWriter *ForFile(const Platform::Path &filename); + + void SetModelviewProjection(const Vector &u, const Vector &v, const Vector &n, + const Vector &origin, double cameraTan, double scale); + Vector Transform(Vector &pos) const; + + void OutputLinesAndMesh(SBezierLoopSetSet *sblss, SMesh *sm); + + void BezierAsPwl(SBezier *sb); + void BezierAsNonrationalCubic(SBezier *sb, int depth=0); + + virtual void StartPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) = 0; + virtual void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) = 0; + virtual void Bezier(SBezier *sb) = 0; + virtual void Triangle(STriangle *tr) = 0; + virtual bool OutputConstraints(IdList *) { return false; } + virtual void Background(RgbaColor color) = 0; + virtual void StartFile() = 0; + virtual void FinishAndCloseFile() = 0; + virtual bool HasCanvasSize() const = 0; + virtual bool CanOutputMesh() const = 0; +}; +class DxfFileWriter : public VectorFileWriter { +public: + struct BezierPath { + std::vector beziers; + }; + + std::vector paths; + IdList *constraint; + + static const char *lineTypeName(StipplePattern stippleType); + + bool OutputConstraints(IdList *constraint) override; + + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return false; } + bool CanOutputMesh() const override { return false; } + bool NeedToOutput(Constraint *c); +}; +class EpsFileWriter : public VectorFileWriter { +public: + Vector prevPt; + void MaybeMoveTo(Vector s, Vector f); + + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return true; } + bool CanOutputMesh() const override { return true; } +}; +class PdfFileWriter : public VectorFileWriter { +public: + uint32_t xref[10]; + uint32_t bodyStart; + Vector prevPt; + void MaybeMoveTo(Vector s, Vector f); + + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return true; } + bool CanOutputMesh() const override { return true; } +}; +class SvgFileWriter : public VectorFileWriter { +public: + Vector prevPt; + void MaybeMoveTo(Vector s, Vector f); + + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return true; } + bool CanOutputMesh() const override { return true; } +}; +class HpglFileWriter : public VectorFileWriter { +public: + static double MmToHpglUnits(double mm); + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return false; } + bool CanOutputMesh() const override { return false; } +}; +class Step2dFileWriter : public VectorFileWriter { + StepFileWriter sfw; + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return false; } + bool CanOutputMesh() const override { return false; } +}; +class GCodeFileWriter : public VectorFileWriter { +public: + SEdgeList sel; + void StartPath( RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void FinishPath(RgbaColor strokeRgb, double lineWidth, + bool filled, RgbaColor fillRgb, hStyle hs) override; + void Triangle(STriangle *tr) override; + void Bezier(SBezier *sb) override; + void Background(RgbaColor color) override; + void StartFile() override; + void FinishAndCloseFile() override; + bool HasCanvasSize() const override { return false; } + bool CanOutputMesh() const override { return false; } +}; + +#ifdef LIBRARY +# define ENTITY EntityBase +# define CONSTRAINT ConstraintBase +#else +# define ENTITY Entity +# define CONSTRAINT Constraint +#endif +class Sketch { +public: + // These are user-editable, and define the sketch. + IdList group; + List
groupOrder; + IdList constraint; + IdList request; + IdList style; + + // These are generated from the above. + IdList entity; + ParamList param; + + inline CONSTRAINT *GetConstraint(hConstraint h) + { return constraint.FindById(h); } + inline ENTITY *GetEntity (hEntity h) { return entity. FindById(h); } + inline Param *GetParam (hParam h) { return param. FindById(h); } + inline Request *GetRequest(hRequest h) { return request.FindById(h); } + inline Group *GetGroup (hGroup h) { return group. FindById(h); } + // Styles are handled a bit differently. + + void Clear(); + + BBox CalculateEntityBBox(bool includingInvisible); + Group *GetRunningMeshGroupFor(hGroup h); +}; +#undef ENTITY +#undef CONSTRAINT + +class SolveSpaceUI { +public: + TextWindow *pTW; + TextWindow &TW; + GraphicsWindow GW; + + // The state for undo/redo + typedef struct UndoState { + IdList group; + List
groupOrder; + IdList request; + IdList constraint; + ParamList param; + IdList style; + hGroup activeGroup; + + void Clear() { + group.Clear(); + request.Clear(); + constraint.Clear(); + param.Clear(); + style.Clear(); + } + } UndoState; + enum { MAX_UNDO = 100 }; + typedef struct { + UndoState d[MAX_UNDO]; + int cnt; + int write; + } UndoStack; + UndoStack undo; + UndoStack redo; + + std::map, Platform::PathLess> images; + bool ReloadLinkedImage(const Platform::Path &saveFile, Platform::Path *filename, + bool canCancel); + + void UndoEnableMenus(); + void UndoRemember(); + void UndoUndo(); + void UndoRedo(); + void PushFromCurrentOnto(UndoStack *uk); + void PopOntoCurrentFrom(UndoStack *uk); + void UndoClearState(UndoState *ut); + void UndoClearStack(UndoStack *uk); + + // Little bits of extra configuration state + enum { MODEL_COLORS = 8 }; + RgbaColor modelColor[MODEL_COLORS]; + Vector lightDir[2]; + double lightIntensity[2]; + double ambientIntensity; + double chordTol; + double chordTolCalculated; + int maxSegments; + double exportChordTol; + int exportMaxSegments; + int timeoutRedundantConstr; //milliseconds + int animationSpeed; //milliseconds + double cameraTangent; + double gridSpacing; + double exportScale; + double exportOffset; + bool arcDimDefaultDiameter; + bool showFullFilePath; + bool fixExportColors; + bool exportBackgroundColor; + bool drawBackFaces; + bool showContourAreas; + bool checkClosedContour; + bool cameraNav; + bool turntableNav; + bool immediatelyEditDimension; + bool automaticLineConstraints; + bool showToolbar; + Platform::Path screenshotFile; + RgbaColor backgroundColor; + bool exportShadedTriangles; + bool exportPwlCurves; + bool exportCanvasSizeAuto; + bool exportMode; + struct { + double left; + double right; + double bottom; + double top; + } exportMargin; + struct { + double width; + double height; + double dx; + double dy; + } exportCanvas; + struct { + double depth; + double safeHeight; + int passes; + double feed; + double plungeFeed; + } gCode; + + Unit viewUnits; + int afterDecimalMm; + int afterDecimalInch; + int afterDecimalDegree; + bool useSIPrefixes; + int autosaveInterval; // in minutes + bool explode; + double explodeDistance; + + std::string MmToString(double v, bool editable=false); + std::string MmToStringSI(double v, int dim = 0); + std::string DegreeToString(double v); + double ExprToMm(Expr *e); + double StringToMm(const std::string &s); + const char *UnitName(); + double MmPerUnit(); + int UnitDigitsAfterDecimal(); + void SetUnitDigitsAfterDecimal(int v); + double ChordTolMm(); + double ExportChordTolMm(); + int GetMaxSegments(); + bool usePerspectiveProj; + double CameraTangent(); + + // Some stuff relating to the tangent arcs created non-parametrically + // as special requests. + double tangentArcRadius; + bool tangentArcManual; + bool tangentArcModify; + + // The platform-dependent code calls this before entering the msg loop + void Init(); + void Exit(); + + // File load/save routines, including the additional files that get + // loaded when we have link groups. + FILE *fh; + void AfterNewFile(); + void AddToRecentList(const Platform::Path &filename); + Platform::Path saveFile; + bool fileLoadError; + bool unsaved; + typedef struct { + char type; + const char *desc; + char fmt; + void *ptr; + } SaveTable; + static const SaveTable SAVED[]; + void SaveUsingTable(const Platform::Path &filename, int type); + void LoadUsingTable(const Platform::Path &filename, char *key, char *val); + struct { + Group g; + Request r; + Entity e; + Param p; + Constraint c; + Style s; + } sv; + static void MenuFile(Command id); + void Autosave(); + void RemoveAutosave(); + static constexpr size_t MAX_RECENT = 8; + static constexpr const char *SKETCH_EXT = "slvs"; + static constexpr const char *BACKUP_EXT = "slvs~"; + std::vector recentFiles; + bool Load(const Platform::Path &filename); + bool GetFilenameAndSave(bool saveAs); + bool OkayToStartNewFile(); + hGroup CreateDefaultDrawingGroup(); + void UpdateWindowTitles(); + void ClearExisting(); + void NewFile(); + bool SaveToFile(const Platform::Path &filename); + bool LoadAutosaveFor(const Platform::Path &filename); + std::function OnSaveFinished; + bool LoadFromFile(const Platform::Path &filename, bool canCancel = false); + void UpgradeLegacyData(); + bool LoadEntitiesFromFile(const Platform::Path &filename, EntityList *le, + SMesh *m, SShell *sh); + bool LoadEntitiesFromSlvs(const Platform::Path &filename, EntityList *le, + SMesh *m, SShell *sh); + bool ReloadAllLinked(const Platform::Path &filename, bool canCancel = false); + // And the various export options + void ExportAsPngTo(const Platform::Path &filename); + void ExportMeshTo(const Platform::Path &filename); + void ExportMeshAsStlTo(FILE *f, SMesh *sm); + void ExportMeshAsObjTo(FILE *fObj, FILE *fMtl, SMesh *sm); + void ExportMeshAsThreeJsTo(FILE *f, const Platform::Path &filename, + SMesh *sm, SOutlineList *sol); + void ExportMeshAsVrmlTo(FILE *f, const Platform::Path &filename, SMesh *sm); + void ExportViewOrWireframeTo(const Platform::Path &filename, bool exportWireframe); + void ExportSectionTo(const Platform::Path &filename); + void ExportWireframeCurves(SEdgeList *sel, SBezierList *sbl, + VectorFileWriter *out); + void ExportLinesAndMesh(SEdgeList *sel, SBezierList *sbl, SMesh *sm, + Vector u, Vector v, + Vector n, Vector origin, + double cameraTan, + VectorFileWriter *out); + + static void MenuAnalyze(Command id); + + // Additional display stuff + struct { + SContour path; + hEntity point; + } traced; + SEdgeList nakedEdges; + struct { + bool draw; + Vector ptA; + Vector ptB; + } extraLine; + struct { + bool draw, showOrigin; + Vector pt, u, v; + } justExportedInfo; + struct { + bool draw; + bool dirty; + Vector position; + } centerOfMass; + + class Clipboard { + public: + List r; + List c; + + void Clear(); + bool ContainsEntity(hEntity old); + hEntity NewEntityFor(hEntity old); + }; + Clipboard clipboard; + + void MarkGroupDirty(hGroup hg, bool onlyThis = false); + void MarkGroupDirtyByEntity(hEntity he); + + // Consistency checking on the sketch: stuff with missing dependencies + // will get deleted automatically. + struct { + int requests; + int groups; + int constraints; + int nonTrivialConstraints; + } deleted; + bool GroupExists(hGroup hg); + bool PruneOrphans(); + bool EntityExists(hEntity he); + bool GroupsInOrder(hGroup before, hGroup after); + bool PruneGroups(hGroup hg); + bool PruneRequestsAndConstraints(hGroup hg); + static void ShowNakedEdges(bool reportOnlyWhenNotOkay); + + enum class Generate : uint32_t { + DIRTY, + ALL, + REGEN, + UNTIL_ACTIVE, + }; + + void GenerateAll(Generate type = Generate::DIRTY, bool andFindFree = false, + bool genForBBox = false); + void SolveGroup(hGroup hg, bool andFindFree); + void SolveGroupAndReport(hGroup hg, bool andFindFree); + SolveResult TestRankForGroup(hGroup hg, int *rank = NULL); + void WriteEqSystemForGroup(hGroup hg); + void MarkDraggedParams(); + void ForceReferences(); + void UpdateCenterOfMass(); + + bool ActiveGroupsOkay(); + + // The system to be solved. + System *pSys; + System &sys; + + // All the TrueType fonts in memory + TtfFontList fonts; + + // Everything has been pruned, so we know there's no dangling references + // to entities that don't exist. Before that, we mustn't try to display + // the sketch! + bool allConsistent; + + bool scheduledGenerateAll; + bool scheduledShowTW; + Platform::TimerRef refreshTimer; + Platform::TimerRef autosaveTimer; + void Refresh(); + void ScheduleShowTW(); + void ScheduleGenerateAll(); + void ScheduleAutosave(); + + static void MenuHelp(Command id); + + void Clear(); + + // We allocate TW and sys on the heap to work around an MSVC problem + // where it puts zero-initialized global data in the binary (~30M of zeroes) + // in release builds. + SolveSpaceUI() + : pTW(new TextWindow()), TW(*pTW), + pSys(new System()), sys(*pSys) {} + + ~SolveSpaceUI() { + delete pTW; + delete pSys; + } +}; + +void ImportDxf(const Platform::Path &file); +void ImportDwg(const Platform::Path &file); +bool LinkIDF(const Platform::Path &filename, EntityList *le, SMesh *m, SShell *sh); +bool LinkStl(const Platform::Path &filename, EntityList *le, SMesh *m, SShell *sh); + +extern SolveSpaceUI SS; +extern Sketch SK; + +} // namespace SolveSpace + +#endif diff --git a/src/srf/boolean.cpp b/src/srf/boolean.cpp new file mode 100644 index 0000000..4778b18 --- /dev/null +++ b/src/srf/boolean.cpp @@ -0,0 +1,1049 @@ +//----------------------------------------------------------------------------- +// Top-level functions to compute the Boolean union, difference or intersection +// between two shells of rational polynomial surfaces. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +static int I; + +void SShell::MakeFromUnionOf(SShell *a, SShell *b) { + MakeFromBoolean(a, b, SSurface::CombineAs::UNION); +} + +void SShell::MakeFromDifferenceOf(SShell *a, SShell *b) { + MakeFromBoolean(a, b, SSurface::CombineAs::DIFFERENCE); +} + +void SShell::MakeFromIntersectionOf(SShell *a, SShell *b) { + MakeFromBoolean(a, b, SSurface::CombineAs::INTERSECTION); +} + +void SCurve::GetAxisAlignedBounding(Vector *ptMax, Vector *ptMin) const { + *ptMax = {VERY_NEGATIVE, VERY_NEGATIVE, VERY_NEGATIVE}; + *ptMin = {VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE}; + + for(int i = 0; i <= exact.deg; i++) { + exact.ctrl[i].MakeMaxMin(ptMax, ptMin); + } +} + +// We will be inserting other curve vertices into our curves to split them. +// This is helpful when curved surfaces become tangent along a trim and the +// usual tests for curve-surface intersection don't split the curve at a vertex. +// This is faster than the previous version that split at surface corners and +// handles more buggy cases. It's not clear this is the best way but it works ok. +static void FindVertsOnCurve(List *l, const SCurve *curve, SShell *sh) { + + Vector amax, amin; + curve->GetAxisAlignedBounding(&amax, &amin); + + for(const auto &sc : sh->curve) { + if(!sc.isExact) continue; + + Vector cmax, cmin; + sc.GetAxisAlignedBounding(&cmax, &cmin); + + if(Vector::BoundingBoxesDisjoint(amax, amin, cmax, cmin)) { + // They cannot possibly intersect, no curves to generate + continue; + } + + for(int i=0; i<2; i++) { + Vector pt = sc.exact.ctrl[ i==0 ? 0 : sc.exact.deg ]; + double t; + curve->exact.ClosestPointTo(pt, &t, /*must converge=*/ false); + double d = pt.Minus(curve->exact.PointAt(t)).Magnitude(); + if((t>LENGTH_EPS) && (t<(1.0-LENGTH_EPS)) && (d < LENGTH_EPS)) { + SInter inter; + inter.p = pt; + l->Add(&inter); + } + } + } +} + +//----------------------------------------------------------------------------- +// Take our original pwl curve. Wherever an edge intersects a surface within +// either agnstA or agnstB, split the piecewise linear element. Then refine +// the intersection so that it lies on all three relevant surfaces: the +// intersecting surface, srfA, and srfB. (So the pwl curve should lie at +// the intersection of srfA and srfB.) Return a new pwl curve with everything +// split. +//----------------------------------------------------------------------------- +SCurve SCurve::MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB, + SSurface *srfA, SSurface *srfB) const +{ + SCurve ret; + ret = *this; + ret.pts = {}; + + // First find any vertex that lies on our curve. + List vertpts = {}; + if(isExact) { + if(agnstA) + FindVertsOnCurve(&vertpts, this, agnstA); + if(agnstB) + FindVertsOnCurve(&vertpts, this, agnstB); + } + + const SCurvePt *p = pts.First(); + ssassert(p != NULL, "Cannot split an empty curve"); + SCurvePt prev = *p; + ret.pts.Add(p); + p = pts.NextAfter(p); + + for(; p; p = pts.NextAfter(p)) { + List il = {}; + + // Find all the intersections with the two passed shells + if(agnstA) + agnstA->AllPointsIntersecting(prev.p, p->p, &il, + /*asSegment=*/true, /*trimmed=*/false, /*inclTangent=*/true); + if(agnstB) + agnstB->AllPointsIntersecting(prev.p, p->p, &il, + /*asSegment=*/true, /*trimmed=*/false, /*inclTangent=*/true); + + if(!il.IsEmpty()) { + // The intersections were generated by intersecting the pwl + // edge against a surface; so they must be refined to lie + // exactly on the original curve. + il.ClearTags(); + SInter *pi; + for(pi = il.First(); pi; pi = il.NextAfter(pi)) { + if(pi->srf == srfA || pi->srf == srfB) { + // The edge certainly intersects the surfaces that it + // trims (at its endpoints), but those ones don't count. + // They are culled later, but no sense calculating them + // and they will cause numerical problems (since two + // of the three surfaces they're refined to lie on will + // be identical, so the matrix will be singular). + pi->tag = 1; + continue; + } + + Point2d puv; + (pi->srf)->ClosestPointTo(pi->p, &puv, /*mustConverge=*/false); + + // Split the edge if the intersection lies within the surface's + // trim curves, or within the chord tol of the trim curve; want + // some slop if points are close to edge and pwl is too coarse, + // and it doesn't hurt to split unnecessarily. + Point2d dummy = { 0, 0 }; + SBspUv::Class c = (pi->srf->bsp) ? pi->srf->bsp->ClassifyPoint(puv, dummy, pi->srf) : SBspUv::Class::OUTSIDE; + if(c == SBspUv::Class::OUTSIDE) { + double d = VERY_POSITIVE; + if(pi->srf->bsp) d = pi->srf->bsp->MinimumDistanceToEdge(puv, pi->srf); + if(d > SS.ChordTolMm()) { + pi->tag = 1; + continue; + } + } + + // We're keeping the intersection, so actually refine it. Finding the intersection + // to within EPS is important to match the ends of different chopped trim curves. + // The general 3-surface intersection fails to refine for trims where surfaces + // are tangent at the curve, but those trims are usually exact, so… + if(isExact) { + (pi->srf)->PointOnCurve(&exact, &(puv.x), &(puv.y)); + } else { + (pi->srf)->PointOnSurfaces(srfA, srfB, &(puv.x), &(puv.y)); + } + pi->p = (pi->srf)->PointAt(puv); + } + il.RemoveTagged(); + } + // Now add any vertex that is on this segment + const Vector lineStart = prev.p; + const Vector lineDirection = (p->p).Minus(prev.p); + for(const auto &vtx : vertpts) { + double t = (vtx.p.Minus(lineStart)).DivProjected(lineDirection); + if((0.0 < t) && (t < 1.0)) { + il.Add(&vtx); + } + } + if(!il.IsEmpty()) { + SInter *pi; + + // And now sort them in order along the line. Note that we must + // do that after refining, in case the refining would make two + // points switch places. + std::sort(il.begin(), il.end(), [&](const SInter &a, const SInter &b) { + double ta = (a.p.Minus(lineStart)).DivProjected(lineDirection); + double tb = (b.p.Minus(lineStart)).DivProjected(lineDirection); + + return (ta < tb); + }); + + // And now uses the intersections to generate our split pwl edge(s) + Vector prev = Vector::From(VERY_POSITIVE, 0, 0); + for(pi = il.First(); pi; pi = il.NextAfter(pi)) { + // On-edge intersection will generate same split point for + // both surfaces, so don't create zero-length edge. + if(!prev.Equals(pi->p)) { + SCurvePt scpt; + scpt.tag = 0; + scpt.p = pi->p; + scpt.vertex = true; + ret.pts.Add(&scpt); + } + prev = pi->p; + } + } + + il.Clear(); + ret.pts.Add(p); + prev = *p; + } + vertpts.Clear(); + return ret; +} + +void SShell::CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into) { +#pragma omp parallel for + for(int i=0; iMakeCopySplitAgainst(agnst, NULL, + surface.FindById(sc->surfA), + surface.FindById(sc->surfB)); + scn.source = opA ? SCurve::Source::A : SCurve::Source::B; +#pragma omp critical + { + hSCurve hsc = into->curve.AddAndAssignId(&scn); + // And note the new ID so that we can rewrite the trims appropriately + sc->newH = hsc; + } + } +} + +void SSurface::TrimFromEdgeList(SEdgeList *el, bool asUv) { + el->l.ClearTags(); + + STrimBy stb = {}; + for(;;) { + // Find an edge, any edge; we'll start from there. + SEdge *se; + for(se = el->l.First(); se; se = el->l.NextAfter(se)) { + if(se->tag) continue; + break; + } + if(!se) break; + se->tag = 1; + stb.start = se->a; + stb.finish = se->b; + stb.curve.v = se->auxA; + stb.backwards = se->auxB ? true : false; + + // Find adjoining edges from the same curve; those should be + // merged into a single trim. + bool merged; + do { + merged = false; + for(se = el->l.First(); se; se = el->l.NextAfter(se)) { + if(se->tag) continue; + if(se->auxA != (int)stb.curve.v) continue; + if(( se->auxB && !stb.backwards) || + (!se->auxB && stb.backwards)) continue; + + if((se->a).Equals(stb.finish)) { + stb.finish = se->b; + se->tag = 1; + merged = true; + } else if((se->b).Equals(stb.start)) { + stb.start = se->a; + se->tag = 1; + merged = true; + } + } + } while(merged); + + if(asUv) { + stb.start = PointAt(stb.start.x, stb.start.y); + stb.finish = PointAt(stb.finish.x, stb.finish.y); + } + + // And add the merged trim, with xyz (not uv like the polygon) pts + trim.Add(&stb); + } +} + +static bool KeepRegion(SSurface::CombineAs type, bool opA, SShell::Class shell, SShell::Class orig) +{ + bool inShell = (shell == SShell::Class::SURF_INSIDE), + outSide = (shell == SShell::Class::SURF_OUTSIDE), + coincSame = (shell == SShell::Class::SURF_COINC_SAME), + coincOpp = (shell == SShell::Class::SURF_COINC_OPP), + inOrig = (orig == SShell::Class::SURF_INSIDE); + + // This one line is not really part of this functions logic + if(!inOrig) return false; + + switch(type) { + case SSurface::CombineAs::UNION: + if(opA) { + return outSide; + } else { + return outSide || coincSame; + } + + case SSurface::CombineAs::DIFFERENCE: + if(opA) { + return outSide || coincOpp; + } else { + return inShell; + } + + case SSurface::CombineAs::INTERSECTION: + if(opA) { + return inShell; + } else { + return inShell || coincSame; + } + + default: ssassert(false, "Unexpected combine type"); + } +} +static bool KeepEdge(SSurface::CombineAs type, bool opA, + SShell::Class indir_shell, SShell::Class outdir_shell, + SShell::Class indir_orig, SShell::Class outdir_orig) +{ + bool keepIn = KeepRegion(type, opA, indir_shell, indir_orig), + keepOut = KeepRegion(type, opA, outdir_shell, outdir_orig); + + // If the regions to the left and right of this edge are both in or both + // out, then this edge is not useful and should be discarded. + if(keepIn && !keepOut) return true; + return false; +} + +static void TagByClassifiedEdge(SBspUv::Class bspclass, SShell::Class *indir, SShell::Class *outdir) +{ + switch(bspclass) { + case SBspUv::Class::INSIDE: + *indir = SShell::Class::SURF_INSIDE; + *outdir = SShell::Class::SURF_INSIDE; + break; + + case SBspUv::Class::OUTSIDE: + *indir = SShell::Class::SURF_OUTSIDE; + *outdir = SShell::Class::SURF_OUTSIDE; + break; + + case SBspUv::Class::EDGE_PARALLEL: + *indir = SShell::Class::SURF_INSIDE; + *outdir = SShell::Class::SURF_OUTSIDE; + break; + + case SBspUv::Class::EDGE_ANTIPARALLEL: + *indir = SShell::Class::SURF_OUTSIDE; + *outdir = SShell::Class::SURF_INSIDE; + break; + + default: + dbp("TagByClassifiedEdge: fail!"); + *indir = SShell::Class::SURF_OUTSIDE; + *outdir = SShell::Class::SURF_OUTSIDE; + break; + } +} + +static void DEBUGEDGELIST(SEdgeList *sel, SSurface *surf) { + dbp("print %d edges", sel->l.n); + SEdge *se; + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + Vector mid = (se->a).Plus(se->b).ScaledBy(0.5); + Vector arrow = (se->b).Minus(se->a); + swap(arrow.x, arrow.y); + arrow.x *= -1; + arrow = arrow.WithMagnitude(0.01); + arrow = arrow.Plus(mid); + + SS.nakedEdges.AddEdge(surf->PointAt(se->a.x, se->a.y), + surf->PointAt(se->b.x, se->b.y)); + SS.nakedEdges.AddEdge(surf->PointAt(mid.x, mid.y), + surf->PointAt(arrow.x, arrow.y)); + } +} + +//----------------------------------------------------------------------------- +// We are given src, with at least one edge, and avoid, a list of points to +// avoid. We return a chain of edges (that share endpoints), such that no +// point within the avoid list ever occurs in the middle of a chain. And we +// delete the edges in that chain from our source list. +//----------------------------------------------------------------------------- +void SSurface::FindChainAvoiding(SEdgeList *src, SEdgeList *dest, + SPointList *avoid) +{ + ssassert(!src->l.IsEmpty(), "Need at least one edge"); + // Start with an arbitrary edge. + dest->l.Add(src->l.First()); + src->l.ClearTags(); + src->l.First()->tag = 1; + + bool added; + do { + added = false; + // The start and finish of the current edge chain + Vector s = dest->l.First()->a, + f = dest->l.Last()->b; + + // We can attach a new edge at the start or finish, as long as that + // start or finish point isn't in the list of points to avoid. + bool startOkay = !avoid->ContainsPoint(s), + finishOkay = !avoid->ContainsPoint(f); + + // Now look for an unused edge that joins at the start or finish of + // our chain (if permitted by the avoid list). + SEdge *se; + for(se = src->l.First(); se; se = src->l.NextAfter(se)) { + if(se->tag) continue; + if(startOkay && s.Equals(se->b)) { + dest->l.AddToBeginning(se); + s = se->a; + se->tag = 1; + startOkay = !avoid->ContainsPoint(s); + } else if(finishOkay && f.Equals(se->a)) { + dest->l.Add(se); + f = se->b; + se->tag = 1; + finishOkay = !avoid->ContainsPoint(f); + } else { + continue; + } + + added = true; + } + } while(added); + + src->l.RemoveTagged(); +} + +void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv, + Vector *pt, + Vector *enin, Vector *enout, + Vector *surfn, + uint32_t auxA, + SShell *shell, SShell *sha, SShell *shb) +{ + // the midpoint of the edge + Point2d muv = (auv.Plus(buv)).ScaledBy(0.5); + + *pt = PointAt(muv); + + // If this edge just approximates a curve, then refine our midpoint so + // so that it actually lies on that curve too. Otherwise stuff like + // point-on-face tests will fail, since the point won't actually lie + // on the other face. + hSCurve hc = { auxA }; + SCurve *sc = shell->curve.FindById(hc); + if(sc->isExact && sc->exact.deg != 1) { + double t; + sc->exact.ClosestPointTo(*pt, &t, /*mustConverge=*/false); + *pt = sc->exact.PointAt(t); + } else if(!sc->isExact) { + SSurface *trimmedA = sc->GetSurfaceA(sha, shb), + *trimmedB = sc->GetSurfaceB(sha, shb); + *pt = trimmedA->ClosestPointOnThisAndSurface(trimmedB, *pt); + } + ClosestPointTo(*pt, &muv); + + *surfn = NormalAt(muv.x, muv.y); + + // Compute the edge's inner normal in xyz space. + Vector ab = (PointAt(auv)).Minus(PointAt(buv)), + enxyz = (ab.Cross(*surfn)).WithMagnitude(SS.ChordTolMm()); + // And based on that, compute the edge's inner normal in uv space. This + // vector is perpendicular to the edge in xyz, but not necessarily in uv. + Vector tu, tv, tx, ty; + TangentsAt(muv.x, muv.y, &tu, &tv); + Vector n = tu.Cross(tv); + // since tu and tv may not be orthogonal, use y in place of v, x in place of u. + // |y| = |v|sin(theta) where theta is the angle between tu and tv. + ty = n.Cross(tu).ScaledBy(1.0/tu.MagSquared()); + tx = tv.Cross(n).ScaledBy(1.0/tv.MagSquared()); + + Point2d enuv; + enuv.x = enxyz.Dot(tx) / tx.MagSquared(); + enuv.y = enxyz.Dot(ty) / ty.MagSquared(); + + // Compute the inner and outer normals of this edge (within the srf), + // in xyz space. These are not necessarily antiparallel, if the + // surface is curved. + Vector pin = PointAt(muv.Minus(enuv)), + pout = PointAt(muv.Plus(enuv)); + *enin = pin.Minus(*pt), + *enout = pout.Minus(*pt); +// ideally this should work (fail screwdriver file) +// *enin = enxyz.ScaledBy(-1.0); +// *enout = enxyz; +} + +//----------------------------------------------------------------------------- +// Trim this surface against the specified shell, in the way that's appropriate +// for the specified Boolean operation type (and which operand we are). We +// also need a pointer to the shell that contains our own surface, since that +// contains our original trim curves. +//----------------------------------------------------------------------------- +SSurface SSurface::MakeCopyTrimAgainst(SShell *parent, + SShell *sha, SShell *shb, + SShell *into, + SSurface::CombineAs type, + int dbg_index) +{ + bool opA = (parent == sha); + SShell *agnst = opA ? shb : sha; + + SSurface ret; + // The returned surface is identical, just the trim curves change + ret = *this; + ret.trim = {}; + + // First, build a list of the existing trim curves; update them to use + // the split curves. + STrimBy *stb; + for(stb = trim.First(); stb; stb = trim.NextAfter(stb)) { + STrimBy stn = *stb; + stn.curve = (parent->curve.FindById(stn.curve))->newH; + ret.trim.Add(&stn); + } + + if(type == SSurface::CombineAs::DIFFERENCE && !opA) { + // The second operand of a Boolean difference gets turned inside out + ret.Reverse(); + } + + // Build up our original trim polygon; remember the coordinates could + // be changed if we just flipped the surface normal, and we are using + // the split curves (not the original curves). + SEdgeList orig = {}; + ret.MakeEdgesInto(into, &orig, MakeAs::UV); + ret.trim.Clear(); + // which means that we can't necessarily use the old BSP... + SBspUv *origBsp = SBspUv::From(&orig, &ret); + + // And now intersect the other shell against us + SEdgeList inter = {}; + + SSurface *ss; + for(SCurve &sc : into->curve) { + if(sc.source != SCurve::Source::INTERSECTION) continue; + if(opA) { + if(sc.surfA != h) continue; + ss = shb->surface.FindById(sc.surfB); + } else { + if(sc.surfB != h) continue; + ss = sha->surface.FindById(sc.surfA); + } + int i; + for(i = 1; i < sc.pts.n; i++) { + Vector a = sc.pts[i-1].p, + b = sc.pts[i].p; + + Point2d auv, buv; + ss->ClosestPointTo(a, &(auv.x), &(auv.y)); + ss->ClosestPointTo(b, &(buv.x), &(buv.y)); + + SBspUv::Class c = (ss->bsp) ? ss->bsp->ClassifyEdge(auv, buv, ss) : SBspUv::Class::OUTSIDE; + if(c != SBspUv::Class::OUTSIDE) { + Vector ta = Vector::From(0, 0, 0); + Vector tb = Vector::From(0, 0, 0); + ret.ClosestPointTo(a, &(ta.x), &(ta.y)); + ret.ClosestPointTo(b, &(tb.x), &(tb.y)); + + Vector tn = ret.NormalAt(ta.x, ta.y); + Vector sn = ss->NormalAt(auv.x, auv.y); + + // We are subtracting the portion of our surface that + // lies in the shell, so the in-plane edge normal should + // point opposite to the surface normal. + bool bkwds = true; + if((tn.Cross(b.Minus(a))).Dot(sn) < 0) bkwds = !bkwds; + if((type == SSurface::CombineAs::DIFFERENCE && !opA) || + (type == SSurface::CombineAs::INTERSECTION)) { // Invert all newly created edges for intersection + bkwds = !bkwds; + } + if(bkwds) { + inter.AddEdge(tb, ta, sc.h.v, 1); + } else { + inter.AddEdge(ta, tb, sc.h.v, 0); + } + } + } + } + + // Record all the points where more than two edges join, which I will call + // the choosing points. If two edges join at a non-choosing point, then + // they must either both be kept or both be discarded (since that would + // otherwise create an open contour). + SPointList choosing = {}; + SEdge *se; + for(se = orig.l.First(); se; se = orig.l.NextAfter(se)) { + choosing.IncrementTagFor(se->a); + choosing.IncrementTagFor(se->b); + } + for(se = inter.l.First(); se; se = inter.l.NextAfter(se)) { + choosing.IncrementTagFor(se->a); + choosing.IncrementTagFor(se->b); + } + SPoint *sp; + for(sp = choosing.l.First(); sp; sp = choosing.l.NextAfter(sp)) { + if(sp->tag == 2) { + sp->tag = 1; + } else { + sp->tag = 0; + } + } + choosing.l.RemoveTagged(); + + // The list of edges to trim our new surface, a combination of edges from + // our original and intersecting edge lists. + SEdgeList final = {}; + + while(!orig.l.IsEmpty()) { + SEdgeList chain = {}; + FindChainAvoiding(&orig, &chain, &choosing); + + // Arbitrarily choose an edge within the chain to classify; they + // should all be the same, though. + se = &(chain.l[chain.l.n/2]); + + Point2d auv = (se->a).ProjectXy(), + buv = (se->b).ProjectXy(); + + Vector pt, enin, enout, surfn; + ret.EdgeNormalsWithinSurface(auv, buv, &pt, &enin, &enout, &surfn, + se->auxA, into, sha, shb); + + SShell::Class indir_shell, outdir_shell, indir_orig, outdir_orig; + + indir_orig = SShell::Class::SURF_INSIDE; + outdir_orig = SShell::Class::SURF_OUTSIDE; + + agnst->ClassifyEdge(&indir_shell, &outdir_shell, + ret.PointAt(auv), ret.PointAt(buv), pt, + enin, enout, surfn); + + if(KeepEdge(type, opA, indir_shell, outdir_shell, + indir_orig, outdir_orig)) + { + for(se = chain.l.First(); se; se = chain.l.NextAfter(se)) { + final.AddEdge(se->a, se->b, se->auxA, se->auxB); + } + } + chain.Clear(); + } + + while(!inter.l.IsEmpty()) { + SEdgeList chain = {}; + FindChainAvoiding(&inter, &chain, &choosing); + + // Any edge in the chain, same as above. + se = &(chain.l[chain.l.n/2]); + + Point2d auv = (se->a).ProjectXy(), + buv = (se->b).ProjectXy(); + + Vector pt, enin, enout, surfn; + ret.EdgeNormalsWithinSurface(auv, buv, &pt, &enin, &enout, &surfn, + se->auxA, into, sha, shb); + + SShell::Class indir_shell, outdir_shell, indir_orig, outdir_orig; + + SBspUv::Class c_this = (origBsp) ? origBsp->ClassifyEdge(auv, buv, &ret) : SBspUv::Class::OUTSIDE; + TagByClassifiedEdge(c_this, &indir_orig, &outdir_orig); + + agnst->ClassifyEdge(&indir_shell, &outdir_shell, + ret.PointAt(auv), ret.PointAt(buv), pt, + enin, enout, surfn); + + if(KeepEdge(type, opA, indir_shell, outdir_shell, + indir_orig, outdir_orig)) + { + for(se = chain.l.First(); se; se = chain.l.NextAfter(se)) { + final.AddEdge(se->a, se->b, se->auxA, se->auxB); + } + } + chain.Clear(); + } + + // Cull extraneous edges; duplicates or anti-parallel pairs. In particular, + // we can get duplicate edges if our surface intersects the other shell + // at an edge, so that both surfaces intersect coincident (and both + // generate an intersection edge). + final.CullExtraneousEdges(/*both=*/true); + + // Use our reassembled edges to trim the new surface. + ret.TrimFromEdgeList(&final, /*asUv=*/true); + + SPolygon poly = {}; + final.l.ClearTags(); + if(!final.AssemblePolygon(&poly, NULL, /*keepDir=*/true)) +#pragma omp critical + { + into->booleanFailed = true; + dbp("failed: I=%d, avoid=%d", I+dbg_index, choosing.l.n); + DEBUGEDGELIST(&final, &ret); + } + poly.Clear(); + + choosing.Clear(); + final.Clear(); + inter.Clear(); + orig.Clear(); + return ret; +} + +void SShell::CopySurfacesTrimAgainst(SShell *sha, SShell *shb, SShell *into, SSurface::CombineAs type) { + std::vector ssn(surface.n); +#pragma omp parallel for + for (int i = 0; i < surface.n; i++) + { + SSurface *ss = &surface[i]; + ssn[i] = ss->MakeCopyTrimAgainst(this, sha, shb, into, type, i); + } + + for (int i = 0; i < surface.n; i++) + { + surface[i].newH = into->surface.AddAndAssignId(&ssn[i]); + } + I += surface.n; +} + +void SShell::MakeIntersectionCurvesAgainst(SShell *agnst, SShell *into) { +#pragma omp parallel for + for(int i = 0; i< surface.n; i++) { + SSurface *sa = &surface[i]; + + for(SSurface &sb : agnst->surface){ + // Intersect every surface from our shell against every surface + // from agnst; this will add zero or more curves to the curve + // list for into. + sa->IntersectAgainst(&sb, this, agnst, into); + } + } +} + +void SShell::CleanupAfterBoolean() { + for(SSurface &ss : surface) { + ss.edges.Clear(); + } +} + +//----------------------------------------------------------------------------- +// All curves contain handles to the two surfaces that they trim. After a +// Boolean or assembly, we must rewrite those handles to refer to the curves +// by their new IDs. +//----------------------------------------------------------------------------- +void SShell::RewriteSurfaceHandlesForCurves(SShell *a, SShell *b) { + for(SCurve &sc : curve) { + sc.surfA = sc.GetSurfaceA(a, b)->newH, + sc.surfB = sc.GetSurfaceB(a, b)->newH; + } +} + +//----------------------------------------------------------------------------- +// Copy all the surfaces and curves from two different shells into a single +// shell. The only difficulty is to rewrite all of their handles; we don't +// look for any surface intersections, so if two objects interfere then the +// result is just self-intersecting. This is used for assembly, since it's +// much faster than merging as union. +//----------------------------------------------------------------------------- +void SShell::MakeFromAssemblyOf(SShell *a, SShell *b) { + booleanFailed = false; + + Vector t = Vector::From(0, 0, 0); + Quaternion q = Quaternion::IDENTITY; + int i = 0; + SShell *ab; + + // First, copy over all the curves. Note which shell (a or b) each curve + // came from, but assign it a new ID. + curve.ReserveMore(a->curve.n + b->curve.n); + SCurve cn; + for(i = 0; i < 2; i++) { + ab = (i == 0) ? a : b; + for(SCurve &c : ab->curve) { + cn = SCurve::FromTransformationOf(&c, t, q, 1.0); + cn.source = (i == 0) ? SCurve::Source::A : SCurve::Source::B; + // surfA and surfB are wrong now, and we can't fix them until + // we've assigned IDs to the surfaces. So we'll get that later. + c.newH = curve.AddAndAssignId(&cn); + } + } + + // Likewise copy over all the surfaces. + surface.ReserveMore(a->surface.n + b->surface.n); + SSurface sn; + for(i = 0; i < 2; i++) { + ab = (i == 0) ? a : b; + for(SSurface &s : ab->surface) { + sn = SSurface::FromTransformationOf(&s, t, q, 1.0, /*includingTrims=*/true); + // All the trim curve IDs get rewritten; we know the new handles + // to the curves since we recorded them in the previous step. + STrimBy *stb; + for(stb = sn.trim.First(); stb; stb = sn.trim.NextAfter(stb)) { + stb->curve = ab->curve.FindById(stb->curve)->newH; + } + s.newH = surface.AddAndAssignId(&sn); + } + } + + // Finally, rewrite the surfaces associated with each curve to use the + // new handles. + RewriteSurfaceHandlesForCurves(a, b); +} + +void SShell::MakeFromBoolean(SShell *a, SShell *b, SSurface::CombineAs type) { + booleanFailed = false; + + a->MakeClassifyingBsps(NULL); + b->MakeClassifyingBsps(NULL); + + // Copy over all the original curves, splitting them so that a + // piecewise linear segment never crosses a surface from the other + // shell. + a->CopyCurvesSplitAgainst(/*opA=*/true, b, this); + b->CopyCurvesSplitAgainst(/*opA=*/false, a, this); + + // Generate the intersection curves for each surface in A against all + // the surfaces in B (which is all of the intersection curves). + a->MakeIntersectionCurvesAgainst(b, this); + + for(SCurve &sc : curve) { + SSurface *srfA = sc.GetSurfaceA(a, b), + *srfB = sc.GetSurfaceB(a, b); + + sc.RemoveShortSegments(srfA, srfB); + } + + // And clean up the piecewise linear things we made as a calculation aid + a->CleanupAfterBoolean(); + b->CleanupAfterBoolean(); + // Remake the classifying BSPs with the split (and short-segment-removed) + // curves + a->MakeClassifyingBsps(this); + b->MakeClassifyingBsps(this); + + if(b->surface.IsEmpty() || a->surface.IsEmpty()) { + I = 1000000; + } else { + I = 0; + } + // Then trim and copy the surfaces + a->CopySurfacesTrimAgainst(a, b, this, type); + b->CopySurfacesTrimAgainst(a, b, this, type); + + // Now that we've copied the surfaces, we know their new hSurfaces, so + // rewrite the curves to refer to the surfaces by their handles in the + // result. + RewriteSurfaceHandlesForCurves(a, b); + + // And clean up the piecewise linear things we made as a calculation aid + a->CleanupAfterBoolean(); + b->CleanupAfterBoolean(); +} + +//----------------------------------------------------------------------------- +// All of the BSP routines that we use to perform and accelerate polygon ops. +//----------------------------------------------------------------------------- +void SShell::MakeClassifyingBsps(SShell *useCurvesFrom) { +#pragma omp parallel for + for(int i = 0; il.First(); se; se = el->l.NextAfter(se)) { + work.AddEdge(se->a, se->b, se->auxA, se->auxB); + } + std::sort(work.l.begin(), work.l.end(), [](SEdge const &a, SEdge const &b) { + double la = (a.a).Minus(a.b).Magnitude(), lb = (b.a).Minus(b.b).Magnitude(); + // Sort in descending order, longest first. This improves numerical + // stability for the normals. + return la > lb; + }); + SBspUv *bsp = NULL; + for(se = work.l.First(); se; se = work.l.NextAfter(se)) { + bsp = InsertOrCreateEdge(bsp, (se->a).ProjectXy(), (se->b).ProjectXy(), srf); + } + + work.Clear(); + return bsp; +} + +//----------------------------------------------------------------------------- +// The points in this BSP are in uv space, but we want to apply our tolerances +// consistently in xyz (i.e., we want to say a point is on-edge if its xyz +// distance to that edge is less than LENGTH_EPS, irrespective of its distance +// in uv). So we linearize the surface about the point we're considering and +// then do the test. That preserves point-on-line relationships, and the only +// time we care about exact correctness is when we're very close to the line, +// which is when the linearization is accurate. +//----------------------------------------------------------------------------- + +void SBspUv::ScalePoints(Point2d *pt, Point2d *a, Point2d *b, SSurface *srf) const { + Vector tu, tv; + srf->TangentsAt(pt->x, pt->y, &tu, &tv); + double mu = tu.Magnitude(), mv = tv.Magnitude(); + + pt->x *= mu; pt->y *= mv; + a ->x *= mu; a ->y *= mv; + b ->x *= mu; b ->y *= mv; +} + +double SBspUv::ScaledSignedDistanceToLine(Point2d pt, Point2d a, Point2d b, + SSurface *srf) const +{ + ScalePoints(&pt, &a, &b, srf); + + Point2d n = ((b.Minus(a)).Normal()).WithMagnitude(1); + double d = a.Dot(n); + + return pt.Dot(n) - d; +} + +double SBspUv::ScaledDistanceToLine(Point2d pt, Point2d a, Point2d b, bool asSegment, + SSurface *srf) const +{ + ScalePoints(&pt, &a, &b, srf); + + return pt.DistanceToLine(a, b, asSegment); +} + +SBspUv *SBspUv::InsertOrCreateEdge(SBspUv *where, Point2d ea, Point2d eb, SSurface *srf) { + if(where == NULL) { + SBspUv *ret = Alloc(); + ret->a = ea; + ret->b = eb; + return ret; + } + where->InsertEdge(ea, eb, srf); + return where; +} + +void SBspUv::InsertEdge(Point2d ea, Point2d eb, SSurface *srf) { + double dea = ScaledSignedDistanceToLine(ea, a, b, srf), + deb = ScaledSignedDistanceToLine(eb, a, b, srf); + + if(fabs(dea) < LENGTH_EPS && fabs(deb) < LENGTH_EPS) { + // Line segment is coincident with this one, store in same node + SBspUv *m = Alloc(); + m->a = ea; + m->b = eb; + m->more = more; + more = m; + } else if(fabs(dea) < LENGTH_EPS) { + // Point A lies on this line, but point B does not + if(deb > 0) { + pos = InsertOrCreateEdge(pos, ea, eb, srf); + } else { + neg = InsertOrCreateEdge(neg, ea, eb, srf); + } + } else if(fabs(deb) < LENGTH_EPS) { + // Point B lies on this line, but point A does not + if(dea > 0) { + pos = InsertOrCreateEdge(pos, ea, eb, srf); + } else { + neg = InsertOrCreateEdge(neg, ea, eb, srf); + } + } else if(dea > 0 && deb > 0) { + pos = InsertOrCreateEdge(pos, ea, eb, srf); + } else if(dea < 0 && deb < 0) { + neg = InsertOrCreateEdge(neg, ea, eb, srf); + } else { + // New edge crosses this one; we need to split. + Point2d n = ((b.Minus(a)).Normal()).WithMagnitude(1); + double d = a.Dot(n); + double t = (d - n.Dot(ea)) / (n.Dot(eb.Minus(ea))); + Point2d pi = ea.Plus((eb.Minus(ea)).ScaledBy(t)); + if(dea > 0) { + pos = InsertOrCreateEdge(pos, ea, pi, srf); + neg = InsertOrCreateEdge(neg, pi, eb, srf); + } else { + neg = InsertOrCreateEdge(neg, ea, pi, srf); + pos = InsertOrCreateEdge(pos, pi, eb, srf); + } + } + return; +} + +SBspUv::Class SBspUv::ClassifyPoint(Point2d p, Point2d eb, SSurface *srf) const { + double dp = ScaledSignedDistanceToLine(p, a, b, srf); + + if(fabs(dp) < LENGTH_EPS) { + const SBspUv *f = this; + while(f) { + Point2d ba = (f->b).Minus(f->a); + if(ScaledDistanceToLine(p, f->a, ba, /*asSegment=*/true, srf) < LENGTH_EPS) { + if(ScaledDistanceToLine(eb, f->a, ba, /*asSegment=*/false, srf) < LENGTH_EPS){ + if(ba.Dot(eb.Minus(p)) > 0) { + return Class::EDGE_PARALLEL; + } else { + return Class::EDGE_ANTIPARALLEL; + } + } else { + return Class::EDGE_OTHER; + } + } + f = f->more; + } + // Pick arbitrarily which side to send it down, doesn't matter + Class c1 = neg ? neg->ClassifyPoint(p, eb, srf) : Class::OUTSIDE; + Class c2 = pos ? pos->ClassifyPoint(p, eb, srf) : Class::INSIDE; + if(c1 != c2) { + dbp("MISMATCH: %d %d %08x %08x", c1, c2, neg, pos); + } + return c1; + } else if(dp > 0) { + return pos ? pos->ClassifyPoint(p, eb, srf) : Class::INSIDE; + } else { + return neg ? neg->ClassifyPoint(p, eb, srf) : Class::OUTSIDE; + } +} + +SBspUv::Class SBspUv::ClassifyEdge(Point2d ea, Point2d eb, SSurface *srf) const { + SBspUv::Class ret = ClassifyPoint((ea.Plus(eb)).ScaledBy(0.5), eb, srf); + if(ret == Class::EDGE_OTHER) { + // Perhaps the edge is tangent at its midpoint (and we screwed up + // somewhere earlier and failed to split it); try a different + // point on the edge. + ret = ClassifyPoint(ea.Plus((eb.Minus(ea)).ScaledBy(0.294)), eb, srf); + } + return ret; +} + +double SBspUv::MinimumDistanceToEdge(Point2d p, SSurface *srf) const { + + double dn = (neg) ? neg->MinimumDistanceToEdge(p, srf) : VERY_POSITIVE; + double dp = (pos) ? pos->MinimumDistanceToEdge(p, srf) : VERY_POSITIVE; + + Point2d as = a, bs = b; + ScalePoints(&p, &as, &bs, srf); + double d = p.DistanceToLine(as, bs.Minus(as), /*asSegment=*/true); + + return min(d, min(dn, dp)); +} + +} // namespace SolveSpace diff --git a/src/srf/curve.cpp b/src/srf/curve.cpp new file mode 100644 index 0000000..ef3e19a --- /dev/null +++ b/src/srf/curve.cpp @@ -0,0 +1,886 @@ +//----------------------------------------------------------------------------- +// Anything involving curves and sets of curves (except for the real math, +// which is in ratpoly.cpp). +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +SBezier SBezier::From(Vector4 p0, Vector4 p1) { + SBezier ret = {}; + ret.deg = 1; + ret.weight[0] = p0.w; + ret.ctrl [0] = p0.PerspectiveProject(); + ret.weight[1] = p1.w; + ret.ctrl [1] = p1.PerspectiveProject(); + return ret; +} + +SBezier SBezier::From(Vector4 p0, Vector4 p1, Vector4 p2) { + SBezier ret = {}; + ret.deg = 2; + ret.weight[0] = p0.w; + ret.ctrl [0] = p0.PerspectiveProject(); + ret.weight[1] = p1.w; + ret.ctrl [1] = p1.PerspectiveProject(); + ret.weight[2] = p2.w; + ret.ctrl [2] = p2.PerspectiveProject(); + return ret; +} + +SBezier SBezier::From(Vector4 p0, Vector4 p1, Vector4 p2, Vector4 p3) { + SBezier ret = {}; + ret.deg = 3; + ret.weight[0] = p0.w; + ret.ctrl [0] = p0.PerspectiveProject(); + ret.weight[1] = p1.w; + ret.ctrl [1] = p1.PerspectiveProject(); + ret.weight[2] = p2.w; + ret.ctrl [2] = p2.PerspectiveProject(); + ret.weight[3] = p3.w; + ret.ctrl [3] = p3.PerspectiveProject(); + return ret; +} + +SBezier SBezier::From(Vector p0, Vector p1) { + return SBezier::From(p0.Project4d(), + p1.Project4d()); +} + +SBezier SBezier::From(Vector p0, Vector p1, Vector p2) { + return SBezier::From(p0.Project4d(), + p1.Project4d(), + p2.Project4d()); +} + +SBezier SBezier::From(Vector p0, Vector p1, Vector p2, Vector p3) { + return SBezier::From(p0.Project4d(), + p1.Project4d(), + p2.Project4d(), + p3.Project4d()); +} + +Vector SBezier::Start() const { + return ctrl[0]; +} + +Vector SBezier::Finish() const { + return ctrl[deg]; +} + +void SBezier::Reverse() { + int i; + for(i = 0; i < (deg+1)/2; i++) { + swap(ctrl[i], ctrl[deg-i]); + swap(weight[i], weight[deg-i]); + } +} + +void SBezier::ScaleSelfBy(double s) { + int i; + for(i = 0; i <= deg; i++) { + ctrl[i] = ctrl[i].ScaledBy(s); + } +} + +void SBezier::GetBoundingProjd(Vector u, Vector orig, + double *umin, double *umax) const +{ + int i; + for(i = 0; i <= deg; i++) { + double ut = ((ctrl[i]).Minus(orig)).Dot(u); + if(ut < *umin) *umin = ut; + if(ut > *umax) *umax = ut; + } +} + +SBezier SBezier::TransformedBy(Vector t, Quaternion q, double scale) const { + SBezier ret = *this; + int i; + for(i = 0; i <= deg; i++) { + ret.ctrl[i] = (ret.ctrl[i]).ScaledBy(scale); + ret.ctrl[i] = (q.Rotate(ret.ctrl[i])).Plus(t); + } + return ret; +} + +//----------------------------------------------------------------------------- +// Does this curve lie entirely within the specified plane? It does if all +// the control points lie in that plane. +//----------------------------------------------------------------------------- +bool SBezier::IsInPlane(Vector n, double d) const { + int i; + for(i = 0; i <= deg; i++) { + if(fabs((ctrl[i]).Dot(n) - d) > LENGTH_EPS) { + return false; + } + } + return true; +} + +//----------------------------------------------------------------------------- +// Is this Bezier exactly the arc of a circle, projected along the specified +// axis? If yes, return that circle's center and radius. +//----------------------------------------------------------------------------- +bool SBezier::IsCircle(Vector axis, Vector *center, double *r) const { + if(deg != 2) return false; + + if(ctrl[1].DistanceToLine(ctrl[0], ctrl[2].Minus(ctrl[0])) < LENGTH_EPS) { + // This is almost a line segment. So it's a circle with very large + // radius, which is likely to make code that tries to handle circles + // blow up. So return false. + return false; + } + + Vector t0 = (ctrl[0]).Minus(ctrl[1]), + t2 = (ctrl[2]).Minus(ctrl[1]), + r0 = axis.Cross(t0), + r2 = axis.Cross(t2); + + *center = Vector::AtIntersectionOfLines(ctrl[0], (ctrl[0]).Plus(r0), + ctrl[2], (ctrl[2]).Plus(r2), + NULL, NULL, NULL); + + double rd0 = center->Minus(ctrl[0]).Magnitude(), + rd2 = center->Minus(ctrl[2]).Magnitude(); + if(fabs(rd0 - rd2) > LENGTH_EPS) { + return false; + } + *r = rd0; + + Vector u = r0.WithMagnitude(1), + v = (axis.Cross(u)).WithMagnitude(1); + Point2d c2 = center->Project2d(u, v), + pa2 = (ctrl[0]).Project2d(u, v).Minus(c2), + pb2 = (ctrl[2]).Project2d(u, v).Minus(c2); + + double thetaa = atan2(pa2.y, pa2.x), // in fact always zero due to csys + thetab = atan2(pb2.y, pb2.x), + dtheta = WRAP_NOT_0(thetab - thetaa, 2*PI); + if(dtheta > PI) { + // Not possible with a second order Bezier arc; so we must have + // the points backwards. + dtheta = 2*PI - dtheta; + } + + if(fabs(weight[1] - cos(dtheta/2)) > LENGTH_EPS) { + return false; + } + + return true; +} + +bool SBezier::IsRational() const { + int i; + for(i = 0; i <= deg; i++) { + if(fabs(weight[i] - 1) > LENGTH_EPS) return true; + } + return false; +} + +//----------------------------------------------------------------------------- +// Apply a perspective transformation to a rational Bezier curve, calculating +// the new weights as required. +//----------------------------------------------------------------------------- +SBezier SBezier::InPerspective(Vector u, Vector v, Vector n, + Vector origin, double cameraTan) const +{ + Quaternion q = Quaternion::From(u, v); + q = q.Inverse(); + // we want Q*(p - o) = Q*p - Q*o + SBezier ret = this->TransformedBy(q.Rotate(origin).ScaledBy(-1), q, 1.0); + int i; + for(i = 0; i <= deg; i++) { + Vector4 ct = Vector4::From(ret.weight[i], ret.ctrl[i]); + // so the desired curve, before perspective, is + // (x/w, y/w, z/w) + // and after perspective is + // ((x/w)/(1 - (z/w)*cameraTan, ... + // = (x/(w - z*cameraTan), ... + // so we want to let w' = w - z*cameraTan + ct.w = ct.w - ct.z*cameraTan; + + ret.ctrl[i] = ct.PerspectiveProject(); + ret.weight[i] = ct.w; + } + return ret; +} + +bool SBezier::Equals(SBezier *b) const { + // We just test of identical degree and control points, even though two + // curves could still be coincident (even sharing endpoints). + if(deg != b->deg) return false; + int i; + for(i = 0; i <= deg; i++) { + if(!(ctrl[i]).Equals(b->ctrl[i])) return false; + if(fabs(weight[i] - b->weight[i]) > LENGTH_EPS) return false; + } + return true; +} + +void SBezierList::Clear() { + l.Clear(); +} + +void SBezierList::ScaleSelfBy(double s) { + SBezier *sb; + for(sb = l.First(); sb; sb = l.NextAfter(sb)) { + sb->ScaleSelfBy(s); + } +} + +//----------------------------------------------------------------------------- +// If our list contains multiple identical Beziers (in either forward or +// reverse order), then cull them. If both is true, both beziers are removed. +// Otherwise only one of them is removed. +//----------------------------------------------------------------------------- +void SBezierList::CullIdenticalBeziers(bool both) { + int i, j; + + l.ClearTags(); + for(i = 0; i < l.n; i++) { + SBezier *bi = &(l[i]), bir; + bir = *bi; + bir.Reverse(); + + for(j = i + 1; j < l.n; j++) { + SBezier *bj = &(l[j]); + if(bj->Equals(bi) || + bj->Equals(&bir)) + { + if (both) bi->tag = 1; + bj->tag = 1; + } + } + } + l.RemoveTagged(); +} + +//----------------------------------------------------------------------------- +// Find all the points where a list of Bezier curves intersects another list +// of Bezier curves. We do this by intersecting their piecewise linearizations, +// and then refining any intersections that we find to lie exactly on the +// curves. So this will screw up on tangencies and stuff, but otherwise should +// be fine. +//----------------------------------------------------------------------------- +void SBezierList::AllIntersectionsWith(SBezierList *sblb, SPointList *spl) const { + for(const SBezier *sba = l.First(); sba; sba = l.NextAfter(sba)) { + for(const SBezier *sbb = sblb->l.First(); sbb; sbb = sblb->l.NextAfter(sbb)) { + sbb->AllIntersectionsWith(sba, spl); + } + } +} +void SBezier::AllIntersectionsWith(const SBezier *sbb, SPointList *spl) const { + SPointList splRaw = {}; + SEdgeList sea, seb; + sea = {}; + seb = {}; + this->MakePwlInto(&sea); + sbb ->MakePwlInto(&seb); + SEdge *se; + for(se = sea.l.First(); se; se = sea.l.NextAfter(se)) { + // This isn't quite correct, since AnyEdgeCrossings doesn't count + // the case where two pairs of line segments intersect at their + // vertices. So this isn't robust, although that case isn't very + // likely. + seb.AnyEdgeCrossings(se->a, se->b, NULL, &splRaw); + } + SPoint *sp; + for(sp = splRaw.l.First(); sp; sp = splRaw.l.NextAfter(sp)) { + Vector p = sp->p; + if(PointOnThisAndCurve(sbb, &p)) { + if(!spl->ContainsPoint(p)) spl->Add(p); + } + } + sea.Clear(); + seb.Clear(); + splRaw.Clear(); +} + +//----------------------------------------------------------------------------- +// Find a plane that contains all of the curves in this list. If the curves +// are all colinear (or coincident, or empty), then that plane is not exactly +// determined but we choose the additional degree(s) of freedom arbitrarily. +// Returns true if all the curves are coplanar, otherwise false. +//----------------------------------------------------------------------------- +bool SBezierList::GetPlaneContainingBeziers(Vector *p, Vector *u, Vector *v, + Vector *notCoplanarAt) const +{ + Vector pt, ptFar, ptOffLine, dp, n; + double farMax, offLineMax; + int i; + + // Get any point on any Bezier; or an arbitrary point if list is empty. + if(!l.IsEmpty()) { + pt = l[0].Start(); + } else { + pt = Vector::From(0, 0, 0); + } + ptFar = ptOffLine = pt; + + // Get the point farthest from our arbitrary point. + farMax = VERY_NEGATIVE; + for(const SBezier *sb = l.First(); sb; sb = l.NextAfter(sb)) { + for(i = 0; i <= sb->deg; i++) { + double m = (pt.Minus(sb->ctrl[i])).Magnitude(); + if(m > farMax) { + ptFar = sb->ctrl[i]; + farMax = m; + } + } + } + if(ptFar.Equals(pt)) { + // The points are all coincident. So neither basis vector matters. + *p = pt; + *u = Vector::From(1, 0, 0); + *v = Vector::From(0, 1, 0); + return true; + } + + // Get the point farthest from the line between pt and ptFar + dp = ptFar.Minus(pt); + offLineMax = VERY_NEGATIVE; + for(const SBezier *sb = l.First(); sb; sb = l.NextAfter(sb)) { + for(i = 0; i <= sb->deg; i++) { + double m = (sb->ctrl[i]).DistanceToLine(pt, dp); + if(m > offLineMax) { + ptOffLine = sb->ctrl[i]; + offLineMax = m; + } + } + } + + *p = pt; + if(offLineMax < LENGTH_EPS) { + // The points are all colinear; so choose the second basis vector + // arbitrarily. + *u = (ptFar.Minus(pt)).WithMagnitude(1); + *v = (u->Normal(0)).WithMagnitude(1); + } else { + // The points actually define a plane. + n = (ptFar.Minus(pt)).Cross(ptOffLine.Minus(pt)); + *u = (n.Normal(0)).WithMagnitude(1); + *v = (n.Normal(1)).WithMagnitude(1); + } + + // So we have a plane; but check whether all of the points lie in that + // plane. + n = u->Cross(*v); + n = n.WithMagnitude(1); + double d = p->Dot(n); + for(const SBezier *sb = l.First(); sb; sb = l.NextAfter(sb)) { + for(i = 0; i <= sb->deg; i++) { + if(fabs(n.Dot(sb->ctrl[i]) - d) > LENGTH_EPS) { + if(notCoplanarAt) *notCoplanarAt = sb->ctrl[i]; + return false; + } + } + } + return true; +} + +//----------------------------------------------------------------------------- +// Assemble curves in sbl into a single loop. The curves may appear in any +// direction (start to finish, or finish to start), and will be reversed if +// necessary. The curves in the returned loop are removed from sbl, even if +// the loop cannot be closed. +//----------------------------------------------------------------------------- +SBezierLoop SBezierLoop::FromCurves(SBezierList *sbl, + bool *allClosed, SEdge *errorAt) +{ + SBezierLoop loop = {}; + + if(sbl->l.n < 1) { + *allClosed = false; + return loop; + } + sbl->l.ClearTags(); + + SBezier *first = &(sbl->l[0]); + first->tag = 1; + loop.l.Add(first); + Vector start = first->Start(); + Vector hanging = first->Finish(); + int auxA = first->auxA; + + sbl->l.RemoveTagged(); + + while(!sbl->l.IsEmpty() && !hanging.Equals(start)) { + int i; + bool foundNext = false; + for(i = 0; i < sbl->l.n; i++) { + SBezier *test = &(sbl->l[i]); + + if((test->Finish()).Equals(hanging) && test->auxA == auxA) { + test->Reverse(); + // and let the next test catch it + } + if((test->Start()).Equals(hanging) && test->auxA == auxA) { + test->tag = 1; + loop.l.Add(test); + hanging = test->Finish(); + sbl->l.RemoveTagged(); + foundNext = true; + break; + } + } + if(!foundNext) { + // The loop completed without finding the hanging edge, so + // it's an open loop + errorAt->a = hanging; + errorAt->b = start; + *allClosed = false; + return loop; + } + } + if(hanging.Equals(start)) { + *allClosed = true; + } else { + // We ran out of edges without forming a closed loop. + errorAt->a = hanging; + errorAt->b = start; + *allClosed = false; + } + + return loop; +} + +void SBezierLoop::Reverse() { + l.Reverse(); + SBezier *sb; + for(sb = l.First(); sb; sb = l.NextAfter(sb)) { + // If we didn't reverse each curve, then the next curve in list would + // share your start, not your finish. + sb->Reverse(); + } +} + +void SBezierLoop::GetBoundingProjd(Vector u, Vector orig, + double *umin, double *umax) const +{ + for(const SBezier *sb = l.First(); sb; sb = l.NextAfter(sb)) { + sb->GetBoundingProjd(u, orig, umin, umax); + } +} + +void SBezierLoop::MakePwlInto(SContour *sc, double chordTol) const { + for(const SBezier *sb = l.First(); sb; sb = l.NextAfter(sb)) { + sb->MakePwlInto(sc, chordTol); + // Avoid double points at join between Beziers; except that + // first and last points should be identical. + if(l.NextAfter(sb) != NULL) { + sc->l.RemoveLast(1); + } + } + // Ensure that it's exactly closed, not just within a numerical tolerance. + if((sc->l.Last()->p).Equals(sc->l.First()->p)) { + *sc->l.Last() = *sc->l.First(); + } +} + +bool SBezierLoop::IsClosed() const { + if(l.IsEmpty()) return false; + Vector s = l.First()->Start(), + f = l.Last()->Finish(); + return s.Equals(f); +} + + +//----------------------------------------------------------------------------- +// Assemble the curves in sbl into multiple loops, and piecewise linearize the +// curves into poly. If we can't close a contour, then we add it to +// openContours (if that isn't NULL) and keep going; so this works even if the +// input contains a mix of open and closed curves. +//----------------------------------------------------------------------------- +SBezierLoopSet SBezierLoopSet::From(SBezierList *sbl, SPolygon *poly, + double chordTol, + bool *allClosed, SEdge *errorAt, + SBezierLoopSet *openContours) +{ + SBezierLoopSet ret = {}; + + *allClosed = true; + while(!sbl->l.IsEmpty()) { + bool thisClosed; + SBezierLoop loop; + loop = SBezierLoop::FromCurves(sbl, &thisClosed, errorAt); + if(!thisClosed) { + // Record open loops in a separate list, if requested. + *allClosed = false; + if(openContours) { + openContours->l.Add(&loop); + } else { + loop.Clear(); + } + } else { + ret.l.Add(&loop); + poly->AddEmptyContour(); + loop.MakePwlInto(poly->l.Last(), chordTol); + } + } + + poly->normal = poly->ComputeNormal(); + ret.normal = poly->normal; + if(poly->l.n > 0) { + ret.point = poly->AnyPoint(); + } else { + ret.point = Vector::From(0, 0, 0); + } + + return ret; +} + +void SBezierLoopSet::GetBoundingProjd(Vector u, Vector orig, + double *umin, double *umax) const +{ + for(const SBezierLoop *sbl = l.First(); sbl; sbl = l.NextAfter(sbl)) { + sbl->GetBoundingProjd(u, orig, umin, umax); + } +} + +double SBezierLoopSet::SignedArea() { + if(EXACT(area == 0.0)) { + SPolygon sp = {}; + MakePwlInto(&sp); + sp.normal = sp.ComputeNormal(); + area = sp.SignedArea(); + sp.Clear(); + } + return area; +} + +//----------------------------------------------------------------------------- +// Convert all the Beziers into piecewise linear form, and assemble that into +// a polygon, one contour per loop. +//----------------------------------------------------------------------------- +void SBezierLoopSet::MakePwlInto(SPolygon *sp) const { + for(const SBezierLoop *sbl = l.First(); sbl; sbl = l.NextAfter(sbl)) { + sp->AddEmptyContour(); + sbl->MakePwlInto(sp->l.Last()); + } +} + +void SBezierLoopSet::Clear() { + int i; + for(i = 0; i < l.n; i++) { + (l[i]).Clear(); + } + l.Clear(); +} + +//----------------------------------------------------------------------------- +// An export helper function. We start with a list of Bezier curves, and +// assemble them into loops. We find the outer loops, and find the outer loops' +// inner loops, and group them accordingly. +//----------------------------------------------------------------------------- +void SBezierLoopSetSet::FindOuterFacesFrom(SBezierList *sbl, SPolygon *spxyz, + SSurface *srfuv, + double chordTol, + bool *allClosed, SEdge *notClosedAt, + bool *allCoplanar, Vector *notCoplanarAt, + SBezierLoopSet *openContours) +{ + SSurface srfPlane; + if(!srfuv) { + Vector p, u, v; + *allCoplanar = + sbl->GetPlaneContainingBeziers(&p, &u, &v, notCoplanarAt); + if(!*allCoplanar) { + // Don't even try to assemble them into loops if they're not + // all coplanar. + if(openContours) { + SBezier *sb; + for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { + SBezierLoop sbl={}; + sbl.l.Add(sb); + openContours->l.Add(&sbl); + } + } + return; + } + // All the curves lie in a plane through p with basis vectors u and v. + srfPlane = SSurface::FromPlane(p, u, v); + srfuv = &srfPlane; + } + + int i, j; + // Assemble the Bezier trim curves into closed loops; we also get the + // piecewise linearization of the curves (in the SPolygon spxyz), as a + // calculation aid for the loop direction. + SBezierLoopSet sbls = SBezierLoopSet::From(sbl, spxyz, chordTol, + allClosed, notClosedAt, + openContours); + if(sbls.l.n != spxyz->l.n) return; + + // Convert the xyz piecewise linear to uv piecewise linear. + SPolygon spuv = {}; + SContour *sc; + for(sc = spxyz->l.First(); sc; sc = spxyz->l.NextAfter(sc)) { + spuv.AddEmptyContour(); + SPoint *pt; + for(pt = sc->l.First(); pt; pt = sc->l.NextAfter(pt)) { + double u, v; + srfuv->ClosestPointTo(pt->p, &u, &v); + spuv.l.Last()->AddPoint(Vector::From(u, v, 0)); + } + } + spuv.normal = Vector::From(0, 0, 1); // must be, since it's in xy plane now + + static const int OUTER_LOOP = 10; + static const int INNER_LOOP = 20; + static const int USED_LOOP = 30; + // Fix the contour directions; we do this properly, in uv space, so it + // works for curved surfaces too (important for STEP export). + spuv.FixContourDirections(); + for(i = 0; i < spuv.l.n; i++) { + SContour *contour = &(spuv.l[i]); + SBezierLoop *bl = &(sbls.l[i]); + if(contour->tag) { + // This contour got reversed in the polygon to make the directions + // consistent, so the same must be necessary for the Bezier loop. + bl->Reverse(); + } + if(contour->IsClockwiseProjdToNormal(spuv.normal)) { + bl->tag = INNER_LOOP; + } else { + bl->tag = OUTER_LOOP; + } + } + + bool loopsRemaining = true; + while(loopsRemaining) { + loopsRemaining = false; + for(i = 0; i < sbls.l.n; i++) { + SBezierLoop *loop = &(sbls.l[i]); + if(loop->tag != OUTER_LOOP) continue; + + // Check if this contour contains any outer loops; if it does, then + // we should do those "inner outer loops" first; otherwise we + // will steal their holes, since their holes also lie inside this + // contour. + for(j = 0; j < sbls.l.n; j++) { + SBezierLoop *outer = &(sbls.l[j]); + if(i == j) continue; + if(outer->tag != OUTER_LOOP) continue; + + Vector p = spuv.l[j].AnyEdgeMidpoint(); + if(spuv.l[i].ContainsPointProjdToNormal(spuv.normal, p)) { + break; + } + } + if(j < sbls.l.n) { + // It does, can't do this one yet. + continue; + } + + SBezierLoopSet outerAndInners = {}; + loopsRemaining = true; + loop->tag = USED_LOOP; + outerAndInners.l.Add(loop); + int auxA = 0; + if(loop->l.n > 0) auxA = loop->l[0].auxA; + + for(j = 0; j < sbls.l.n; j++) { + SBezierLoop *inner = &(sbls.l[j]); + if(inner->tag != INNER_LOOP) continue; + if(inner->l.n < 1) continue; + if(inner->l[0].auxA != auxA) continue; + + Vector p = spuv.l[j].AnyEdgeMidpoint(); + if(spuv.l[i].ContainsPointProjdToNormal(spuv.normal, p)) { + outerAndInners.l.Add(inner); + inner->tag = USED_LOOP; + } + } + + outerAndInners.point = srfuv->PointAt(0, 0); + outerAndInners.normal = srfuv->NormalAt(0, 0); + l.Add(&outerAndInners); + } + } + + // If we have poorly-formed loops--for example, overlapping zero-area + // stuff--then we can end up with leftovers. We use this function to + // group stuff into closed paths for export when possible, so it's bad + // to screw up on that stuff. So just add them onto the open curve list. + // Very ugly, but better than losing curves. + for(i = 0; i < sbls.l.n; i++) { + SBezierLoop *loop = &(sbls.l[i]); + if(loop->tag == USED_LOOP) continue; + + if(openContours) { + openContours->l.Add(loop); + } else { + loop->Clear(); + } + // but don't free the used loops, since we shallow-copied them to + // ourself + } + + sbls.l.Clear(); // not sbls.Clear(), since that would deep-clear + spuv.Clear(); +} + +void SBezierLoopSetSet::AddOpenPath(SBezier *sb) { + SBezierLoop sbl = {}; + sbl.l.Add(sb); + + SBezierLoopSet sbls = {}; + sbls.l.Add(&sbl); + + l.Add(&sbls); +} + +void SBezierLoopSetSet::Clear() { + SBezierLoopSet *sbls; + for(sbls = l.First(); sbls; sbls = l.NextAfter(sbls)) { + sbls->Clear(); + } + l.Clear(); +} + +SCurve SCurve::FromTransformationOf(SCurve *a, Vector t, + Quaternion q, double scale) +{ + bool needRotate = !EXACT(q.vx == 0.0 && q.vy == 0.0 && q.vz == 0.0 && q.w == 1.0); + bool needTranslate = !EXACT(t.x == 0.0 && t.y == 0.0 && t.z == 0.0); + bool needScale = !EXACT(scale == 1.0); + + SCurve ret = {}; + ret.h = a->h; + ret.isExact = a->isExact; + ret.exact = (a->exact).TransformedBy(t, q, scale); + ret.surfA = a->surfA; + ret.surfB = a->surfB; + + SCurvePt *p; + ret.pts.ReserveMore(a->pts.n); + for(p = a->pts.First(); p; p = a->pts.NextAfter(p)) { + SCurvePt pp = *p; + if(needScale) { + pp.p = (pp.p).ScaledBy(scale); + } + if(needRotate) { + pp.p = q.Rotate(pp.p); + } + if(needTranslate) { + pp.p = pp.p.Plus(t); + } + ret.pts.Add(&pp); + } + return ret; +} + +void SCurve::Clear() { + pts.Clear(); +} + +SSurface *SCurve::GetSurfaceA(SShell *a, SShell *b) const { + if(source == Source::A) { + return a->surface.FindById(surfA); + } else if(source == Source::B) { + return b->surface.FindById(surfA); + } else if(source == Source::INTERSECTION) { + return a->surface.FindById(surfA); + } else ssassert(false, "Unexpected curve source"); +} + +SSurface *SCurve::GetSurfaceB(SShell *a, SShell *b) const { + if(source == Source::A) { + return a->surface.FindById(surfB); + } else if(source == Source::B) { + return b->surface.FindById(surfB); + } else if(source == Source::INTERSECTION) { + return b->surface.FindById(surfB); + } else ssassert(false, "Unexpected curve source"); +} + +//----------------------------------------------------------------------------- +// When we split line segments wherever they intersect a surface, we introduce +// extra pwl points. This may create very short edges that could be removed +// without violating the chord tolerance. Those are ugly, and also break +// stuff in the Booleans. So remove them. +//----------------------------------------------------------------------------- +void SCurve::RemoveShortSegments(SSurface *srfA, SSurface *srfB) { + if(pts.n <= 2) return; + pts.ClearTags(); + + Vector prev = pts[0].p; + double tprev = 0; + double t = 0; + double tnext = 0; + + int i, a; + for(i = 1; i < pts.n - 1; i++) { + SCurvePt *sct = &(pts[i]), + *scn = &(pts[i+1]); + + if(sct->vertex) { + prev = sct->p; + continue; + } + + // if the curve is exact and points are >0.05 apart wrt t, point is there + // deliberately regardless of chord tolerance (ex: small circles) + tprev = t = tnext = 0; + if (isExact) { + exact.ClosestPointTo(prev, &tprev, /*mustconverge=*/ true); + exact.ClosestPointTo(sct->p, &t, /*mustconverge=*/ true); + exact.ClosestPointTo(scn->p, &tnext, /*mustconverge=*/ true); + } + if ( (t - tprev > 0.05) && (tnext - t > 0.05) ) { + prev = sct->p; + continue; + } + + bool mustKeep = false; + + // We must check against both surfaces; the piecewise linear edge + // may have a different chord tolerance in the two surfaces. (For + // example, a circle in the surface of a cylinder is just a straight + // line, so it always has perfect chord tol, but that circle in + // a plane is a circle so it doesn't). + for(a = 0; a < 2; a++) { + SSurface *srf = (a == 0) ? srfA : srfB; + Vector puv, nuv; + srf->ClosestPointTo(prev, &(puv.x), &(puv.y)); + srf->ClosestPointTo(scn->p, &(nuv.x), &(nuv.y)); + + if(srf->ChordToleranceForEdge(nuv, puv) > SS.ChordTolMm() ) { + mustKeep = true; + } + } + + if(mustKeep) { + prev = sct->p; + } else { + sct->tag = 1; + // and prev is unchanged, since there's no longer any point + // in between + } + } + + pts.RemoveTagged(); +} + +STrimBy STrimBy::EntireCurve(SShell *shell, hSCurve hsc, bool backwards) { + STrimBy stb = {}; + stb.curve = hsc; + SCurve *sc = shell->curve.FindById(hsc); + + if(backwards) { + stb.finish = sc->pts[0].p; + stb.start = sc->pts.Last()->p; + stb.backwards = true; + } else { + stb.start = sc->pts[0].p; + stb.finish = sc->pts.Last()->p; + stb.backwards = false; + } + + return stb; +} + +} // namespace SolveSpace diff --git a/src/srf/merge.cpp b/src/srf/merge.cpp new file mode 100644 index 0000000..03ef339 --- /dev/null +++ b/src/srf/merge.cpp @@ -0,0 +1,130 @@ +//----------------------------------------------------------------------------- +// Routines to merge multiple coincident surfaces (each with their own trim +// curves) into a single surface, with all of the trim curves. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void SShell::MergeCoincidentSurfaces() { + surface.ClearTags(); + + int i, j; + SSurface *si, *sj; + + for(i = 0; i < surface.n; i++) { + si = &(surface[i]); + if(si->tag) continue; + // Let someone else clean up the empty surfaces; we can certainly merge + // them, but we don't know how to calculate a reasonable bounding box. + if(si->trim.IsEmpty()) + continue; + // And for now we handle only coincident planes, so no sense wasting + // time on other surfaces. + if(si->degm != 1 || si->degn != 1) continue; + + SEdgeList sel = {}; + si->MakeEdgesInto(this, &sel, SSurface::MakeAs::XYZ); + + bool mergedThisTime, merged = false; + do { + mergedThisTime = false; + + for(j = i + 1; j < surface.n; j++) { + sj = &(surface[j]); + if(sj->tag) continue; + if(!sj->CoincidentWith(si, /*sameNormal=*/true)) continue; + if(!sj->color.Equals(si->color)) continue; + // But we do merge surfaces with different face entities, since + // otherwise we'd hardly ever merge anything. + + // This surface is coincident. But let's not merge coincident + // surfaces if they contain disjoint contours; that just makes + // the bounding box tests less effective, and possibly things + // less robust. + SEdgeList tel = {}; + sj->MakeEdgesInto(this, &tel, SSurface::MakeAs::XYZ); + if(!sel.ContainsEdgeFrom(&tel)) { + tel.Clear(); + continue; + } + tel.Clear(); + + sj->tag = 1; + merged = true; + mergedThisTime = true; + sj->MakeEdgesInto(this, &sel, SSurface::MakeAs::XYZ); + sj->trim.Clear(); + + // All the references to this surface get replaced with the + // new srf + for(SCurve &sc : curve) { + if(sc.surfA == sj->h) sc.surfA = si->h; + if(sc.surfB == sj->h) sc.surfB = si->h; + } + } + + // If this iteration merged a contour onto ours, then we have to + // go through the surfaces again; that might have made a new + // surface touch us. + } while(mergedThisTime); + + if(merged) { + sel.CullExtraneousEdges(); + si->trim.Clear(); + si->TrimFromEdgeList(&sel, /*asUv=*/false); + + // And we must choose control points such that all the trims lie + // with u and v in [0, 1], so that the bbox tests work. + Vector u, v, n; + si->TangentsAt(0.5, 0.5, &u, &v); + u = u.WithMagnitude(1); + v = v.WithMagnitude(1); + n = si->NormalAt(0.5, 0.5).WithMagnitude(1); + v = (n.Cross(u)).WithMagnitude(1); + + double umax = VERY_NEGATIVE, umin = VERY_POSITIVE, + vmax = VERY_NEGATIVE, vmin = VERY_POSITIVE; + SEdge *se; + for(se = sel.l.First(); se; se = sel.l.NextAfter(se)) { + double ut = (se->a).Dot(u), vt = (se->a).Dot(v); + umax = max(umax, ut); + vmax = max(vmax, vt); + umin = min(umin, ut); + vmin = min(vmin, vt); + } + + // An interesting problem here; the real curve could extend + // slightly beyond the bounding box of the piecewise linear + // bits. Not a problem for us, but some apps won't import STEP + // in that case. So give a bit of extra room; in theory just + // a chord tolerance, but more can't hurt. + double muv = max((umax - umin), (vmax - vmin)); + double tol = muv/50 + 3*SS.ChordTolMm(); + umax += tol; + vmax += tol; + umin -= tol; + vmin -= tol; + + // We move in the +v direction as v goes from 0 to 1, and in the + // +u direction as u goes from 0 to 1. So our normal ends up + // pointed the same direction. + double nt = (si->ctrl[0][0]).Dot(n); + si->ctrl[0][0] = + Vector::From(umin, vmin, nt).ScaleOutOfCsys(u, v, n); + si->ctrl[0][1] = + Vector::From(umin, vmax, nt).ScaleOutOfCsys(u, v, n); + si->ctrl[1][1] = + Vector::From(umax, vmax, nt).ScaleOutOfCsys(u, v, n); + si->ctrl[1][0] = + Vector::From(umax, vmin, nt).ScaleOutOfCsys(u, v, n); + } + sel.Clear(); + } + + surface.RemoveTagged(); +} + +} // namespace SolveSpace diff --git a/src/srf/ratpoly.cpp b/src/srf/ratpoly.cpp new file mode 100644 index 0000000..20b8d19 --- /dev/null +++ b/src/srf/ratpoly.cpp @@ -0,0 +1,704 @@ +//----------------------------------------------------------------------------- +// Math on rational polynomial surfaces and curves, typically in Bezier +// form. Evaluate, root-find (by Newton's methods), evaluate derivatives, +// and so on. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +// Converge it to better than LENGTH_EPS; we want two points, each +// independently projected into uv and back, to end up equal with the +// LENGTH_EPS. Best case that requires LENGTH_EPS/2, but more is better +// and convergence should be fast by now. +#define RATPOLY_EPS (LENGTH_EPS/(1e2)) + +static inline double Bernstein(int k, int deg, double t) { +// indexed by [degree][k][exponent] + static const double bernstein_coeff[4][4][4] = { + { { 1.0,0.0,0.0,0.0 }, { 1.0,0.0,0.0,0.0 }, { 1.0,0.0,0.0,0.0 }, { 1.0,0.0,0.0,0.0 } }, + { { 1.0,-1.0,0.0,0.0 }, { 0.0,1.0,0.0,0.0 }, { 0.0,0.0,0.0,0.0 }, { 0.0,0.0,0.0,0.0 } }, + { { 1.0,-2.0,1.0,0.0 }, { 0.0,2.0,-2.0,0.0 },{ 0.0,0.0,1.0,0.0 }, { 0.0,0.0,0.0,0.0 } }, + { { 1.0,-3.0,3.0,-1.0 },{ 0.0,3.0,-6.0,3.0 },{ 0.0,0.0,3.0,-3.0}, { 0.0,0.0,0.0,1.0 } } }; + + const double *c = bernstein_coeff[deg][k]; + return (((c[3]*t+c[2])*t)+c[1])*t+c[0]; +} + +static inline double BernsteinDerivative(int k, int deg, double t) { + static const double bernstein_derivative_coeff[4][4][3] = { + { { 0.0,0.0,0.0 }, { 0.0,0.0,0.0 }, { 0.0,0.0,0.0 }, { 0.0,0.0,0.0 } }, + { { -1.0,0.0,0.0 }, { 1.0,0.0,0.0 }, { 0.0,0.0,0.0 }, { 0.0,0.0,0.0 } }, + { { -2.0,2.0,0.0 }, { 2.0,-4.0,0.0 },{ 0.0,2.0,0.0 }, { 0.0,0.0,0.0 } }, + { { -3.0,6.0,-3.0 },{ 3.0,-12.0,9.0 },{ 0.0,6.0,-9.0}, { 0.0,0.0,3.0 } } }; + + const double *c = bernstein_derivative_coeff[deg][k]; + return ((c[2]*t)+c[1])*t+c[0]; +} + +Vector SBezier::PointAt(double t) const { + Vector pt = Vector::From(0, 0, 0); + double d = 0; + + int i; + for(i = 0; i <= deg; i++) { + double B = Bernstein(i, deg, t); + pt = pt.Plus(ctrl[i].ScaledBy(B*weight[i])); + d += weight[i]*B; + } + pt = pt.ScaledBy(1.0/d); + return pt; +} + +Vector SBezier::TangentAt(double t) const { + Vector pt = Vector::From(0, 0, 0), pt_p = Vector::From(0, 0, 0); + double d = 0, d_p = 0; + + int i; + for(i = 0; i <= deg; i++) { + double B = Bernstein(i, deg, t), + Bp = BernsteinDerivative(i, deg, t); + + pt = pt.Plus(ctrl[i].ScaledBy(B*weight[i])); + d += weight[i]*B; + + pt_p = pt_p.Plus(ctrl[i].ScaledBy(Bp*weight[i])); + d_p += weight[i]*Bp; + } + + // quotient rule; f(t) = n(t)/d(t), so f' = (n'*d - n*d')/(d^2) + Vector ret; + ret = (pt_p.ScaledBy(d)).Minus(pt.ScaledBy(d_p)); + ret = ret.ScaledBy(1.0/(d*d)); + return ret; +} + +void SBezier::ClosestPointTo(Vector p, double *t, bool mustConverge) const { + int i; + double minDist = VERY_POSITIVE; + *t = 0; + double res = (deg <= 2) ? 7.0 : 20.0; + for(i = 0; i < (int)res; i++) { + double tryt = (i/res); + + Vector tryp = PointAt(tryt); + double d = (tryp.Minus(p)).Magnitude(); + if(d < minDist) { + *t = tryt; + minDist = d; + } + } + + Vector p0; + for(i = 0; i < (mustConverge ? 15 : 5); i++) { + p0 = PointAt(*t); + if(p0.Equals(p, RATPOLY_EPS)) { + return; + } + + Vector dp = TangentAt(*t); + Vector pc = p.ClosestPointOnLine(p0, dp); + *t += (pc.Minus(p0)).DivProjected(dp); + } + if(mustConverge) { + dbp("didn't converge (closest point on bezier curve)"); + } +} + +bool SBezier::PointOnThisAndCurve(const SBezier *sbb, Vector *p) const { + double ta, tb; + this->ClosestPointTo(*p, &ta, /*mustConverge=*/false); + sbb ->ClosestPointTo(*p, &tb, /*mustConverge=*/false); + + int i; + for(i = 0; i < 20; i++) { + Vector pa = this->PointAt(ta), + pb = sbb ->PointAt(tb), + da = this->TangentAt(ta), + db = sbb ->TangentAt(tb); + + if(pa.Equals(pb, RATPOLY_EPS)) { + *p = pa; + return true; + } + + double tta, ttb; + Vector::ClosestPointBetweenLines(pa, da, pb, db, &tta, &ttb); + ta += tta; + tb += ttb; + } + return false; +} + +void SBezier::SplitAt(double t, SBezier *bef, SBezier *aft) const { + Vector4 ct[4]; + int i; + for(i = 0; i <= deg; i++) { + ct[i] = Vector4::From(weight[i], ctrl[i]); + } + + switch(deg) { + case 1: { + Vector4 cts = Vector4::Blend(ct[0], ct[1], t); + *bef = SBezier::From(ct[0], cts); + *aft = SBezier::From(cts, ct[1]); + break; + } + case 2: { + Vector4 ct01 = Vector4::Blend(ct[0], ct[1], t), + ct12 = Vector4::Blend(ct[1], ct[2], t), + cts = Vector4::Blend(ct01, ct12, t); + + *bef = SBezier::From(ct[0], ct01, cts); + *aft = SBezier::From(cts, ct12, ct[2]); + break; + } + case 3: { + Vector4 ct01 = Vector4::Blend(ct[0], ct[1], t), + ct12 = Vector4::Blend(ct[1], ct[2], t), + ct23 = Vector4::Blend(ct[2], ct[3], t), + ct01_12 = Vector4::Blend(ct01, ct12, t), + ct12_23 = Vector4::Blend(ct12, ct23, t), + cts = Vector4::Blend(ct01_12, ct12_23, t); + + *bef = SBezier::From(ct[0], ct01, ct01_12, cts); + *aft = SBezier::From(cts, ct12_23, ct23, ct[3]); + break; + } + default: ssassert(false, "Unexpected degree of spline"); + } +} + +void SBezier::MakePwlInto(SEdgeList *sel, double chordTol, double max_dt) const { + List lv = {}; + MakePwlInto(&lv, chordTol, max_dt); + int i; + for(i = 1; i < lv.n; i++) { + sel->AddEdge(lv[i-1], lv[i]); + } + lv.Clear(); +} +void SBezier::MakePwlInto(List *l, double chordTol, double max_dt) const { + List lv = {}; + MakePwlInto(&lv, chordTol, max_dt); + int i; + for(i = 0; i < lv.n; i++) { + SCurvePt scpt; + scpt.tag = 0; + scpt.p = lv[i]; + scpt.vertex = (i == 0) || (i == (lv.n - 1)); + l->Add(&scpt); + } + lv.Clear(); +} +void SBezier::MakePwlInto(SContour *sc, double chordTol, double max_dt) const { + List lv = {}; + MakePwlInto(&lv, chordTol, max_dt); + int i; + for(i = 0; i < lv.n; i++) { + sc->AddPoint(lv[i]); + } + lv.Clear(); +} +//-------------------------------------------------------------------------------------- +// all variants of MakePwlInto come here. Split a rational Bezier into Piecewise Linear +// segments that don't deviate from the actual curve by more than the chordTol distance. +// max_dt allows to force curves to be split into spans of no more than a certain +// length based on t-parameter. RemoveShortSegments() may delete points when dt <= 0.1 +//-------------------------------------------------------------------------------------- +void SBezier::MakePwlInto(List *l, double chordTol, double max_dt) const { + if(EXACT(chordTol == 0)) { + // Use the default chord tolerance. + chordTol = SS.ChordTolMm(); + } + // Never do fewer than three intermediate points for curves; people seem to get + // unhappy when their circles turn into squares, but maybe less + // unhappy with octagons. Now 16-gons. + if (EXACT(max_dt == 0.0)) { + max_dt = (deg == 1) ? 1.0 : 0.25; + } + l->Add(&(ctrl[0])); + // don't split first degee (lines) unless asked to by the caller via max_dt + if((deg == 1) && (max_dt >= 1.0)) { + l->Add(&(ctrl[1])); + } else { + MakePwlInitialWorker(l, 0.0, 0.5, chordTol, max_dt); + MakePwlInitialWorker(l, 0.5, 1.0, chordTol, max_dt); + } +} +void SBezier::MakePwlWorker(List *l, double ta, double tb, double chordTol, double max_dt) const +{ + Vector pa = PointAt(ta); + Vector pb = PointAt(tb); + + Vector pm = PointAt((ta + tb) / 2.0); + double d = pm.DistanceToLine(pa, pb.Minus(pa)); + + double step = 1.0/SS.GetMaxSegments(); + if(((tb - ta) < step || d < chordTol) && ((tb-ta) <= max_dt) ) { + // A previous call has already added the beginning of our interval. + l->Add(&pb); + } else { + double tm = (ta + tb) / 2; + MakePwlWorker(l, ta, tm, chordTol, max_dt); + MakePwlWorker(l, tm, tb, chordTol, max_dt); + } +} +void SBezier::MakePwlInitialWorker(List *l, double ta, double tb, double chordTol, double max_dt) const +{ + Vector pa = PointAt(ta); + Vector pb = PointAt(tb); + + double tm1 = ta + (tb - ta) * 0.25; + double tm2 = ta + (tb - ta) * 0.5; + double tm3 = ta + (tb - ta) * 0.75; + + Vector pm1 = PointAt(tm1); + Vector pm2 = PointAt(tm2); + Vector pm3 = PointAt(tm3); + Vector dir = pb.Minus(pa); + + double d = max({ + pm1.DistanceToLine(pa, dir), + pm2.DistanceToLine(pa, dir), + pm3.DistanceToLine(pa, dir) + }); + + double step = 1.0/SS.GetMaxSegments(); + if( ((tb - ta) < step || d < chordTol) && ((tb-ta) <= max_dt) ) { + // A previous call has already added the beginning of our interval. + l->Add(&pb); + } else { + double tm = (ta + tb) / 2; + MakePwlWorker(l, ta, tm, chordTol, max_dt); + MakePwlWorker(l, tm, tb, chordTol, max_dt); + } +} + +void SBezier::MakeNonrationalCubicInto(SBezierList *bl, double tolerance, int depth) const { + Vector t0 = TangentAt(0), t1 = TangentAt(1); + // The curve is correct, and the first derivatives are correct, at the + // endpoints. + SBezier bnr = SBezier::From( + Start(), + Start().Plus(t0.ScaledBy(1.0/3)), + Finish().Minus(t1.ScaledBy(1.0/3)), + Finish()); + + bool closeEnough = true; + int i; + for(i = 1; i <= 3; i++) { + double t = i/4.0; + Vector p0 = PointAt(t), + pn = bnr.PointAt(t); + double d = (p0.Minus(pn)).Magnitude(); + if(d > tolerance) { + closeEnough = false; + } + } + + if(closeEnough || depth > 3) { + bl->l.Add(this); + } else { + SBezier bef, aft; + SplitAt(0.5, &bef, &aft); + bef.MakeNonrationalCubicInto(bl, tolerance, depth+1); + aft.MakeNonrationalCubicInto(bl, tolerance, depth+1); + } +} + +Vector SSurface::PointAt(Point2d puv) const { + return PointAt(puv.x, puv.y); +} +Vector SSurface::PointAt(double u, double v) const { + Vector num = Vector::From(0, 0, 0); + double den = 0; + + int i, j; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + double Bi = Bernstein(i, degm, u), + Bj = Bernstein(j, degn, v); + + num = num.Plus(ctrl[i][j].ScaledBy(Bi*Bj*weight[i][j])); + den += weight[i][j]*Bi*Bj; + } + } + num = num.ScaledBy(1.0/den); + return num; +} + +void SSurface::TangentsAt(double u, double v, Vector *tu, Vector *tv, bool retry) const { + Vector num = Vector::From(0, 0, 0), + num_u = Vector::From(0, 0, 0), + num_v = Vector::From(0, 0, 0); + double den = 0, + den_u = 0, + den_v = 0; + + int i, j; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + double Bi = Bernstein(i, degm, u), + Bj = Bernstein(j, degn, v), + Bip = BernsteinDerivative(i, degm, u), + Bjp = BernsteinDerivative(j, degn, v); + + num = num.Plus(ctrl[i][j].ScaledBy(Bi*Bj*weight[i][j])); + den += weight[i][j]*Bi*Bj; + + num_u = num_u.Plus(ctrl[i][j].ScaledBy(Bip*Bj*weight[i][j])); + den_u += weight[i][j]*Bip*Bj; + + num_v = num_v.Plus(ctrl[i][j].ScaledBy(Bi*Bjp*weight[i][j])); + den_v += weight[i][j]*Bi*Bjp; + } + } + // quotient rule; f(t) = n(t)/d(t), so f' = (n'*d - n*d')/(d^2) + *tu = ((num_u.ScaledBy(den)).Minus(num.ScaledBy(den_u))); + *tu = tu->ScaledBy(1.0/(den*den)); + + *tv = ((num_v.ScaledBy(den)).Minus(num.ScaledBy(den_v))); + *tv = tv->ScaledBy(1.0/(den*den)); + + // Tangent is zero at sungularities like the north pole. Move away a bit and retry. + if(tv->Equals(Vector::From(0,0,0)) && retry) + TangentsAt(u+(0.5-u)*0.00001, v, tu, tv, false); + if(tu->Equals(Vector::From(0,0,0)) && retry) + TangentsAt(u, v+(0.5-v)*0.00001, tu, tv, false); +} + +Vector SSurface::NormalAt(Point2d puv) const { + return NormalAt(puv.x, puv.y); +} + +Vector SSurface::NormalAt(double u, double v) const { + Vector tu, tv; + TangentsAt(u, v, &tu, &tv); + return tu.Cross(tv); +} + +void SSurface::ClosestPointTo(Vector p, Point2d *puv, bool mustConverge) { + ClosestPointTo(p, &(puv->x), &(puv->y), mustConverge); +} + +void SSurface::ClosestPointTo(Vector p, double *u, double *v, bool mustConverge) { + // A few special cases first; when control points are coincident the + // derivative goes to zero at the control points, and would result in + // nonconvergence. We avoid that here, and also guarantee a consistent + // (u, v) (of the infinitely many possible in one parameter). + if(p.Equals(ctrl[0] [0] )) { *u = 0; *v = 0; return; } + if(p.Equals(ctrl[degm][0] )) { *u = 1; *v = 0; return; } + if(p.Equals(ctrl[degm][degn])) { *u = 1; *v = 1; return; } + if(p.Equals(ctrl[0] [degn])) { *u = 0; *v = 1; return; } + + // And planes are trivial, so don't waste time iterating over those. + if(degm == 1 && degn == 1) { + Vector orig = ctrl[0][0], + bu = (ctrl[1][0]).Minus(orig), + bv = (ctrl[0][1]).Minus(orig); + if((ctrl[1][1]).Equals(orig.Plus(bu).Plus(bv))) { + + Vector n = bu.Cross(bv); + Vector ty = n.Cross(bu).ScaledBy(1.0/bu.MagSquared()); + Vector tx = bv.Cross(n).ScaledBy(1.0/bv.MagSquared()); + + Vector dp = p.Minus(orig); + *u = dp.Dot(bu) / tx.MagSquared(); + *v = dp.Dot(bv) / ty.MagSquared(); + return; + } + } + + // Try whatever the previous guess was. This is likely to do something + // good if we're working our way along a curve or something else where + // we project successive points that are close to each other; something + // like a 20% speedup empirically. + if(mustConverge) { + double ut = cached.x, vt = cached.y; + if(ClosestPointNewton(p, &ut, &vt, mustConverge)) { + cached.x = *u = ut; + cached.y = *v = vt; + return; + } + } + + // Search for a reasonable initial guess + int i, j; + double minDist = VERY_POSITIVE; + int res = (max(degm, degn) == 2) ? 7 : 20; + for(i = 0; i < res; i++) { + for(j = 0; j < res; j++) { + double tryu = (i + 0.5)/res, tryv = (j + 0.5)/res; + + Vector tryp = PointAt(tryu, tryv); + double d = (tryp.Minus(p)).Magnitude(); + if(d < minDist) { + *u = tryu; + *v = tryv; + minDist = d; + } + } + } + + if(ClosestPointNewton(p, u, v, mustConverge)) { + cached.x = *u; + cached.y = *v; + return; + } + + // If we failed to converge, then at least don't return NaN. + if(mustConverge) { +// This is expected not to converge when the target point is not on the surface but nearby. +// let's not pollute the output window for normal use. +// Vector p0 = PointAt(*u, *v); +// dbp("didn't converge"); +// dbp("have %.3f %.3f %.3f", CO(p0)); +// dbp("want %.3f %.3f %.3f", CO(p)); +// dbp("distance = %g", (p.Minus(p0)).Magnitude()); + } + if(IsReasonable(*u) || IsReasonable(*v)) { + *u = *v = 0; + } +} + +bool SSurface::ClosestPointNewton(Vector p, double *u, double *v, bool mustConverge) const +{ + // Initial guess is in u, v; refine by Newton iteration. + Vector p0 = Vector::From(0, 0, 0); + for(int i = 0; i < (mustConverge ? 25 : 5); i++) { + p0 = PointAt(*u, *v); + if(mustConverge) { + if(p0.Equals(p, RATPOLY_EPS)) { + return true; + } + } + + Vector tu, tv, tx, ty; + TangentsAt(*u, *v, &tu, &tv); + Vector n = tu.Cross(tv); + // since tu and tv may not be orthogonal, use y in place of v. + // |y| = |v|sin(theta) where theta is the angle between tu and tv. + ty = n.Cross(tu).ScaledBy(1.0/tu.MagSquared()); + tx = tv.Cross(n).ScaledBy(1.0/tv.MagSquared()); + + // Project the point into a plane through p0, with basis tu, tv; a + // second-order thing would converge faster but needs second + // derivatives. + Vector dp = p.Minus(p0); + double du = dp.Dot(tx), + dv = dp.Dot(ty); + *u += du / (tx.MagSquared()); + *v += dv / (ty.MagSquared()); + + if (*u < 0.0) *u = 0.0; + else if (*u > 1.0) *u = 1.0; + if (*v < 0.0) *v = 0.0; + else if (*v > 1.0) *v = 1.0; + + } + + return false; +} + +bool SSurface::PointIntersectingLine(Vector p0, Vector p1, double *u, double *v) const +{ + int i; + for(i = 0; i < 20; i++) { + Vector pi, p, tu, tv; + p = PointAt(*u, *v); + TangentsAt(*u, *v, &tu, &tv); + + Vector n = (tu.Cross(tv)).WithMagnitude(1); + double d = p.Dot(n); + + bool parallel; + pi = Vector::AtIntersectionOfPlaneAndLine(n, d, p0, p1, ¶llel); + if(parallel) { + dbp("parallel (surface intersecting line)"); + break; + } + + // Check for convergence + if(pi.Equals(p, RATPOLY_EPS)) return true; + + n = tu.Cross(tv); + Vector ty = n.Cross(tu).ScaledBy(1.0/tu.MagSquared()); + Vector tx = tv.Cross(n).ScaledBy(1.0/tv.MagSquared()); + + // Adjust our guess and iterate + Vector dp = pi.Minus(p); + double du = dp.Dot(tx), dv = dp.Dot(ty); + *u += du / tx.MagSquared(); + *v += dv / ty.MagSquared(); + } + dbp("didn't converge (surface intersecting line)"); + return false; +} + +Vector SSurface::ClosestPointOnThisAndSurface(SSurface *srf2, Vector p) { + // This is untested. + int i, j; + Point2d puv[2]; + SSurface *srf[2] = { this, srf2 }; + + for(j = 0; j < 2; j++) { + (srf[j])->ClosestPointTo(p, &(puv[j]), /*mustConverge=*/false); + } + + for(i = 0; i < 10; i++) { + Vector tu[2], tv[2], cp[2], n[2]; + double d[2]; + + for(j = 0; j < 2; j++) { + (srf[j])->TangentsAt(puv[j].x, puv[j].y, &(tu[j]), &(tv[j])); + + cp[j] = (srf[j])->PointAt(puv[j]); + + n[j] = ((tu[j]).Cross(tv[j])).WithMagnitude(1); + d[j] = (n[j]).Dot(cp[j]); + } + + if((cp[0]).Equals(cp[1], RATPOLY_EPS)) break; + + Vector p0 = Vector::AtIntersectionOfPlanes(n[0], d[0], n[1], d[1]), + dp = (n[0]).Cross(n[1]); + + Vector pc = p.ClosestPointOnLine(p0, dp); + + // Adjust our guess and iterate + for(j = 0; j < 2; j++) { + Vector n = tu[j].Cross(tv[j]); + Vector ty = n.Cross(tu[j]).ScaledBy(1.0/tu[j].MagSquared()); + Vector tx = tv[j].Cross(n).ScaledBy(1.0/tv[j].MagSquared()); + + Vector dc = pc.Minus(cp[j]); + double du = dc.Dot(tx), dv = dc.Dot(ty); + puv[j].x += du / tx.MagSquared(); + puv[j].y += dv / ty.MagSquared(); + } + } + if(i >= 10) { + dbp("this and srf, didn't converge, d=%g", + (puv[0].Minus(puv[1])).Magnitude()); + } + + // If this converged, then the two points are actually equal. + return ((srf[0])->PointAt(puv[0])).Plus( + ((srf[1])->PointAt(puv[1]))).ScaledBy(0.5); +} + +void SSurface::PointOnSurfaces(SSurface *s1, SSurface *s2, double *up, double *vp) +{ + double u[3] = { *up, 0, 0 }, v[3] = { *vp, 0, 0 }; + SSurface *srf[3] = { this, s1, s2 }; + + // Get initial guesses for (u, v) in the other surfaces + Vector p = PointAt(*u, *v); + (srf[1])->ClosestPointTo(p, &(u[1]), &(v[1]), /*mustConverge=*/false); + (srf[2])->ClosestPointTo(p, &(u[2]), &(v[2]), /*mustConverge=*/false); + + int i, j; + for(i = 0; i < 20; i++) { + // Approximate each surface by a plane + Vector p[3], tu[3], tv[3], n[3]; + double d[3]; + for(j = 0; j < 3; j++) { + p[j] = (srf[j])->PointAt(u[j], v[j]); + (srf[j])->TangentsAt(u[j], v[j], &(tu[j]), &(tv[j])); + n[j] = ((tu[j]).Cross(tv[j])).WithMagnitude(1); + d[j] = (n[j]).Dot(p[j]); + } + + // If a = b and b = c, then does a = c? No, it doesn't. + if((p[0]).Equals(p[1], RATPOLY_EPS) && + (p[1]).Equals(p[2], RATPOLY_EPS) && + (p[2]).Equals(p[0], RATPOLY_EPS)) + { + *up = u[0]; + *vp = v[0]; + return; + } + + bool parallel; + Vector pi = Vector::AtIntersectionOfPlanes(n[0], d[0], + n[1], d[1], + n[2], d[2], ¶llel); + + if(parallel) { // lets try something else for parallel planes + pi = p[0].Plus(p[1]).Plus(p[2]).ScaledBy(1.0/3.0); + } + + for(j = 0; j < 3; j++) { + Vector n = tu[j].Cross(tv[j]); + Vector ty = n.Cross(tu[j]).ScaledBy(1.0/tu[j].MagSquared()); + Vector tx = tv[j].Cross(n).ScaledBy(1.0/tv[j].MagSquared()); + + Vector dp = pi.Minus(p[j]); + double du = dp.Dot(tx), dv = dp.Dot(ty); + + u[j] += du / tx.MagSquared(); + v[j] += dv / ty.MagSquared(); + } + } + dbp("didn't converge (three surfaces intersecting)"); +} + +void SSurface::PointOnCurve(const SBezier *curve, double *up, double *vp) +{ + Vector tu,tv,n; + double u = *up, v = *vp; + Vector ps = PointAt(u, v); + // Get initial guesses for t on the curve + double tCurve = 0.5; + curve->ClosestPointTo(ps, &tCurve, /*mustConverge=*/false); + if(tCurve < 0.0) tCurve = 0.0; + if(tCurve > 1.0) tCurve = 1.0; + + for(int i = 0; i < 30; i++) { + // Approximate the surface by a plane + Vector ps = PointAt(u, v); + TangentsAt(u, v, &tu, &tv); + n = tu.Cross(tv).WithMagnitude(1); + + // point on curve and tangent line direction + Vector pc = curve->PointAt(tCurve); + Vector tc = curve->TangentAt(tCurve); + + if(ps.Equals(pc, RATPOLY_EPS)) { + *up = u; + *vp = v; + return; + } + + //pi is where the curve tangent line intersects the surface tangent plane + Vector pi; + double d = tc.Dot(n); + if (fabs(d) < 1e-10) { // parallel line and plane, guess the average rather than fail + pi = pc.Plus(ps).ScaledBy(0.5); + } else { + pi = pc.Minus(tc.ScaledBy(pc.Minus(ps).Dot(n)/d)); + } + + // project the point onto the tangent plane and line + { + Vector n = tu.Cross(tv); + Vector ty = n.Cross(tu).ScaledBy(1.0/tu.MagSquared()); + Vector tx = tv.Cross(n).ScaledBy(1.0/tv.MagSquared()); + + Vector dp = pi.Minus(ps); + double du = dp.Dot(tx), dv = dp.Dot(ty); + + u += du / tx.MagSquared(); + v += dv / ty.MagSquared(); + } + tCurve += pi.Minus(pc).Dot(tc) / tc.MagSquared(); + if(tCurve < 0.0) tCurve = 0.0; + if(tCurve > 1.0) tCurve = 1.0; + } + dbp("didn't converge (surface and curve intersecting)"); +} + +} // namespace SolveSpace diff --git a/src/srf/raycast.cpp b/src/srf/raycast.cpp new file mode 100644 index 0000000..4c2f435 --- /dev/null +++ b/src/srf/raycast.cpp @@ -0,0 +1,616 @@ +//----------------------------------------------------------------------------- +// Routines for ray-casting: intersecting a line segment or an infinite line +// with a surface or shell. Ray-casting against a shell is used for point-in- +// shell testing, and the intersection of edge line segments against surfaces +// is used to get rough surface-curve intersections, which are later refined +// numerically. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +// Dot product tolerance for perpendicular; this is on the direction cosine, +// so it's about 0.001 degrees. +const double SShell::DOTP_TOL = 1e-5; + +extern int FLAG; + + +double SSurface::DepartureFromCoplanar() const { + int i, j; + int ia, ja, ib = 0, jb = 0, ic = 0, jc = 0; + double best; + + // Grab three points to define a plane; first choose (0, 0) arbitrarily. + ia = ja = 0; + // Then the point farthest from pt a. + best = VERY_NEGATIVE; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + if(i == ia && j == ja) continue; + + double dist = (ctrl[i][j]).Minus(ctrl[ia][ja]).Magnitude(); + if(dist > best) { + best = dist; + ib = i; + jb = j; + } + } + } + // Then biggest magnitude of ab cross ac. + best = VERY_NEGATIVE; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + if(i == ia && j == ja) continue; + if(i == ib && j == jb) continue; + + double mag = + ((ctrl[ia][ja].Minus(ctrl[ib][jb]))).Cross( + (ctrl[ia][ja].Minus(ctrl[i ][j ]))).Magnitude(); + if(mag > best) { + best = mag; + ic = i; + jc = j; + } + } + } + + Vector n = ((ctrl[ia][ja].Minus(ctrl[ib][jb]))).Cross( + (ctrl[ia][ja].Minus(ctrl[ic][jc]))); + n = n.WithMagnitude(1); + double d = (ctrl[ia][ja]).Dot(n); + + // Finally, calculate the deviation from each point to the plane. + double farthest = VERY_NEGATIVE; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + double dist = fabs(n.Dot(ctrl[i][j]) - d); + if(dist > farthest) { + farthest = dist; + } + } + } + return farthest; +} + +void SSurface::WeightControlPoints() { + int i, j; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + ctrl[i][j] = (ctrl[i][j]).ScaledBy(weight[i][j]); + } + } +} +void SSurface::UnWeightControlPoints() { + int i, j; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + ctrl[i][j] = (ctrl[i][j]).ScaledBy(1.0/weight[i][j]); + } + } +} +void SSurface::CopyRowOrCol(bool row, int this_ij, SSurface *src, int src_ij) { + if(row) { + int j; + for(j = 0; j <= degn; j++) { + ctrl [this_ij][j] = src->ctrl [src_ij][j]; + weight[this_ij][j] = src->weight[src_ij][j]; + } + } else { + int i; + for(i = 0; i <= degm; i++) { + ctrl [i][this_ij] = src->ctrl [i][src_ij]; + weight[i][this_ij] = src->weight[i][src_ij]; + } + } +} +void SSurface::BlendRowOrCol(bool row, int this_ij, SSurface *a, int a_ij, + SSurface *b, int b_ij) +{ + if(row) { + int j; + for(j = 0; j <= degn; j++) { + Vector c = (a->ctrl [a_ij][j]).Plus(b->ctrl [b_ij][j]); + double w = (a->weight[a_ij][j] + b->weight[b_ij][j]); + ctrl [this_ij][j] = c.ScaledBy(0.5); + weight[this_ij][j] = w / 2; + } + } else { + int i; + for(i = 0; i <= degm; i++) { + Vector c = (a->ctrl [i][a_ij]).Plus(b->ctrl [i][b_ij]); + double w = (a->weight[i][a_ij] + b->weight[i][b_ij]); + ctrl [i][this_ij] = c.ScaledBy(0.5); + weight[i][this_ij] = w / 2; + } + } +} +void SSurface::SplitInHalf(bool byU, SSurface *sa, SSurface *sb) { + sa->degm = sb->degm = degm; + sa->degn = sb->degn = degn; + + // by de Casteljau's algorithm in a projective space; so we must work + // on points (w*x, w*y, w*z, w) so create a temporary copy + SSurface st; + st = *this; + st.WeightControlPoints(); + + switch(byU ? degm : degn) { + case 1: + sa->CopyRowOrCol (byU, 0, &st, 0); + sb->CopyRowOrCol (byU, 1, &st, 1); + + sa->BlendRowOrCol(byU, 1, &st, 0, &st, 1); + sb->BlendRowOrCol(byU, 0, &st, 0, &st, 1); + break; + + case 2: + sa->CopyRowOrCol (byU, 0, &st, 0); + sb->CopyRowOrCol (byU, 2, &st, 2); + + sa->BlendRowOrCol(byU, 1, &st, 0, &st, 1); + sb->BlendRowOrCol(byU, 1, &st, 1, &st, 2); + + sa->BlendRowOrCol(byU, 2, sa, 1, sb, 1); + sb->BlendRowOrCol(byU, 0, sa, 1, sb, 1); + break; + + case 3: { + sa->CopyRowOrCol (byU, 0, &st, 0); + sb->CopyRowOrCol (byU, 3, &st, 3); + + sa->BlendRowOrCol(byU, 1, &st, 0, &st, 1); + sb->BlendRowOrCol(byU, 2, &st, 2, &st, 3); + st. BlendRowOrCol(byU, 0, &st, 1, &st, 2); // use row/col 0 as scratch + + sa->BlendRowOrCol(byU, 2, sa, 1, &st, 0); + sb->BlendRowOrCol(byU, 1, sb, 2, &st, 0); + + sa->BlendRowOrCol(byU, 3, sa, 2, sb, 1); + sb->BlendRowOrCol(byU, 0, sa, 2, sb, 1); + break; + } + + default: ssassert(false, "Unexpected degree of spline"); + } + + sa->UnWeightControlPoints(); + sb->UnWeightControlPoints(); +} + +//----------------------------------------------------------------------------- +// Find all points where the indicated finite (if segment) or infinite (if not +// segment) line intersects our surface. Report them in uv space in the list. +// We first do a bounding box check; if the line doesn't intersect, then we're +// done. If it does, then we check how small our surface is. If it's big, +// then we subdivide into quarters and recurse. If it's small, then we refine +// by Newton's method and record the point. +//----------------------------------------------------------------------------- +void SSurface::AllPointsIntersectingUntrimmed(Vector a, Vector b, + int *cnt, int *level, + List *l, bool asSegment, + SSurface *sorig) +{ + // Test if the line intersects our axis-aligned bounding box; if no, then + // no possibility of an intersection + if(LineEntirelyOutsideBbox(a, b, asSegment)) return; + + if(*cnt > 2000) { + dbp("!!! too many subdivisions (level=%d)!", *level); + dbp("degm = %d degn = %d", degm, degn); + return; + } + (*cnt)++; + + // If we might intersect, and the surface is small, then switch to Newton + // iterations. + if(DepartureFromCoplanar() < 0.2*SS.ChordTolMm()) { + Vector p = (ctrl[0 ][0 ]).Plus( + ctrl[0 ][degn]).Plus( + ctrl[degm][0 ]).Plus( + ctrl[degm][degn]).ScaledBy(0.25); + Inter inter; + sorig->ClosestPointTo(p, &(inter.p.x), &(inter.p.y), /*mustConverge=*/false); + if(sorig->PointIntersectingLine(a, b, &(inter.p.x), &(inter.p.y))) { + Vector p = sorig->PointAt(inter.p.x, inter.p.y); + // Debug check, verify that the point lies in both surfaces + // (which it ought to, since the surfaces should be coincident) + double u, v; + ClosestPointTo(p, &u, &v); + l->Add(&inter); + } else { + // Might not converge if line is almost tangent to surface... + } + return; + } + + // But the surface is big, so split it, alternating by u and v + SSurface surf0, surf1; + SplitInHalf((*level & 1) == 0, &surf0, &surf1); + + int nextLevel = (*level) + 1; + (*level) = nextLevel; + surf0.AllPointsIntersectingUntrimmed(a, b, cnt, level, l, asSegment, sorig); + (*level) = nextLevel; + surf1.AllPointsIntersectingUntrimmed(a, b, cnt, level, l, asSegment, sorig); +} + +//----------------------------------------------------------------------------- +// Find all points where a line through a and b intersects our surface, and +// add them to the list. If seg is true then report only intersections that +// lie within the finite line segment (not including the endpoints); otherwise +// we work along the infinite line. And we report either just intersections +// inside the trim curve, or any intersection with u, v in [0, 1]. And we +// either disregard or report tangent points. +//----------------------------------------------------------------------------- +void SSurface::AllPointsIntersecting(Vector a, Vector b, + List *l, + bool asSegment, bool trimmed, bool inclTangent) +{ + if(LineEntirelyOutsideBbox(a, b, asSegment)) return; + + Vector ba = b.Minus(a); + double bam = ba.Magnitude(); + + List inters = {}; + + // All the intersections between the line and the surface; either special + // cases that we can quickly solve in closed form, or general numerical. + Vector center, axis, start, finish; + double radius; + if(degm == 1 && degn == 1) { + // Against a plane, easy. + Vector n = NormalAt(0, 0).WithMagnitude(1); + double d = n.Dot(PointAt(0, 0)); + // Trim to line segment now if requested, don't generate points that + // would just get discarded later. + if(!asSegment || + (n.Dot(a) > d + LENGTH_EPS && n.Dot(b) < d - LENGTH_EPS) || + (n.Dot(b) > d + LENGTH_EPS && n.Dot(a) < d - LENGTH_EPS)) + { + Vector p = Vector::AtIntersectionOfPlaneAndLine(n, d, a, b, NULL); + Inter inter; + ClosestPointTo(p, &(inter.p.x), &(inter.p.y)); + inters.Add(&inter); + } + } else if(IsCylinder(&axis, ¢er, &radius, &start, &finish)) { + // This one can be solved in closed form too. + Vector ab = b.Minus(a); + if(axis.Cross(ab).Magnitude() < LENGTH_EPS) { + // edge is parallel to axis of cylinder, no intersection points + return; + } + // A coordinate system centered at the center of the circle, with + // the edge under test horizontal + Vector u, v, n = axis.WithMagnitude(1); + u = (ab.Minus(n.ScaledBy(ab.Dot(n)))).WithMagnitude(1); + v = n.Cross(u); + Point2d ap = (a.Minus(center)).DotInToCsys(u, v, n).ProjectXy(), + bp = (b.Minus(center)).DotInToCsys(u, v, n).ProjectXy(), + sp = (start. Minus(center)).DotInToCsys(u, v, n).ProjectXy(), + fp = (finish.Minus(center)).DotInToCsys(u, v, n).ProjectXy(); + + double thetas = atan2(sp.y, sp.x), thetaf = atan2(fp.y, fp.x); + + Point2d ip[2]; + int ip_n = 0; + if(fabs(fabs(ap.y) - radius) < LENGTH_EPS) { + // tangent + if(inclTangent) { + ip[0] = Point2d::From(0, ap.y); + ip_n = 1; + } + } else if(fabs(ap.y) < radius) { + // two intersections + double xint = sqrt(radius*radius - ap.y*ap.y); + ip[0] = Point2d::From(-xint, ap.y); + ip[1] = Point2d::From( xint, ap.y); + ip_n = 2; + } + int i; + for(i = 0; i < ip_n; i++) { + double t = (ip[i].Minus(ap)).DivProjected(bp.Minus(ap)); + // This is a point on the circle; but is it on the arc? + Point2d pp = ap.Plus((bp.Minus(ap)).ScaledBy(t)); + double theta = atan2(pp.y, pp.x); + double dp = WRAP_SYMMETRIC(theta - thetas, 2*PI), + df = WRAP_SYMMETRIC(thetaf - thetas, 2*PI); + double tol = LENGTH_EPS/radius; + + if((df > 0 && ((dp < -tol) || (dp > df + tol))) || + (df < 0 && ((dp > tol) || (dp < df - tol)))) + { + continue; + } + + Vector p = a.Plus((b.Minus(a)).ScaledBy(t)); + + Inter inter; + ClosestPointTo(p, &(inter.p.x), &(inter.p.y)); + inters.Add(&inter); + } + } else { + // General numerical solution by subdivision, fallback + int cnt = 0, level = 0; + AllPointsIntersectingUntrimmed(a, b, &cnt, &level, &inters, asSegment, this); + } + + // Remove duplicate intersection points + inters.ClearTags(); + int i, j; + for(i = 0; i < inters.n; i++) { + for(j = i + 1; j < inters.n; j++) { + if(inters[i].p.Equals(inters[j].p)) { + inters[j].tag = 1; + } + } + } + inters.RemoveTagged(); + + for(i = 0; i < inters.n; i++) { + Point2d puv = inters[i].p; + + // Make sure the point lies within the finite line segment + Vector pxyz = PointAt(puv.x, puv.y); + double t = (pxyz.Minus(a)).DivProjected(ba); + if(asSegment && (t > 1 - LENGTH_EPS/bam || t < LENGTH_EPS/bam)) { + continue; + } + + // And that it lies inside our trim region + Point2d dummy = { 0, 0 }; + SBspUv::Class c = (bsp) ? bsp->ClassifyPoint(puv, dummy, this) : SBspUv::Class::OUTSIDE; + if(trimmed && c == SBspUv::Class::OUTSIDE) { + continue; + } + + // It does, so generate the intersection + SInter si; + si.p = pxyz; + si.surfNormal = NormalAt(puv.x, puv.y); + si.pinter = puv; + si.srf = this; + si.onEdge = (c != SBspUv::Class::INSIDE); + l->Add(&si); + } + + inters.Clear(); +} + +void SShell::AllPointsIntersecting(Vector a, Vector b, + List *il, + bool asSegment, bool trimmed, bool inclTangent) +{ + for(SSurface &ss : surface) { + ss.AllPointsIntersecting(a, b, il, + asSegment, trimmed, inclTangent); + } +} + + + +SShell::Class SShell::ClassifyRegion(Vector edge_n, Vector inter_surf_n, + Vector edge_surf_n) const +{ + double dot = inter_surf_n.DirectionCosineWith(edge_n); + if(fabs(dot) < DOTP_TOL) { + // The edge's surface and the edge-on-face surface + // are coincident. Test the edge's surface normal + // to see if it's with same or opposite normals. + if(inter_surf_n.Dot(edge_surf_n) > 0) { + return Class::SURF_COINC_SAME; + } else { + return Class::SURF_COINC_OPP; + } + } else if(dot > 0) { + return Class::SURF_OUTSIDE; + } else { + return Class::SURF_INSIDE; + } +} + +//----------------------------------------------------------------------------- +// Does the given point lie on our shell? There are many cases; inside and +// outside are obvious, but then there's all the edge-on-edge and edge-on-face +// possibilities. +// +// To calculate, we intersect a ray through p with our shell, and classify +// using the closest intersection point. If the ray hits a surface on edge, +// then just reattempt in a different random direction. +//----------------------------------------------------------------------------- + +// table of vectors in 6 arbitrary directions covering 4 of the 8 octants. +// use overlapping sets of 3 to reduce memory usage. +static const double Random[8] = {1.278, 5.0103, 9.427, -2.331, 7.13, 2.954, 5.034, -4.777}; + +bool SShell::ClassifyEdge(Class *indir, Class *outdir, + Vector ea, Vector eb, + Vector p, + Vector edge_n_in, Vector edge_n_out, Vector surf_n) +{ + List l = {}; + + // First, check for edge-on-edge + int edge_inters = 0; + Vector inter_surf_n[2], inter_edge_n[2]; + for(SSurface &srf : surface) { + if(srf.LineEntirelyOutsideBbox(ea, eb, /*asSegment=*/true)) continue; + + SEdgeList *sel = &(srf.edges); + SEdge *se; + for(se = sel->l.First(); se; se = sel->l.NextAfter(se)) { + if((ea.Equals(se->a) && eb.Equals(se->b)) || + (eb.Equals(se->a) && ea.Equals(se->b)) || + p.OnLineSegment(se->a, se->b)) + { + if(edge_inters < 2) { + // Edge-on-edge case + Point2d pm; + srf.ClosestPointTo(p, &pm, /*mustConverge=*/false); + // A vector normal to the surface, at the intersection point + inter_surf_n[edge_inters] = srf.NormalAt(pm); + // A vector normal to the intersecting edge (but within the + // intersecting surface) at the intersection point, pointing + // out. + inter_edge_n[edge_inters] = + (inter_surf_n[edge_inters]).Cross((se->b).Minus((se->a))); + } + + edge_inters++; + } + } + } + + if(edge_inters == 2) { + //! @todo make this use the appropriate curved normals + double dotp[2]; + for(int i = 0; i < 2; i++) { + dotp[i] = edge_n_out.DirectionCosineWith(inter_surf_n[i]); + } + + if(fabs(dotp[1]) < DOTP_TOL) { + swap(dotp[0], dotp[1]); + swap(inter_surf_n[0], inter_surf_n[1]); + swap(inter_edge_n[0], inter_edge_n[1]); + } + + Class coinc = (surf_n.Dot(inter_surf_n[0])) > 0 ? Class::SURF_COINC_SAME : Class::SURF_COINC_OPP; + + if(fabs(dotp[0]) < DOTP_TOL && fabs(dotp[1]) < DOTP_TOL) { + // This is actually an edge on face case, just that the face + // is split into two pieces joining at our edge. + *indir = coinc; + *outdir = coinc; + } else if(fabs(dotp[0]) < DOTP_TOL && dotp[1] > DOTP_TOL) { + if(edge_n_out.Dot(inter_edge_n[0]) > 0) { + *indir = coinc; + *outdir = Class::SURF_OUTSIDE; + } else { + *indir = Class::SURF_INSIDE; + *outdir = coinc; + } + } else if(fabs(dotp[0]) < DOTP_TOL && dotp[1] < -DOTP_TOL) { + if(edge_n_out.Dot(inter_edge_n[0]) > 0) { + *indir = coinc; + *outdir = Class::SURF_INSIDE; + } else { + *indir = Class::SURF_OUTSIDE; + *outdir = coinc; + } + } else if(dotp[0] > DOTP_TOL && dotp[1] > DOTP_TOL) { + *indir = Class::SURF_INSIDE; + *outdir = Class::SURF_OUTSIDE; + } else if(dotp[0] < -DOTP_TOL && dotp[1] < -DOTP_TOL) { + *indir = Class::SURF_OUTSIDE; + *outdir = Class::SURF_INSIDE; + } else { + // Edge is tangent to the shell at shell's edge, so can't be + // a boundary of the surface. + return false; + } + return true; + } + + if(edge_inters != 0) dbp("bad, edge_inters=%d", edge_inters); + + // Next, check for edge-on-surface. The ray-casting for edge-inside-shell + // would catch this too, but test separately, for speed (since many edges + // are on surface) and for numerical stability, so we don't pick up + // the additional error from the line intersection. + + for(SSurface &srf : surface) { + if(srf.LineEntirelyOutsideBbox(ea, eb, /*asSegment=*/true)) continue; + + Point2d puv; + srf.ClosestPointTo(p, &(puv.x), &(puv.y), /*mustConverge=*/false); + Vector pp = srf.PointAt(puv); + + if((pp.Minus(p)).Magnitude() > LENGTH_EPS) continue; + Point2d dummy = { 0, 0 }; + SBspUv::Class c = (srf.bsp) ? srf.bsp->ClassifyPoint(puv, dummy, &srf) : SBspUv::Class::OUTSIDE; + if(c == SBspUv::Class::OUTSIDE) continue; + + // Edge-on-face (unless edge-on-edge above superseded) + Point2d pin, pout; + srf.ClosestPointTo(p.Plus(edge_n_in), &pin, /*mustConverge=*/false); + srf.ClosestPointTo(p.Plus(edge_n_out), &pout, /*mustConverge=*/false); + + Vector surf_n_in = srf.NormalAt(pin), + surf_n_out = srf.NormalAt(pout); + + *indir = ClassifyRegion(edge_n_in, surf_n_in, surf_n); + *outdir = ClassifyRegion(edge_n_out, surf_n_out, surf_n); + return true; + } + + // Edge is not on face or on edge; so it's either inside or outside + // the shell, and we'll determine which by raycasting. + int cnt = 0; + for(;;) { + // Cast a ray in a random direction (two-sided so that we test if + // the point lies on a surface, but use only one side for in/out + // testing) + Vector ray = Vector::From(Random[cnt], Random[cnt+1], Random[cnt+2]); + + AllPointsIntersecting( + p.Minus(ray), p.Plus(ray), &l, + /*asSegment=*/false, /*trimmed=*/true, /*inclTangent=*/false); + + // no intersections means it's outside + *indir = Class::SURF_OUTSIDE; + *outdir = Class::SURF_OUTSIDE; + double dmin = VERY_POSITIVE; + bool onEdge = false; + edge_inters = 0; + + SInter *si; + for(si = l.First(); si; si = l.NextAfter(si)) { + double t = ((si->p).Minus(p)).DivProjected(ray); + if(t*ray.Magnitude() < -LENGTH_EPS) { + // wrong side, doesn't count + continue; + } + + double d = ((si->p).Minus(p)).Magnitude(); + + // We actually should never hit this case; it should have been + // handled above. + if(d < LENGTH_EPS && si->onEdge) { + edge_inters++; + } + + if(d < dmin) { + dmin = d; + // Edge does not lie on surface; either strictly inside + // or strictly outside + if((si->surfNormal).Dot(ray) > 0) { + *indir = Class::SURF_INSIDE; + *outdir = Class::SURF_INSIDE; + } else { + *indir = Class::SURF_OUTSIDE; + *outdir = Class::SURF_OUTSIDE; + } + onEdge = si->onEdge; + } + } + l.Clear(); + + // If the point being tested lies exactly on an edge of the shell, + // then our ray always lies on edge, and that's okay. Otherwise + // try again in a different random direction. + if(!onEdge) break; + cnt++; + if(cnt > 5) { + dbp("can't find a ray that doesn't hit on edge!"); + dbp("on edge = %d, edge_inters = %d", onEdge, edge_inters); + SS.nakedEdges.AddEdge(ea, eb); + break; + } + } + + return true; +} + +} // namespace SolveSpace diff --git a/src/srf/shell.cpp b/src/srf/shell.cpp new file mode 100644 index 0000000..9d7fa47 --- /dev/null +++ b/src/srf/shell.cpp @@ -0,0 +1,618 @@ +//----------------------------------------------------------------------------- +// Anything involving NURBS shells (i.e., shells); except +// for the real math, which is in ratpoly.cpp. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +typedef struct { + hSCurve hc; + hSSurface hs; +} TrimLine; + + +void SShell::MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, RgbaColor color) +{ + // Make the extrusion direction consistent with respect to the normal + // of the sketch we're extruding. + if((t0.Minus(t1)).Dot(sbls->normal) < 0) { + swap(t0, t1); + } + + // Define a coordinate system to contain the original sketch, and get + // a bounding box in that csys + Vector n = sbls->normal.ScaledBy(-1); + Vector u = n.Normal(0), v = n.Normal(1); + Vector orig = sbls->point; + double umax = VERY_NEGATIVE, umin = VERY_POSITIVE; + sbls->GetBoundingProjd(u, orig, &umin, &umax); + double vmax = VERY_NEGATIVE, vmin = VERY_POSITIVE; + sbls->GetBoundingProjd(v, orig, &vmin, &vmax); + // and now fix things up so that all u and v lie between 0 and 1 + orig = orig.Plus(u.ScaledBy(umin)); + orig = orig.Plus(v.ScaledBy(vmin)); + u = u.ScaledBy(umax - umin); + v = v.ScaledBy(vmax - vmin); + + // So we can now generate the top and bottom surfaces of the extrusion, + // planes within a translated (and maybe mirrored) version of that csys. + SSurface s0, s1; + s0 = SSurface::FromPlane(orig.Plus(t0), u, v); + s0.color = color; + s1 = SSurface::FromPlane(orig.Plus(t1).Plus(u), u.ScaledBy(-1), v); + s1.color = color; + hSSurface hs0 = surface.AddAndAssignId(&s0), + hs1 = surface.AddAndAssignId(&s1); + + // Now go through the input curves. For each one, generate its surface + // of extrusion, its two translated trim curves, and one trim line. We + // go through by loops so that we can assign the lines correctly. + SBezierLoop *sbl; + for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { + SBezier *sb; + List trimLines = {}; + + for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { + // Generate the surface of extrusion of this curve, and add + // it to the list + SSurface ss = SSurface::FromExtrusionOf(sb, t0, t1); + ss.color = color; + hSSurface hsext = surface.AddAndAssignId(&ss); + + // Translate the curve by t0 and t1 to produce two trim curves + SCurve sc = {}; + sc.isExact = true; + sc.exact = sb->TransformedBy(t0, Quaternion::IDENTITY, 1.0); + (sc.exact).MakePwlInto(&(sc.pts)); + sc.surfA = hs0; + sc.surfB = hsext; + hSCurve hc0 = curve.AddAndAssignId(&sc); + + sc = {}; + sc.isExact = true; + sc.exact = sb->TransformedBy(t1, Quaternion::IDENTITY, 1.0); + (sc.exact).MakePwlInto(&(sc.pts)); + sc.surfA = hs1; + sc.surfB = hsext; + hSCurve hc1 = curve.AddAndAssignId(&sc); + + STrimBy stb0, stb1; + // The translated curves trim the flat top and bottom surfaces. + stb0 = STrimBy::EntireCurve(this, hc0, /*backwards=*/false); + stb1 = STrimBy::EntireCurve(this, hc1, /*backwards=*/true); + (surface.FindById(hs0))->trim.Add(&stb0); + (surface.FindById(hs1))->trim.Add(&stb1); + + // The translated curves also trim the surface of extrusion. + stb0 = STrimBy::EntireCurve(this, hc0, /*backwards=*/true); + stb1 = STrimBy::EntireCurve(this, hc1, /*backwards=*/false); + (surface.FindById(hsext))->trim.Add(&stb0); + (surface.FindById(hsext))->trim.Add(&stb1); + + // And form the trim line + Vector pt = sb->Finish(); + sc = {}; + sc.isExact = true; + sc.exact = SBezier::From(pt.Plus(t0), pt.Plus(t1)); + (sc.exact).MakePwlInto(&(sc.pts)); + hSCurve hl = curve.AddAndAssignId(&sc); + // save this for later + TrimLine tl; + tl.hc = hl; + tl.hs = hsext; + trimLines.Add(&tl); + } + + int i; + for(i = 0; i < trimLines.n; i++) { + TrimLine *tl = &(trimLines[i]); + SSurface *ss = surface.FindById(tl->hs); + + TrimLine *tlp = &(trimLines[WRAP(i-1, trimLines.n)]); + + STrimBy stb; + stb = STrimBy::EntireCurve(this, tl->hc, /*backwards=*/true); + ss->trim.Add(&stb); + stb = STrimBy::EntireCurve(this, tlp->hc, /*backwards=*/false); + ss->trim.Add(&stb); + + (curve.FindById(tl->hc))->surfA = ss->h; + (curve.FindById(tlp->hc))->surfB = ss->h; + } + trimLines.Clear(); + } +} + +bool SShell::CheckNormalAxisRelationship(SBezierLoopSet *sbls, Vector pt, Vector axis, double da, double dx) +// Check that the direction of revolution/extrusion ends up parallel to the normal of +// the sketch, on the side of the axis where the sketch is. +{ + SBezierLoop *sbl; + Vector pto; + double md = VERY_NEGATIVE; + for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { + SBezier *sb; + for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { + // Choose the point farthest from the axis; we'll get garbage + // if we choose a point that lies on the axis, for example. + // (And our surface will be self-intersecting if the sketch + // spans the axis, so don't worry about that.) + for(int i = 0; i <= sb->deg; i++) { + Vector p = sb->ctrl[i]; + double d = p.DistanceToLine(pt, axis); + if(d > md) { + md = d; + pto = p; + } + } + } + } + Vector ptc = pto.ClosestPointOnLine(pt, axis), + up = axis.Cross(pto.Minus(ptc)).ScaledBy(da), + vp = up.Plus(axis.ScaledBy(dx)); + + return (vp.Dot(sbls->normal) > 0); +} + +// sketch must not contain the axis of revolution as a non-construction line for helix +void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, + RgbaColor color, Group *group, double angles, + double anglef, double dists, double distf) { + int i0 = surface.n; // number of pre-existing surfaces + SBezierLoop *sbl; + // for testing - hard code the axial distance, and number of sections. + // distance will need to be parameters in the future. + double dist = distf - dists; + int sections = (int)(fabs(anglef - angles) / (PI / 2) + 1); + double wedge = (anglef - angles) / sections; + int startMapping = Group::REMAP_LATHE_START, endMapping = Group::REMAP_LATHE_END; + + if(CheckNormalAxisRelationship(sbls, pt, axis, anglef-angles, distf-dists)) { + swap(angles, anglef); + swap(dists, distf); + dist = -dist; + wedge = -wedge; + swap(startMapping, endMapping); + } + + // Define a coordinate system to contain the original sketch, and get + // a bounding box in that csys + Vector n = sbls->normal.ScaledBy(-1); + Vector u = n.Normal(0), v = n.Normal(1); + Vector orig = sbls->point; + double umax = VERY_NEGATIVE, umin = VERY_POSITIVE; + sbls->GetBoundingProjd(u, orig, &umin, &umax); + double vmax = VERY_NEGATIVE, vmin = VERY_POSITIVE; + sbls->GetBoundingProjd(v, orig, &vmin, &vmax); + // and now fix things up so that all u and v lie between 0 and 1 + orig = orig.Plus(u.ScaledBy(umin)); + orig = orig.Plus(v.ScaledBy(vmin)); + u = u.ScaledBy(umax - umin); + v = v.ScaledBy(vmax - vmin); + + // So we can now generate the end caps of the extrusion within + // a translated and rotated (and maybe mirrored) version of that csys. + SSurface s0, s1; + s0 = SSurface::FromPlane(orig.RotatedAbout(pt, axis, angles).Plus(axis.ScaledBy(dists)), + u.RotatedAbout(axis, angles), v.RotatedAbout(axis, angles)); + s0.color = color; + + hEntity face0 = group->Remap(Entity::NO_ENTITY, startMapping); + s0.face = face0.v; + + s1 = SSurface::FromPlane( + orig.Plus(u).RotatedAbout(pt, axis, anglef).Plus(axis.ScaledBy(distf)), + u.ScaledBy(-1).RotatedAbout(axis, anglef), v.RotatedAbout(axis, anglef)); + s1.color = color; + + hEntity face1 = group->Remap(Entity::NO_ENTITY, endMapping); + s1.face = face1.v; + + hSSurface hs0 = surface.AddAndAssignId(&s0); + hSSurface hs1 = surface.AddAndAssignId(&s1); + + // Now we actually build and trim the swept surfaces. One loop at a time. + for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { + int i, j; + SBezier *sb; + List> hsl = {}; + + // This is where all the NURBS are created and Remapped to the generating curve + for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { + std::vector revs(sections); + for(j = 0; j < sections; j++) { + if((dist == 0) && sb->deg == 1 && + (sb->ctrl[0]).DistanceToLine(pt, axis) < LENGTH_EPS && + (sb->ctrl[1]).DistanceToLine(pt, axis) < LENGTH_EPS) { + // This is a line on the axis of revolution; it does + // not contribute a surface. + revs[j].v = 0; + } else { + SSurface ss = SSurface::FromRevolutionOf( + sb, pt, axis, angles + (wedge)*j, angles + (wedge) * (j + 1), + dists + j * dist / sections, dists + (j + 1) * dist / sections); + ss.color = color; + if(sb->entity != 0) { + hEntity he; + he.v = sb->entity; + hEntity hface = group->Remap(he, Group::REMAP_LINE_TO_FACE); + if(SK.entity.FindByIdNoOops(hface) != NULL) { + ss.face = hface.v; + } + } + revs[j] = surface.AddAndAssignId(&ss); + } + } + hsl.Add(&revs); + } + // Still the same loop. Need to create trim curves + for(i = 0; i < sbl->l.n; i++) { + std::vector revs = hsl[i], revsp = hsl[WRAP(i - 1, sbl->l.n)]; + + sb = &(sbl->l[i]); + + // we will need the grid t-values for this entire row of surfaces + List t_values; + t_values = {}; + if (revs[0].v) { + double ps = 0.0; + t_values.Add(&ps); + (surface.FindById(revs[0]))->MakeTriangulationGridInto( + &t_values, 0.0, 1.0, true, 0); + } + // we generate one more curve than we did surfaces + for(j = 0; j <= sections; j++) { + SCurve sc; + Quaternion qs = Quaternion::From(axis, angles + wedge * j); + // we want Q*(x - p) + p = Q*x + (p - Q*p) + Vector ts = + pt.Minus(qs.Rotate(pt)).Plus(axis.ScaledBy(dists + j * dist / sections)); + + // If this input curve generated a surface, then trim that + // surface with the rotated version of the input curve. + if(revs[0].v) { // not d[j] because crash on j==sections + sc = {}; + sc.isExact = true; + sc.exact = sb->TransformedBy(ts, qs, 1.0); + // make the PWL for the curve based on t value list + for(int x = 0; x < t_values.n; x++) { + SCurvePt scpt; + scpt.tag = 0; + scpt.p = sc.exact.PointAt(t_values[x]); + scpt.vertex = (x == 0) || (x == (t_values.n - 1)); + sc.pts.Add(&scpt); + } + + // the surfaces already exists so trim with this curve + if(j < sections) { + sc.surfA = revs[j]; + } else { + sc.surfA = hs1; // end cap + } + + if(j > 0) { + sc.surfB = revs[j - 1]; + } else { + sc.surfB = hs0; // staring cap + } + + hSCurve hcb = curve.AddAndAssignId(&sc); + + STrimBy stb; + stb = STrimBy::EntireCurve(this, hcb, /*backwards=*/true); + (surface.FindById(sc.surfA))->trim.Add(&stb); + stb = STrimBy::EntireCurve(this, hcb, /*backwards=*/false); + (surface.FindById(sc.surfB))->trim.Add(&stb); + } else if(j == 0) { // curve was on the rotation axis and is shared by the end caps. + sc = {}; + sc.isExact = true; + sc.exact = sb->TransformedBy(ts, qs, 1.0); + (sc.exact).MakePwlInto(&(sc.pts)); + sc.surfA = hs1; // end cap + sc.surfB = hs0; // staring cap + hSCurve hcb = curve.AddAndAssignId(&sc); + + STrimBy stb; + stb = STrimBy::EntireCurve(this, hcb, /*backwards=*/true); + (surface.FindById(sc.surfA))->trim.Add(&stb); + stb = STrimBy::EntireCurve(this, hcb, /*backwards=*/false); + (surface.FindById(sc.surfB))->trim.Add(&stb); + } + + // And if this input curve and the one after it both generated + // surfaces, then trim both of those by the appropriate + // curve based on the control points. + if((j < sections) && revs[j].v && revsp[j].v) { + SSurface *ss = surface.FindById(revs[j]); + + sc = {}; + sc.isExact = true; + sc.exact = SBezier::From(ss->ctrl[0][0], ss->ctrl[0][1], ss->ctrl[0][2]); + sc.exact.weight[1] = ss->weight[0][1]; + double max_dt = 0.5; + if (sc.exact.deg > 1) max_dt = 0.125; + (sc.exact).MakePwlInto(&(sc.pts), 0.0, max_dt); + sc.surfA = revs[j]; + sc.surfB = revsp[j]; + + hSCurve hcc = curve.AddAndAssignId(&sc); + + STrimBy stb; + stb = STrimBy::EntireCurve(this, hcc, /*backwards=*/false); + (surface.FindById(sc.surfA))->trim.Add(&stb); + stb = STrimBy::EntireCurve(this, hcc, /*backwards=*/true); + (surface.FindById(sc.surfB))->trim.Add(&stb); + } + } + t_values.Clear(); + } + + hsl.Clear(); + } + + if(dist == 0) { + MakeFirstOrderRevolvedSurfaces(pt, axis, i0); + } +} + +void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, RgbaColor color, + Group *group) { + int i0 = surface.n; // number of pre-existing surfaces + SBezierLoop *sbl; + + if(CheckNormalAxisRelationship(sbls, pt, axis, 1.0, 0.0)) { + axis = axis.ScaledBy(-1); + } + + // Now we actually build and trim the surfaces. + for(sbl = sbls->l.First(); sbl; sbl = sbls->l.NextAfter(sbl)) { + int i, j; + SBezier *sb; + List> hsl = {}; + + for(sb = sbl->l.First(); sb; sb = sbl->l.NextAfter(sb)) { + std::vector revs(4); + for(j = 0; j < 4; j++) { + if(sb->deg == 1 && + (sb->ctrl[0]).DistanceToLine(pt, axis) < LENGTH_EPS && + (sb->ctrl[1]).DistanceToLine(pt, axis) < LENGTH_EPS) + { + // This is a line on the axis of revolution; it does + // not contribute a surface. + revs[j].v = 0; + } else { + SSurface ss = SSurface::FromRevolutionOf(sb, pt, axis, (PI / 2) * j, + (PI / 2) * (j + 1), 0.0, 0.0); + ss.color = color; + if(sb->entity != 0) { + hEntity he; + he.v = sb->entity; + hEntity hface = group->Remap(he, Group::REMAP_LINE_TO_FACE); + if(SK.entity.FindByIdNoOops(hface) != NULL) { + ss.face = hface.v; + } + } + revs[j] = surface.AddAndAssignId(&ss); + } + } + hsl.Add(&revs); + } + + for(i = 0; i < sbl->l.n; i++) { + std::vector revs = hsl[i], + revsp = hsl[WRAP(i-1, sbl->l.n)]; + + sb = &(sbl->l[i]); + + for(j = 0; j < 4; j++) { + SCurve sc; + Quaternion qs = Quaternion::From(axis, (PI/2)*j); + // we want Q*(x - p) + p = Q*x + (p - Q*p) + Vector ts = pt.Minus(qs.Rotate(pt)); + + // If this input curve generate a surface, then trim that + // surface with the rotated version of the input curve. + if(revs[j].v) { + sc = {}; + sc.isExact = true; + sc.exact = sb->TransformedBy(ts, qs, 1.0); + (sc.exact).MakePwlInto(&(sc.pts)); + sc.surfA = revs[j]; + sc.surfB = revs[WRAP(j-1, 4)]; + + hSCurve hcb = curve.AddAndAssignId(&sc); + + STrimBy stb; + stb = STrimBy::EntireCurve(this, hcb, /*backwards=*/true); + (surface.FindById(sc.surfA))->trim.Add(&stb); + stb = STrimBy::EntireCurve(this, hcb, /*backwards=*/false); + (surface.FindById(sc.surfB))->trim.Add(&stb); + } + + // And if this input curve and the one after it both generated + // surfaces, then trim both of those by the appropriate + // circle. + if(revs[j].v && revsp[j].v) { + SSurface *ss = surface.FindById(revs[j]); + + sc = {}; + sc.isExact = true; + sc.exact = SBezier::From(ss->ctrl[0][0], + ss->ctrl[0][1], + ss->ctrl[0][2]); + sc.exact.weight[1] = ss->weight[0][1]; + (sc.exact).MakePwlInto(&(sc.pts)); + sc.surfA = revs[j]; + sc.surfB = revsp[j]; + + hSCurve hcc = curve.AddAndAssignId(&sc); + + STrimBy stb; + stb = STrimBy::EntireCurve(this, hcc, /*backwards=*/false); + (surface.FindById(sc.surfA))->trim.Add(&stb); + stb = STrimBy::EntireCurve(this, hcc, /*backwards=*/true); + (surface.FindById(sc.surfB))->trim.Add(&stb); + } + } + } + + hsl.Clear(); + } + + MakeFirstOrderRevolvedSurfaces(pt, axis, i0); +} + +void SShell::MakeFirstOrderRevolvedSurfaces(Vector pt, Vector axis, int i0) { + int i; + + for(i = i0; i < surface.n; i++) { + SSurface *srf = &(surface[i]); + + // Revolution of a line; this is potentially a plane, which we can + // rewrite to have degree (1, 1). + if(srf->degm == 1 && srf->degn == 2) { + // close start, far start, far finish + Vector cs, fs, ff; + double d0, d1; + d0 = (srf->ctrl[0][0]).DistanceToLine(pt, axis); + d1 = (srf->ctrl[1][0]).DistanceToLine(pt, axis); + + if(d0 > d1) { + cs = srf->ctrl[1][0]; + fs = srf->ctrl[0][0]; + ff = srf->ctrl[0][2]; + } else { + cs = srf->ctrl[0][0]; + fs = srf->ctrl[1][0]; + ff = srf->ctrl[1][2]; + } + + // origin close, origin far + Vector oc = cs.ClosestPointOnLine(pt, axis), + of = fs.ClosestPointOnLine(pt, axis); + + if(oc.Equals(of)) { + // This is a plane, not a (non-degenerate) cone. + Vector oldn = srf->NormalAt(0.5, 0.5); + + Vector u = fs.Minus(of), v; + + v = (axis.Cross(u)).WithMagnitude(1); + + double vm = (ff.Minus(of)).Dot(v); + v = v.ScaledBy(vm); + + srf->degm = 1; + srf->degn = 1; + srf->ctrl[0][0] = of; + srf->ctrl[0][1] = of.Plus(u); + srf->ctrl[1][0] = of.Plus(v); + srf->ctrl[1][1] = of.Plus(u).Plus(v); + srf->weight[0][0] = 1; + srf->weight[0][1] = 1; + srf->weight[1][0] = 1; + srf->weight[1][1] = 1; + + if(oldn.Dot(srf->NormalAt(0.5, 0.5)) < 0) { + swap(srf->ctrl[0][0], srf->ctrl[1][0]); + swap(srf->ctrl[0][1], srf->ctrl[1][1]); + } + continue; + } + + if(fabs(d0 - d1) < LENGTH_EPS) { + // This is a cylinder; so transpose it so that we'll recognize + // it as a surface of extrusion. + SSurface sn = *srf; + + // Transposing u and v flips the normal, so reverse u to + // flip it again and put it back where we started. + sn.degm = 2; + sn.degn = 1; + int dm, dn; + for(dm = 0; dm <= 1; dm++) { + for(dn = 0; dn <= 2; dn++) { + sn.ctrl [dn][dm] = srf->ctrl [1-dm][dn]; + sn.weight[dn][dm] = srf->weight[1-dm][dn]; + } + } + + *srf = sn; + continue; + } + } + } +} + +void SShell::MakeFromCopyOf(SShell *a) { + ssassert(this != a, "Can't make from copy of self"); + MakeFromTransformationOf(a, + Vector::From(0, 0, 0), Quaternion::IDENTITY, 1.0); +} + +void SShell::MakeFromTransformationOf(SShell *a, + Vector t, Quaternion q, double scale) +{ + booleanFailed = false; + surface.ReserveMore(a->surface.n); + for(SSurface &s : a->surface) { + SSurface n; + n = SSurface::FromTransformationOf(&s, t, q, scale, /*includingTrims=*/true); + surface.Add(&n); // keeping the old ID + } + + curve.ReserveMore(a->curve.n); + for(SCurve &c : a->curve) { + SCurve n; + n = SCurve::FromTransformationOf(&c, t, q, scale); + curve.Add(&n); // keeping the old ID + } +} + +void SShell::MakeEdgesInto(SEdgeList *sel) { + for(SSurface &s : surface) { + s.MakeEdgesInto(this, sel, SSurface::MakeAs::XYZ); + } +} + +void SShell::MakeSectionEdgesInto(Vector n, double d, SEdgeList *sel, SBezierList *sbl) +{ + for(SSurface &s : surface) { + if(s.CoincidentWithPlane(n, d)) { + s.MakeSectionEdgesInto(this, sel, sbl); + } + } +} + +void SShell::TriangulateInto(SMesh *sm) { +#pragma omp parallel for + for(int i=0; iTriangulateInto(this, &m); + #pragma omp critical + sm->MakeFromCopyOf(&m); + m.Clear(); + } +} + +bool SShell::IsEmpty() const { + return surface.IsEmpty(); +} + +void SShell::Clear() { + for(SSurface &s : surface) { + s.Clear(); + } + surface.Clear(); + + for(SCurve &c : curve) { + c.Clear(); + } + curve.Clear(); +} + +} // namespace SolveSpace diff --git a/src/srf/surface.cpp b/src/srf/surface.cpp new file mode 100644 index 0000000..8ddd084 --- /dev/null +++ b/src/srf/surface.cpp @@ -0,0 +1,494 @@ +//----------------------------------------------------------------------------- +// Anything involving surfaces and sets of surfaces (i.e., shells); except +// for the real math, which is in ratpoly.cpp. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +SSurface SSurface::FromExtrusionOf(SBezier *sb, Vector t0, Vector t1) { + SSurface ret = {}; + + ret.degm = sb->deg; + ret.degn = 1; + + int i; + for(i = 0; i <= ret.degm; i++) { + ret.ctrl[i][0] = (sb->ctrl[i]).Plus(t0); + ret.weight[i][0] = sb->weight[i]; + + ret.ctrl[i][1] = (sb->ctrl[i]).Plus(t1); + ret.weight[i][1] = sb->weight[i]; + } + + return ret; +} + +bool SSurface::IsExtrusion(SBezier *of, Vector *alongp) const { + int i; + + if(degn != 1) return false; + + Vector along = (ctrl[0][1]).Minus(ctrl[0][0]); + for(i = 0; i <= degm; i++) { + if((fabs(weight[i][1] - weight[i][0]) < LENGTH_EPS) && + ((ctrl[i][1]).Minus(ctrl[i][0])).Equals(along)) + { + continue; + } + return false; + } + + // yes, we are a surface of extrusion; copy the original curve and return + if(of) { + for(i = 0; i <= degm; i++) { + of->weight[i] = weight[i][0]; + of->ctrl[i] = ctrl[i][0]; + } + of->deg = degm; + *alongp = along; + } + return true; +} + +bool SSurface::IsCylinder(Vector *axis, Vector *center, double *r, + Vector *start, Vector *finish) const +{ + SBezier sb; + if(!IsExtrusion(&sb, axis)) return false; + if(!sb.IsCircle(*axis, center, r)) return false; + + *start = sb.ctrl[0]; + *finish = sb.ctrl[2]; + return true; +} + +// Create a surface patch by revolving and possibly translating a curve. +// Works for sections up to but not including 180 degrees. +SSurface SSurface::FromRevolutionOf(SBezier *sb, Vector pt, Vector axis, double thetas, + double thetaf, double dists, + double distf) { // s is start, f is finish + SSurface ret = {}; + ret.degm = sb->deg; + ret.degn = 2; + + double dtheta = fabs(WRAP_SYMMETRIC(thetaf - thetas, 2*PI)); + double w = cos(dtheta / 2); + + // Revolve the curve about the z axis + int i; + for(i = 0; i <= ret.degm; i++) { + Vector p = sb->ctrl[i]; + + Vector ps = p.RotatedAbout(pt, axis, thetas), + pf = p.RotatedAbout(pt, axis, thetaf); + + // The middle control point should be at the intersection of the tangents at ps and pf. + // This is equivalent but works for 0 <= angle < 180 degrees. + Vector mid = ps.Plus(pf).ScaledBy(0.5); + Vector c = ps.ClosestPointOnLine(pt, axis); + Vector ct = mid.Minus(c).ScaledBy(1 / (w * w)).Plus(c); + + // not sure this is needed + if(ps.Equals(pf)) { + ps = c; + ct = c; + pf = c; + } + // moving along the axis can create hilical surfaces (or straight extrusion if + // thetas==thetaf) + ret.ctrl[i][0] = ps.Plus(axis.ScaledBy(dists)); + ret.ctrl[i][1] = ct.Plus(axis.ScaledBy((dists + distf) / 2)); + ret.ctrl[i][2] = pf.Plus(axis.ScaledBy(distf)); + + ret.weight[i][0] = sb->weight[i]; + ret.weight[i][1] = sb->weight[i] * w; + ret.weight[i][2] = sb->weight[i]; + } + + return ret; +} + +SSurface SSurface::FromPlane(Vector pt, Vector u, Vector v) { + SSurface ret = {}; + + ret.degm = 1; + ret.degn = 1; + + ret.weight[0][0] = ret.weight[0][1] = 1; + ret.weight[1][0] = ret.weight[1][1] = 1; + + ret.ctrl[0][0] = pt; + ret.ctrl[0][1] = pt.Plus(u); + ret.ctrl[1][0] = pt.Plus(v); + ret.ctrl[1][1] = pt.Plus(v).Plus(u); + + return ret; +} + +SSurface SSurface::FromTransformationOf(SSurface *a, Vector t, Quaternion q, double scale, + bool includingTrims) +{ + bool needRotate = !EXACT(q.vx == 0.0 && q.vy == 0.0 && q.vz == 0.0 && q.w == 1.0); + bool needTranslate = !EXACT(t.x == 0.0 && t.y == 0.0 && t.z == 0.0); + bool needScale = !EXACT(scale == 1.0); + + SSurface ret = {}; + ret.h = a->h; + ret.color = a->color; + ret.face = a->face; + + ret.degm = a->degm; + ret.degn = a->degn; + int i, j; + for(i = 0; i <= 3; i++) { + for(j = 0; j <= 3; j++) { + Vector ctrl = a->ctrl[i][j]; + if(needScale) { + ctrl = ctrl.ScaledBy(scale); + } + if(needRotate) { + ctrl = q.Rotate(ctrl); + } + if(needTranslate) { + ctrl = ctrl.Plus(t); + } + ret.ctrl[i][j] = ctrl; + ret.weight[i][j] = a->weight[i][j]; + } + } + + if(includingTrims) { + STrimBy *stb; + ret.trim.ReserveMore(a->trim.n); + for(stb = a->trim.First(); stb; stb = a->trim.NextAfter(stb)) { + STrimBy n = *stb; + if(needScale) { + n.start = n.start.ScaledBy(scale); + n.finish = n.finish.ScaledBy(scale); + } + if(needRotate) { + n.start = q.Rotate(n.start); + n.finish = q.Rotate(n.finish); + } + if(needTranslate) { + n.start = n.start.Plus(t); + n.finish = n.finish.Plus(t); + } + ret.trim.Add(&n); + } + } + + if(scale < 0) { + // If we mirror every surface of a shell, then it will end up inside + // out. So fix that here. + ret.Reverse(); + } + + return ret; +} + +void SSurface::GetAxisAlignedBounding(Vector *ptMax, Vector *ptMin) const { + *ptMax = Vector::From(VERY_NEGATIVE, VERY_NEGATIVE, VERY_NEGATIVE); + *ptMin = Vector::From(VERY_POSITIVE, VERY_POSITIVE, VERY_POSITIVE); + + int i, j; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + (ctrl[i][j]).MakeMaxMin(ptMax, ptMin); + } + } +} + +bool SSurface::LineEntirelyOutsideBbox(Vector a, Vector b, bool asSegment) const { + Vector amax, amin; + GetAxisAlignedBounding(&amax, &amin); + if(!Vector::BoundingBoxIntersectsLine(amax, amin, a, b, asSegment)) { + // The line segment could fail to intersect the bbox, but lie entirely + // within it and intersect the surface. + if(a.OutsideAndNotOn(amax, amin) && b.OutsideAndNotOn(amax, amin)) { + return true; + } + } + return false; +} + +//----------------------------------------------------------------------------- +// Generate the piecewise linear approximation of the trim stb, which applies +// to the curve sc. +//----------------------------------------------------------------------------- +void SSurface::MakeTrimEdgesInto(SEdgeList *sel, MakeAs flags, + SCurve *sc, STrimBy *stb) +{ + Vector prev = Vector::From(0, 0, 0); + bool inCurve = false, empty = true; + double u = 0, v = 0; + + int i, first, last, increment; + if(stb->backwards) { + first = sc->pts.n - 1; + last = 0; + increment = -1; + } else { + first = 0; + last = sc->pts.n - 1; + increment = 1; + } + for(i = first; i != (last + increment); i += increment) { + Vector tpt, *pt = &(sc->pts[i].p); + + if(flags == MakeAs::UV) { + ClosestPointTo(*pt, &u, &v); + tpt = Vector::From(u, v, 0); + } else { + tpt = *pt; + } + + if(inCurve) { + sel->AddEdge(prev, tpt, sc->h.v, stb->backwards); + empty = false; + } + + prev = tpt; // either uv or xyz, depending on flags + + if(pt->Equals(stb->start)) inCurve = true; + if(pt->Equals(stb->finish)) inCurve = false; + } + if(inCurve) dbp("trim was unterminated"); + if(empty) dbp("trim was empty"); +} + +//----------------------------------------------------------------------------- +// Generate all of our trim curves, in piecewise linear form. We can do +// so in either uv or xyz coordinates. And if requested, then we can use +// the split curves from useCurvesFrom instead of the curves in our own +// shell. +//----------------------------------------------------------------------------- +void SSurface::MakeEdgesInto(SShell *shell, SEdgeList *sel, MakeAs flags, + SShell *useCurvesFrom) +{ + STrimBy *stb; + for(stb = trim.First(); stb; stb = trim.NextAfter(stb)) { + SCurve *sc = shell->curve.FindById(stb->curve); + + // We have the option to use the curves from another shell; this + // is relevant when generating the coincident edges while doing the + // Booleans, since the curves from the output shell will be split + // against any intersecting surfaces (and the originals aren't). + if(useCurvesFrom) { + sc = useCurvesFrom->curve.FindById(sc->newH); + } + + MakeTrimEdgesInto(sel, flags, sc, stb); + } +} + +//----------------------------------------------------------------------------- +// Compute the exact tangent to the intersection curve between two surfaces, +// by taking the cross product of the surface normals. We choose the direction +// of this tangent so that its dot product with dir is positive. +//----------------------------------------------------------------------------- +Vector SSurface::ExactSurfaceTangentAt(Vector p, SSurface *srfA, SSurface *srfB, Vector dir) +{ + Point2d puva, puvb; + srfA->ClosestPointTo(p, &puva); + srfB->ClosestPointTo(p, &puvb); + Vector ts = (srfA->NormalAt(puva)).Cross( + (srfB->NormalAt(puvb))); + ts = ts.WithMagnitude(1); + if(ts.Dot(dir) < 0) { + ts = ts.ScaledBy(-1); + } + return ts; +} + +//----------------------------------------------------------------------------- +// Report our trim curves. If a trim curve is exact and sbl is not null, then +// add its exact form to sbl. Otherwise, add its piecewise linearization to +// sel. +//----------------------------------------------------------------------------- +void SSurface::MakeSectionEdgesInto(SShell *shell, SEdgeList *sel, SBezierList *sbl) +{ + STrimBy *stb; + for(stb = trim.First(); stb; stb = trim.NextAfter(stb)) { + SCurve *sc = shell->curve.FindById(stb->curve); + SBezier *sb = &(sc->exact); + + if(sbl && sc->isExact && (sb->deg != 1 || !sel)) { + double ts, tf; + if(stb->backwards) { + sb->ClosestPointTo(stb->start, &tf); + sb->ClosestPointTo(stb->finish, &ts); + } else { + sb->ClosestPointTo(stb->start, &ts); + sb->ClosestPointTo(stb->finish, &tf); + } + SBezier junk_bef, keep_aft; + sb->SplitAt(ts, &junk_bef, &keep_aft); + // In the kept piece, the range that used to go from ts to 1 + // now goes from 0 to 1; so rescale tf appropriately. + tf = (tf - ts)/(1 - ts); + + SBezier keep_bef, junk_aft; + keep_aft.SplitAt(tf, &keep_bef, &junk_aft); + + sbl->l.Add(&keep_bef); + } else if(sbl && !sel && !sc->isExact) { + // We must approximate this trim curve, as piecewise cubic sections. + SSurface *srfA = shell->surface.FindById(sc->surfA); + SSurface *srfB = shell->surface.FindById(sc->surfB); + + Vector s = stb->backwards ? stb->finish : stb->start, + f = stb->backwards ? stb->start : stb->finish; + + int sp, fp; + for(sp = 0; sp < sc->pts.n; sp++) { + if(s.Equals(sc->pts[sp].p)) break; + } + if(sp >= sc->pts.n) return; + for(fp = sp; fp < sc->pts.n; fp++) { + if(f.Equals(sc->pts[fp].p)) break; + } + if(fp >= sc->pts.n) return; + // So now the curve we want goes from elem[sp] to elem[fp] + + while(sp < fp) { + // Initially, we'll try approximating the entire trim curve + // as a single Bezier segment + int fpt = fp; + + for(;;) { + // So construct a cubic Bezier with the correct endpoints + // and tangents for the current span. + Vector st = sc->pts[sp].p, + ft = sc->pts[fpt].p, + sf = ft.Minus(st); + double m = sf.Magnitude() / 3; + + Vector stan = ExactSurfaceTangentAt(st, srfA, srfB, sf), + ftan = ExactSurfaceTangentAt(ft, srfA, srfB, sf); + + SBezier sb = SBezier::From(st, + st.Plus (stan.WithMagnitude(m)), + ft.Minus(ftan.WithMagnitude(m)), + ft); + + // And test how much this curve deviates from the + // intermediate points (if any). + int i; + bool tooFar = false; + for(i = sp + 1; i <= (fpt - 1); i++) { + Vector p = sc->pts[i].p; + double t; + sb.ClosestPointTo(p, &t, /*mustConverge=*/false); + Vector pp = sb.PointAt(t); + if((pp.Minus(p)).Magnitude() > SS.ChordTolMm()/2) { + tooFar = true; + break; + } + } + + if(tooFar) { + // Deviates by too much, so try a shorter span + fpt--; + continue; + } else { + // Okay, so use this piece and break. + sbl->l.Add(&sb); + break; + } + } + + // And continue interpolating, starting wherever the curve + // we just generated finishes. + sp = fpt; + } + } else { + if(sel) MakeTrimEdgesInto(sel, MakeAs::XYZ, sc, stb); + } + } +} + +void SSurface::TriangulateInto(SShell *shell, SMesh *sm) { + SEdgeList el = {}; + + MakeEdgesInto(shell, &el, MakeAs::UV); + + SPolygon poly = {}; + if(el.AssemblePolygon(&poly, NULL, /*keepDir=*/true)) { + int i, start = sm->l.n; + if(degm == 1 && degn == 1) { + // A surface with curvature along one direction only; so + // choose the triangulation with chords that lie as much + // as possible within the surface. And since the trim curves + // have been pwl'd to within the desired chord tol, that will + // produce a surface good to within roughly that tol. + // + // If this is just a plane (degree (1, 1)) then the triangulation + // code will notice that, and not bother checking chord tols. + poly.UvTriangulateInto(sm, this); + } else { + // A surface with compound curvature. So we must overlay a + // two-dimensional grid, and triangulate around that. + poly.UvGridTriangulateInto(sm, this); + } + + STriMeta meta = { face, color }; + for(i = start; i < sm->l.n; i++) { + STriangle *st = &(sm->l[i]); + st->meta = meta; + st->an = NormalAt(st->a.x, st->a.y); + st->bn = NormalAt(st->b.x, st->b.y); + st->cn = NormalAt(st->c.x, st->c.y); + st->a = PointAt(st->a.x, st->a.y); + st->b = PointAt(st->b.x, st->b.y); + st->c = PointAt(st->c.x, st->c.y); + // Works out that my chosen contour direction is inconsistent with + // the triangle direction, sigh. + st->FlipNormal(); + } + } else { + dbp("failed to assemble polygon to trim nurbs surface in uv space"); + } + + el.Clear(); + poly.Clear(); +} + +//----------------------------------------------------------------------------- +// Reverse the parametrisation of one of our dimensions, which flips the +// normal. We therefore must reverse all our trim curves too. The uv +// coordinates change, but trim curves are stored as xyz so nothing happens +//----------------------------------------------------------------------------- +void SSurface::Reverse() { + int i, j; + for(i = 0; i < (degm+1)/2; i++) { + for(j = 0; j <= degn; j++) { + swap(ctrl[i][j], ctrl[degm-i][j]); + swap(weight[i][j], weight[degm-i][j]); + } + } + + STrimBy *stb; + for(stb = trim.First(); stb; stb = trim.NextAfter(stb)) { + stb->backwards = !stb->backwards; + swap(stb->start, stb->finish); + } +} + +void SSurface::ScaleSelfBy(double s) { + int i, j; + for(i = 0; i <= degm; i++) { + for(j = 0; j <= degn; j++) { + ctrl[i][j] = ctrl[i][j].ScaledBy(s); + } + } +} + +void SSurface::Clear() { + trim.Clear(); +} + +} // namespace SolveSpace diff --git a/src/srf/surface.h b/src/srf/surface.h new file mode 100644 index 0000000..d117167 --- /dev/null +++ b/src/srf/surface.h @@ -0,0 +1,449 @@ +//----------------------------------------------------------------------------- +// Functions relating to rational polynomial surfaces, which are trimmed by +// curves (either rational polynomial curves, or piecewise linear +// approximations to curves of intersection that can't be represented +// exactly in ratpoly form), and assembled into watertight shells. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_SURFACE_H +#define SOLVESPACE_SURFACE_H + +#include + +#include "dsc.h" +#include "handle.h" +#include "polygon.h" + +namespace SolveSpace { + +class Group; +class SBezierList; +class SSurface; +class SCurvePt; + +// Utility data structure, a two-dimensional BSP to accelerate polygon +// operations. +class SBspUv { +public: + Point2d a, b; + + SBspUv *pos; + SBspUv *neg; + + SBspUv *more; + + enum class Class : uint32_t { + INSIDE = 100, + OUTSIDE = 200, + EDGE_PARALLEL = 300, + EDGE_ANTIPARALLEL = 400, + EDGE_OTHER = 500 + }; + + static SBspUv *Alloc(); + static SBspUv *From(SEdgeList *el, SSurface *srf); + + void ScalePoints(Point2d *pt, Point2d *a, Point2d *b, SSurface *srf) const; + double ScaledSignedDistanceToLine(Point2d pt, Point2d a, Point2d b, + SSurface *srf) const; + double ScaledDistanceToLine(Point2d pt, Point2d a, Point2d b, bool asSegment, + SSurface *srf) const; + + void InsertEdge(Point2d a, Point2d b, SSurface *srf); + static SBspUv *InsertOrCreateEdge(SBspUv *where, Point2d ea, Point2d eb, SSurface *srf); + Class ClassifyPoint(Point2d p, Point2d eb, SSurface *srf) const; + Class ClassifyEdge(Point2d ea, Point2d eb, SSurface *srf) const; + double MinimumDistanceToEdge(Point2d p, SSurface *srf) const; +}; + +// Now the data structures to represent a shell of trimmed rational polynomial +// surfaces. + +class SShell; + +class hSSurface { +public: + uint32_t v; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +class hSCurve { +public: + uint32_t v; +}; + +template<> +struct IsHandleOracle : std::true_type {}; + +// Stuff for rational polynomial curves, of degree one to three. These are +// our inputs, and are also calculated for certain exact surface-surface +// intersections. +class SBezier { +public: + int tag; + int auxA, auxB; + + int deg; + Vector ctrl[4]; + double weight[4]; + uint32_t entity; + + Vector PointAt(double t) const; + Vector TangentAt(double t) const; + void ClosestPointTo(Vector p, double *t, bool mustConverge=true) const; + void SplitAt(double t, SBezier *bef, SBezier *aft) const; + bool PointOnThisAndCurve(const SBezier *sbb, Vector *p) const; + + Vector Start() const; + Vector Finish() const; + bool Equals(SBezier *b) const; + void MakePwlInto(SEdgeList *sel, double chordTol=0, double max_dt=0.0) const; + void MakePwlInto(List *l, double chordTol=0, double max_dt=0.0) const; + void MakePwlInto(SContour *sc, double chordTol=0, double max_dt=0.0) const; + void MakePwlInto(List *l, double chordTol=0, double max_dt=0.0) const; + void MakePwlWorker(List *l, double ta, double tb, double chordTol, double max_dt) const; + void MakePwlInitialWorker(List *l, double ta, double tb, double chordTol, double max_dt) const; + void MakeNonrationalCubicInto(SBezierList *bl, double tolerance, int depth = 0) const; + + void AllIntersectionsWith(const SBezier *sbb, SPointList *spl) const; + void GetBoundingProjd(Vector u, Vector orig, double *umin, double *umax) const; + void Reverse(); + + bool IsInPlane(Vector n, double d) const; + bool IsCircle(Vector axis, Vector *center, double *r) const; + bool IsRational() const; + + SBezier TransformedBy(Vector t, Quaternion q, double scale) const; + SBezier InPerspective(Vector u, Vector v, Vector n, + Vector origin, double cameraTan) const; + void ScaleSelfBy(double s); + + static SBezier From(Vector p0, Vector p1, Vector p2, Vector p3); + static SBezier From(Vector p0, Vector p1, Vector p2); + static SBezier From(Vector p0, Vector p1); + static SBezier From(Vector4 p0, Vector4 p1, Vector4 p2, Vector4 p3); + static SBezier From(Vector4 p0, Vector4 p1, Vector4 p2); + static SBezier From(Vector4 p0, Vector4 p1); +}; + +class SBezierList { +public: + List l; + + void Clear(); + void ScaleSelfBy(double s); + void CullIdenticalBeziers(bool both=true); + void AllIntersectionsWith(SBezierList *sblb, SPointList *spl) const; + bool GetPlaneContainingBeziers(Vector *p, Vector *u, Vector *v, + Vector *notCoplanarAt) const; +}; + +class SBezierLoop { +public: + int tag; + List l; + + inline void Clear() { l.Clear(); } + bool IsClosed() const; + void Reverse(); + void MakePwlInto(SContour *sc, double chordTol=0) const; + void GetBoundingProjd(Vector u, Vector orig, double *umin, double *umax) const; + + static SBezierLoop FromCurves(SBezierList *spcl, + bool *allClosed, SEdge *errorAt); +}; + +class SBezierLoopSet { +public: + List l; + Vector normal; + Vector point; + double area; + + static SBezierLoopSet From(SBezierList *spcl, SPolygon *poly, + double chordTol, + bool *allClosed, SEdge *errorAt, + SBezierLoopSet *openContours); + + void GetBoundingProjd(Vector u, Vector orig, double *umin, double *umax) const; + double SignedArea(); + void MakePwlInto(SPolygon *sp) const; + void Clear(); +}; + +class SBezierLoopSetSet { +public: + List l; + + void FindOuterFacesFrom(SBezierList *sbl, SPolygon *spxyz, SSurface *srfuv, + double chordTol, + bool *allClosed, SEdge *notClosedAt, + bool *allCoplanar, Vector *notCoplanarAt, + SBezierLoopSet *openContours); + void AddOpenPath(SBezier *sb); + void Clear(); +}; + +// Stuff for the surface trim curves: piecewise linear +class SCurvePt { +public: + int tag; + Vector p; + bool vertex; +}; + +class SCurve { +public: + hSCurve h; + + // In a Boolean, C = A op B. The curves in A and B get copied into C, and + // therefore must get new hSCurves assigned. For the curves in A and B, + // we use newH to record their new handle in C. + hSCurve newH; + enum class Source : uint32_t { + A = 100, + B = 200, + INTERSECTION = 300 + }; + Source source; + + bool isExact; + SBezier exact; + + List pts; + + hSSurface surfA; + hSSurface surfB; + + static SCurve FromTransformationOf(SCurve *a, Vector t, + Quaternion q, double scale); + SCurve MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB, + SSurface *srfA, SSurface *srfB) const; + void RemoveShortSegments(SSurface *srfA, SSurface *srfB); + SSurface *GetSurfaceA(SShell *a, SShell *b) const; + SSurface *GetSurfaceB(SShell *a, SShell *b) const; + + void Clear(); + void GetAxisAlignedBounding(Vector *ptMax, Vector *ptMin) const; +}; + +// A segment of a curve by which a surface is trimmed: indicates which curve, +// by its handle, and the starting and ending points of our segment of it. +// The vector out points out of the surface; it, the surface outer normal, +// and a tangent to the beginning of the curve are all orthogonal. +class STrimBy { +public: + hSCurve curve; + bool backwards; + // If a trim runs backwards, then start and finish still correspond to + // the actual start and finish, but they appear in reverse order in + // the referenced curve. + Vector start; + Vector finish; + + static STrimBy EntireCurve(SShell *shell, hSCurve hsc, bool backwards); +}; + +// An intersection point between a line and a surface +class SInter { +public: + int tag; + Vector p; + SSurface *srf; + Point2d pinter; + Vector surfNormal; // of the intersecting surface, at pinter + bool onEdge; // pinter is on edge of trim poly +}; + +// A rational polynomial surface in Bezier form. +class SSurface { +public: + + enum class CombineAs : uint32_t { + UNION = 10, + DIFFERENCE = 11, + INTERSECTION = 12 + }; + + int tag; + hSSurface h; + + // Same as newH for the curves; record what a surface gets renamed to + // when I copy things over. + hSSurface newH; + + RgbaColor color; + uint32_t face; + + int degm, degn; + Vector ctrl[4][4]; + double weight[4][4]; + + List trim; + + // For testing whether a point (u, v) on the surface lies inside the trim + SBspUv *bsp; + SEdgeList edges; + + // For caching our initial (u, v) when doing Newton iterations to project + // a point into our surface. + Point2d cached; + + static SSurface FromExtrusionOf(SBezier *spc, Vector t0, Vector t1); + static SSurface FromRevolutionOf(SBezier *sb, Vector pt, Vector axis, double thetas, + double thetaf, double dists, double distf); + static SSurface FromPlane(Vector pt, Vector u, Vector v); + static SSurface FromTransformationOf(SSurface *a, Vector t, Quaternion q, + double scale, + bool includingTrims); + void ScaleSelfBy(double s); + + void EdgeNormalsWithinSurface(Point2d auv, Point2d buv, + Vector *pt, Vector *enin, Vector *enout, + Vector *surfn, + uint32_t auxA, + SShell *shell, SShell *sha, SShell *shb); + void FindChainAvoiding(SEdgeList *src, SEdgeList *dest, SPointList *avoid); + SSurface MakeCopyTrimAgainst(SShell *parent, SShell *a, SShell *b, + SShell *into, SSurface::CombineAs type, int dbg_index); + void TrimFromEdgeList(SEdgeList *el, bool asUv); + void IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB, + SShell *into); + void AddExactIntersectionCurve(SBezier *sb, SSurface *srfB, + SShell *agnstA, SShell *agnstB, SShell *into); + + typedef struct { + int tag; + Point2d p; + } Inter; + void WeightControlPoints(); + void UnWeightControlPoints(); + void CopyRowOrCol(bool row, int this_ij, SSurface *src, int src_ij); + void BlendRowOrCol(bool row, int this_ij, SSurface *a, int a_ij, + SSurface *b, int b_ij); + double DepartureFromCoplanar() const; + void SplitInHalf(bool byU, SSurface *sa, SSurface *sb); + void AllPointsIntersecting(Vector a, Vector b, + List *l, + bool asSegment, bool trimmed, bool inclTangent); + void AllPointsIntersectingUntrimmed(Vector a, Vector b, + int *cnt, int *level, + List *l, bool asSegment, + SSurface *sorig); + + void ClosestPointTo(Vector p, Point2d *puv, bool mustConverge=true); + void ClosestPointTo(Vector p, double *u, double *v, bool mustConverge=true); + bool ClosestPointNewton(Vector p, double *u, double *v, bool mustConverge=true) const; + + bool PointIntersectingLine(Vector p0, Vector p1, double *u, double *v) const; + Vector ClosestPointOnThisAndSurface(SSurface *srf2, Vector p); + void PointOnSurfaces(SSurface *s1, SSurface *s2, double *u, double *v); + void PointOnCurve(const SBezier *curve, double *up, double *vp); + Vector PointAt(double u, double v) const; + Vector PointAt(Point2d puv) const; + void TangentsAt(double u, double v, Vector *tu, Vector *tv, bool retry=true) const; + Vector NormalAt(Point2d puv) const; + Vector NormalAt(double u, double v) const; + bool LineEntirelyOutsideBbox(Vector a, Vector b, bool asSegment) const; + void GetAxisAlignedBounding(Vector *ptMax, Vector *ptMin) const; + bool CoincidentWithPlane(Vector n, double d) const; + bool CoincidentWith(SSurface *ss, bool sameNormal) const; + bool ContainsPlaneCurve(SCurve *sc) const; + bool IsExtrusion(SBezier *of, Vector *along) const; + bool IsCylinder(Vector *axis, Vector *center, double *r, + Vector *start, Vector *finish) const; + + void TriangulateInto(SShell *shell, SMesh *sm); + + // these are intended as bitmasks, even though there's just one now + enum class MakeAs : uint32_t { + UV = 0x01, + XYZ = 0x00 + }; + void MakeTrimEdgesInto(SEdgeList *sel, MakeAs flags, SCurve *sc, STrimBy *stb); + void MakeEdgesInto(SShell *shell, SEdgeList *sel, MakeAs flags, + SShell *useCurvesFrom=NULL); + + Vector ExactSurfaceTangentAt(Vector p, SSurface *srfA, SSurface *srfB, + Vector dir); + void MakeSectionEdgesInto(SShell *shell, SEdgeList *sel, SBezierList *sbl); + void MakeClassifyingBsp(SShell *shell, SShell *useCurvesFrom); + double ChordToleranceForEdge(Vector a, Vector b) const; + void MakeTriangulationGridInto(List *l, double vs, double vf, + bool swapped, int depth) const; + Vector PointAtMaybeSwapped(double u, double v, bool swapped) const; + Vector NormalAtMaybeSwapped(double u, double v, bool swapped) const; + + void Reverse(); + void Clear(); +}; + +class SShell { +public: + IdList curve; + IdList surface; + + bool booleanFailed; + + void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1, + RgbaColor color); + bool CheckNormalAxisRelationship(SBezierLoopSet *sbls, Vector pt, Vector axis, double da, double dx); + void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, + RgbaColor color, Group *group); + void MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis, RgbaColor color, + Group *group, double angles, double anglef, double dists, double distf); + void MakeFirstOrderRevolvedSurfaces(Vector pt, Vector axis, int i0); + void MakeFromUnionOf(SShell *a, SShell *b); + void MakeFromDifferenceOf(SShell *a, SShell *b); + void MakeFromIntersectionOf(SShell *a, SShell *b); + void MakeFromBoolean(SShell *a, SShell *b, SSurface::CombineAs type); + void CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into); + void CopySurfacesTrimAgainst(SShell *sha, SShell *shb, SShell *into, SSurface::CombineAs type); + void MakeIntersectionCurvesAgainst(SShell *against, SShell *into); + void MakeClassifyingBsps(SShell *useCurvesFrom); + void AllPointsIntersecting(Vector a, Vector b, List *il, + bool asSegment, bool trimmed, bool inclTangent); + void MakeCoincidentEdgesInto(SSurface *proto, bool sameNormal, + SEdgeList *el, SShell *useCurvesFrom); + void RewriteSurfaceHandlesForCurves(SShell *a, SShell *b); + void CleanupAfterBoolean(); + + // Definitions when classifying regions of a surface; it is either inside, + // outside, or coincident (with parallel or antiparallel normal) with a + // shell. + enum class Class : uint32_t { + SURF_INSIDE = 100, + SURF_OUTSIDE = 200, + SURF_COINC_SAME = 300, + SURF_COINC_OPP = 400 + }; + static const double DOTP_TOL; + Class ClassifyRegion(Vector edge_n, Vector inter_surf_n, + Vector edge_surf_n) const; + + bool ClassifyEdge(Class *indir, Class *outdir, + Vector ea, Vector eb, + Vector p, Vector edge_n_in, + Vector edge_n_out, Vector surf_n); + + void MakeFromCopyOf(SShell *a); + void MakeFromTransformationOf(SShell *a, + Vector trans, Quaternion q, double scale); + void MakeFromAssemblyOf(SShell *a, SShell *b); + void MergeCoincidentSurfaces(); + + void TriangulateInto(SMesh *sm); + void MakeEdgesInto(SEdgeList *sel); + void MakeSectionEdgesInto(Vector n, double d, SEdgeList *sel, SBezierList *sbl); + bool IsEmpty() const; + void RemapFaces(Group *g, int remap); + void Clear(); +}; + +} // namespace SolveSpace + +#endif diff --git a/src/srf/surfinter.cpp b/src/srf/surfinter.cpp new file mode 100644 index 0000000..c13c7d2 --- /dev/null +++ b/src/srf/surfinter.cpp @@ -0,0 +1,596 @@ +//----------------------------------------------------------------------------- +// How to intersect two surfaces, to get some type of curve. This is either +// an exact special case (e.g., two planes to make a line), or a numerical +// thing. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +extern int FLAG; + +void SSurface::AddExactIntersectionCurve(SBezier *sb, SSurface *srfB, + SShell *agnstA, SShell *agnstB, SShell *into) +{ + SCurve sc = {}; + // Important to keep the order of (surfA, surfB) consistent; when we later + // rewrite the identifiers, we rewrite surfA from A and surfB from B. + sc.surfA = h; + sc.surfB = srfB->h; + sc.exact = *sb; + sc.isExact = true; + + // Now we have to piecewise linearize the curve. If there's already an + // identical curve in the shell, then follow that pwl exactly, otherwise + // calculate from scratch. + SCurve split, *existing = NULL; + SBezier sbrev = *sb; + sbrev.Reverse(); + bool backwards = false; +#pragma omp critical(into) + { + for(SCurve &se : into->curve) { + if(se.isExact) { + if(sb->Equals(&(se.exact))) { + existing = &se; + break; + } + if(sbrev.Equals(&(se.exact))) { + existing = &se; + backwards = true; + break; + } + } + } + }// end omp critical + if(existing) { + SCurvePt *v; + for(v = existing->pts.First(); v; v = existing->pts.NextAfter(v)) { + sc.pts.Add(v); + } + if(backwards) sc.pts.Reverse(); + split = sc; + sc = {}; + } else { + sb->MakePwlInto(&(sc.pts)); + // and split the line where it intersects our existing surfaces + split = sc.MakeCopySplitAgainst(agnstA, agnstB, this, srfB); + sc.Clear(); + } + + // Test if the curve lies entirely outside one of the + SCurvePt *scpt; + bool withinA = false, withinB = false; + for(scpt = split.pts.First(); scpt; scpt = split.pts.NextAfter(scpt)) { + double tol = 0.01; + Point2d puv; + ClosestPointTo(scpt->p, &puv); + if(puv.x > -tol && puv.x < 1 + tol && + puv.y > -tol && puv.y < 1 + tol) + { + withinA = true; + } + srfB->ClosestPointTo(scpt->p, &puv); + if(puv.x > -tol && puv.x < 1 + tol && + puv.y > -tol && puv.y < 1 + tol) + { + withinB = true; + } + // Break out early, no sense wasting time if we already have the answer. + if(withinA && withinB) break; + } + if(!(withinA && withinB)) { + // Intersection curve lies entirely outside one of the surfaces, so + // it's fake. + split.Clear(); + return; + } + +#if 0 + if(sb->deg == 2) { + dbp(" "); + SCurvePt *prev = NULL, *v; + dbp("split.pts.n = %d", split.pts.n); + for(v = split.pts.First(); v; v = split.pts.NextAfter(v)) { + if(prev) { + Vector e = (prev->p).Minus(v->p).WithMagnitude(0); + SS.nakedEdges.AddEdge((prev->p).Plus(e), (v->p).Minus(e)); + } + prev = v; + } + } +#endif // 0 + ssassert(!(sb->Start()).Equals(sb->Finish()), + "Unexpected zero-length edge"); + + split.source = SCurve::Source::INTERSECTION; +#pragma omp critical(into) + { + into->curve.AddAndAssignId(&split); + } +} + +void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB, + SShell *into) +{ + Vector amax, amin, bmax, bmin; + GetAxisAlignedBounding(&amax, &amin); + b->GetAxisAlignedBounding(&bmax, &bmin); + + if(Vector::BoundingBoxesDisjoint(amax, amin, bmax, bmin)) { + // They cannot possibly intersect, no curves to generate + return; + } + + Vector alongt, alongb; + SBezier oft, ofb; + bool isExtdt = this->IsExtrusion(&oft, &alongt), + isExtdb = b->IsExtrusion(&ofb, &alongb); + + if(degm == 1 && degn == 1 && b->degm == 1 && b->degn == 1) { + // Line-line intersection; it's a plane or nothing. + Vector na = NormalAt(0, 0).WithMagnitude(1), + nb = b->NormalAt(0, 0).WithMagnitude(1); + double da = na.Dot(PointAt(0, 0)), + db = nb.Dot(b->PointAt(0, 0)); + + Vector dl = na.Cross(nb); + if(dl.Magnitude() < LENGTH_EPS) return; // parallel planes + dl = dl.WithMagnitude(1); + Vector p = Vector::AtIntersectionOfPlanes(na, da, nb, db); + + // Trim it to the region 0 <= {u,v} <= 1 for each plane; not strictly + // necessary, since line will be split and excess edges culled, but + // this improves speed and robustness. + int i; + double tmax = VERY_POSITIVE, tmin = VERY_NEGATIVE; + for(i = 0; i < 2; i++) { + SSurface *s = (i == 0) ? this : b; + Vector tu, tv; + s->TangentsAt(0, 0, &tu, &tv); + + double up, vp, ud, vd; + s->ClosestPointTo(p, &up, &vp); + ud = (dl.Dot(tu)) / tu.MagSquared(); + vd = (dl.Dot(tv)) / tv.MagSquared(); + + // so u = up + t*ud + // v = vp + t*vd + if(ud > LENGTH_EPS) { + tmin = max(tmin, -up/ud); + tmax = min(tmax, (1 - up)/ud); + } else if(ud < -LENGTH_EPS) { + tmax = min(tmax, -up/ud); + tmin = max(tmin, (1 - up)/ud); + } else { + if(up < -LENGTH_EPS || up > 1 + LENGTH_EPS) { + // u is constant, and outside [0, 1] + tmax = VERY_NEGATIVE; + } + } + if(vd > LENGTH_EPS) { + tmin = max(tmin, -vp/vd); + tmax = min(tmax, (1 - vp)/vd); + } else if(vd < -LENGTH_EPS) { + tmax = min(tmax, -vp/vd); + tmin = max(tmin, (1 - vp)/vd); + } else { + if(vp < -LENGTH_EPS || vp > 1 + LENGTH_EPS) { + // v is constant, and outside [0, 1] + tmax = VERY_NEGATIVE; + } + } + } + + if(tmax > tmin + LENGTH_EPS) { + SBezier bezier = SBezier::From(p.Plus(dl.ScaledBy(tmin)), + p.Plus(dl.ScaledBy(tmax))); + AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into); + } + } else if((degm == 1 && degn == 1 && isExtdb) || + (b->degm == 1 && b->degn == 1 && isExtdt)) + { + // The intersection between a plane and a surface of extrusion + SSurface *splane, *sext; + if(degm == 1 && degn == 1) { + splane = this; + sext = b; + } else { + splane = b; + sext = this; + } + + Vector n = splane->NormalAt(0, 0).WithMagnitude(1), along; + double d = n.Dot(splane->PointAt(0, 0)); + SBezier bezier; + (void)sext->IsExtrusion(&bezier, &along); + + if(fabs(n.Dot(along)) < LENGTH_EPS) { + // Direction of extrusion is parallel to plane; so intersection + // is zero or more lines. Build a line within the plane, and + // normal to the direction of extrusion, and intersect that line + // against the surface; each intersection point corresponds to + // a line. + Vector pm, alu, p0, dp; + // a point halfway along the extrusion + pm = ((sext->ctrl[0][0]).Plus(sext->ctrl[0][1])).ScaledBy(0.5); + alu = along.WithMagnitude(1); + dp = (n.Cross(along)).WithMagnitude(1); + // n, alu, and dp form an orthogonal csys; set n component to + // place it on the plane, alu component to lie halfway along + // extrusion, and dp component doesn't matter so zero + p0 = n.ScaledBy(d).Plus(alu.ScaledBy(pm.Dot(alu))); + + List inters = {}; + sext->AllPointsIntersecting(p0, p0.Plus(dp), &inters, + /*asSegment=*/false, /*trimmed=*/false, /*inclTangent=*/true); + + SInter *si; + for(si = inters.First(); si; si = inters.NextAfter(si)) { + Vector al = along.ScaledBy(0.5); + SBezier bezier; + bezier = SBezier::From((si->p).Minus(al), (si->p).Plus(al)); + AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into); + } + + inters.Clear(); + } else { + // Direction of extrusion is not parallel to plane; so + // intersection is projection of extruded curve into our plane. + int i; + for(i = 0; i <= bezier.deg; i++) { + Vector p0 = bezier.ctrl[i], + p1 = p0.Plus(along); + + bezier.ctrl[i] = + Vector::AtIntersectionOfPlaneAndLine(n, d, p0, p1, NULL); + } + + AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into); + } + } else if(isExtdt && isExtdb && + sqrt(fabs(alongt.Dot(alongb))) > + sqrt(alongt.Magnitude() * alongb.Magnitude()) - LENGTH_EPS) + { + // Two surfaces of extrusion along the same axis. So they might + // intersect along some number of lines parallel to the axis. + Vector axis = alongt.WithMagnitude(1); + + List inters = {}; + List lv = {}; + + double a_axis0 = ( ctrl[0][0]).Dot(axis), + a_axis1 = ( ctrl[0][1]).Dot(axis), + b_axis0 = (b->ctrl[0][0]).Dot(axis), + b_axis1 = (b->ctrl[0][1]).Dot(axis); + + if(a_axis0 > a_axis1) swap(a_axis0, a_axis1); + if(b_axis0 > b_axis1) swap(b_axis0, b_axis1); + + double ab_axis0 = max(a_axis0, b_axis0), + ab_axis1 = min(a_axis1, b_axis1); + + if(fabs(ab_axis0 - ab_axis1) < LENGTH_EPS) { + // The line would be zero-length + return; + } + + Vector axis0 = axis.ScaledBy(ab_axis0), + axis1 = axis.ScaledBy(ab_axis1), + axisc = (axis0.Plus(axis1)).ScaledBy(0.5); + + oft.MakePwlInto(&lv); + + int i; + for(i = 0; i < lv.n - 1; i++) { + Vector pa = lv[i], pb = lv[i+1]; + pa = pa.Minus(axis.ScaledBy(pa.Dot(axis))); + pb = pb.Minus(axis.ScaledBy(pb.Dot(axis))); + pa = pa.Plus(axisc); + pb = pb.Plus(axisc); + + b->AllPointsIntersecting(pa, pb, &inters, + /*asSegment=*/true,/*trimmed=*/false, /*inclTangent=*/false); + } + + SInter *si; + for(si = inters.First(); si; si = inters.NextAfter(si)) { + Vector p = (si->p).Minus(axis.ScaledBy((si->p).Dot(axis))); + double ub, vb; + b->ClosestPointTo(p, &ub, &vb, /*mustConverge=*/true); + SSurface plane; + plane = SSurface::FromPlane(p, axis.Normal(0), axis.Normal(1)); + + b->PointOnSurfaces(this, &plane, &ub, &vb); + + p = b->PointAt(ub, vb); + + SBezier bezier; + bezier = SBezier::From(p.Plus(axis0), p.Plus(axis1)); + AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into); + } + + inters.Clear(); + lv.Clear(); + } else { + if((degm == 1 && degn == 1) || (b->degm == 1 && b->degn == 1)) { + // we should only be here if just one surface is a plane because the + // plane-plane case was already handled above. Need to check the other + // nonplanar surface for trim curves that lie in the plane and are not + // already trimming both surfaces. This happens when we cut a Lathe shell + // on one of the seams for example. + // This also seems necessary to merge some coincident surfaces. + SSurface *splane, *sext; + SShell *shext; + if(degm == 1 && degn == 1) { // this and other checks assume coplanar ctrl pts. + splane = this; + sext = b; + shext = agnstB; + } else { + splane = b; + sext = this; + shext = agnstA; + } + bool foundExact = false; + for(SCurve &sc : shext->curve) { + if(sc.source == SCurve::Source::INTERSECTION) continue; + if(!sc.isExact) continue; + if((sc.surfA != sext->h) && (sc.surfB != sext->h)) continue; + // we have a curve belonging to the curved surface and not the plane. + // does it lie completely in the plane? + if(splane->ContainsPlaneCurve(&sc)) { + SBezier bezier = sc.exact; + AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into); + foundExact = true; + } + } + // if we found at lest one of these we don't want to do the numerical + // intersection as well. Sometimes it will also find the same curve but + // with different PWLs and the polygon will fail to assemble. + if(foundExact) + return; + } + + // Try intersecting the surfaces numerically, by a marching algorithm. + // First, we find all the intersections between a surface and the + // boundary of the other surface. + SPointList spl = {}; + int a; + for(a = 0; a < 2; a++) { + SShell *shA = (a == 0) ? agnstA : agnstB; + SSurface *srfA = (a == 0) ? this : b, + *srfB = (a == 0) ? b : this; + + SEdgeList el = {}; + srfA->MakeEdgesInto(shA, &el, MakeAs::XYZ, NULL); + + SEdge *se; + for(se = el.l.First(); se; se = el.l.NextAfter(se)) { + List lsi = {}; + + srfB->AllPointsIntersecting(se->a, se->b, &lsi, + /*asSegment=*/true, /*trimmed=*/true, /*inclTangent=*/false); + if(lsi.IsEmpty()) + continue; + + // Find the other surface that this curve trims. + hSCurve hsc = { (uint32_t)se->auxA }; + SCurve *sc = shA->curve.FindById(hsc); + hSSurface hother = (sc->surfA == srfA->h) ? + sc->surfB : sc->surfA; + SSurface *other = shA->surface.FindById(hother); + + SInter *si; + for(si = lsi.First(); si; si = lsi.NextAfter(si)) { + Vector p = si->p; + double u, v; + srfB->ClosestPointTo(p, &u, &v); + if(sc->isExact) { + srfB->PointOnCurve(&(sc->exact), &u, &v); + } else { + srfB->PointOnSurfaces(srfA, other, &u, &v); + } + p = srfB->PointAt(u, v); + if(!spl.ContainsPoint(p)) { + SPoint sp; + sp.p = p; + // We also need the edge normal, so that we know in + // which direction to march. + srfA->ClosestPointTo(p, &u, &v); + Vector n = srfA->NormalAt(u, v); + sp.auxv = n.Cross((se->b).Minus(se->a)); + sp.auxv = (sp.auxv).WithMagnitude(1); + + spl.l.Add(&sp); + } + } + lsi.Clear(); + } + + el.Clear(); + } + + while(spl.l.n >= 2) { + SCurve sc = {}; + sc.surfA = h; + sc.surfB = b->h; + sc.isExact = false; + sc.source = SCurve::Source::INTERSECTION; + + Vector start = spl.l[0].p, + startv = spl.l[0].auxv; + spl.l.ClearTags(); + spl.l[0].tag = 1; + spl.l.RemoveTagged(); + + // Our chord tolerance is whatever the user specified + double maxtol = SS.ChordTolMm(); + int maxsteps = max(300, SS.GetMaxSegments()*3); + + // The curve starts at our starting point. + SCurvePt padd = {}; + padd.vertex = true; + padd.p = start; + sc.pts.Add(&padd); + + Point2d pa, pb; + Vector np, npc = Vector::From(0, 0, 0); + bool fwd = false; + // Better to start with a too-small step, so that we don't miss + // features of the curve entirely. + double tol, step = maxtol; + for(a = 0; a < maxsteps; a++) { + ClosestPointTo(start, &pa); + b->ClosestPointTo(start, &pb); + + Vector na = NormalAt(pa).WithMagnitude(1), + nb = b->NormalAt(pb).WithMagnitude(1); + + if(a == 0) { + Vector dp = nb.Cross(na); + if(dp.Dot(startv) < 0) { + // We want to march in the more inward direction. + fwd = true; + } else { + fwd = false; + } + } + + Vector dp = nb.Cross(na).WithMagnitude(1.0); + if(!fwd) dp = dp.ScaledBy(-1.0); + int i; + for(i = 0; i < 20; i++) { + np = start.Plus(dp.ScaledBy(step)); + npc = ClosestPointOnThisAndSurface(b, np); + tol = (npc.Minus(np)).Magnitude(); + + if(tol > maxtol*0.8) { + step *= 0.90; + } else { + step /= 0.90; + } + + if((tol < maxtol) && (tol > maxtol/2)) { + // If we meet the chord tolerance test, and we're + // not too fine, then we break out. + break; + } + } + + SPoint *sp; + for(sp = spl.l.First(); sp; sp = spl.l.NextAfter(sp)) { + if((sp->p).OnLineSegment(start, npc, 2*SS.ChordTolMm())) { + sp->tag = 1; + a = maxsteps; + npc = sp->p; + } + } + + padd.p = npc; + padd.vertex = (a == maxsteps); + sc.pts.Add(&padd); + + start = npc; + } + + spl.l.RemoveTagged(); + + // And now we split and insert the curve + SCurve split = sc.MakeCopySplitAgainst(agnstA, agnstB, this, b); + sc.Clear(); +#pragma omp critical(into) + { + into->curve.AddAndAssignId(&split); + } + } + spl.Clear(); + } +} + +//----------------------------------------------------------------------------- +// Are two surfaces coincident, with the same (or with opposite) normals? +// Currently handles planes only. +//----------------------------------------------------------------------------- +bool SSurface::CoincidentWith(SSurface *ss, bool sameNormal) const { + if(degm != 1 || degn != 1) return false; + if(ss->degm != 1 || ss->degn != 1) return false; + + Vector p = ctrl[0][0]; + Vector n = NormalAt(0, 0).WithMagnitude(1); + double d = n.Dot(p); + + if(!ss->CoincidentWithPlane(n, d)) return false; + + Vector n2 = ss->NormalAt(0, 0); + if(sameNormal) { + if(n2.Dot(n) < 0) return false; + } else { + if(n2.Dot(n) > 0) return false; + } + + return true; +} + +bool SSurface::CoincidentWithPlane(Vector n, double d) const { + if(degm != 1 || degn != 1) return false; + if(fabs(n.Dot(ctrl[0][0]) - d) > LENGTH_EPS) return false; + if(fabs(n.Dot(ctrl[0][1]) - d) > LENGTH_EPS) return false; + if(fabs(n.Dot(ctrl[1][0]) - d) > LENGTH_EPS) return false; + if(fabs(n.Dot(ctrl[1][1]) - d) > LENGTH_EPS) return false; + + return true; +} + +//----------------------------------------------------------------------------- +// Does a planar surface contain a curve? Does the curve lie completely in plane? +//----------------------------------------------------------------------------- +bool SSurface::ContainsPlaneCurve(SCurve *sc) const { + if(degm != 1 || degn != 1) return false; + if(!sc->isExact) return false; // we don't handle those (yet?) + + Vector p = ctrl[0][0]; + Vector n = NormalAt(0, 0).WithMagnitude(1); + double d = n.Dot(p); + + // check all control points on the curve + for(int i=0; i<= sc->exact.deg; i++) { + if(fabs(n.Dot(sc->exact.ctrl[i]) - d) > LENGTH_EPS) return false; + } + return true; +} + +//----------------------------------------------------------------------------- +// In our shell, find all surfaces that are coincident with the prototype +// surface (with same or opposite normal, as specified), and copy all of +// their trim polygons into el. The edges are returned in uv coordinates for +// the prototype surface. +//----------------------------------------------------------------------------- +void SShell::MakeCoincidentEdgesInto(SSurface *proto, bool sameNormal, + SEdgeList *el, SShell *useCurvesFrom) +{ + for(SSurface &ss : surface) { + if(proto->CoincidentWith(&ss, sameNormal)) { + ss.MakeEdgesInto(this, el, SSurface::MakeAs::XYZ, useCurvesFrom); + } + } + + SEdge *se; + for(se = el->l.First(); se; se = el->l.NextAfter(se)) { + double ua, va, ub, vb; + proto->ClosestPointTo(se->a, &ua, &va); + proto->ClosestPointTo(se->b, &ub, &vb); + + if(sameNormal) { + se->a = Vector::From(ua, va, 0); + se->b = Vector::From(ub, vb, 0); + } else { + // Flip normal, so flip all edge directions + se->b = Vector::From(ua, va, 0); + se->a = Vector::From(ub, vb, 0); + } + } +} + +} // namespace SolveSpace diff --git a/src/srf/triangulate.cpp b/src/srf/triangulate.cpp new file mode 100644 index 0000000..81a2a45 --- /dev/null +++ b/src/srf/triangulate.cpp @@ -0,0 +1,738 @@ +//----------------------------------------------------------------------------- +// Triangulate a surface. If the surface is curved, then we first superimpose +// a grid of quads, with spacing to achieve our chord tolerance. We then +// proceed by ear-clipping; the resulting mesh should be watertight and not +// awful numerically, but has no special properties (Delaunay, etc.). +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void SPolygon::UvTriangulateInto(SMesh *m, SSurface *srf) { + if(l.n <= 0) return; + + //int64_t in = GetMilliseconds(); + + normal = Vector::From(0, 0, 1); + + while(l.n > 0) { + FixContourDirections(); + l.ClearTags(); + + // Find a top-level contour, and start with that. Then build bridges + // in order to merge all its islands into a single contour. + SContour *top; + for(top = l.First(); top; top = l.NextAfter(top)) { + if(top->timesEnclosed == 0) { + break; + } + } + if(!top) { + dbp("polygon has no top-level contours?"); + return; + } + + // Start with the outer contour + SContour merged = {}; + top->tag = 1; + top->CopyInto(&merged); + merged.l.RemoveLast(1); + + // List all of the edges, for testing whether bridges work. + SEdgeList el = {}; + top->MakeEdgesInto(&el); + List vl = {}; + + // And now find all of its holes. Note that we will also find any + // outer contours that lie entirely within this contour, and any + // holes for those contours. But that's okay, because we can merge + // those too. + SContour *sc; + for(sc = l.First(); sc; sc = l.NextAfter(sc)) { + if(sc->timesEnclosed != 1) continue; + if(sc->l.n < 2) continue; + + // Test the midpoint of an edge. Our polygon may not be self- + // intersecting, but two contours may share a vertex; so a + // vertex could be on the edge of another polygon, in which + // case ContainsPointProjdToNormal returns indeterminate. + Vector tp = sc->AnyEdgeMidpoint(); + if(top->ContainsPointProjdToNormal(normal, tp)) { + sc->tag = 2; + sc->MakeEdgesInto(&el); + sc->FindPointWithMinX(); + } + } + +// dbp("finished finding holes: %d ms", (int)(GetMilliseconds() - in)); + for(;;) { + double xmin = 1e10; + SContour *scmin = NULL; + + for(sc = l.First(); sc; sc = l.NextAfter(sc)) { + if(sc->tag != 2) continue; + + if(sc->xminPt.x < xmin) { + xmin = sc->xminPt.x; + scmin = sc; + } + } + if(!scmin) break; + + if(!merged.BridgeToContour(scmin, &el, &vl)) { + dbp("couldn't merge our hole"); + return; + } +// dbp(" bridged to contour: %d ms", (int)(GetMilliseconds() - in)); + scmin->tag = 3; + } +// dbp("finished merging holes: %d ms", (int)(GetMilliseconds() - in)); + + merged.UvTriangulateInto(m, srf); +// dbp("finished ear clippping: %d ms", (int)(GetMilliseconds() - in)); + merged.l.Clear(); + el.Clear(); + vl.Clear(); + + // Careful, need to free the points within the contours, and not just + // the contours themselves. This was a tricky memory leak. + for(sc = l.First(); sc; sc = l.NextAfter(sc)) { + if(sc->tag) { + sc->l.Clear(); + } + } + l.RemoveTagged(); + } +} + +bool SContour::BridgeToContour(SContour *sc, + SEdgeList *avoidEdges, List *avoidPts) +{ + int i, j; + bool withbridge = true; + + // Start looking for a bridge on our new hole near its leftmost (min x) + // point. + int sco = 0; + for(i = 0; i < (sc->l.n - 1); i++) { + if((sc->l[i].p).EqualsExactly(sc->xminPt)) { + sco = i; + } + } + + // And start looking on our merged contour at whichever point is nearest + // to the leftmost point of the new segment. + int thiso = 0; + double dmin = 1e10; + for(i = 0; i < l.n-1; i++) { + Vector p = l[i].p; + double d = (p.Minus(sc->xminPt)).MagSquared(); + if(d < dmin) { + dmin = d; + thiso = i; + } + } + + int thisp, scp; + + Vector a, b, *f; + + // First check if the contours share a point; in that case we should + // merge them there, without a bridge. + for(i = 0; i < l.n; i++) { + thisp = WRAP(i+thiso, l.n-1); + a = l[thisp].p; + + for(f = avoidPts->First(); f; f = avoidPts->NextAfter(f)) { + if(f->Equals(a)) break; + } + if(f) continue; + + for(j = 0; j < (sc->l.n - 1); j++) { + scp = WRAP(j+sco, (sc->l.n - 1)); + b = sc->l[scp].p; + + if(a.Equals(b)) { + withbridge = false; + goto haveEdge; + } + } + } + + // If that fails, look for a bridge that does not intersect any edges. + for(i = 0; i < l.n; i++) { + thisp = WRAP(i+thiso, l.n); + a = l[thisp].p; + + for(f = avoidPts->First(); f; f = avoidPts->NextAfter(f)) { + if(f->Equals(a)) break; + } + if(f) continue; + + for(j = 0; j < (sc->l.n - 1); j++) { + scp = WRAP(j+sco, (sc->l.n - 1)); + b = sc->l[scp].p; + + for(f = avoidPts->First(); f; f = avoidPts->NextAfter(f)) { + if(f->Equals(b)) break; + } + if(f) continue; + + if(avoidEdges->AnyEdgeCrossings(a, b) > 0) { + // doesn't work, bridge crosses an existing edge + } else { + goto haveEdge; + } + } + } + + // Tried all the possibilities, didn't find an edge + return false; + +haveEdge: + SContour merged = {}; + for(i = 0; i < l.n; i++) { + if(withbridge || (i != thisp)) { + merged.AddPoint(l[i].p); + } + if(i == thisp) { + // less than or equal; need to duplicate the join point + for(j = 0; j <= (sc->l.n - 1); j++) { + int jp = WRAP(j + scp, (sc->l.n - 1)); + merged.AddPoint((sc->l[jp]).p); + } + // and likewise duplicate join point for the outer curve + if(withbridge) { + merged.AddPoint(l[i].p); + } + } + } + + // and future bridges mustn't cross our bridge, and it's tricky to get + // things right if two bridges come from the same point + if(withbridge) { + avoidEdges->AddEdge(a, b); + avoidPts->Add(&a); + } + avoidPts->Add(&b); + + l.Clear(); + l = merged.l; + return true; +} + +bool SContour::IsEmptyTriangle(int ap, int bp, int cp, double scaledEPS) const { + + STriangle tr = {}; + tr.a = l[ap].p; + tr.b = l[bp].p; + tr.c = l[cp].p; + + // Accelerate with an axis-aligned bounding box test + Vector maxv = tr.a, minv = tr.a; + (tr.b).MakeMaxMin(&maxv, &minv); + (tr.c).MakeMaxMin(&maxv, &minv); + + Vector n = Vector::From(0, 0, -1); + + int i; + for(i = 0; i < l.n; i++) { + if(i == ap || i == bp || i == cp) continue; + + Vector p = l[i].p; + if(p.OutsideAndNotOn(maxv, minv)) continue; + + // A point on the edge of the triangle is considered to be inside, + // and therefore makes it a non-ear; but a point on the vertex is + // "outside", since that's necessary to make bridges work. + if(p.EqualsExactly(tr.a)) continue; + if(p.EqualsExactly(tr.b)) continue; + if(p.EqualsExactly(tr.c)) continue; + + if(tr.ContainsPointProjd(n, p)) { + return false; + } + } + return true; +} + +// Test if ray b->d passes through triangle a,b,c +static bool RayIsInside(Vector a, Vector c, Vector b, Vector d) { + // coincident edges are not considered to intersect the triangle + if (d.Equals(a)) return false; + if (d.Equals(c)) return false; + // if d and c are on opposite sides of ba, we are ok + // likewise if d and a are on opposite sides of bc + Vector ba = a.Minus(b); + Vector bc = c.Minus(b); + Vector bd = d.Minus(b); + + // perpendicular to (x,y) is (x,-y) so dot that with the two points. If they + // have opposite signs their product will be negative. If bd and bc are on + // opposite sides of ba the ray does not intersect. Likewise for bd,ba and bc. + if ( (bd.x*(ba.y) + (bd.y * (-ba.x))) * ( bc.x*(ba.y) + (bc.y * (-ba.x))) < LENGTH_EPS) + return false; + if ( (bd.x*(bc.y) + (bd.y * (-bc.x))) * ( ba.x*(bc.y) + (ba.y * (-bc.x))) < LENGTH_EPS) + return false; + + return true; +} + +bool SContour::IsEar(int bp, double scaledEps) const { + int ap = WRAP(bp-1, l.n), + cp = WRAP(bp+1, l.n); + + STriangle tr = {}; + tr.a = l[ap].p; + tr.b = l[bp].p; + tr.c = l[cp].p; + + if((tr.a).Equals(tr.c)) { + // This is two coincident and anti-parallel edges. Zero-area, so + // won't generate a real triangle, but we certainly can clip it. + return true; + } + + Vector n = Vector::From(0, 0, -1); + if((tr.Normal()).Dot(n) < scaledEps) { + // This vertex is reflex, or between two collinear edges; either way, + // it's not an ear. + return false; + } + + // Accelerate with an axis-aligned bounding box test + Vector maxv = tr.a, minv = tr.a; + (tr.b).MakeMaxMin(&maxv, &minv); + (tr.c).MakeMaxMin(&maxv, &minv); + + int i; + for(i = 0; i < l.n; i++) { + if(i == ap || i == bp || i == cp) continue; + + Vector p = l[i].p; + if(p.OutsideAndNotOn(maxv, minv)) continue; + + // A point on the edge of the triangle is considered to be inside, + // and therefore makes it a non-ear; but a point on the vertex is + // "outside", since that's necessary to make bridges work. + if(p.EqualsExactly(tr.a)) continue; + if(p.EqualsExactly(tr.c)) continue; + // points coincident with bp have to be allowed for bridges but edges + // from that other point must not cross through our triangle. + if(p.EqualsExactly(tr.b)) { + int j = WRAP(i-1, l.n); + int k = WRAP(i+1, l.n); + Vector jp = l[j].p; + Vector kp = l[k].p; + + // two consecutive bridges (A,B,C) and later (C,B,A) are not an ear + if (jp.Equals(tr.c) && kp.Equals(tr.a)) return false; + // check both edges from the point in question + if (!RayIsInside(tr.a, tr.c, p,jp) && !RayIsInside(tr.a, tr.c, p,kp)) + continue; + } + + if(tr.ContainsPointProjd(n, p)) { + return false; + } + } + return true; +} + +void SContour::ClipEarInto(SMesh *m, int bp, double scaledEps) { + int ap = WRAP(bp-1, l.n), + cp = WRAP(bp+1, l.n); + + STriangle tr = {}; + tr.a = l[ap].p; + tr.b = l[bp].p; + tr.c = l[cp].p; + if(tr.Normal().MagSquared() < scaledEps*scaledEps) { + // A vertex with more than two edges will cause us to generate + // zero-area triangles, which must be culled. + } else { + m->AddTriangle(&tr); + } + + // By deleting the point at bp, we may change the ear-ness of the points + // on either side. + l[ap].ear = EarType::UNKNOWN; + l[cp].ear = EarType::UNKNOWN; + + l.ClearTags(); + l[bp].tag = 1; + l.RemoveTagged(); +} + +void SContour::UvTriangulateInto(SMesh *m, SSurface *srf) { + Vector tu, tv; + srf->TangentsAt(0.5, 0.5, &tu, &tv); + double s = sqrt(tu.MagSquared() + tv.MagSquared()); + // We would like to apply our tolerances in xyz; but that would be a lot + // of work, so at least scale the epsilon semi-reasonably. That's + // perfect for square planes, less perfect for anything else. + double scaledEps = LENGTH_EPS / s; + + int i; + // Clean the original contour by removing any zero-length edges. + // initialize eartypes to unknown while we're going over them. + l.ClearTags(); + l[0].ear = EarType::UNKNOWN; + for(i = 1; i < l.n; i++) { + l[i].ear = EarType::UNKNOWN; + if((l[i].p).Equals(l[i-1].p)) { + l[i].tag = 1; + } + } + if( (l[0].p).Equals(l[l.n-1].p) ) { + l[l.n-1].tag = 1; + } + l.RemoveTagged(); + + // Handle simple triangle fans all at once. This pass is optional. + if(srf->degm == 1 && srf->degn == 1) { + l.ClearTags(); + int j=0; + int pstart = 0; + double elen = -1.0; + double oldspan = 0.0; + for(i = 1; i < l.n; i++) { + Vector ab = l[i].p.Minus(l[i-1].p); + // first time just measure the segment + if (elen < 0.0) { + elen = ab.Dot(ab); + oldspan = elen; + j = 1; + continue; + } + // check for consecutive segments of similar size which are also + // ears and where the group forms a convex ear + bool end = false; + double ratio = ab.Dot(ab) / elen; + if ((ratio < 0.25) || (ratio > 4.0)) end = true; + + double slen = l[pstart].p.Minus(l[i].p).MagSquared(); + if (slen < oldspan) end = true; + + if (!IsEar(i-1, scaledEps) ) end = true; +// if ((j>0) && !IsEar(pstart, i-1, i, scaledEps)) end = true; + if ((j>0) && !IsEmptyTriangle(pstart, i-1, i, scaledEps)) end = true; + // the new segment is valid so add to the fan + if (!end) { + j++; + oldspan = slen; + } + // we need to stop at the end of polygon but may still + if (i == l.n-1) { + end = true; + } + if (end) { // triangulate the fan and tag the vertices + if (j > 3) { + Vector center = l[pstart+1].p.Plus(l[pstart+j-1].p).ScaledBy(0.5); + for (int x=0; xAddTriangle(&tr); + } + for (int x=1; xAddTriangle(&tr); + } + pstart = i-1; + elen = ab.Dot(ab); + oldspan = elen; + j = 1; + } + } + l.RemoveTagged(); + } // end optional fan creation pass + + bool toggle = false; + while(l.n > 3) { + int bestEar = -1; + double bestChordTol = VERY_POSITIVE; + // Alternate the starting position so we generate strip-like + // triangulations instead of fan-like + toggle = !toggle; + int offset = toggle ? -1 : 0; + for(i = 0; i < l.n; i++) { + int ear = WRAP(i+offset, l.n); + if(l[ear].ear == EarType::UNKNOWN) { + (l[ear]).ear = IsEar(ear, scaledEps) ? EarType::EAR : EarType::NOT_EAR; + } + if(l[ear].ear == EarType::EAR) { + if(srf->degm == 1 && srf->degn == 1) { + // This is a plane; any ear is a good ear. + bestEar = ear; + break; + } + // If we are triangulating a curved surface, then try to + // clip ears that have a small chord tolerance from the + // surface. + Vector prev = l[WRAP((i+offset-1), l.n)].p, + next = l[WRAP((i+offset+1), l.n)].p; + double tol = srf->ChordToleranceForEdge(prev, next); + if(tol < bestChordTol - scaledEps) { + bestEar = ear; + bestChordTol = tol; + } + if(bestChordTol < 0.1*SS.ChordTolMm()) { + break; + } + } + } + if(bestEar < 0) { + dbp("couldn't find an ear! fail"); + return; + } + ClipEarInto(m, bestEar, scaledEps); + } + + ClipEarInto(m, 0, scaledEps); // add the last triangle +} + +double SSurface::ChordToleranceForEdge(Vector a, Vector b) const { + Vector as = PointAt(a.x, a.y), bs = PointAt(b.x, b.y); + + double worst = VERY_NEGATIVE; + int i; + for(i = 1; i <= 3; i++) { + Vector p = a. Plus((b. Minus(a )).ScaledBy(i/4.0)), + ps = as.Plus((bs.Minus(as)).ScaledBy(i/4.0)); + + Vector pps = PointAt(p.x, p.y); + worst = max(worst, (pps.Minus(ps)).MagSquared()); + } + return sqrt(worst); +} + +Vector SSurface::PointAtMaybeSwapped(double u, double v, bool swapped) const { + if(swapped) { + return PointAt(v, u); + } else { + return PointAt(u, v); + } +} + +Vector SSurface::NormalAtMaybeSwapped(double u, double v, bool swapped) const { + Vector du, dv; + if(swapped) { + TangentsAt(v, u, &dv, &du); + } else { + TangentsAt(u, v, &du, &dv); + } + return du.Cross(dv).WithMagnitude(1.0); +} + +void SSurface::MakeTriangulationGridInto(List *l, double vs, double vf, + bool swapped, int depth) const +{ + double worst = 0; + + // Try piecewise linearizing four curves, at u = 0, 1/3, 2/3, 1; choose + // the worst chord tolerance of any of those. + double worst_twist = 1.0; + int i; + for(i = 0; i <= 3; i++) { + double u = i/3.0; + + // This chord test should be identical to the one in SBezier::MakePwl + // to make the piecewise linear edges line up with the grid more or + // less. + Vector ps = PointAtMaybeSwapped(u, vs, swapped), + pf = PointAtMaybeSwapped(u, vf, swapped); + + double vm1 = (2*vs + vf) / 3, + vm2 = (vs + 2*vf) / 3; + + Vector pm1 = PointAtMaybeSwapped(u, vm1, swapped), + pm2 = PointAtMaybeSwapped(u, vm2, swapped); + + // 0.999 is about 2.5 degrees of twist over the middle 1/3 V-span. + // we don't check at the ends because the derivative may not be valid there. + double twist = 1.0; + if (degm == 1) twist = NormalAtMaybeSwapped(u, vm1, swapped).Dot( + NormalAtMaybeSwapped(u, vm2, swapped) ); + if (twist < worst_twist) worst_twist = twist; + + worst = max(worst, pm1.DistanceToLine(ps, pf.Minus(ps))); + worst = max(worst, pm2.DistanceToLine(ps, pf.Minus(ps))); + } + + double step = 1.0/SS.GetMaxSegments(); + if( ((vf - vs) < step || worst < SS.ChordTolMm()) + && ((worst_twist > 0.999) || (depth > 3)) ) { + l->Add(&vf); + } else { + MakeTriangulationGridInto(l, vs, (vs+vf)/2, swapped, depth+1); + MakeTriangulationGridInto(l, (vs+vf)/2, vf, swapped, depth+1); + } +} + +void SPolygon::UvGridTriangulateInto(SMesh *mesh, SSurface *srf) { + SEdgeList orig = {}; + MakeEdgesInto(&orig); + + SEdgeList holes = {}; + + normal = Vector::From(0, 0, 1); + FixContourDirections(); + + // Build a rectangular grid, with horizontal and vertical lines in the + // uv plane. The spacing of these lines is adaptive, so calculate that. + List li, lj; + li = {}; + lj = {}; + double v[5] = {0.0, 0.25, 0.5, 0.75, 1.0}; + li.Add(&v[0]); + srf->MakeTriangulationGridInto(&li, 0, 1, /*swapped=*/true, 0); + lj.Add(&v[0]); + srf->MakeTriangulationGridInto(&lj, 0, 1, /*swapped=*/false, 0); + + // force 2nd order grid to have at least 4 segments in each direction + if ((li.n < 5) && (srf->degm>1)) { // 4 segments minimum + li.Clear(); + li.Add(&v[0]);li.Add(&v[1]);li.Add(&v[2]);li.Add(&v[3]);li.Add(&v[4]); + } + if ((lj.n < 5) && (srf->degn>1)) { // 4 segments minimum + lj.Clear(); + lj.Add(&v[0]);lj.Add(&v[1]);lj.Add(&v[2]);lj.Add(&v[3]);lj.Add(&v[4]); + } + + if ((li.n > 3) && (lj.n > 3)) { + // Now iterate over each quad in the grid. If it's outside the polygon, + // or if it intersects the polygon, then we discard it. Otherwise we + // generate two triangles in the mesh, and cut it out of our polygon. + // Quads around the perimeter would be rejected by AnyEdgeCrossings. + std::vector bottom(lj.n, false); // did we use this quad? + Vector tu = {0,0,0}, tv = {0,0,0}; + int i, j; + for(i = 1; i < (li.n-1); i++) { + bool prev_flag = false; + for(j = 1; j < (lj.n-1); j++) { + bool this_flag = true; + double us = li[i], uf = li[i+1], + vs = lj[j], vf = lj[j+1]; + + Vector a = Vector::From(us, vs, 0), + b = Vector::From(us, vf, 0), + c = Vector::From(uf, vf, 0), + d = Vector::From(uf, vs, 0); + + // | d-----c + // | | | + // | | | + // | a-----b + // | + // +-------------> j/v axis + + if( (i==(li.n-2)) || (j==(lj.n-2)) || + orig.AnyEdgeCrossings(a, b, NULL) || + orig.AnyEdgeCrossings(b, c, NULL) || + orig.AnyEdgeCrossings(c, d, NULL) || + orig.AnyEdgeCrossings(d, a, NULL)) + { + this_flag = false; + } + + // There's no intersections, so it doesn't matter which point + // we decide to test. + if(!this->ContainsPoint(a)) { + this_flag = false; + } + + if (this_flag) { + // Add the quad to our mesh + srf->TangentsAt(us,vs, &tu,&tv); + if(tu.Dot(tv) < LENGTH_EPS) { + /* Split "the other way" if angle>90 + compare to LENGTH_EPS instead of zero to avoid alternating triangle + "orientations" when the tangents are orthogonal (revolve, lathe etc.) + this results in a higher quality mesh. */ + STriangle tr = {}; + tr.a = a; + tr.b = b; + tr.c = c; + mesh->AddTriangle(&tr); + tr.a = a; + tr.b = c; + tr.c = d; + mesh->AddTriangle(&tr); + } else{ + STriangle tr = {}; + tr.a = a; + tr.b = b; + tr.c = d; + mesh->AddTriangle(&tr); + tr.a = b; + tr.b = c; + tr.c = d; + mesh->AddTriangle(&tr); + } + if (!prev_flag) // add our own left edge + holes.AddEdge(d, a); + if (!bottom[j]) // add our own bottom edge + holes.AddEdge(a, b); + } else { + if (prev_flag) // add our left neighbors right edge + holes.AddEdge(a, d); + if (bottom[j]) // add our bottom neighbors top edge + holes.AddEdge(b, a); + } + prev_flag = this_flag; + bottom[j] = this_flag; + } + } + + // Because no duplicate edges were created we do not need to cull them. + SPolygon hp = {}; + holes.AssemblePolygon(&hp, NULL, /*keepDir=*/true); + + SContour *sc; + for(sc = hp.l.First(); sc; sc = hp.l.NextAfter(sc)) { + l.Add(sc); + } + hp.l.Clear(); + } + orig.Clear(); + holes.Clear(); + li.Clear(); + lj.Clear(); + UvTriangulateInto(mesh, srf); +} + +void SPolygon::TriangulateInto(SMesh *m) const { + Vector n = normal; + if(n.Equals(Vector::From(0.0, 0.0, 0.0))) { + n = ComputeNormal(); + } + Vector u = n.Normal(0); + Vector v = n.Normal(1); + + SPolygon p = {}; + this->InverseTransformInto(&p, u, v, n); + + SSurface srf = SSurface::FromPlane(Vector::From(0.0, 0.0, 0.0), + Vector::From(1.0, 0.0, 0.0), + Vector::From(0.0, 1.0, 0.0)); + SMesh pm = {}; + p.UvTriangulateInto(&pm, &srf); + for(STriangle st : pm.l) { + st = st.Transform(u, v, n); + m->AddTriangle(&st); + } + + p.Clear(); + pm.Clear(); +} + +} // namespace SolveSpace diff --git a/src/style.cpp b/src/style.cpp new file mode 100644 index 0000000..950b04e --- /dev/null +++ b/src/style.cpp @@ -0,0 +1,948 @@ +//----------------------------------------------------------------------------- +// Implementation of a cosmetic line style, which determines the color and +// other appearance of a line or curve on-screen and in exported files. Some +// styles are predefined, and others can be created by the user. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +const Style::Default Style::Defaults[] = { + { { ACTIVE_GRP }, "ActiveGrp", RGBf(1.0, 1.0, 1.0), 1.5, 4, true, StipplePattern::CONTINUOUS }, + { { CONSTRUCTION }, "Construction", RGBf(0.1, 0.7, 0.1), 1.5, 0, false, StipplePattern::CONTINUOUS }, + { { INACTIVE_GRP }, "InactiveGrp", RGBf(0.5, 0.3, 0.0), 1.5, 3, true, StipplePattern::CONTINUOUS }, + { { DATUM }, "Datum", RGBf(0.0, 0.8, 0.0), 1.5, 0, true, StipplePattern::CONTINUOUS }, + { { SOLID_EDGE }, "SolidEdge", RGBf(0.8, 0.8, 0.8), 1.0, 2, true, StipplePattern::CONTINUOUS }, + { { CONSTRAINT }, "Constraint", RGBf(1.0, 0.1, 1.0), 1.0, 0, true, StipplePattern::CONTINUOUS }, + { { SELECTED }, "Selected", RGBf(1.0, 0.0, 0.0), 1.5, 0, true, StipplePattern::CONTINUOUS }, + { { HOVERED }, "Hovered", RGBf(1.0, 1.0, 0.0), 1.5, 0, true, StipplePattern::CONTINUOUS }, + { { CONTOUR_FILL }, "ContourFill", RGBf(0.0, 0.1, 0.1), 1.0, 0, true, StipplePattern::CONTINUOUS }, + { { NORMALS }, "Normals", RGBf(0.0, 0.4, 0.4), 1.0, 0, true, StipplePattern::CONTINUOUS }, + { { ANALYZE }, "Analyze", RGBf(0.0, 1.0, 1.0), 3.0, 0, true, StipplePattern::CONTINUOUS }, + { { DRAW_ERROR }, "DrawError", RGBf(1.0, 0.0, 0.0), 8.0, 0, true, StipplePattern::CONTINUOUS }, + { { DIM_SOLID }, "DimSolid", RGBf(0.1, 0.1, 0.1), 1.0, 0, true, StipplePattern::CONTINUOUS }, + { { HIDDEN_EDGE }, "HiddenEdge", RGBf(0.8, 0.8, 0.8), 1.0, 1, true, StipplePattern::DASH }, + { { OUTLINE }, "Outline", RGBf(0.8, 0.8, 0.8), 3.0, 5, true, StipplePattern::CONTINUOUS }, + { { 0 }, NULL, RGBf(0.0, 0.0, 0.0), 0.0, 0, true, StipplePattern::CONTINUOUS } +}; + +std::string Style::CnfColor(const std::string &prefix) { + return "Style_" + prefix + "_Color"; +} +std::string Style::CnfWidth(const std::string &prefix) { + return "Style_" + prefix + "_Width"; +} +std::string Style::CnfStippleType(const std::string &prefix) { + return "Style_" + prefix + "_StippleType"; +} +std::string Style::CnfStippleScale(const std::string &prefix) { + return "Style_" + prefix + "_StippleScale"; +} +std::string Style::CnfTextHeight(const std::string &prefix) { + return "Style_" + prefix + "_TextHeight"; +} +std::string Style::CnfExportable(const std::string &prefix) { + return "Style_" + prefix + "_Exportable"; +} + +std::string Style::CnfPrefixToName(const std::string &prefix) { + std::string name = "#def-"; + + for(size_t i = 0; i < prefix.length(); i++) { + if(isupper(prefix[i]) && i != 0) + name += '-'; + name += tolower(prefix[i]); + } + + return name; +} + +void Style::CreateAllDefaultStyles() { + const Default *d; + for(d = &(Defaults[0]); d->h.v; d++) { + (void)Get(d->h); + } +} + +void Style::CreateDefaultStyle(hStyle h) { + bool isDefaultStyle = true; + const Default *d; + for(d = &(Defaults[0]); d->h.v; d++) { + if(d->h == h) break; + } + if(!d->h.v) { + // Not a default style; so just create it the same as our default + // active group entity style. + d = &(Defaults[0]); + isDefaultStyle = false; + } + + Style ns = {}; + FillDefaultStyle(&ns, d); + ns.h = h; + if(isDefaultStyle) { + ns.name = CnfPrefixToName(d->cnfPrefix); + } else { + ns.name = "new-custom-style"; + } + + SK.style.Add(&ns); +} + +void Style::FillDefaultStyle(Style *s, const Default *d, bool factory) { + Platform::SettingsRef settings = Platform::GetSettings(); + + if(d == NULL) d = &Defaults[0]; + s->color = (factory) + ? d->color + : settings->ThawColor(CnfColor(d->cnfPrefix), d->color); + s->width = (factory) + ? d->width + : settings->ThawFloat(CnfWidth(d->cnfPrefix), (float)(d->width)); + s->widthAs = UnitsAs::PIXELS; + s->textHeight = (factory) ? 11.5 + : settings->ThawFloat(CnfTextHeight(d->cnfPrefix), 11.5); + s->textHeightAs = UnitsAs::PIXELS; + s->textOrigin = TextOrigin::NONE; + s->textAngle = 0; + s->visible = true; + s->exportable = (factory) + ? d->exportable + : settings->ThawBool(CnfExportable(d->cnfPrefix), d->exportable); + s->filled = false; + s->fillColor = RGBf(0.3, 0.3, 0.3); + s->stippleType = (factory) + ? d->stippleType + : Style::StipplePatternFromString( + settings->ThawString(CnfStippleType(d->cnfPrefix), + StipplePatternName(d->stippleType))); + s->stippleScale = (factory) + ? 15.0 + : settings->ThawFloat(CnfStippleScale(d->cnfPrefix), 15.0); + s->zIndex = d->zIndex; +} + +void Style::LoadFactoryDefaults() { + const Default *d; + for(d = &(Defaults[0]); d->h.v; d++) { + Style *s = Get(d->h); + FillDefaultStyle(s, d, /*factory=*/true); + } + SS.backgroundColor = RGBi(0, 0, 0); +} + +void Style::FreezeDefaultStyles(Platform::SettingsRef settings) { + const Default *d; + for(d = &(Defaults[0]); d->h.v; d++) { + settings->FreezeColor(CnfColor(d->cnfPrefix), Color(d->h)); + settings->FreezeFloat(CnfWidth(d->cnfPrefix), (float)Width(d->h)); + settings->FreezeString(CnfStippleType(d->cnfPrefix), StipplePatternName(d->h)); + settings->FreezeFloat(CnfStippleScale(d->cnfPrefix), (float)StippleScale(d->h)); + settings->FreezeFloat(CnfTextHeight(d->cnfPrefix), (float)TextHeight(d->h)); + settings->FreezeBool(CnfExportable(d->cnfPrefix), Exportable(d->h.v)); + } +} + +uint32_t Style::CreateCustomStyle(bool rememberForUndo) { + if(rememberForUndo) SS.UndoRemember(); + uint32_t vs = max((uint32_t)Style::FIRST_CUSTOM, SK.style.MaximumId() + 1); + hStyle hs = { vs }; + (void)Style::Get(hs); + return hs.v; +} + +void Style::AssignSelectionToStyle(uint32_t v) { + bool showError = false; + SS.GW.GroupSelection(); + + SS.UndoRemember(); + int i; + for(i = 0; i < SS.GW.gs.entities; i++) { + hEntity he = SS.GW.gs.entity[i]; + Entity *e = SK.GetEntity(he); + if(!e->IsStylable()) continue; + + if(!he.isFromRequest()) { + showError = true; + continue; + } + + hRequest hr = he.request(); + Request *r = SK.GetRequest(hr); + r->style.v = v; + SS.MarkGroupDirty(r->group); + } + for(i = 0; i < SS.GW.gs.constraints; i++) { + hConstraint hc = SS.GW.gs.constraint[i]; + Constraint *c = SK.GetConstraint(hc); + if(!c->IsStylable()) continue; + + c->disp.style.v = v; + SS.MarkGroupDirty(c->group); + } + + if(showError) { + Error(_("Can't assign style to an entity that's derived from another " + "entity; try assigning a style to this entity's parent.")); + } + + SS.GW.ClearSelection(); + SS.GW.Invalidate(); + + // And show that style's info screen in the text window. + SS.TW.GoToScreen(TextWindow::Screen::STYLE_INFO); + SS.TW.shown.style.v = v; + SS.ScheduleShowTW(); +} + +//----------------------------------------------------------------------------- +// Look up a style by its handle. If that style does not exist, then create +// the style, according to our table of default styles. +//----------------------------------------------------------------------------- +Style *Style::Get(hStyle h) { + if(h.v == 0) h.v = ACTIVE_GRP; + + Style *s = SK.style.FindByIdNoOops(h); + if(s) { + // It exists, good. + return s; + } else { + // It doesn't exist; so we should create it and then return that. + CreateDefaultStyle(h); + return SK.style.FindById(h); + } +} + +//----------------------------------------------------------------------------- +// A couple of wrappers, so that I can call these functions with either an +// hStyle or with the integer corresponding to that hStyle.v. +//----------------------------------------------------------------------------- +RgbaColor Style::Color(int s, bool forExport) { + hStyle hs = { (uint32_t)s }; + return Color(hs, forExport); +} +double Style::Width(int s) { + hStyle hs = { (uint32_t)s }; + return Width(hs); +} + +//----------------------------------------------------------------------------- +// If a color is almost white, then we can rewrite it to black, just so that +// it won't disappear on file formats with a light background. +//----------------------------------------------------------------------------- +RgbaColor Style::RewriteColor(RgbaColor rgbin) { + Vector rgb = Vector::From(rgbin.redF(), rgbin.greenF(), rgbin.blueF()); + rgb = rgb.Minus(Vector::From(1, 1, 1)); + if(rgb.Magnitude() < 0.4 && SS.fixExportColors) { + // This is an almost-white color in a default style, which is + // good for the default on-screen view (black bg) but probably + // not desired in the exported files, which typically are shown + // against white backgrounds. + return RGBi(0, 0, 0); + } else { + return rgbin; + } +} + +//----------------------------------------------------------------------------- +// Return the stroke color associated with our style as 8-bit RGB. +//----------------------------------------------------------------------------- +RgbaColor Style::Color(hStyle h, bool forExport) { + Style *s = Get(h); + if(forExport) { + return RewriteColor(s->color); + } else { + return s->color; + } +} + +//----------------------------------------------------------------------------- +// Return the fill color associated with our style as 8-bit RGB. +//----------------------------------------------------------------------------- +RgbaColor Style::FillColor(hStyle h, bool forExport) { + Style *s = Get(h); + if(forExport) { + return RewriteColor(s->fillColor); + } else { + return s->fillColor; + } +} + +//----------------------------------------------------------------------------- +// Return the width associated with our style in pixels.. +//----------------------------------------------------------------------------- +double Style::Width(hStyle h) { + Style *s = Get(h); + switch(s->widthAs) { + case UnitsAs::MM: return s->width * SS.GW.scale; + case UnitsAs::PIXELS: return s->width; + } + ssassert(false, "Unexpected units"); +} + +//----------------------------------------------------------------------------- +// Return the width associated with our style in millimeters.. +//----------------------------------------------------------------------------- +double Style::WidthMm(int hs) { + double widthpx = Width(hs); + return widthpx / SS.GW.scale; +} + +//----------------------------------------------------------------------------- +// Return the associated text height, in pixels. +//----------------------------------------------------------------------------- +double Style::TextHeight(hStyle h) { + Style *s = Get(h); + switch(s->textHeightAs) { + case UnitsAs::MM: return s->textHeight * SS.GW.scale; + case UnitsAs::PIXELS: return s->textHeight; + } + ssassert(false, "Unexpected units"); +} + +double Style::DefaultTextHeight() { + hStyle hs { Style::CONSTRAINT }; + return TextHeight(hs); +} + +//----------------------------------------------------------------------------- +// Return the parameters of this style, as a canvas stroke. +//----------------------------------------------------------------------------- +Canvas::Stroke Style::Stroke(hStyle hs) { + Canvas::Stroke stroke = {}; + Style *style = Style::Get(hs); + stroke.color = style->color; + stroke.stipplePattern = style->stippleType; + stroke.stippleScale = style->stippleScale; + stroke.width = style->width; + switch(style->widthAs) { + case Style::UnitsAs::PIXELS: + stroke.unit = Canvas::Unit::PX; + break; + case Style::UnitsAs::MM: + stroke.unit = Canvas::Unit::MM; + break; + } + return stroke; +} + +Canvas::Stroke Style::Stroke(int hsv) { + hStyle hs = { (uint32_t) hsv }; + return Style::Stroke(hs); +} + +//----------------------------------------------------------------------------- +// Should lines and curves from this style appear in the output file? Only +// if it's both shown and exportable. +//----------------------------------------------------------------------------- +bool Style::Exportable(int si) { + hStyle hs = { (uint32_t)si }; + Style *s = Get(hs); + return (s->exportable) && (s->visible); +} + +//----------------------------------------------------------------------------- +// Return the appropriate style for our entity. If the entity has a style +// explicitly assigned, then it's that style. Otherwise it's the appropriate +// default style. +//----------------------------------------------------------------------------- +hStyle Style::ForEntity(hEntity he) { + Entity *e = SK.GetEntity(he); + // If the entity has a special style, use that. If that style doesn't + // exist yet, then it will get created automatically later. + if(e->style.v != 0) { + return e->style; + } + + // Otherwise, we use the default rules. + hStyle hs; + if(e->group != SS.GW.activeGroup) { + hs.v = INACTIVE_GRP; + } else if(e->construction) { + hs.v = CONSTRUCTION; + } else { + hs.v = ACTIVE_GRP; + } + return hs; +} + +StipplePattern Style::StipplePatternFromString(std::string name) { + std::transform(name.begin(), name.end(), name.begin(), ::tolower); + if(name == "continuous") { + return StipplePattern::CONTINUOUS; + } else if(name == "shortdash") { + return StipplePattern::SHORT_DASH; + } else if(name == "dash") { + return StipplePattern::DASH; + } else if(name == "longdash") { + return StipplePattern::LONG_DASH; + } else if(name == "dashdot") { + return StipplePattern::DASH_DOT; + } else if(name == "dashdotdot") { + return StipplePattern::DASH_DOT_DOT; + } else if(name == "dot") { + return StipplePattern::DOT; + } else if(name == "freehand") { + return StipplePattern::FREEHAND; + } else if(name == "zigzag") { + return StipplePattern::ZIGZAG; + } + + return StipplePattern::CONTINUOUS; +} + +StipplePattern Style::PatternType(hStyle hs) { + Style *s = Get(hs); + return s->stippleType; +} + +std::string Style::StipplePatternName(hStyle hs) { + Style *s = Get(hs); + return StipplePatternName(s->stippleType); +} + +std::string Style::StipplePatternName(StipplePattern stippleType) { + switch(stippleType) { + case StipplePattern::CONTINUOUS: return "Continuous"; + case StipplePattern::SHORT_DASH: return "ShortDash"; + case StipplePattern::DASH: return "Dash"; + case StipplePattern::LONG_DASH: return "LongDash"; + case StipplePattern::DASH_DOT: return "DashDot"; + case StipplePattern::DASH_DOT_DOT: return "DashDotDot"; + case StipplePattern::DOT: return "Dot"; + case StipplePattern::FREEHAND: return "FreeHand"; + case StipplePattern::ZIGZAG: return "ZigZag"; + } + + return "Continuous"; +} + +double Style::StippleScale(hStyle hs) { + Style *s = Get(hs); + return s->stippleScale; +} + +double Style::StippleScaleMm(hStyle hs) { + Style *s = Get(hs); + if(s->widthAs == UnitsAs::MM) { + return s->stippleScale; + } else if(s->widthAs == UnitsAs::PIXELS) { + return s->stippleScale / SS.GW.scale; + } + return 1.0; +} + +std::string Style::DescriptionString() const { + if(name.empty()) { + return ssprintf("s%03x-(unnamed)", h.v); + } else { + return ssprintf("s%03x-%s", h.v, name.c_str()); + } +} + + +void TextWindow::ScreenShowListOfStyles(int link, uint32_t v) { + SS.TW.GoToScreen(Screen::LIST_OF_STYLES); +} +void TextWindow::ScreenShowStyleInfo(int link, uint32_t v) { + GraphicsWindow::MenuEdit(Command::UNSELECT_ALL); + SS.TW.GoToScreen(Screen::STYLE_INFO); + SS.TW.shown.style.v = v; +} + +void TextWindow::ScreenLoadFactoryDefaultStyles(int link, uint32_t v) { + Style::LoadFactoryDefaults(); + SS.TW.GoToScreen(Screen::LIST_OF_STYLES); + SS.GW.persistentDirty = true; +} + +void TextWindow::ScreenCreateCustomStyle(int link, uint32_t v) { + Style::CreateCustomStyle(); +} + +void TextWindow::ScreenChangeBackgroundColor(int link, uint32_t v) { + RgbaColor rgb = SS.backgroundColor; + SS.TW.ShowEditControlWithColorPicker(3, rgb); + SS.TW.edit.meaning = Edit::BACKGROUND_COLOR; +} + +void TextWindow::ShowListOfStyles() { + Printf(true, "%Ft color style-name"); + + bool darkbg = false; + for(Style &s : SK.style) { + Printf(false, "%Bp %Bz %Bp %Fl%Ll%f%D%s%E", + darkbg ? 'd' : 'a', + &s.color, + darkbg ? 'd' : 'a', + ScreenShowStyleInfo, s.h.v, + s.DescriptionString().c_str()); + + darkbg = !darkbg; + } + + Printf(true, " %Fl%Ll%fcreate a new custom style%E", + &ScreenCreateCustomStyle); + + Printf(false, ""); + + RgbaColor rgb = SS.backgroundColor; + Printf(false, "%Ft background color (r, g, b)%E"); + Printf(false, "%Ba %@, %@, %@ %Fl%D%f%Ll[change]%E", + rgb.redF(), rgb.greenF(), rgb.blueF(), + top[rows-1] + 2, &ScreenChangeBackgroundColor); + + Printf(false, ""); + Printf(false, " %Fl%Ll%fload factory defaults%E", + &ScreenLoadFactoryDefaultStyles); +} + + +void TextWindow::ScreenChangeStyleName(int link, uint32_t v) { + hStyle hs = { v }; + Style *s = Style::Get(hs); + SS.TW.ShowEditControl(12, s->name); + SS.TW.edit.style = hs; + SS.TW.edit.meaning = Edit::STYLE_NAME; +} + +void TextWindow::ScreenDeleteStyle(int link, uint32_t v) { + SS.UndoRemember(); + hStyle hs = { v }; + Style *s = SK.style.FindByIdNoOops(hs); + if(s) { + SK.style.RemoveById(hs); + // And it will get recreated automatically if something is still using + // the style, so no need to do anything else. + } + SS.TW.GoToScreen(Screen::LIST_OF_STYLES); + SS.GW.Invalidate(); +} + +void TextWindow::ScreenChangeStylePatternType(int link, uint32_t v) { + hStyle hs = { v }; + Style *s = Style::Get(hs); + s->stippleType = (StipplePattern)(link - 1); + SS.GW.persistentDirty = true; +} + +void TextWindow::ScreenChangeStyleMetric(int link, uint32_t v) { + hStyle hs = { v }; + Style *s = Style::Get(hs); + double val; + Style::UnitsAs units; + Edit meaning; + int col; + switch(link) { + case 't': + val = s->textHeight; + units = s->textHeightAs; + col = 10; + meaning = Edit::STYLE_TEXT_HEIGHT; + break; + + case 's': + val = s->stippleScale; + units = s->widthAs; + col = 17; + meaning = Edit::STYLE_STIPPLE_PERIOD; + break; + + case 'w': + case 'W': + val = s->width; + units = s->widthAs; + col = 9; + meaning = Edit::STYLE_WIDTH; + break; + + default: ssassert(false, "Unexpected link"); + } + + std::string edit_value; + if(units == Style::UnitsAs::PIXELS) { + edit_value = ssprintf("%.2f", val); + } else { + edit_value = SS.MmToString(val, true); + } + SS.TW.ShowEditControl(col, edit_value); + SS.TW.edit.style = hs; + SS.TW.edit.meaning = meaning; +} + +void TextWindow::ScreenChangeStyleTextAngle(int link, uint32_t v) { + hStyle hs = { v }; + Style *s = Style::Get(hs); + SS.TW.ShowEditControl(9, ssprintf("%.2f", s->textAngle)); + SS.TW.edit.style = hs; + SS.TW.edit.meaning = Edit::STYLE_TEXT_ANGLE; +} + +void TextWindow::ScreenChangeStyleColor(int link, uint32_t v) { + hStyle hs = { v }; + Style *s = Style::Get(hs); + // Same function used for stroke and fill colors + Edit em; + RgbaColor rgb; + if(link == 's') { + em = Edit::STYLE_COLOR; + rgb = s->color; + } else if(link == 'f') { + em = Edit::STYLE_FILL_COLOR; + rgb = s->fillColor; + } else ssassert(false, "Unexpected link"); + SS.TW.ShowEditControlWithColorPicker(13, rgb); + SS.TW.edit.style = hs; + SS.TW.edit.meaning = em; +} + +void TextWindow::ScreenChangeStyleYesNo(int link, uint32_t v) { + SS.UndoRemember(); + hStyle hs = { v }; + Style *s = Style::Get(hs); + switch(link) { + // Units for the width + case 'w': + if(s->widthAs != Style::UnitsAs::MM) { + s->widthAs = Style::UnitsAs::MM; + s->width /= SS.GW.scale; + s->stippleScale /= SS.GW.scale; + } + break; + case 'W': + if(s->widthAs != Style::UnitsAs::PIXELS) { + s->widthAs = Style::UnitsAs::PIXELS; + s->width *= SS.GW.scale; + s->stippleScale *= SS.GW.scale; + } + break; + + // Units for the height + case 'g': + if(s->textHeightAs != Style::UnitsAs::MM) { + s->textHeightAs = Style::UnitsAs::MM; + s->textHeight /= SS.GW.scale; + } + break; + + case 'G': + if(s->textHeightAs != Style::UnitsAs::PIXELS) { + s->textHeightAs = Style::UnitsAs::PIXELS; + s->textHeight *= SS.GW.scale; + } + break; + + case 'e': + s->exportable = !(s->exportable); + break; + + case 'v': + s->visible = !(s->visible); + break; + + case 'f': + s->filled = !(s->filled); + break; + + // Horizontal text alignment + case 'L': + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin | (uint32_t)Style::TextOrigin::LEFT); + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::RIGHT); + break; + case 'H': + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::LEFT); + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::RIGHT); + break; + case 'R': + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::LEFT); + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin | (uint32_t)Style::TextOrigin::RIGHT); + break; + + // Vertical text alignment + case 'B': + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin | (uint32_t)Style::TextOrigin::BOT); + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::TOP); + break; + case 'V': + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::BOT); + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::TOP); + break; + case 'T': + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin & ~(uint32_t)Style::TextOrigin::BOT); + s->textOrigin = (Style::TextOrigin)((uint32_t)s->textOrigin | (uint32_t)Style::TextOrigin::TOP); + break; + } + SS.GW.Invalidate(/*clearPersistent=*/true); +} + +bool TextWindow::EditControlDoneForStyles(const std::string &str) { + Style *s; + switch(edit.meaning) { + case Edit::STYLE_STIPPLE_PERIOD: + case Edit::STYLE_TEXT_HEIGHT: + case Edit::STYLE_WIDTH: { + SS.UndoRemember(); + s = Style::Get(edit.style); + + double v; + Style::UnitsAs units = (edit.meaning == Edit::STYLE_TEXT_HEIGHT) ? + s->textHeightAs : s->widthAs; + if(units == Style::UnitsAs::MM) { + v = SS.StringToMm(str); + } else { + v = atof(str.c_str()); + } + v = max(0.0, v); + if(edit.meaning == Edit::STYLE_TEXT_HEIGHT) { + s->textHeight = v; + } else if(edit.meaning == Edit::STYLE_STIPPLE_PERIOD) { + s->stippleScale = v; + } else { + s->width = v; + } + break; + } + case Edit::STYLE_TEXT_ANGLE: + SS.UndoRemember(); + s = Style::Get(edit.style); + s->textAngle = WRAP_SYMMETRIC(atof(str.c_str()), 360); + break; + + case Edit::BACKGROUND_COLOR: + case Edit::STYLE_FILL_COLOR: + case Edit::STYLE_COLOR: { + Vector rgb; + if(sscanf(str.c_str(), "%lf, %lf, %lf", &rgb.x, &rgb.y, &rgb.z)==3) { + rgb = rgb.ClampWithin(0, 1); + if(edit.meaning == Edit::STYLE_COLOR) { + SS.UndoRemember(); + s = Style::Get(edit.style); + s->color = RGBf(rgb.x, rgb.y, rgb.z); + } else if(edit.meaning == Edit::STYLE_FILL_COLOR) { + SS.UndoRemember(); + s = Style::Get(edit.style); + s->fillColor = RGBf(rgb.x, rgb.y, rgb.z); + } else { + SS.backgroundColor = RGBf(rgb.x, rgb.y, rgb.z); + } + } else { + Error(_("Bad format: specify color as r, g, b")); + } + break; + } + case Edit::STYLE_NAME: + if(str.empty()) { + Error(_("Style name cannot be empty")); + } else { + SS.UndoRemember(); + s = Style::Get(edit.style); + s->name = str; + } + break; + + default: return false; + } + SS.GW.persistentDirty = true; + return true; +} + +void TextWindow::ShowStyleInfo() { + Printf(true, "%Fl%f%Ll(back to list of styles)%E", &ScreenShowListOfStyles); + + Style *s = Style::Get(shown.style); + + if(s->h.v < Style::FIRST_CUSTOM) { + Printf(true, "%FtSTYLE %E%s ", s->DescriptionString().c_str()); + } else { + Printf(true, "%FtSTYLE %E%s " + "[%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]", + s->DescriptionString().c_str(), + s->h.v, &ScreenChangeStyleName, + s->h.v, &ScreenDeleteStyle); + } + Printf(true, "%Ft line stroke style%E"); + Printf(false, "%Ba %Ftcolor %E%Bz %Ba (%@, %@, %@) %D%f%Ls%Fl[change]%E", + &s->color, + s->color.redF(), s->color.greenF(), s->color.blueF(), + s->h.v, ScreenChangeStyleColor); + + // The line width, and its units + if(s->widthAs == Style::UnitsAs::PIXELS) { + Printf(false, " %Ftwidth%E %@ %D%f%Lp%Fl[change]%E", + s->width, + s->h.v, &ScreenChangeStyleMetric, + (s->h.v < Style::FIRST_CUSTOM) ? 'w' : 'W'); + } else { + Printf(false, " %Ftwidth%E %s %D%f%Lp%Fl[change]%E", + SS.MmToString(s->width).c_str(), + s->h.v, &ScreenChangeStyleMetric, + (s->h.v < Style::FIRST_CUSTOM) ? 'w' : 'W'); + } + + if(s->widthAs == Style::UnitsAs::PIXELS) { + Printf(false, "%Ba %Ftstipple width%E %@ %D%f%Lp%Fl[change]%E", + s->stippleScale, + s->h.v, &ScreenChangeStyleMetric, 's'); + } else { + Printf(false, "%Ba %Ftstipple width%E %s %D%f%Lp%Fl[change]%E", + SS.MmToString(s->stippleScale).c_str(), + s->h.v, &ScreenChangeStyleMetric, 's'); + } + + bool widthpx = (s->widthAs == Style::UnitsAs::PIXELS); + if(s->h.v < Style::FIRST_CUSTOM) { + Printf(false," %Ftin units of %Fdpixels%E"); + } else { + Printf(false,"%Ba %Ftin units of %Fd" + "%D%f%LW%s pixels%E " + "%D%f%Lw%s %s", + s->h.v, &ScreenChangeStyleYesNo, + widthpx ? RADIO_TRUE : RADIO_FALSE, + s->h.v, &ScreenChangeStyleYesNo, + !widthpx ? RADIO_TRUE : RADIO_FALSE, + SS.UnitName()); + } + + Printf(false,"%Ba %Ftstipple type:%E"); + + const size_t patternCount = (size_t)StipplePattern::LAST + 1; + const char *patternsSource[patternCount] = { + "___________", + "- - - - ", + "- - - - - -", + "__ __ __ __", + "-.-.-.-.-.-", + "..-..-..-..", + "...........", + "~~~~~~~~~~~", + "__~__~__~__" + }; + std::string patterns[patternCount]; + + for(uint32_t i = 0; i <= (uint32_t)StipplePattern::LAST; i++) { + const char *str = patternsSource[i]; + do { + switch(*str) { + case ' ': patterns[i] += " "; break; + case '.': patterns[i] += "\xEE\x80\x84"; break; + case '_': patterns[i] += "\xEE\x80\x85"; break; + case '-': patterns[i] += "\xEE\x80\x86"; break; + case '~': patterns[i] += "\xEE\x80\x87"; break; + default: ssassert(false, "Unexpected stipple pattern element"); + } + } while(*(++str)); + } + + for(uint32_t i = 0; i <= (uint32_t)StipplePattern::LAST; i++) { + const char *radio = s->stippleType == (StipplePattern)i ? RADIO_TRUE : RADIO_FALSE; + Printf(false, "%Bp %D%f%Lp%s %s%E", + (i % 2 == 0) ? 'd' : 'a', + s->h.v, &ScreenChangeStylePatternType, + i + 1, radio, patterns[i].c_str()); + } + + if(s->h.v >= Style::FIRST_CUSTOM) { + // The fill color, and whether contours are filled + + Printf(false, ""); + Printf(false, "%Ft contour fill style%E"); + Printf(false, + "%Ba %Ftcolor %E%Bz %Ba (%@, %@, %@) %D%f%Lf%Fl[change]%E", + &s->fillColor, + s->fillColor.redF(), s->fillColor.greenF(), s->fillColor.blueF(), + s->h.v, ScreenChangeStyleColor); + + Printf(false, "%Bd %D%f%Lf%s contours are filled%E", + s->h.v, &ScreenChangeStyleYesNo, + s->filled ? CHECK_TRUE : CHECK_FALSE); + } + + // The text height, and its units + Printf(false, ""); + Printf(false, "%Ft text style%E"); + + if(s->textHeightAs == Style::UnitsAs::PIXELS) { + Printf(false, "%Ba %Ftheight %E%@ %D%f%Lt%Fl%s%E", + s->textHeight, + s->h.v, &ScreenChangeStyleMetric, + "[change]"); + } else { + Printf(false, "%Ba %Ftheight %E%s %D%f%Lt%Fl%s%E", + SS.MmToString(s->textHeight).c_str(), + s->h.v, &ScreenChangeStyleMetric, + "[change]"); + } + + bool textHeightpx = (s->textHeightAs == Style::UnitsAs::PIXELS); + if(s->h.v < Style::FIRST_CUSTOM) { + Printf(false,"%Bd %Ftin units of %Fdpixels"); + } else { + Printf(false,"%Bd %Ftin units of %Fd" + "%D%f%LG%s pixels%E " + "%D%f%Lg%s %s", + s->h.v, &ScreenChangeStyleYesNo, + textHeightpx ? RADIO_TRUE : RADIO_FALSE, + s->h.v, &ScreenChangeStyleYesNo, + !textHeightpx ? RADIO_TRUE : RADIO_FALSE, + SS.UnitName()); + } + + if(s->h.v >= Style::FIRST_CUSTOM) { + Printf(false, "%Ba %Ftangle %E%@ %D%f%Ll%Fl[change]%E", + s->textAngle, + s->h.v, &ScreenChangeStyleTextAngle); + + Printf(false, ""); + Printf(false, "%Ft text comment alignment%E"); + bool neither; + neither = !((uint32_t)s->textOrigin & ((uint32_t)Style::TextOrigin::LEFT | (uint32_t)Style::TextOrigin::RIGHT)); + Printf(false, "%Ba " + "%D%f%LL%s left%E " + "%D%f%LH%s center%E " + "%D%f%LR%s right%E ", + s->h.v, &ScreenChangeStyleYesNo, + ((uint32_t)s->textOrigin & (uint32_t)Style::TextOrigin::LEFT) ? RADIO_TRUE : RADIO_FALSE, + s->h.v, &ScreenChangeStyleYesNo, + neither ? RADIO_TRUE : RADIO_FALSE, + s->h.v, &ScreenChangeStyleYesNo, + ((uint32_t)s->textOrigin & (uint32_t)Style::TextOrigin::RIGHT) ? RADIO_TRUE : RADIO_FALSE); + + neither = !((uint32_t)s->textOrigin & ((uint32_t)Style::TextOrigin::BOT | (uint32_t)Style::TextOrigin::TOP)); + Printf(false, "%Bd " + "%D%f%LB%s bottom%E " + "%D%f%LV%s center%E " + "%D%f%LT%s top%E ", + s->h.v, &ScreenChangeStyleYesNo, + ((uint32_t)s->textOrigin & (uint32_t)Style::TextOrigin::BOT) ? RADIO_TRUE : RADIO_FALSE, + s->h.v, &ScreenChangeStyleYesNo, + neither ? RADIO_TRUE : RADIO_FALSE, + s->h.v, &ScreenChangeStyleYesNo, + ((uint32_t)s->textOrigin & (uint32_t)Style::TextOrigin::TOP) ? RADIO_TRUE : RADIO_FALSE); + } + + Printf(false, ""); + + if(s->h.v >= Style::FIRST_CUSTOM) { + Printf(false, " %Fd%D%f%Lv%s show these objects on screen%E", + s->h.v, &ScreenChangeStyleYesNo, + s->visible ? CHECK_TRUE : CHECK_FALSE); + } + + Printf(false, " %Fd%D%f%Le%s export these objects%E", + s->h.v, &ScreenChangeStyleYesNo, + s->exportable ? CHECK_TRUE : CHECK_FALSE); + + if(s->h.v >= Style::FIRST_CUSTOM) { + Printf(false, ""); + Printf(false, "To assign lines or curves to this style,"); + Printf(false, "right-click them on the drawing."); + } +} + +void TextWindow::ScreenAssignSelectionToStyle(int link, uint32_t v) { + Style::AssignSelectionToStyle(v); +} + +} // namespace SolveSpace diff --git a/src/system.cpp b/src/system.cpp new file mode 100644 index 0000000..89d3159 --- /dev/null +++ b/src/system.cpp @@ -0,0 +1,614 @@ +//----------------------------------------------------------------------------- +// Once we've written our constraint equations in the symbolic algebra system, +// these routines linearize them, and solve by a modified Newton's method. +// This also contains the routines to detect non-convergence or inconsistency, +// and report diagnostics to the user. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +#include +#include + +namespace SolveSpace { + +// The solver will converge all unknowns to within this tolerance. This must +// always be much less than LENGTH_EPS, and in practice should be much less. +const double System::CONVERGE_TOLERANCE = (LENGTH_EPS/(1e2)); + +constexpr size_t LikelyPartialCountPerEq = 10; + +bool System::WriteJacobian(int tag) { + // Clear all + mat.param.clear(); + mat.eq.clear(); + mat.A.sym.setZero(); + mat.B.sym.clear(); + + for(Equation &e : eq) { + if(e.tag != tag) continue; + mat.eq.push_back(&e); + } + if(mat.eq.size() >= MAX_UNKNOWNS) { + return false; + } + mat.m = mat.eq.size(); + + std::unordered_map paramToIndex; + for(Param &p : param) { + if(p.tag != tag) continue; + // Fill the param id to index map + paramToIndex[p.h.v] = mat.param.size(); + mat.param.push_back(p.h); + } + mat.n = mat.param.size(); + + // In some experimenting, this is almost always the right size. + // Value is usually between 0 and 20, comes from number of constraints? + mat.A.sym.resize(mat.m, mat.n); + mat.A.sym.reserve(Eigen::VectorXi::Constant(mat.n, LikelyPartialCountPerEq)); + + mat.B.sym.reserve(mat.eq.size()); + for(size_t i = 0; i < mat.eq.size(); i++) { + Equation *e = mat.eq[i]; + // Deep-copy and simplify (fold) the current equation. + Expr *f = e->e->DeepCopyWithParamsAsPointers(¶m, &(SK.param), /*foldConstants=*/true); + + ParamSet paramsUsed; + f->ParamsUsedList(¶msUsed); + + for(hParam p : paramsUsed) { + // Find the index of this parameter + auto it = paramToIndex.find(p.v); + if(it == paramToIndex.end()) continue; + // this is the parameter index + const int j = it->second; + // compute partial derivative of f + Expr *pd = f->PartialWrt(p); + pd = pd->FoldConstants(/*allocCopy=*/false); + if(pd->IsZeroConst()) + continue; + mat.A.sym.insert(i, j) = pd; + } + mat.B.sym.push_back(f); + } + return true; +} + +void System::EvalJacobian() { + using namespace Eigen; + mat.A.num.setZero(); + mat.A.num.resize(mat.m, mat.n); + const int size = mat.A.sym.outerSize(); + + for(int k = 0; k < size; k++) { + for(SparseMatrix ::InnerIterator it(mat.A.sym, k); it; ++it) { + double value = it.value()->Eval(); + if(EXACT(value == 0.0)) continue; + mat.A.num.insert(it.row(), it.col()) = value; + } + } + mat.A.num.makeCompressed(); +} + +bool System::IsDragged(hParam p) { + return dragged.find(p) != dragged.end(); +} + +SubstitutionMap System::SolveBySubstitution() { + // Contains pointers to last substitutions in a substitution chain + std::vector subVec; + // Maps a parameter to the index of its last substitution in `subVec` + std::unordered_map> leaves; + // Tracks how many slots in `subVec` contain a specific last substitution + // (this can happen as slots that once contained a specific substitution + // are updated to point to another over the run of the substitution algorithm) + std::unordered_map, HandleHasher> slotTrack; + + for(auto &teq : eq) { + Expr *tex = teq.e; + + // If we have `(a - b) = 0` where both a and b are parameters, then `a = b` and we can substitute + if(tex->op == Expr::Op::MINUS && + tex->a->op == Expr::Op::PARAM && + tex->b->op == Expr::Op::PARAM) + { + Param *sub = param.FindByIdNoOops(tex->a->parh); + Param *by = param.FindByIdNoOops(tex->b->parh); + if(!sub || !by) { + // Don't substitute unless they're both solver params; + // otherwise it's an equation that can be solved immediately, + // or an error to flag later. + continue; + } + + if(sub->h == by->h) { + teq.tag = EQ_SUBSTITUTED; + continue; + } + + // Take the last substitution of parameter a + size_t subIdx = 0; + auto it = leaves.find(sub->h); + if(it != leaves.end()) { + subIdx = it->second; + sub = subVec.at(it->second - 1); + } + + // Take the last substitution of parameter b + size_t byIdx = 0; + it = leaves.find(by->h); + if(it != leaves.end()) { + byIdx = it->second; + by = subVec.at(it->second - 1); + } + + // If the last substituton of `a` is a dragged param, keep it + // and substitute the other param + if(IsDragged(sub->h)) { + std::swap(sub, by); + std::swap(subIdx, byIdx); + } + + if(subIdx == 0) { + if(byIdx == 0) { + // Neither `sub` nor `by` are in the map, so add them and + // set the target index + subVec.push_back(by); + leaves[by->h] = leaves[sub->h] = subVec.size(); + } else { + // `sub` isn't in the map, but `by` is, so just add `sub` to + // the map with `by` as the target + leaves[sub->h] = byIdx; + } + } else { + // `sub` already exists in the map, so just update any slots + // that point to it as the last substitution to point to `by` + // instead + auto it = slotTrack.find(sub->h); + if(it == slotTrack.end()) { + // There's only this one slot, so just replace it with `by` + subVec[subIdx - 1] = by; + + // If `by` was already in the map, that means we now have + // an additional slot where it resides, so add it to the + // slot tracker + if(byIdx != 0) { + // If `by` is already in the slot tracker, we'll get + // back a vector with at least two elements; otherwise + // this access will add a new item to the slot tracker + // with an empty vector + auto &bySlots = slotTrack[by->h]; + if(bySlots.empty()) { + bySlots.push_back(byIdx); + } + bySlots.push_back(subIdx); + } + } else { + // We have more than one slot pointing to `sub`, so update + // all of the slots to point to `by` + for(size_t i : it->second) { + subVec[i - 1] = by; + } + + // No more slots are pointing to `sub`, so extract the slot list + // and erase `sub` from the tracker + auto subSlots = std::move(it->second); + slotTrack.erase(it); + + // Same as above: this access either gives us an existing vector + // with at least two elements, or creates an empty vector + auto &bySlots = slotTrack[by->h]; + if(bySlots.empty()) { + bySlots = std::move(subSlots); + if(byIdx != 0) { + bySlots.push_back(byIdx); + } + } else { + bySlots.insert(bySlots.end(), subSlots.begin(), subSlots.end()); + } + } + + leaves[by->h] = subIdx; + } + + sub->tag = VAR_SUBSTITUTED; + teq.tag = EQ_SUBSTITUTED; + } + } + + SubstitutionMap subMap; + for(auto &sub : leaves) { + Param *by = subVec[sub.second - 1]; + if(sub.first != by->h) { + subMap[sub.first] = by; + } + } + + // Substitute all the equations + for(auto &req : eq) { + req.e->Substitute(subMap); + } + + return subMap; +} + +//----------------------------------------------------------------------------- +// Calculate the rank of the Jacobian matrix +//----------------------------------------------------------------------------- +int System::CalculateRank() { + using namespace Eigen; + if(mat.n == 0 || mat.m == 0) return 0; + SparseQR , COLAMDOrdering> solver; + solver.compute(mat.A.num); + int result = solver.rank(); + return result; +} + +bool System::TestRank(int *dof, int *rank) { + EvalJacobian(); + int jacobianRank = CalculateRank(); + // We are calculating dof based on real rank, not mat.m. + // Using this approach we can calculate real dof even when redundant is allowed. + if(dof != NULL) *dof = mat.n - jacobianRank; + if(rank) { + *rank = jacobianRank; + } + return jacobianRank == mat.m; +} + +bool System::SolveLinearSystem(const Eigen::SparseMatrix &A, + const Eigen::VectorXd &B, Eigen::VectorXd *X) +{ + if(A.outerSize() == 0) return true; + using namespace Eigen; + SparseQR, COLAMDOrdering> solver; + //SimplicialLDLT> solver; + solver.compute(A); + *X = solver.solve(B); + return (solver.info() == Success); +} + +bool System::SolveLeastSquares() { + using namespace Eigen; + // Scale the columns; this scale weights the parameters for the least + // squares solve, so that we can encourage the solver to make bigger + // changes in some parameters, and smaller in others. + VectorXd scale = VectorXd::Ones(mat.n); + for(int c = 0; c < mat.n; c++) { + if(IsDragged(mat.param[c])) { + // It's least squares, so this parameter doesn't need to be all + // that big to get a large effect. + scale[c] = 1 / 20.0; + } + } + + const int size = mat.A.num.outerSize(); + for(int k = 0; k < size; k++) { + for(SparseMatrix::InnerIterator it(mat.A.num, k); it; ++it) { + it.valueRef() *= scale[it.col()]; + } + } + + SparseMatrix AAt = mat.A.num * mat.A.num.transpose(); + AAt.makeCompressed(); + VectorXd z(mat.n); + + if(!SolveLinearSystem(AAt, mat.B.num, &z)) return false; + + mat.X = mat.A.num.transpose() * z; + + for(int c = 0; c < mat.n; c++) { + mat.X[c] *= scale[c]; + } + return true; +} + +bool System::NewtonSolve() { + + int iter = 0; + bool converged = false; + int i; + + // Evaluate the functions at our operating point. + mat.B.num = Eigen::VectorXd(mat.m); + for(i = 0; i < mat.m; i++) { + mat.B.num[i] = (mat.B.sym[i])->Eval(); + } + do { + // And evaluate the Jacobian at our initial operating point. + EvalJacobian(); + + if(!SolveLeastSquares()) break; + + // Take the Newton step; + // J(x_n) (x_{n+1} - x_n) = 0 - F(x_n) + for(i = 0; i < mat.n; i++) { + Param *p = param.FindById(mat.param[i]); + p->val -= mat.X[i]; + if(IsReasonable(p->val)) { + // Very bad, and clearly not convergent + return false; + } + } + + // Re-evalute the functions, since the params have just changed. + for(i = 0; i < mat.m; i++) { + mat.B.num[i] = (mat.B.sym[i])->Eval(); + if(IsReasonable(mat.B.num[i])) { + // Very bad, and clearly not convergent + return false; + } + } + + // Check for convergence + converged = true; + for(i = 0; i < mat.m; i++) { + if(fabs(mat.B.num[i]) > CONVERGE_TOLERANCE) { + converged = false; + break; + } + } + } while(iter++ < 50 && !converged); + + return converged; +} + +void System::WriteEquationsExceptFor(hConstraint hc, Group *g) { + // Generate all the equations from constraints in this group + for(auto &con : SK.constraint) { + ConstraintBase *c = &con; + if(c->group != g->h) continue; + if(c->h == hc) continue; + + if(c->HasLabel() && c->type != Constraint::Type::COMMENT && + g->allDimsReference) + { + // When all dimensions are reference, we adjust them to display + // the correct value, and then don't generate any equations. + c->ModifyToSatisfy(); + continue; + } + if(g->relaxConstraints && c->type != Constraint::Type::POINTS_COINCIDENT) { + // When the constraints are relaxed, we keep only the point- + // coincident constraints, and the constraints generated by + // the entities and groups. + continue; + } + + c->GenerateEquations(&eq); + } + // And the equations from entities + for(auto &ent : SK.entity) { + EntityBase *e = &ent; + if(e->group != g->h) continue; + + e->GenerateEquations(&eq); + } + // And from the groups themselves + g->GenerateEquations(&eq); +} + +void System::FindWhichToRemoveToFixJacobian(Group *g, List *bad, bool forceDofCheck) { + auto time = GetMilliseconds(); + g->solved.timeout = false; + int a; + + for(a = 0; a < 2; a++) { + for(auto &con : SK.constraint) { + if((GetMilliseconds() - time) > g->solved.findToFixTimeout) { + g->solved.timeout = true; + return; + } + + ConstraintBase *c = &con; + if(c->group != g->h) continue; + if((c->type == Constraint::Type::POINTS_COINCIDENT && a == 0) || + (c->type != Constraint::Type::POINTS_COINCIDENT && a == 1)) + { + // Do the constraints in two passes: first everything but + // the point-coincident constraints, then only those + // constraints (so they appear last in the list). + continue; + } + + param.ClearTags(); + eq.Clear(); + WriteEquationsExceptFor(c->h, g); + eq.ClearTags(); + + // It's a major speedup to solve the easy ones by substitution here, + // and that doesn't break anything. + if(!forceDofCheck) { + SolveBySubstitution(); + } + + WriteJacobian(0); + EvalJacobian(); + + int rank = CalculateRank(); + if(rank == mat.m) { + // We fixed it by removing this constraint + bad->Add(&(c->h)); + } + } + } +} + +SolveResult System::Solve(Group *g, int *dof, List *bad, + bool andFindBad, bool andFindFree, bool forceDofCheck) +{ + WriteEquationsExceptFor(Constraint::NO_CONSTRAINT, g); + + bool rankOk; + + // int x; + // printf("%d equations", eq.n); + // for(x = 0; x < eq.n; x++) { + // printf(" %.3f = %s = 0", eq[x].e->Eval(), eq[x].e->Print().c_str()); + // } + // printf("%d parameters", param.n); + // for(x = 0; x < param.n; x++) { + // printf(" param %08x at %.3f", param[x].h.v, param[x].val); + // } + + // All params and equations are assigned to group zero. + param.ClearTags(); + eq.ClearTags(); + + SubstitutionMap subMap; + + // Since we are suppressing dof calculation or allowing redundant, we + // can't / don't want to catch result of dof checking without substitution + if(g->suppressDofCalculation || g->allowRedundant || !forceDofCheck) { + subMap = SolveBySubstitution(); + } + + // Before solving the big system, see if we can find any equations that + // are soluble alone. This can be a huge speedup. We don't know whether + // the system is consistent yet, but if it isn't then we'll catch that + // later. + int alone = 1; + for(auto &e : eq) { + if(e.tag != 0) + continue; + + hParam hp = e.e->ReferencedParams(¶m); + if(hp == Expr::NO_PARAMS) continue; + if(hp == Expr::MULTIPLE_PARAMS) continue; + + Param *p = param.FindById(hp); + if(p->tag != 0) continue; // let rank test catch inconsistency + + e.tag = alone; + p->tag = alone; + WriteJacobian(alone); + if(!NewtonSolve()) { + // We don't do the rank test, so let's arbitrarily return + // the DIDNT_CONVERGE result here. + rankOk = true; + // Failed to converge, bail out early + goto didnt_converge; + } + alone++; + } + + // Now write the Jacobian for what's left, and do a rank test; that + // tells us if the system is inconsistently constrained. + if(!WriteJacobian(0)) { + return SolveResult::TOO_MANY_UNKNOWNS; + } + // Clear dof value in order to have indication when dof is actually not calculated + if(dof != NULL) *dof = -1; + // We are suppressing or allowing redundant, so we no need to catch unsolveable + redundant + rankOk = (!g->suppressDofCalculation && !g->allowRedundant) ? TestRank(dof) : true; + + // And do the leftovers as one big system + if(!NewtonSolve()) { + goto didnt_converge; + } + + // Here we are want to calculate dof even when redundant is allowed, so just handle suppressing + rankOk = (!g->suppressDofCalculation) ? TestRank(dof) : true; + if(!rankOk) { + if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, forceDofCheck); + } else { + MarkParamsFree(andFindFree); + } + // System solved correctly, so write the new values back in to the + // main parameter table. + for(auto &p : param) { + auto it = subMap.find(p.h); + double val = it == subMap.end() ? p.val : it->second->val; + + Param *pp = SK.GetParam(p.h); + pp->val = val; + pp->known = true; + pp->free = p.free; + } + return rankOk ? SolveResult::OKAY : SolveResult::REDUNDANT_OKAY; + +didnt_converge: + SK.constraint.ClearTags(); + // Not using range-for here because index is used in additional ways + for(size_t i = 0; i < mat.eq.size(); i++) { + if(fabs(mat.B.num[i]) > CONVERGE_TOLERANCE || IsReasonable(mat.B.num[i])) { + // This constraint is unsatisfied. + if(!mat.eq[i]->h.isFromConstraint()) continue; + + hConstraint hc = mat.eq[i]->h.constraint(); + ConstraintBase *c = SK.constraint.FindByIdNoOops(hc); + if(!c) continue; + // Don't double-show constraints that generated multiple + // unsatisfied equations + if(!c->tag) { + bad->Add(&(c->h)); + c->tag = 1; + } + } + } + + return rankOk ? SolveResult::DIDNT_CONVERGE : SolveResult::REDUNDANT_DIDNT_CONVERGE; +} + +SolveResult System::SolveRank(Group *g, int *rank, int *dof, List *bad, + bool andFindBad, bool andFindFree) +{ + WriteEquationsExceptFor(Constraint::NO_CONSTRAINT, g); + + // All params and equations are assigned to group zero. + param.ClearTags(); + eq.ClearTags(); + + // Now write the Jacobian, and do a rank test; that + // tells us if the system is inconsistently constrained. + if(!WriteJacobian(0)) { + return SolveResult::TOO_MANY_UNKNOWNS; + } + + bool rankOk = TestRank(dof, rank); + if(!rankOk) { + // When we are testing with redundant allowed, we don't want to have additional info + // about redundants since this test is working only for single redundant constraint + if(!g->suppressDofCalculation && !g->allowRedundant) { + if(andFindBad) FindWhichToRemoveToFixJacobian(g, bad, true); + } + } else { + MarkParamsFree(andFindFree); + } + return rankOk ? SolveResult::OKAY : SolveResult::REDUNDANT_OKAY; +} + +void System::Clear() { + entity.Clear(); + param.Clear(); + eq.Clear(); + dragged.clear(); + mat.A.num.setZero(); + mat.A.sym.setZero(); +} + +void System::MarkParamsFree(bool find) { + // If requested, find all the free (unbound) variables. This might be + // more than the number of degrees of freedom. Don't always do this, + // because the display would get annoying and it's slow. + for(auto &p : param) { + p.free = false; + + if(find) { + if(p.tag == 0) { + p.tag = VAR_DOF_TEST; + WriteJacobian(0); + EvalJacobian(); + int rank = CalculateRank(); + if(rank == mat.m) { + p.free = true; + } + p.tag = 0; + } + } + } +} + +} // namespace SolveSpace diff --git a/src/textscreens.cpp b/src/textscreens.cpp new file mode 100644 index 0000000..41dcb1b --- /dev/null +++ b/src/textscreens.cpp @@ -0,0 +1,984 @@ +//----------------------------------------------------------------------------- +// The text-based browser window, used to view the structure of the model by +// groups and for other similar purposes. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// A navigation bar that always appears at the top of the window, with a +// link to bring us back home. +//----------------------------------------------------------------------------- +void TextWindow::ScreenHome(int link, uint32_t v) { + SS.TW.GoToScreen(Screen::LIST_OF_GROUPS); +} +void TextWindow::ShowHeader(bool withNav) { + ClearScreen(); + + const char *header; + std::string desc; + if(SS.GW.LockedInWorkplane()) { + header = "in plane: "; + desc = SK.GetEntity(SS.GW.ActiveWorkplane())->DescriptionString(); + } else { + header = "drawing / constraining in 3d"; + desc = ""; + } + + // Navigation buttons + if(withNav) { + Printf(false, " %Fl%Lh%fhome%E %Ft%s%E%s", + (&TextWindow::ScreenHome), header, desc.c_str()); + } else { + Printf(false, " %Ft%s%E%s", header, desc.c_str()); + } + + // Leave space for the icons that are painted here. + Printf(false, ""); + Printf(false, ""); +} + +//----------------------------------------------------------------------------- +// The screen that shows a list of every group in the sketch, with options +// to hide or show them, and to view them in detail. This is our home page. +//----------------------------------------------------------------------------- +void TextWindow::ScreenSelectGroup(int link, uint32_t v) { + GraphicsWindow::MenuEdit(Command::UNSELECT_ALL); + SS.TW.GoToScreen(Screen::GROUP_INFO); + SS.TW.shown.group.v = v; +} +void TextWindow::ScreenToggleGroupShown(int link, uint32_t v) { + hGroup hg = { v }; + Group *g = SK.GetGroup(hg); + g->visible = !(g->visible); + // If a group was just shown, then it might not have been generated + // previously, so regenerate. + SS.GenerateAll(); +} +void TextWindow::ScreenShowGroupsSpecial(int link, uint32_t v) { + for(hGroup hg : SK.groupOrder) { + Group *g = SK.GetGroup(hg); + switch(link) { + case 's': g->visible = true; break; + case 'c': g->visible = g->solved.dof != 0; break; + case 'h': g->visible = false; break; + } + } + SS.GW.persistentDirty = true; +} +void TextWindow::ScreenActivateGroup(int link, uint32_t v) { + SS.GW.activeGroup.v = v; + SK.GetGroup(SS.GW.activeGroup)->Activate(); + SS.GW.ClearSuper(); +} +void TextWindow::ReportHowGroupSolved(hGroup hg) { + SS.GW.ClearSuper(); + SS.TW.GoToScreen(Screen::GROUP_SOLVE_INFO); + SS.TW.shown.group = hg; + SS.ScheduleShowTW(); +} +void TextWindow::ScreenHowGroupSolved(int link, uint32_t v) { + if(SS.GW.activeGroup.v != v) { + ScreenActivateGroup(link, v); + } + SS.TW.GoToScreen(Screen::GROUP_SOLVE_INFO); + SS.TW.shown.group.v = v; +} +void TextWindow::ScreenShowConfiguration(int link, uint32_t v) { + SS.TW.GoToScreen(Screen::CONFIGURATION); +} +void TextWindow::ScreenShowEditView(int link, uint32_t v) { + SS.TW.GoToScreen(Screen::EDIT_VIEW); +} +void TextWindow::ScreenGoToWebsite(int link, uint32_t v) { + Platform::OpenInBrowser("http://solvespace.com/txtlink"); +} +void TextWindow::ShowListOfGroups() { + const char *radioTrue = " " RADIO_TRUE " ", + *radioFalse = " " RADIO_FALSE " ", + *checkTrue = " " CHECK_TRUE " ", + *checkFalse = " " CHECK_FALSE " "; + + Printf(true, "%Ft active"); + Printf(false, "%Ft shown dof group-name%E"); + bool afterActive = false; + bool backgroundParity = false; + for(hGroup hg : SK.groupOrder) { + Group *g = SK.GetGroup(hg); + + std::string s = g->DescriptionString(); + bool active = (g->h == SS.GW.activeGroup); + bool shown = g->visible; + bool ok = g->IsSolvedOkay(); + bool warn = (g->type == Group::Type::DRAWING_WORKPLANE && + g->polyError.how != PolyError::GOOD) || + ((g->type == Group::Type::EXTRUDE || + g->type == Group::Type::LATHE) && + SK.GetGroup(g->opA)->polyError.how != PolyError::GOOD); + int dof = g->solved.dof; + char sdof[16] = "ok "; + if(ok && dof > 0) { + if(dof > 999) { + strcpy(sdof, "###"); + } else { + sprintf(sdof, "%-3d", dof); + } + } + std::string suffix; + if(g->forceToMesh || g->IsTriangleMeshAssembly()) { + suffix = " (∆)"; + } + + bool ref = (g->h == Group::HGROUP_REFERENCES); + Printf(false, + "%Bp%Fd " + "%Ft%s%Fb%D%f%Ll%s%E " + "%Fb%s%D%f%Ll%s%E " + "%Fp%D%f%s%Ll%s%E " + "%Fp%Ll%D%f%s%E%s", + // Alternate between light and dark backgrounds, for readability + backgroundParity ? 'd' : 'a', + // Link that activates the group + ref ? " " : "", + g->h.v, (&TextWindow::ScreenActivateGroup), + ref ? "" : (active ? radioTrue : radioFalse), + // Link that hides or shows the group + afterActive ? " - " : "", + g->h.v, (&TextWindow::ScreenToggleGroupShown), + afterActive ? "" : (shown ? checkTrue : checkFalse), + // Link to the errors, if a problem occurred while solving + ok ? (warn ? 'm' : (dof > 0 ? 'i' : 's')) : 'x', + g->h.v, (&TextWindow::ScreenHowGroupSolved), + ok ? ((warn && SS.checkClosedContour) ? "err" : sdof) : "", + ok ? "" : "ERR", + // Link to a screen that gives more details on the group + g->suppress ? 'g' : 'l', + g->h.v, (&TextWindow::ScreenSelectGroup), s.c_str(), + suffix.c_str()); + + if(active) afterActive = true; + backgroundParity = !backgroundParity; + } + + Printf(true, " %Fl%Ls%fshow all%E / %Fl%Lc%fonly unconstrained%E / %Fl%Lh%fhide all%E", + &(TextWindow::ScreenShowGroupsSpecial), + &(TextWindow::ScreenShowGroupsSpecial), + &(TextWindow::ScreenShowGroupsSpecial)); + Printf(true, " %Fl%Ls%fline styles%E /" + " %Fl%Ls%fview%E /" + " %Fl%Ls%fconfiguration%E", + &(TextWindow::ScreenShowListOfStyles), + &(TextWindow::ScreenShowEditView), + &(TextWindow::ScreenShowConfiguration)); +} + + +//----------------------------------------------------------------------------- +// The screen that shows information about a specific group, and allows the +// user to edit various things about it. +//----------------------------------------------------------------------------- +void TextWindow::ScreenHoverGroupWorkplane(int link, uint32_t v) { + SS.GW.hover.Clear(); + hGroup hg = { v }; + SS.GW.hover.entity = hg.entity(0); + SS.GW.hover.emphasized = true; +} +void TextWindow::ScreenHoverEntity(int link, uint32_t v) { + SS.GW.hover.Clear(); + hEntity he = { v }; + SS.GW.hover.entity = he; + SS.GW.hover.emphasized = true; +} +void TextWindow::ScreenHoverRequest(int link, uint32_t v) { + SS.GW.hover.Clear(); + hRequest hr = { v }; + SS.GW.hover.entity = hr.entity(0); + SS.GW.hover.emphasized = true; +} +void TextWindow::ScreenHoverConstraint(int link, uint32_t v) { + if( SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_NOSHOW ) return; + hConstraint hc = { v }; + SS.GW.hover.Clear(); + SS.GW.hover.constraint = hc; + SS.GW.hover.emphasized = true; +} +void TextWindow::ScreenSelectEntity(int link, uint32_t v) { + SS.GW.ClearSelection(); + GraphicsWindow::Selection sel = {}; + hEntity he = { v }; + sel.entity = he; + SS.GW.selection.Add(&sel); +} +void TextWindow::ScreenSelectRequest(int link, uint32_t v) { + SS.GW.ClearSelection(); + GraphicsWindow::Selection sel = {}; + hRequest hr = { v }; + sel.entity = hr.entity(0); + SS.GW.selection.Add(&sel); +} +void TextWindow::ScreenSelectConstraint(int link, uint32_t v) { + SS.GW.ClearSelection(); + GraphicsWindow::Selection sel = {}; + sel.constraint.v = v; + SS.GW.selection.Add(&sel); +} + +void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) { + SS.UndoRemember(); + Group *g = SK.GetGroup(SS.TW.shown.group); + + switch(link) { + case 's': + if(g->subtype == Group::Subtype::TWO_SIDED) + g->subtype = Group::Subtype::ONE_SIDED; + if(g->subtype == Group::Subtype::TWO_SKEWED) + g->subtype = Group::Subtype::ONE_SKEWED; + break; + case 'S': + if(g->subtype == Group::Subtype::ONE_SIDED) + g->subtype = Group::Subtype::TWO_SIDED; + if(g->subtype == Group::Subtype::ONE_SKEWED) + g->subtype = Group::Subtype::TWO_SKEWED; + break; + case 'w': + if(g->subtype == Group::Subtype::ONE_SIDED) { + g->subtype = Group::Subtype::ONE_SKEWED; + break; + } + if(g->subtype == Group::Subtype::TWO_SIDED) { + g->subtype = Group::Subtype::TWO_SKEWED; + break; + } + if(g->subtype == Group::Subtype::ONE_SKEWED) { + g->subtype = Group::Subtype::ONE_SIDED; + break; + } + if(g->subtype == Group::Subtype::TWO_SKEWED) { + g->subtype = Group::Subtype::TWO_SIDED; + break; + } + break; + + case 'k': g->skipFirst = true; break; + case 'K': g->skipFirst = false; break; + + case 'c': + if(g->type == Group::Type::EXTRUDE) { + // When an extrude group is first created, it's positioned for a union + // extrusion. If no constraints were added, flip it when we switch between + // union/assemble and difference/intersection modes to avoid manual work doing the same. + if(g->meshCombine != (Group::CombineAs)v && g->GetNumConstraints() == 0) { + // I apologise for this if statement + if((((Group::CombineAs::DIFFERENCE == g->meshCombine) || + (Group::CombineAs::INTERSECTION == g->meshCombine)) && + (Group::CombineAs::DIFFERENCE != (Group::CombineAs)v) && + (Group::CombineAs::INTERSECTION != (Group::CombineAs)v)) || + ((Group::CombineAs::DIFFERENCE != g->meshCombine) && + (Group::CombineAs::INTERSECTION != g->meshCombine) && + ((Group::CombineAs::DIFFERENCE == (Group::CombineAs)v) || + (Group::CombineAs::INTERSECTION == (Group::CombineAs)v)))) { + g->ExtrusionForceVectorTo(g->ExtrusionGetVector().Negated()); + } + } + } + g->meshCombine = (Group::CombineAs)v; + break; + + case 'P': g->suppress = !(g->suppress); break; + + case 'r': g->relaxConstraints = !(g->relaxConstraints); break; + + case 'e': g->allowRedundant = !(g->allowRedundant); break; + + case 'D': g->suppressDofCalculation = !(g->suppressDofCalculation); break; + + case 'v': g->visible = !(g->visible); break; + + case 'd': g->allDimsReference = !(g->allDimsReference); break; + + case 'f': g->forceToMesh = !(g->forceToMesh); break; + } + + SS.MarkGroupDirty(g->h); + SS.GW.ClearSuper(); +} + +void TextWindow::ScreenColor(int link, uint32_t v) { + SS.UndoRemember(); + + Group *g = SK.GetGroup(SS.TW.shown.group); + SS.TW.ShowEditControlWithColorPicker(3, g->color); + SS.TW.edit.meaning = Edit::GROUP_COLOR; +} +void TextWindow::ScreenOpacity(int link, uint32_t v) { + Group *g = SK.GetGroup(SS.TW.shown.group); + + SS.TW.ShowEditControl(11, ssprintf("%.2f", g->color.alphaF())); + SS.TW.edit.meaning = Edit::GROUP_OPACITY; + SS.TW.edit.group = g->h; +} +void TextWindow::ScreenChangeExprA(int link, uint32_t v) { + Group *g = SK.GetGroup(SS.TW.shown.group); + + SS.TW.ShowEditControl(10, ssprintf("%d", (int)g->valA)); + SS.TW.edit.meaning = Edit::TIMES_REPEATED; + SS.TW.edit.group.v = v; +} +void TextWindow::ScreenChangeGroupName(int link, uint32_t v) { + Group *g = SK.GetGroup(SS.TW.shown.group); + SS.TW.ShowEditControl(12, g->DescriptionString().substr(5)); + SS.TW.edit.meaning = Edit::GROUP_NAME; + SS.TW.edit.group.v = v; +} +void TextWindow::ScreenChangeGroupScale(int link, uint32_t v) { + Group *g = SK.GetGroup(SS.TW.shown.group); + + SS.TW.ShowEditControl(13, ssprintf("%.3f", g->scale)); + SS.TW.edit.meaning = Edit::GROUP_SCALE; + SS.TW.edit.group.v = v; +} +void TextWindow::ScreenChangeHelixPitch(int link, uint32_t v) { + Group *g = SK.GetGroup(SS.TW.shown.group); + double pitch = g->valB/SS.MmPerUnit(); + SS.TW.ShowEditControl(3, ssprintf("%.8f", pitch)); + SS.TW.edit.meaning = Edit::HELIX_PITCH; + SS.TW.edit.group.v = v; +} +void TextWindow::ScreenChangePitchOption(int link, uint32_t v) { + Group *g = SK.GetGroup(SS.TW.shown.group); + if(g->valB == 0.0) { + g->valB = SK.GetParam(g->h.param(7))->val * PI / + (SK.GetParam(g->h.param(3))->val); + } else { + g->valB = 0.0; + } + SS.GW.Invalidate(); +} +void TextWindow::ScreenDeleteGroup(int link, uint32_t v) { + SS.UndoRemember(); + + hGroup hg = SS.TW.shown.group; + if(hg == SS.GW.activeGroup) { + SS.GW.activeGroup = SK.GetGroup(SS.GW.activeGroup)->PreviousGroup()->h; + } + + // Reset the text window, since we're displaying information about + // the group that's about to get deleted. + SS.TW.ClearSuper(); + + // This is a major change, so let's re-solve everything. + SK.group.RemoveById(hg); + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + + // Reset the graphics window. This will also recreate the default + // group if it was removed. + SS.GW.ClearSuper(); +} +void TextWindow::ShowGroupInfo() { + Group *g = SK.GetGroup(shown.group); + const char *s = "???"; + + if(shown.group == Group::HGROUP_REFERENCES) { + Printf(true, "%FtGROUP %E%s", g->DescriptionString().c_str()); + goto list_items; + } else { + Printf(true, "%FtGROUP %E%s [%Fl%Ll%D%frename%E/%Fl%Ll%D%fdel%E]", + g->DescriptionString().c_str(), + g->h.v, &TextWindow::ScreenChangeGroupName, + g->h.v, &TextWindow::ScreenDeleteGroup); + } + + if(g->type == Group::Type::LATHE) { + Printf(true, " %Ftlathe plane sketch"); + } else if(g->type == Group::Type::EXTRUDE || g->type == Group::Type::ROTATE || + g->type == Group::Type::TRANSLATE || g->type == Group::Type::REVOLVE || + g->type == Group::Type::HELIX) { + if(g->type == Group::Type::EXTRUDE) { + s = "extrude plane sketch"; + } else if(g->type == Group::Type::TRANSLATE) { + s = "translate original sketch"; + } else if(g->type == Group::Type::HELIX) { + s = "create helical extrusion"; + } else if(g->type == Group::Type::ROTATE) { + s = "rotate original sketch"; + } else if(g->type == Group::Type::REVOLVE) { + s = "revolve original sketch"; + } + Printf(true, " %Ft%s%E", s); + + bool one = ((g->subtype == Group::Subtype::ONE_SIDED) || + (g->subtype == Group::Subtype::ONE_SKEWED)); + bool two = ((g->subtype == Group::Subtype::TWO_SIDED) || + (g->subtype == Group::Subtype::TWO_SKEWED)); + bool skew = ((g->subtype == Group::Subtype::ONE_SKEWED) || + (g->subtype == Group::Subtype::TWO_SKEWED)); + + if (g->type == Group::Type::EXTRUDE) { + Printf(false, + "%Ba %f%Ls%Fd%s one-sided%E " + "%f%LS%Fd%s two-sided%E " + "%f%Lw%Fd%s skewed%E", + &TextWindow::ScreenChangeGroupOption, + one ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + two ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + skew ? CHECK_TRUE : CHECK_FALSE); + } else { + Printf(false, + "%Ba %f%Ls%Fd%s one-sided%E " + "%f%LS%Fd%s two-sided%E", + &TextWindow::ScreenChangeGroupOption, + one ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + two ? RADIO_TRUE : RADIO_FALSE); + } + + if(g->type == Group::Type::ROTATE || g->type == Group::Type::TRANSLATE) { + if(g->subtype == Group::Subtype::ONE_SIDED) { + bool skip = g->skipFirst; + Printf(false, + "%Bd %Ftstart %f%LK%Fd%s with original%E " + "%f%Lk%Fd%s with copy #1%E", + &ScreenChangeGroupOption, + !skip ? RADIO_TRUE : RADIO_FALSE, + &ScreenChangeGroupOption, + skip ? RADIO_TRUE : RADIO_FALSE); + } + + int times = (int)(g->valA); + Printf(false, "%Bp %Ftrepeat%E %d time%s %Fl%Ll%D%f[change]%E", + (g->subtype == Group::Subtype::ONE_SIDED) ? 'a' : 'd', + times, times == 1 ? "" : "s", + g->h.v, &TextWindow::ScreenChangeExprA); + } + } else if(g->type == Group::Type::LINKED) { + Printf(true, " %Ftlink geometry from file%E"); + Platform::Path relativePath = g->linkFile.RelativeTo(SS.saveFile.Parent()); + if(relativePath.IsEmpty()) { + Printf(false, "%Ba '%s'", g->linkFile.raw.c_str()); + } else { + Printf(false, "%Ba '%s'", relativePath.raw.c_str()); + } + Printf(false, "%Bd %Ftscaled by%E %# %Fl%Ll%f%D[change]%E", + g->scale, + &TextWindow::ScreenChangeGroupScale, g->h.v); + } else if(g->type == Group::Type::DRAWING_3D) { + Printf(true, " %Ftsketch in 3d%E"); + } else if(g->type == Group::Type::DRAWING_WORKPLANE) { + Printf(true, " %Ftsketch in new workplane%E"); + } else { + Printf(true, "???"); + } + Printf(false, ""); + + if(g->type == Group::Type::HELIX) { + Printf(false, "%Ft pitch - length per turn%E"); + + if (fabs(g->valB) != 0.0) { + Printf(false, " %Ba %# %Fl%Ll%f%D[change]%E", + g->valB / SS.MmPerUnit(), + &TextWindow::ScreenChangeHelixPitch, g->h.v); + } else { + Printf(false, " %Ba %# %E", + SK.GetParam(g->h.param(7))->val * PI / + ( (SK.GetParam(g->h.param(3))->val) * SS.MmPerUnit() ), + &TextWindow::ScreenChangeHelixPitch, g->h.v); + } + Printf(false, " %Fd%f%LP%s fixed", + &TextWindow::ScreenChangePitchOption, + g->valB != 0 ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, ""); // blank line + } + + if(g->type == Group::Type::EXTRUDE || g->type == Group::Type::LATHE || + g->type == Group::Type::REVOLVE || g->type == Group::Type::LINKED || + g->type == Group::Type::HELIX) { + bool un = (g->meshCombine == Group::CombineAs::UNION); + bool diff = (g->meshCombine == Group::CombineAs::DIFFERENCE); + bool intr = (g->meshCombine == Group::CombineAs::INTERSECTION); + bool asy = (g->meshCombine == Group::CombineAs::ASSEMBLE); + + Printf(false, " %Ftsolid model as"); + Printf(false, "%Ba %f%D%Lc%Fd%s union%E " + "%f%D%Lc%Fd%s assemble%E ", + &TextWindow::ScreenChangeGroupOption, + Group::CombineAs::UNION, + un ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + Group::CombineAs::ASSEMBLE, + (asy ? RADIO_TRUE : RADIO_FALSE)); + Printf(false, "%Ba %f%D%Lc%Fd%s difference%E " + "%f%D%Lc%Fd%s intersection%E ", + &TextWindow::ScreenChangeGroupOption, + Group::CombineAs::DIFFERENCE, + diff ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + Group::CombineAs::INTERSECTION, + intr ? RADIO_TRUE : RADIO_FALSE); + + if(g->type == Group::Type::EXTRUDE || g->type == Group::Type::LATHE || + g->type == Group::Type::REVOLVE || g->type == Group::Type::HELIX) { + Printf(false, + "%Bd %Ftcolor %E%Bz %Bd (%@, %@, %@) %f%D%Lf%Fl[change]%E", + &g->color, + g->color.redF(), g->color.greenF(), g->color.blueF(), + ScreenColor, top[rows-1] + 2); + Printf(false, "%Bd %Ftopacity%E %@ %f%Lf%Fl[change]%E", + g->color.alphaF(), + &TextWindow::ScreenOpacity); + } + + if(g->type == Group::Type::EXTRUDE || g->type == Group::Type::LATHE || + g->type == Group::Type::REVOLVE || g->type == Group::Type::LINKED || + g->type == Group::Type::HELIX) { + Printf(false, " %Fd%f%LP%s suppress this group's solid model", + &TextWindow::ScreenChangeGroupOption, + g->suppress ? CHECK_TRUE : CHECK_FALSE); + } + + Printf(false, ""); + } + + Printf(false, " %f%Lv%Fd%s show entities from this group", + &TextWindow::ScreenChangeGroupOption, + g->visible ? CHECK_TRUE : CHECK_FALSE); + + if(!g->IsForcedToMeshBySource() && !g->IsTriangleMeshAssembly()) { + Printf(false, " %f%Lf%Fd%s force NURBS surfaces to triangle mesh", + &TextWindow::ScreenChangeGroupOption, + g->forceToMesh ? CHECK_TRUE : CHECK_FALSE); + } else { + Printf(false, " (model already forced to triangle mesh)"); + } + + Printf(true, " %f%Lr%Fd%s relax constraints and dimensions", + &TextWindow::ScreenChangeGroupOption, + g->relaxConstraints ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, " %f%Le%Fd%s allow redundant constraints", + &TextWindow::ScreenChangeGroupOption, + g->allowRedundant ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, " %f%LD%Fd%s suppress dof calculation (improves solver performance)", + &TextWindow::ScreenChangeGroupOption, + g->suppressDofCalculation ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, " %f%Ld%Fd%s treat all dimensions as reference", + &TextWindow::ScreenChangeGroupOption, + g->allDimsReference ? CHECK_TRUE : CHECK_FALSE); + + if(g->booleanFailed) { + Printf(false, ""); + Printf(false, "The Boolean operation failed. It may be "); + Printf(false, "possible to fix the problem by choosing "); + Printf(false, "'force NURBS surfaces to triangle mesh'."); + } + +list_items: + Printf(false, ""); + Printf(false, "%Ft requests in group"); + + int a = 0; + for(auto &r : SK.request) { + + if(r.group == shown.group) { + std::string s = r.DescriptionString(); + Printf(false, "%Bp %Fl%Ll%D%f%h%s%E", + (a & 1) ? 'd' : 'a', + r.h.v, + (&TextWindow::ScreenSelectRequest), + &(TextWindow::ScreenHoverRequest), + s.c_str()); + a++; + } + } + if(a == 0) Printf(false, "%Ba (none)"); + + a = 0; + Printf(false, ""); + Printf(false, "%Ft constraints in group (%d DOF)", g->solved.dof); + for(auto &c : SK.constraint) { + + if(c.group == shown.group) { + std::string s = c.DescriptionString(); + Printf(false, "%Bp %Fl%Ll%D%f%h%s%E %s", + (a & 1) ? 'd' : 'a', + c.h.v, + (&TextWindow::ScreenSelectConstraint), + (&TextWindow::ScreenHoverConstraint), + s.c_str(), + c.reference ? "(ref)" : ""); + a++; + } + } + if(a == 0) Printf(false, "%Ba (none)"); +} + +//----------------------------------------------------------------------------- +// The screen that's displayed when the sketch fails to solve. A report of +// what failed, and (if the problem is a singular Jacobian) a list of +// constraints that could be removed to fix it. +//----------------------------------------------------------------------------- +void TextWindow::ScreenAllowRedundant(int link, uint32_t v) { + SS.UndoRemember(); + + Group *g = SK.GetGroup(SS.TW.shown.group); + g->allowRedundant = true; + SS.MarkGroupDirty(SS.TW.shown.group); + + SS.TW.shown.screen = Screen::GROUP_INFO; + SS.TW.Show(); +} +void TextWindow::ShowGroupSolveInfo() { + Group *g = SK.GetGroup(shown.group); + if(g->IsSolvedOkay()) { + // Go back to the default group info screen + shown.screen = Screen::GROUP_INFO; + Show(); + return; + } + + Printf(true, "%FtGROUP %E%s", g->DescriptionString().c_str()); + switch(g->solved.how) { + case SolveResult::DIDNT_CONVERGE: + Printf(true, "%FxSOLVE FAILED!%Fd unsolvable constraints"); + Printf(true, "the following constraints are incompatible"); + break; + + case SolveResult::REDUNDANT_DIDNT_CONVERGE: + Printf(true, "%FxSOLVE FAILED!%Fd unsolvable constraints"); + Printf(true, "the following constraints are unsatisfied"); + break; + + case SolveResult::REDUNDANT_OKAY: + Printf(true, "%FxSOLVE FAILED!%Fd redundant constraints"); + Printf(true, "remove any one of these to fix it"); + break; + + case SolveResult::TOO_MANY_UNKNOWNS: + Printf(true, "Too many unknowns in a single group!"); + return; + + default: ssassert(false, "Unexpected solve result"); + } + + for(int i = 0; i < g->solved.remove.n; i++) { + hConstraint hc = g->solved.remove[i]; + Constraint *c = SK.constraint.FindByIdNoOops(hc); + if(!c) continue; + + Printf(false, "%Bp %Fl%Ll%D%f%h%s%E", + (i & 1) ? 'd' : 'a', + c->h.v, (&TextWindow::ScreenSelectConstraint), + (&TextWindow::ScreenHoverConstraint), + c->DescriptionString().c_str()); + } + + if(g->solved.timeout) { + Printf(true, "%FxSome items in list have been omitted%Fd"); + Printf(false, "%Fxbecause the operation timed out.%Fd"); + } + + Printf(true, "It may be possible to fix the problem "); + Printf(false, "by selecting Edit -> Undo."); + + if(g->solved.how == SolveResult::REDUNDANT_OKAY) { + Printf(true, "It is possible to suppress this error "); + Printf(false, "by %Fl%f%Llallowing redundant constraints%E in ", + &TextWindow::ScreenAllowRedundant); + Printf(false, "this group."); + } +} + +//----------------------------------------------------------------------------- +// When we're stepping a dimension. User specifies the finish value, and +// how many steps to take in between current and finish, re-solving each +// time. +//----------------------------------------------------------------------------- +void TextWindow::ScreenStepDimFinish(int link, uint32_t v) { + SS.TW.edit.meaning = Edit::STEP_DIM_FINISH; + std::string edit_value; + if(SS.TW.stepDim.isDistance) { + edit_value = SS.MmToString(SS.TW.stepDim.finish, true); + } else { + edit_value = ssprintf("%.3f", SS.TW.stepDim.finish); + } + SS.TW.ShowEditControl(12, edit_value); +} +void TextWindow::ScreenStepDimSteps(int link, uint32_t v) { + SS.TW.edit.meaning = Edit::STEP_DIM_STEPS; + SS.TW.ShowEditControl(12, ssprintf("%d", SS.TW.stepDim.steps)); +} +void TextWindow::ScreenStepDimGo(int link, uint32_t v) { + hConstraint hc = SS.TW.shown.constraint; + Constraint *c = SK.constraint.FindByIdNoOops(hc); + if(c) { + SS.UndoRemember(); + + double start = c->valA, finish = SS.TW.stepDim.finish; + SS.TW.stepDim.time = GetMilliseconds(); + SS.TW.stepDim.step = 1; + + if(!SS.TW.stepDim.timer) { + SS.TW.stepDim.timer = Platform::CreateTimer(); + } + SS.TW.stepDim.timer->onTimeout = [=] { + if(SS.TW.stepDim.step <= SS.TW.stepDim.steps) { + c->valA = start + ((finish - start)*SS.TW.stepDim.step)/SS.TW.stepDim.steps; + SS.MarkGroupDirty(c->group); + SS.GenerateAll(); + if(!SS.ActiveGroupsOkay()) { + // Failed to solve, so quit + return; + } + SS.TW.stepDim.step++; + + const int64_t STEP_MILLIS = 50; + int64_t time = GetMilliseconds(); + if(time - SS.TW.stepDim.time < STEP_MILLIS) { + SS.TW.stepDim.timer->RunAfterNextFrame(); + } else { + SS.TW.stepDim.timer->RunAfter((unsigned)(time - SS.TW.stepDim.time - STEP_MILLIS)); + } + SS.TW.stepDim.time = time; + } else { + SS.TW.GoToScreen(Screen::LIST_OF_GROUPS); + SS.ScheduleShowTW(); + } + SS.GW.Invalidate(); + }; + SS.TW.stepDim.timer->RunAfterNextFrame(); + } +} +void TextWindow::ShowStepDimension() { + Constraint *c = SK.constraint.FindByIdNoOops(shown.constraint); + if(!c) { + shown.screen = Screen::LIST_OF_GROUPS; + Show(); + return; + } + + Printf(true, "%FtSTEP DIMENSION%E %s", c->DescriptionString().c_str()); + + if(stepDim.isDistance) { + Printf(true, "%Ba %Ftstart%E %s", SS.MmToString(c->valA).c_str()); + Printf(false, "%Bd %Ftfinish%E %s %Fl%Ll%f[change]%E", + SS.MmToString(stepDim.finish).c_str(), &ScreenStepDimFinish); + } else { + Printf(true, "%Ba %Ftstart%E %@", c->valA); + Printf(false, "%Bd %Ftfinish%E %@ %Fl%Ll%f[change]%E", + stepDim.finish, &ScreenStepDimFinish); + } + Printf(false, "%Ba %Ftsteps%E %d %Fl%Ll%f%D[change]%E", + stepDim.steps, &ScreenStepDimSteps); + + Printf(true, " %Fl%Ll%fstep dimension now%E", &ScreenStepDimGo); + + Printf(true, "(or %Fl%Ll%fcancel operation%E)", &ScreenHome); +} + +//----------------------------------------------------------------------------- +// When we're creating tangent arcs (as requests, not as some parametric +// thing). User gets to specify the radius, and whether the old untrimmed +// curves are kept or deleted. +//----------------------------------------------------------------------------- +void TextWindow::ScreenChangeTangentArc(int link, uint32_t v) { + switch(link) { + case 'r': { + SS.TW.edit.meaning = Edit::TANGENT_ARC_RADIUS; + SS.TW.ShowEditControl(3, SS.MmToString(SS.tangentArcRadius, true)); + break; + } + + case 'a': SS.tangentArcManual = !SS.tangentArcManual; break; + case 'm': SS.tangentArcModify = !SS.tangentArcModify; break; + } +} +void TextWindow::ShowTangentArc() { + Printf(true, "%FtTANGENT ARC PARAMETERS%E"); + + Printf(true, "%Ft radius of created arc%E"); + if(SS.tangentArcManual) { + Printf(false, "%Ba %s %Fl%Lr%f[change]%E", + SS.MmToString(SS.tangentArcRadius).c_str(), + &(TextWindow::ScreenChangeTangentArc)); + } else { + Printf(false, "%Ba automatic"); + } + + Printf(false, ""); + Printf(false, " %Fd%f%La%s choose radius automatically%E", + &ScreenChangeTangentArc, + !SS.tangentArcManual ? CHECK_TRUE : CHECK_FALSE); + Printf(false, " %Fd%f%Lm%s modify original entities%E", + &ScreenChangeTangentArc, + SS.tangentArcModify ? CHECK_TRUE : CHECK_FALSE); + + Printf(false, ""); + Printf(false, "To create a tangent arc at a point,"); + Printf(false, "select that point and then choose"); + Printf(false, "Sketch -> Tangent Arc at Point."); + Printf(true, "(or %Fl%Ll%fback to home screen%E)", &ScreenHome); +} + +//----------------------------------------------------------------------------- +// The edit control is visible, and the user just pressed enter. +//----------------------------------------------------------------------------- +void TextWindow::EditControlDone(std::string s) { + edit.showAgain = false; + + switch(edit.meaning) { + case Edit::TIMES_REPEATED: + if(Expr *e = Expr::From(s, /*popUpError=*/true)) { + SS.UndoRemember(); + + double ev = e->Eval(); + if((int)ev < 1) { + Error(_("Can't repeat fewer than 1 time.")); + break; + } + if((int)ev > 999) { + Error(_("Can't repeat more than 999 times.")); + break; + } + + Group *g = SK.GetGroup(edit.group); + g->valA = ev; + + if(g->type == Group::Type::ROTATE) { + // If the group does not contain any constraints, then + // set the numerical guess to space the copies uniformly + // over one rotation. Don't touch the guess if we're + // already constrained, because that would break + // convergence. + if(g->GetNumConstraints() == 0) { + double copies = (g->skipFirst) ? (ev + 1) : ev; + SK.GetParam(g->h.param(3))->val = PI/(2*copies); + } + } + + SS.MarkGroupDirty(g->h); + } + break; + + case Edit::GROUP_NAME: + if(s.empty()) { + Error(_("Group name cannot be empty")); + } else { + SS.UndoRemember(); + + Group *g = SK.GetGroup(edit.group); + g->name = s; + } + break; + + case Edit::GROUP_SCALE: + if(Expr *e = Expr::From(s, /*popUpError=*/true)) { + double ev = e->Eval(); + if(fabs(ev) < 1e-6) { + Error(_("Scale cannot be zero.")); + } else { + Group *g = SK.GetGroup(edit.group); + g->scale = ev; + SS.MarkGroupDirty(g->h); + } + } + break; + + case Edit::HELIX_PITCH: // stored in valB + if(Expr *e = Expr::From(s, /*popUpError=*/true)) { + double ev = e->Eval(); + Group *g = SK.GetGroup(edit.group); + g->valB = ev * SS.MmPerUnit(); + SS.MarkGroupDirty(g->h); + } + break; + + case Edit::GROUP_COLOR: { + Vector rgb; + if(sscanf(s.c_str(), "%lf, %lf, %lf", &rgb.x, &rgb.y, &rgb.z)==3) { + rgb = rgb.ClampWithin(0, 1); + + Group *g = SK.group.FindByIdNoOops(SS.TW.shown.group); + if(!g) break; + g->color = RgbaColor::FromFloat((float)rgb.x, (float)rgb.y, (float)rgb.z, + g->color.alphaF()); + + SS.MarkGroupDirty(g->h); + SS.GW.ClearSuper(); + } else { + Error(_("Bad format: specify color as r, g, b")); + } + break; + } + case Edit::GROUP_OPACITY: + if(Expr *e = Expr::From(s, /*popUpError=*/true)) { + double alpha = e->Eval(); + if(alpha < 0 || alpha > 1) { + Error(_("Opacity must be between zero and one.")); + } else { + Group *g = SK.GetGroup(edit.group); + g->color.alpha = (int)(255.1f * alpha); + SS.MarkGroupDirty(g->h); + SS.GW.ClearSuper(); + } + } + break; + + case Edit::TTF_TEXT: + SS.UndoRemember(); + if(Request *r = SK.request.FindByIdNoOops(edit.request)) { + r->str = s; + SS.MarkGroupDirty(r->group); + } + break; + + case Edit::STEP_DIM_FINISH: + if(Expr *e = Expr::From(s, /*popUpError=*/true)) { + if(stepDim.isDistance) { + stepDim.finish = SS.ExprToMm(e); + } else { + stepDim.finish = e->Eval(); + } + } + break; + + case Edit::STEP_DIM_STEPS: + stepDim.steps = min(300, max(1, atoi(s.c_str()))); + break; + + case Edit::TANGENT_ARC_RADIUS: + if(Expr *e = Expr::From(s, /*popUpError=*/true)) { + if(e->Eval() < LENGTH_EPS) { + Error(_("Radius cannot be zero or negative.")); + break; + } + SS.tangentArcRadius = SS.ExprToMm(e); + } + break; + + default: { + int cnt = 0; + if(EditControlDoneForStyles(s)) cnt++; + if(EditControlDoneForConfiguration(s)) cnt++; + if(EditControlDoneForPaste(s)) cnt++; + if(EditControlDoneForView(s)) cnt++; + ssassert(cnt == 1, "Expected exactly one parameter to be edited"); + break; + } + } + SS.GW.Invalidate(); + SS.ScheduleShowTW(); + + if(!edit.showAgain) { + HideEditControl(); + edit.meaning = Edit::NOTHING; + } +} + +} // namespace SolveSpace diff --git a/src/textwin.cpp b/src/textwin.cpp new file mode 100644 index 0000000..537c2d1 --- /dev/null +++ b/src/textwin.cpp @@ -0,0 +1,1173 @@ +//----------------------------------------------------------------------------- +// Helper functions for the text-based browser window. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include +#include +#include "solvespace.h" + +namespace SolveSpace { + +class Button { +public: + virtual std::string Tooltip() = 0; + virtual void Draw(UiCanvas *uiCanvas, int x, int y, bool asHovered) = 0; + virtual int AdvanceWidth() = 0; + virtual void Click() = 0; +}; + +class SpacerButton : public Button { +public: + std::string Tooltip() override { return ""; } + + void Draw(UiCanvas *uiCanvas, int x, int y, bool asHovered) override { + // Draw a darker-grey spacer in between the groups of icons. + uiCanvas->DrawRect(x, x + 4, y, y - 24, + /*fillColor=*/{ 45, 45, 45, 255 }, + /*outlineColor=*/{}); + } + + int AdvanceWidth() override { return 12; } + + void Click() override {} +}; + +class ShowHideButton : public Button { +public: + bool *variable; + std::string tooltip; + std::string iconName; + std::shared_ptr icon; + + ShowHideButton(bool *variable, std::string iconName, std::string tooltip) + : variable(variable), tooltip(tooltip), iconName(iconName) {} + + std::string Tooltip() override { + return ((*variable) ? "Hide " : "Show ") + tooltip; + } + + void Draw(UiCanvas *uiCanvas, int x, int y, bool asHovered) override { + if(icon == NULL) { + icon = LoadPng("icons/text-window/" + iconName + ".png"); + } + + uiCanvas->DrawPixmap(icon, x, y - 24); + if(asHovered) { + uiCanvas->DrawRect(x - 2, x + 26, y + 2, y - 26, + /*fillColor=*/{ 255, 255, 0, 75 }, + /*outlineColor=*/{}); + } + if(!*(variable)) { + int s = 0, f = 23; + RgbaColor color = { 255, 0, 0, 150 }; + uiCanvas->DrawLine(x+s, y-s, x+f, y-f, color, 2); + uiCanvas->DrawLine(x+s, y-f, x+f, y-s, color, 2); + } + } + + int AdvanceWidth() override { return 32; } + + void Click() override { SS.GW.ToggleBool(variable); } +}; + +class FacesButton : public ShowHideButton { +public: + FacesButton() + : ShowHideButton(&(SS.GW.showFaces), "faces", "") {} + + std::string Tooltip() override { + if(*variable) { + return "Don't make faces selectable with mouse"; + } else { + return "Make faces selectable with mouse"; + } + } +}; + +#include +class TriStateButton : public Button { +public: + static const size_t tri = 3; + + TriStateButton(unsigned *variable, const std::array &states, + const std::array &tooltips, + const std::array &iconNames) + : variable(variable), states(states), tooltips(tooltips), iconNames(iconNames) { + } + + unsigned *const variable; + const std::array states; + const std::array tooltips; + const std::array iconNames; + std::shared_ptr icons[tri]; + + std::string Tooltip() override { + for(size_t k = 0; k < tri; ++k) + if(*variable == states[k]) + return tooltips[k]; + ssassert(false, "Unexpected mode"); + } + + void Draw(UiCanvas *uiCanvas, int x, int y, bool asHovered) override { + for(size_t k = 0; k < tri; ++k) + if(icons[k] == nullptr) + icons[k] = LoadPng("icons/text-window/" + iconNames[k] + ".png"); + + std::shared_ptr icon; + for(size_t k = 0; k < tri; ++k) + if(*variable == states[k]) { + icon = icons[k]; + break; + } + + uiCanvas->DrawPixmap(icon, x, y - 24); + if(asHovered) { + uiCanvas->DrawRect(x - 2, x + 26, y + 2, y - 26, + /*fillColor=*/{255, 255, 0, 75}, + /*outlineColor=*/{}); + } + } + + + int AdvanceWidth() override { return 32; } + + void Click() override { + for(size_t k = 0; k < tri; ++k) + if(*variable == states[k]) { + *variable = states[(k + 1) % tri]; + break; + } + + SS.GenerateAll(); + SS.GW.Invalidate(); + SS.ScheduleShowTW(); + } +}; + +static SpacerButton spacerButton; + +static ShowHideButton workplanesButton = + { &(SS.GW.showWorkplanes), "workplane", "workplanes from inactive groups" }; +static ShowHideButton normalsButton = + { &(SS.GW.showNormals), "normal", "normals" }; +static ShowHideButton pointsButton = + { &(SS.GW.showPoints), "point", "points" }; +static ShowHideButton constructionButton = + { &(SS.GW.showConstruction), "construction", "construction entities" }; +static TriStateButton constraintsButton = { + (unsigned *)(&(SS.GW.showConstraints)), + {(unsigned)GraphicsWindow::ShowConstraintMode::SCM_SHOW_ALL, + (unsigned)GraphicsWindow::ShowConstraintMode::SCM_SHOW_DIM, + (unsigned)GraphicsWindow::ShowConstraintMode::SCM_NOSHOW}, + {"Show only dimensions", "Hide constraints and dimensions", "Show constraints and dimensions"}, + {"constraint", "constraint-dimo", "constraint-wo"}}; +static FacesButton facesButton; +static ShowHideButton shadedButton = + { &(SS.GW.showShaded), "shaded", "shaded view of solid model" }; +static ShowHideButton edgesButton = + { &(SS.GW.showEdges), "edges", "edges of solid model" }; +static ShowHideButton outlinesButton = + { &(SS.GW.showOutlines), "outlines", "outline of solid model" }; +static ShowHideButton meshButton = + { &(SS.GW.showMesh), "mesh", "triangle mesh of solid model" }; +static TriStateButton occludedLinesButton = { + (unsigned *)(&(SS.GW.drawOccludedAs)), + {(unsigned)GraphicsWindow::DrawOccludedAs::INVISIBLE, + (unsigned)GraphicsWindow::DrawOccludedAs::STIPPLED, + (unsigned)GraphicsWindow::DrawOccludedAs::VISIBLE}, + {"Stipple occluded lines", "Draw occluded lines", "Don't draw occluded lines"}, + {"occluded-invisible", "occluded-stippled", "occluded-visible"}}; + +static Button *buttons[] = { + &workplanesButton, + &normalsButton, + &pointsButton, + &constructionButton, + &constraintsButton, + &facesButton, + &spacerButton, + &shadedButton, + &edgesButton, + &outlinesButton, + &meshButton, + &spacerButton, + &occludedLinesButton, +}; + +/** Foreground color codes. */ +const TextWindow::Color TextWindow::fgColors[] = { + { 'd', RGBi(255, 255, 255) }, // Default : white + { 'l', RGBi(100, 200, 255) }, // links : blue + { 't', RGBi(255, 200, 100) }, // tree/text : yellow + { 'h', RGBi( 90, 90, 90) }, + { 's', RGBi( 40, 255, 40) }, // Ok : green + { 'm', RGBi(200, 200, 0) }, + { 'r', RGBi( 0, 0, 0) }, // Reverse : black + { 'x', RGBi(255, 20, 20) }, // Error : red + { 'i', RGBi( 0, 255, 255) }, // Info : cyan + { 'g', RGBi(128, 128, 128) }, // Disabled : gray + { 'b', RGBi(200, 200, 200) }, + { 0, RGBi( 0, 0, 0) } +}; +/** Background color codes. */ +const TextWindow::Color TextWindow::bgColors[] = { + { 'd', RGBi( 0, 0, 0) }, // Default : black + { 't', RGBi( 34, 15, 15) }, + { 'a', RGBi( 25, 25, 25) }, // Alternate : dark gray + { 'r', RGBi(255, 255, 255) }, // Reverse : white + { 0, RGBi( 0, 0, 0) } +}; + +void TextWindow::MakeColorTable(const Color *in, float *out) { + int i; + for(i = 0; in[i].c != 0; i++) { + int c = in[i].c; + ssassert(c >= 0 && c <= 255, "Unexpected color index"); + out[c*3 + 0] = in[i].color.redF(); + out[c*3 + 1] = in[i].color.greenF(); + out[c*3 + 2] = in[i].color.blueF(); + } +} + +void TextWindow::Init() { + if(!window) { + window = Platform::CreateWindow(Platform::Window::Kind::TOOL, SS.GW.window); + if(window) { + canvas = CreateRenderer(); + + using namespace std::placeholders; + window->onClose = []() { + SS.TW.HideEditControl(); + SS.GW.showTextWindow = false; + SS.GW.EnsureValidActives(); + }; + window->onMouseEvent = [this](Platform::MouseEvent event) { + using Platform::MouseEvent; + + if(event.type == MouseEvent::Type::PRESS || + event.type == MouseEvent::Type::DBL_PRESS || + event.type == MouseEvent::Type::MOTION) { + bool isClick = (event.type != MouseEvent::Type::MOTION); + bool leftDown = (event.button == MouseEvent::Button::LEFT); + this->MouseEvent(isClick, leftDown, event.x, event.y); + return true; + } else if(event.type == MouseEvent::Type::LEAVE) { + MouseLeave(); + return true; + } else if(event.type == MouseEvent::Type::SCROLL_VERT) { + if (event.scrollDelta == 0) { + return true; + } + if (abs(event.scrollDelta) < 0.2) { + if (event.scrollDelta > 0) { + event.scrollDelta = 0.2; + } else { + event.scrollDelta = -0.2; + } + } + double offset = LINE_HEIGHT / 2 * event.scrollDelta; + ScrollbarEvent(window->GetScrollbarPosition() - offset); + } + return false; + }; + window->onKeyboardEvent = SS.GW.window->onKeyboardEvent; + window->onRender = std::bind(&TextWindow::Paint, this); + window->onEditingDone = std::bind(&TextWindow::EditControlDone, this, _1); + window->onScrollbarAdjusted = std::bind(&TextWindow::ScrollbarEvent, this, _1); + window->SetMinContentSize(370, 370); + } + } + + ClearSuper(); +} + +void TextWindow::ClearSuper() { + // Ugly hack, but not so ugly as the next line + Platform::WindowRef oldWindow = std::move(window); + std::shared_ptr oldCanvas = std::move(canvas); + + // Cannot use *this = {} here because TextWindow instances + // are 2.4MB long; this causes stack overflows in prologue + // when built with MSVC, even with optimizations. + this->~TextWindow(); + new(this) TextWindow(); + + // Return old canvas + window = std::move(oldWindow); + canvas = std::move(oldCanvas); + + HideEditControl(); + + MakeColorTable(fgColors, fgColorTable); + MakeColorTable(bgColors, bgColorTable); + + ClearScreen(); + Show(); +} + +void TextWindow::HideEditControl() { + editControl.colorPicker.show = false; + if(window) { + window->HideEditor(); + window->Invalidate(); + } +} + +void TextWindow::ShowEditControl(int col, const std::string &str, int halfRow) { + if(halfRow < 0) halfRow = top[hoveredRow]; + editControl.halfRow = halfRow; + editControl.col = col; + + int x = LEFT_MARGIN + CHAR_WIDTH_*col; + int y = (halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2); + + double width, height; + window->GetContentSize(&width, &height); + window->ShowEditor(x, y + LINE_HEIGHT - 2, LINE_HEIGHT - 4, + width - x, /*isMonospace=*/true, str); +} + +void TextWindow::ShowEditControlWithColorPicker(int col, RgbaColor rgb) { + SS.ScheduleShowTW(); + + editControl.colorPicker.show = true; + editControl.colorPicker.rgb = rgb; + editControl.colorPicker.h = 0; + editControl.colorPicker.s = 0; + editControl.colorPicker.v = 1; + ShowEditControl(col, ssprintf("%.2f, %.2f, %.2f", rgb.redF(), rgb.greenF(), rgb.blueF())); +} + +void TextWindow::ClearScreen() { + int i, j; + for(i = 0; i < MAX_ROWS; i++) { + for(j = 0; j < MAX_COLS; j++) { + text[i][j] = ' '; + meta[i][j].fg = 'd'; + meta[i][j].bg = 'd'; + meta[i][j].link = NOT_A_LINK; + } + top[i] = i*2; + } + rows = 0; +} + +// This message was added when someone had too many fonts for the text window +// Scrolling seemed to be broken, but was actually at the MAX_ROWS. +static const char* endString = " **** End of Text Screen ****"; + +void TextWindow::Printf(bool halfLine, const char *fmt, ...) { + if(!canvas) return; + + if(rows >= MAX_ROWS) return; + + if(rows >= MAX_ROWS-2 && (fmt != endString)) { + // twice due to some half-row issues on resizing + Printf(halfLine, endString); + Printf(halfLine, endString); + return; + } + + va_list vl; + va_start(vl, fmt); + + int r, c; + r = rows; + top[r] = (r == 0) ? 0 : (top[r-1] + (halfLine ? 3 : 2)); + rows++; + + for(c = 0; c < MAX_COLS; c++) { + text[r][c] = ' '; + meta[r][c].link = NOT_A_LINK; + } + + char fg = 'd'; + char bg = 'd'; + RgbaColor bgRgb = RGBi(0, 0, 0); + int link = NOT_A_LINK; + uint32_t data = 0; + LinkFunction *f = NULL, *h = NULL; + + c = 0; + while(*fmt) { + char buf[1024]; + + if(*fmt == '%') { + fmt++; + if(*fmt == '\0') goto done; + strcpy(buf, ""); + switch(*fmt) { + case 'd': { + int v = va_arg(vl, int); + sprintf(buf, "%d", v); + break; + } + case 'x': { + unsigned int v = va_arg(vl, unsigned int); + sprintf(buf, "%08x", v); + break; + } + case '@': { + double v = va_arg(vl, double); + sprintf(buf, "%.2f", v); + break; + } + case '2': { + double v = va_arg(vl, double); + sprintf(buf, "%s%.2f", v < 0 ? "" : " ", v); + break; + } + case '3': { + double v = va_arg(vl, double); + sprintf(buf, "%s%.3f", v < 0 ? "" : " ", v); + break; + } + case '#': { + double v = va_arg(vl, double); + sprintf(buf, "%.3f", v); + break; + } + case 's': { + char *s = va_arg(vl, char *); + memcpy(buf, s, min(sizeof(buf), strlen(s)+1)); + break; + } + case 'c': { + // 'char' is promoted to 'int' when passed through '...' + int v = va_arg(vl, int); + if(v == 0) { + strcpy(buf, ""); + } else { + sprintf(buf, "%c", v); + } + break; + } + case 'E': + fg = 'd'; + // leave the background, though + link = NOT_A_LINK; + data = 0; + f = NULL; + h = NULL; + break; + + case 'F': + case 'B': { + char cc = fmt[1]; // color code + RgbaColor *rgbPtr = NULL; + switch(cc) { + case 0: goto done; // truncated directive + case 'p': cc = (char)va_arg(vl, int); break; + case 'z': rgbPtr = va_arg(vl, RgbaColor *); break; + } + if(*fmt == 'F') { + fg = cc; + } else { + bg = cc; + if(rgbPtr) bgRgb = *rgbPtr; + } + fmt++; + break; + } + case 'L': + if(fmt[1] == '\0') goto done; + fmt++; + if(*fmt == 'p') { + link = va_arg(vl, int); + } else { + link = *fmt; + } + break; + + case 'f': + f = va_arg(vl, LinkFunction *); + break; + + case 'h': + h = va_arg(vl, LinkFunction *); + break; + + case 'D': { + unsigned int v = va_arg(vl, unsigned int); + data = (uint32_t)v; + break; + } + case '%': + strcpy(buf, "%"); + break; + } + } else { + utf8_iterator it2(fmt), it1 = it2++; + strncpy(buf, fmt, it2 - it1); + buf[it2 - it1] = '\0'; + } + + for(utf8_iterator it(buf); *it; ++it) { + for(size_t i = 0; i < canvas->GetBitmapFont()->GetWidth(*it); i++) { + if(c >= MAX_COLS) goto done; + text[r][c] = (i == 0) ? *it : ' '; + meta[r][c].fg = fg; + meta[r][c].bg = bg; + meta[r][c].bgRgb = bgRgb; + meta[r][c].link = link; + meta[r][c].data = data; + meta[r][c].f = f; + meta[r][c].h = h; + c++; + } + } + + utf8_iterator it(fmt); + it++; + fmt = it.ptr(); + } + while(c < MAX_COLS) { + meta[r][c].fg = fg; + meta[r][c].bg = bg; + meta[r][c].bgRgb = bgRgb; + c++; + } + +done: + va_end(vl); +} + +void TextWindow::Show() { + if(SS.GW.pending.operation == GraphicsWindow::Pending::NONE) { + SS.GW.ClearPending(/*scheduleShowTW=*/false); + } + + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + + // Make sure these tests agree with test used to draw indicator line on + // main list of groups screen. + if(SS.GW.pending.description) { + // A pending operation (that must be completed with the mouse in + // the graphics window) will preempt our usual display. + HideEditControl(); + ShowHeader(false); + Printf(false, ""); + Printf(false, "%s", SS.GW.pending.description); + Printf(true, "%Fl%f%Ll(cancel operation)%E", + &TextWindow::ScreenUnselectAll); + } else if((gs.n > 0 || gs.constraints > 0) && + shown.screen != Screen::PASTE_TRANSFORMED) + { + if(edit.meaning != Edit::TTF_TEXT) HideEditControl(); + ShowHeader(false); + DescribeSelection(); + } else { + if(edit.meaning == Edit::TTF_TEXT) HideEditControl(); + ShowHeader(true); + switch(shown.screen) { + default: + shown.screen = Screen::LIST_OF_GROUPS; + // fall through + case Screen::LIST_OF_GROUPS: ShowListOfGroups(); break; + case Screen::GROUP_INFO: ShowGroupInfo(); break; + case Screen::GROUP_SOLVE_INFO: ShowGroupSolveInfo(); break; + case Screen::CONFIGURATION: ShowConfiguration(); break; + case Screen::STEP_DIMENSION: ShowStepDimension(); break; + case Screen::LIST_OF_STYLES: ShowListOfStyles(); break; + case Screen::STYLE_INFO: ShowStyleInfo(); break; + case Screen::PASTE_TRANSFORMED: ShowPasteTransformed(); break; + case Screen::EDIT_VIEW: ShowEditView(); break; + case Screen::TANGENT_ARC: ShowTangentArc(); break; + } + } + Printf(false, ""); + + // Make sure there's room for the color picker + if(editControl.colorPicker.show) { + int pickerHeight = 25; + int halfRow = editControl.halfRow; + if(top[rows-1] - halfRow < pickerHeight && rows < MAX_ROWS) { + rows++; + top[rows-1] = halfRow + pickerHeight; + } + } + + if(window) Resize(); +} + +void TextWindow::Resize() +{ + double width, height; + window->GetContentSize(&width, &height); + + halfRows = (int)height / (LINE_HEIGHT/2); + + int bottom = top[rows-1] + 2; + scrollPos = min(scrollPos, bottom - halfRows); + scrollPos = max(scrollPos, 0); + + window->ConfigureScrollbar(0, top[rows - 1] + 1, halfRows); + window->SetScrollbarPosition(scrollPos); + window->SetScrollbarVisible(top[rows - 1] + 1 > halfRows); + window->Invalidate(); +} + +void TextWindow::DrawOrHitTestIcons(UiCanvas *uiCanvas, TextWindow::DrawOrHitHow how, + double mx, double my) +{ + double width, height; + window->GetContentSize(&width, &height); + + int x = 20, y = 33 + LINE_HEIGHT; + y -= scrollPos*(LINE_HEIGHT/2); + + if(how == PAINT) { + int top = y - 28, bot = y + 4; + uiCanvas->DrawRect(0, (int)width, top, bot, + /*fillColor=*/{ 30, 30, 30, 255 }, /*outlineColor=*/{}); + } + + Button *oldHovered = hoveredButton; + if(how != PAINT) { + hoveredButton = NULL; + } + + double hoveredX = 0, hoveredY = 0; + for(Button *button : buttons) { + if(how == PAINT) { + button->Draw(uiCanvas, x, y, (button == hoveredButton)); + } else if(mx > x - 2 && mx < x + 26 && + my < y + 2 && my > y - 26) { + hoveredButton = button; + hoveredX = x - 2; + hoveredY = y - 26; + if(how == CLICK) { + button->Click(); + } + } + + x += button->AdvanceWidth(); + } + + if(how != PAINT && hoveredButton != oldHovered) { + if(hoveredButton == NULL) { + window->SetTooltip("", 0, 0, 0, 0); + } else { + window->SetTooltip(hoveredButton->Tooltip(), hoveredX, hoveredY, 28, 28); + } + window->Invalidate(); + } +} + +//---------------------------------------------------------------------------- +// Given (x, y, z) = (h, s, v) in [0,6), [0,1], [0,1], return (x, y, z) = +// (r, g, b) all in [0, 1]. +//---------------------------------------------------------------------------- +Vector TextWindow::HsvToRgb(Vector hsv) { + if(hsv.x >= 6) hsv.x -= 6; + + Vector rgb; + double hmod2 = hsv.x; + while(hmod2 >= 2) hmod2 -= 2; + double x = (1 - fabs(hmod2 - 1)); + if(hsv.x < 1) { + rgb = Vector::From(1, x, 0); + } else if(hsv.x < 2) { + rgb = Vector::From(x, 1, 0); + } else if(hsv.x < 3) { + rgb = Vector::From(0, 1, x); + } else if(hsv.x < 4) { + rgb = Vector::From(0, x, 1); + } else if(hsv.x < 5) { + rgb = Vector::From(x, 0, 1); + } else { + rgb = Vector::From(1, 0, x); + } + double c = hsv.y*hsv.z; + double m = 1 - hsv.z; + rgb = rgb.ScaledBy(c); + rgb = rgb.Plus(Vector::From(m, m, m)); + + return rgb; +} + +std::shared_ptr TextWindow::HsvPattern2d(int w, int h) { + std::shared_ptr pixmap = Pixmap::Create(Pixmap::Format::RGB, w, h); + for(size_t j = 0; j < pixmap->height; j++) { + size_t p = pixmap->stride * j; + for(size_t i = 0; i < pixmap->width; i++) { + Vector hsv = Vector::From(6.0*i/(pixmap->width-1), 1.0*j/(pixmap->height-1), 1); + Vector rgb = HsvToRgb(hsv); + rgb = rgb.ScaledBy(255); + pixmap->data[p++] = (uint8_t)rgb.x; + pixmap->data[p++] = (uint8_t)rgb.y; + pixmap->data[p++] = (uint8_t)rgb.z; + } + } + return pixmap; +} + +std::shared_ptr TextWindow::HsvPattern1d(double hue, double sat, int w, int h) { + std::shared_ptr pixmap = Pixmap::Create(Pixmap::Format::RGB, w, h); + for(size_t i = 0; i < pixmap->height; i++) { + size_t p = i * pixmap->stride; + for(size_t j = 0; j < pixmap->width; j++) { + Vector hsv = Vector::From(6*hue, sat, 1.0*(pixmap->width - 1 - j)/pixmap->width); + Vector rgb = HsvToRgb(hsv); + rgb = rgb.ScaledBy(255); + pixmap->data[p++] = (uint8_t)rgb.x; + pixmap->data[p++] = (uint8_t)rgb.y; + pixmap->data[p++] = (uint8_t)rgb.z; + } + } + return pixmap; +} + +void TextWindow::ColorPickerDone() { + RgbaColor rgb = editControl.colorPicker.rgb; + EditControlDone(ssprintf("%.2f, %.2f, %.3f", rgb.redF(), rgb.greenF(), rgb.blueF())); +} + +bool TextWindow::DrawOrHitTestColorPicker(UiCanvas *uiCanvas, DrawOrHitHow how, bool leftDown, + double x, double y) +{ + using Platform::Window; + + bool mousePointerAsHand = false; + + if(how == HOVER && !leftDown) { + editControl.colorPicker.picker1dActive = false; + editControl.colorPicker.picker2dActive = false; + } + + if(!editControl.colorPicker.show) return false; + if(how == CLICK || (how == HOVER && leftDown)) window->Invalidate(); + + static const RgbaColor BaseColor[12] = { + RGBi(255, 0, 0), + RGBi( 0, 255, 0), + RGBi( 0, 0, 255), + + RGBi( 0, 255, 255), + RGBi(255, 0, 255), + RGBi(255, 255, 0), + + RGBi(255, 127, 0), + RGBi(255, 0, 127), + RGBi( 0, 255, 127), + RGBi(127, 255, 0), + RGBi(127, 0, 255), + RGBi( 0, 127, 255), + }; + + double width, height; + window->GetContentSize(&width, &height); + + int px = LEFT_MARGIN + CHAR_WIDTH_*editControl.col; + int py = (editControl.halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2); + + py += LINE_HEIGHT + 5; + + static const int WIDTH = 16, HEIGHT = 12; + static const int PITCH = 18, SIZE = 15; + + px = min(px, (int)width - (WIDTH*PITCH + 40)); + + int pxm = px + WIDTH*PITCH + 11, + pym = py + HEIGHT*PITCH + 7; + + int bw = 6; + if(how == PAINT) { + uiCanvas->DrawRect(px, pxm+bw, py, pym+bw, + /*fillColor=*/{ 50, 50, 50, 255 }, + /*outlineColor=*/{}, + /*zIndex=*/1); + uiCanvas->DrawRect(px+(bw/2), pxm+(bw/2), py+(bw/2), pym+(bw/2), + /*fillColor=*/{ 0, 0, 0, 255 }, + /*outlineColor=*/{}, + /*zIndex=*/1); + } else { + if(x < px || x > pxm+(bw/2) || + y < py || y > pym+(bw/2)) + { + return false; + } + } + px += (bw/2); + py += (bw/2); + + int i, j; + for(i = 0; i < WIDTH/2; i++) { + for(j = 0; j < HEIGHT; j++) { + Vector rgb; + RgbaColor d; + if(i == 0 && j < 8) { + d = SS.modelColor[j]; + rgb = Vector::From(d.redF(), d.greenF(), d.blueF()); + } else if(i == 0) { + double a = (j - 8.0)/3.0; + rgb = Vector::From(a, a, a); + } else { + d = BaseColor[j]; + rgb = Vector::From(d.redF(), d.greenF(), d.blueF()); + if(i >= 2 && i <= 4) { + double a = (i == 2) ? 0.2 : (i == 3) ? 0.3 : 0.4; + rgb = rgb.Plus(Vector::From(a, a, a)); + } + if(i >= 5 && i <= 7) { + double a = (i == 5) ? 0.7 : (i == 6) ? 0.4 : 0.18; + rgb = rgb.ScaledBy(a); + } + } + + rgb = rgb.ClampWithin(0, 1); + int sx = px + 5 + PITCH*(i + 8) + 4, sy = py + 5 + PITCH*j; + + if(how == PAINT) { + uiCanvas->DrawRect(sx, sx+SIZE, sy, sy+SIZE, + /*fillColor=*/RGBf(rgb.x, rgb.y, rgb.z), + /*outlineColor=*/{}, + /*zIndex=*/2); + } else if(how == CLICK) { + if(x >= sx && x <= sx+SIZE && y >= sy && y <= sy+SIZE) { + editControl.colorPicker.rgb = RGBf(rgb.x, rgb.y, rgb.z); + ColorPickerDone(); + } + } else if(how == HOVER) { + if(x >= sx && x <= sx+SIZE && y >= sy && y <= sy+SIZE) { + mousePointerAsHand = true; + } + } + } + } + + int hxm, hym; + int hx = px + 5, hy = py + 5; + hxm = hx + PITCH*7 + SIZE; + hym = hy + PITCH*2 + SIZE; + if(how == PAINT) { + uiCanvas->DrawRect(hx, hxm, hy, hym, + /*fillColor=*/editControl.colorPicker.rgb, + /*outlineColor=*/{}, + /*zIndex=*/2); + } else if(how == CLICK) { + if(x >= hx && x <= hxm && y >= hy && y <= hym) { + ColorPickerDone(); + } + } else if(how == HOVER) { + if(x >= hx && x <= hxm && y >= hy && y <= hym) { + mousePointerAsHand = true; + } + } + + hy += PITCH*3; + + hxm = hx + PITCH*7 + SIZE; + hym = hy + PITCH*1 + SIZE; + // The one-dimensional thing to pick the color's value + if(how == PAINT) { + uiCanvas->DrawPixmap(HsvPattern1d(editControl.colorPicker.h, + editControl.colorPicker.s, + hxm-hx, hym-hy), + hx, hy, /*zIndex=*/2); + + int cx = hx+(int)((hxm-hx)*(1.0 - editControl.colorPicker.v)); + uiCanvas->DrawLine(cx, hy, cx, hym, + /*fillColor=*/{ 0, 0, 0, 255 }, + /*outlineColor=*/{}, + /*zIndex=*/3); + } else if(how == CLICK || + (how == HOVER && leftDown && editControl.colorPicker.picker1dActive)) + { + if(x >= hx && x <= hxm && y >= hy && y <= hym) { + editControl.colorPicker.v = 1 - (x - hx)/(hxm - hx); + + Vector rgb = HsvToRgb(Vector::From( + 6*editControl.colorPicker.h, + editControl.colorPicker.s, + editControl.colorPicker.v)); + editControl.colorPicker.rgb = RGBf(rgb.x, rgb.y, rgb.z); + + editControl.colorPicker.picker1dActive = true; + } + } + // and advance our vertical position + hy += PITCH*2; + + hxm = hx + PITCH*7 + SIZE; + hym = hy + PITCH*6 + SIZE; + // Two-dimensional thing to pick a color by hue and saturation + if(how == PAINT) { + uiCanvas->DrawPixmap(HsvPattern2d(hxm-hx, hym-hy), hx, hy, + /*zIndex=*/2); + + int cx = hx+(int)((hxm-hx)*editControl.colorPicker.h), + cy = hy+(int)((hym-hy)*editControl.colorPicker.s); + uiCanvas->DrawLine(cx - 5, cy, cx + 5, cy, + /*fillColor=*/{ 255, 255, 255, 255 }, + /*outlineColor=*/{}, + /*zIndex=*/3); + uiCanvas->DrawLine(cx, cy - 5, cx, cy + 5, + /*fillColor=*/{ 255, 255, 255, 255 }, + /*outlineColor=*/{}, + /*zIndex=*/3); + } else if(how == CLICK || + (how == HOVER && leftDown && editControl.colorPicker.picker2dActive)) + { + if(x >= hx && x <= hxm && y >= hy && y <= hym) { + double h = (x - hx)/(hxm - hx), + s = (y - hy)/(hym - hy); + editControl.colorPicker.h = h; + editControl.colorPicker.s = s; + + Vector rgb = HsvToRgb(Vector::From( + 6*editControl.colorPicker.h, + editControl.colorPicker.s, + editControl.colorPicker.v)); + editControl.colorPicker.rgb = RGBf(rgb.x, rgb.y, rgb.z); + + editControl.colorPicker.picker2dActive = true; + } + } + + window->SetCursor(mousePointerAsHand ? + Window::Cursor::HAND : + Window::Cursor::POINTER); + return true; +} + +void TextWindow::Paint() { + if (!canvas) return; + + double width, height; + window->GetContentSize(&width, &height); + if(halfRows != (int)height / (LINE_HEIGHT/2)) + Resize(); + + Camera camera = {}; + camera.width = width; + camera.height = height; + camera.pixelRatio = window->GetDevicePixelRatio(); + camera.gridFit = (window->GetDevicePixelRatio() == 1); + camera.LoadIdentity(); + camera.offset.x = -camera.width / 2.0; + camera.offset.y = -camera.height / 2.0; + + Lighting lighting = {}; + lighting.backgroundColor = RGBi(0, 0, 0); + + canvas->SetLighting(lighting); + canvas->SetCamera(camera); + canvas->StartFrame(); + + UiCanvas uiCanvas = {}; + uiCanvas.canvas = canvas; + uiCanvas.flip = true; + + int r, c, a; + for(a = 0; a < 2; a++) { + for(r = 0; r < rows; r++) { + int ltop = top[r]; + if(ltop < (scrollPos-1)) continue; + if(ltop > scrollPos+halfRows) break; + + for(c = 0; c < min(((int)width/CHAR_WIDTH_)+1, (int) MAX_COLS); c++) { + int x = LEFT_MARGIN + c*CHAR_WIDTH_; + int y = (ltop-scrollPos)*(LINE_HEIGHT/2) + 4; + + int fg = meta[r][c].fg; + int bg = meta[r][c].bg; + + // On the first pass, all the background quads; on the next + // pass, all the foreground (i.e., font) quads. + if(a == 0) { + RgbaColor bgRgb = meta[r][c].bgRgb; + int bh = LINE_HEIGHT, adj = 0; + if(bg == 'z') { + bh = CHAR_HEIGHT; + adj += 2; + } else { + bgRgb = RgbaColor::FromFloat(bgColorTable[bg*3+0], + bgColorTable[bg*3+1], + bgColorTable[bg*3+2]); + } + + if(bg != 'd') { + // Move the quad down a bit, so that the descenders + // still have the correct background. + uiCanvas.DrawRect(x, x + CHAR_WIDTH_, y + adj, y + adj + bh, + /*fillColor=*/bgRgb, /*outlineColor=*/{}); + } + } else if(a == 1) { + RgbaColor fgRgb = RgbaColor::FromFloat(fgColorTable[fg*3+0], + fgColorTable[fg*3+1], + fgColorTable[fg*3+2]); + if(text[r][c] != ' ') { + uiCanvas.DrawBitmapChar(text[r][c], x, y + CHAR_HEIGHT, fgRgb); + } + + // If this is a link and it's hovered, then draw the + // underline + if(meta[r][c].link && meta[r][c].link != 'n' && + (r == hoveredRow && c == hoveredCol)) + { + int cs = c, cf = c; + while(cs >= 0 && meta[r][cs].link && + meta[r][cs].f == meta[r][c].f && + meta[r][cs].data == meta[r][c].data) + { + cs--; + } + cs++; + + while( meta[r][cf].link && + meta[r][cf].f == meta[r][c].f && + meta[r][cf].data == meta[r][c].data) + { + cf++; + } + + // But don't underline checkboxes or radio buttons + while(((text[r][cs] >= 0xe000 && text[r][cs] <= 0xefff) || + text[r][cs] == ' ') && + cs < cf) + { + cs++; + } + + // Always use the color of the rightmost character + // in the link, so that underline is consistent color + fg = meta[r][cf-1].fg; + fgRgb = RgbaColor::FromFloat(fgColorTable[fg*3+0], + fgColorTable[fg*3+1], + fgColorTable[fg*3+2]); + int yp = y + CHAR_HEIGHT; + uiCanvas.DrawLine(LEFT_MARGIN + cs*CHAR_WIDTH_, yp, + LEFT_MARGIN + cf*CHAR_WIDTH_, yp, + fgRgb); + } + } + } + } + } + + // The line to indicate the column of radio buttons that indicates the + // active group. + SS.GW.GroupSelection(); + auto const &gs = SS.GW.gs; + // Make sure this test agrees with test to determine which screen is drawn + if(!SS.GW.pending.description && gs.n == 0 && gs.constraints == 0 && + shown.screen == Screen::LIST_OF_GROUPS) + { + int x = 29, y = 70 + LINE_HEIGHT; + y -= scrollPos*(LINE_HEIGHT/2); + + RgbaColor color = RgbaColor::FromFloat(fgColorTable['t'*3+0], + fgColorTable['t'*3+1], + fgColorTable['t'*3+2]); + uiCanvas.DrawLine(x, y, x, y+40, color); + } + + // The header has some icons that are drawn separately from the text + DrawOrHitTestIcons(&uiCanvas, PAINT, 0, 0); + + // And we may show a color picker for certain editable fields + DrawOrHitTestColorPicker(&uiCanvas, PAINT, false, 0, 0); + + canvas->FlushFrame(); + canvas->FinishFrame(); + canvas->Clear(); +} + +void TextWindow::MouseEvent(bool leftClick, bool leftDown, double x, double y) { + using Platform::Window; + + if(SS.TW.window->IsEditorVisible() || SS.GW.window->IsEditorVisible()) { + if(DrawOrHitTestColorPicker(NULL, leftClick ? CLICK : HOVER, leftDown, x, y)) { + return; + } + + if(leftClick) { + HideEditControl(); + SS.GW.window->HideEditor(); + } else { + window->SetCursor(Window::Cursor::POINTER); + } + return; + } + + DrawOrHitTestIcons(NULL, leftClick ? CLICK : HOVER, x, y); + + GraphicsWindow::Selection ps = SS.GW.hover; + SS.GW.hover.Clear(); + + int prevHoveredRow = hoveredRow, + prevHoveredCol = hoveredCol; + hoveredRow = 0; + hoveredCol = 0; + + // Find the corresponding character in the text buffer + int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH_); + int hh = (LINE_HEIGHT)/2; + y += scrollPos*hh; + int r; + for(r = 0; r < rows; r++) { + if(y >= top[r]*hh && y <= (top[r]+2)*hh) { + break; + } + } + if(r >= 0 && c >= 0 && r < rows && c < MAX_COLS) { + window->SetCursor(Window::Cursor::POINTER); + + hoveredRow = r; + hoveredCol = c; + + const auto &item = meta[r][c]; + if(leftClick) { + if(item.link && item.f) { + (item.f)(item.link, item.data); + Show(); + SS.GW.Invalidate(); + } + } else { + if(item.link) { + window->SetCursor(Window::Cursor::HAND); + if(item.h) { + (item.h)(item.link, item.data); + } + } else { + window->SetCursor(Window::Cursor::POINTER); + } + } + } + + if((!ps.Equals(&(SS.GW.hover))) || + prevHoveredRow != hoveredRow || + prevHoveredCol != hoveredCol) + { + SS.GW.Invalidate(); + window->Invalidate(); + } +} + +void TextWindow::MouseLeave() { + hoveredButton = NULL; + hoveredRow = 0; + hoveredCol = 0; + window->Invalidate(); +} + +void TextWindow::ScrollbarEvent(double newPos) { + if(window->IsEditorVisible()) { + // An edit field is active. Do not move the scrollbar. + return; + } + + int bottom = top[rows-1] + 2; + newPos = min((int)newPos, bottom - halfRows); + newPos = max((int)newPos, 0); + if(newPos != scrollPos) { + scrollPos = (int)newPos; + window->SetScrollbarPosition(scrollPos); + window->Invalidate(); + } +} + +} diff --git a/src/toolbar.cpp b/src/toolbar.cpp new file mode 100644 index 0000000..372b909 --- /dev/null +++ b/src/toolbar.cpp @@ -0,0 +1,252 @@ +//----------------------------------------------------------------------------- +// The toolbar that appears at the top left of the graphics window, where the +// user can select icons with the mouse, to perform operations equivalent to +// selecting a menu item or using a keyboard shortcut. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +struct ToolIcon { + std::string name; + Command command; + const char *tooltip; + std::shared_ptr pixmap; +}; +static ToolIcon Toolbar[] = { + { "line", Command::LINE_SEGMENT, + N_("Sketch line segment"), {} }, + { "rectangle", Command::RECTANGLE, + N_("Sketch rectangle"), {} }, + { "circle", Command::CIRCLE, + N_("Sketch circle"), {} }, + { "arc", Command::ARC, + N_("Sketch arc of a circle"), {} }, + { "text", Command::TTF_TEXT, + N_("Sketch curves from text in a TrueType font"), {} }, + { "image", Command::IMAGE, + N_("Sketch image from a file"), {} }, + { "tangent-arc", Command::TANGENT_ARC, + N_("Create tangent arc at selected point"), {} }, + { "bezier", Command::CUBIC, + N_("Sketch cubic Bezier spline"), {} }, + { "point", Command::DATUM_POINT, + N_("Sketch datum point"), {} }, + { "construction", Command::CONSTRUCTION, + N_("Toggle construction"), {} }, + { "trim", Command::SPLIT_CURVES, + N_("Split lines / curves where they intersect"), {} }, + { "", Command::NONE, "", {} }, + + { "length", Command::DISTANCE_DIA, + N_("Constrain distance / diameter / length"), {} }, + { "angle", Command::ANGLE, + N_("Constrain angle"), {} }, + { "horiz", Command::HORIZONTAL, + N_("Constrain to be horizontal"), {} }, + { "vert", Command::VERTICAL, + N_("Constrain to be vertical"), {} }, + { "parallel", Command::PARALLEL, + N_("Constrain to be parallel or tangent"), {} }, + { "perpendicular", Command::PERPENDICULAR, + N_("Constrain to be perpendicular"), {} }, + { "pointonx", Command::ON_ENTITY, + N_("Constrain point on line / curve / plane / point"), {} }, + { "symmetric", Command::SYMMETRIC, + N_("Constrain symmetric"), {} }, + { "equal", Command::EQUAL, + N_("Constrain equal length / radius / angle"), {} }, + { "same-orientation",Command::ORIENTED_SAME, + N_("Constrain normals in same orientation"), {} }, + { "other-supp", Command::OTHER_ANGLE, + N_("Other supplementary angle"), {} }, + { "ref", Command::REFERENCE, + N_("Toggle reference dimension"), {} }, + { "", Command::NONE, "", {} }, + + { "extrude", Command::GROUP_EXTRUDE, + N_("New group extruding active sketch"), {} }, + { "lathe", Command::GROUP_LATHE, + N_("New group rotating active sketch"), {} }, + { "helix", Command::GROUP_HELIX, + N_("New group helix from active sketch"), {} }, + { "revolve", Command::GROUP_REVOLVE, + N_("New group revolve active sketch"), {} }, + { "step-rotate", Command::GROUP_ROT, + N_("New group step and repeat rotating"), {} }, + { "step-translate", Command::GROUP_TRANS, + N_("New group step and repeat translating"), {} }, + { "sketch-in-plane", Command::GROUP_WRKPL, + N_("New group in new workplane (thru given entities)"), {} }, + { "sketch-in-3d", Command::GROUP_3D, + N_("New group in 3d"), {} }, + { "assemble", Command::GROUP_LINK, + N_("New group linking / assembling file"), {} }, + { "", Command::NONE, "", {} }, + + { "in3d", Command::NEAREST_ISO, + N_("Nearest isometric view"), {} }, + { "ontoworkplane", Command::ONTO_WORKPLANE, + N_("Align view to active workplane"), {} }, +}; + +void GraphicsWindow::ToolbarDraw(UiCanvas *canvas) { + ToolbarDrawOrHitTest(0, 0, canvas, NULL, NULL, NULL); +} + +bool GraphicsWindow::ToolbarMouseMoved(int x, int y) { + double width, height; + window->GetContentSize(&width, &height); + + x += ((int)width/2); + y += ((int)height/2); + + Command hitCommand; + int hitX, hitY; + bool withinToolbar = ToolbarDrawOrHitTest(x, y, NULL, &hitCommand, &hitX, &hitY); + + if(hitCommand != toolbarHovered) { + toolbarHovered = hitCommand; + Invalidate(); + } + + if(toolbarHovered != Command::NONE) { + std::string tooltip; + for(ToolIcon &icon : Toolbar) { + if(toolbarHovered == icon.command) { + tooltip = Translate(icon.tooltip); + } + } + + Platform::KeyboardEvent accel = SS.GW.AcceleratorForCommand(toolbarHovered); + std::string accelDesc = Platform::AcceleratorDescription(accel); + if(!accelDesc.empty()) { + tooltip += ssprintf(" (%s)", accelDesc.c_str()); + } + + window->SetTooltip(tooltip, hitX, hitY, 32, 32); + } else { + window->SetTooltip("", 0, 0, 0, 0); + } + + return withinToolbar; +} + +bool GraphicsWindow::ToolbarMouseDown(int x, int y) { + double width, height; + window->GetContentSize(&width, &height); + + x += ((int)width/2); + y += ((int)height/2); + + Command hitCommand; + bool withinToolbar = ToolbarDrawOrHitTest(x, y, NULL, &hitCommand, NULL, NULL); + if(hitCommand != Command::NONE) { + SS.GW.ActivateCommand(hitCommand); + } + return withinToolbar; +} + +bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas, + Command *hitCommand, int *hitX, int *hitY) +{ + double width, height; + window->GetContentSize(&width, &height); + + int x = 17, y = (int)(height - 21); // 20 is the menu bar height + + // When changing these values, also change the asReference drawing code in drawentity.cpp + // as well as the "window->SetMinContentSize(720, 636);" in graphicswin.cpp + int fudge = 8; + int h = 32*18 + 3*16 + fudge; // Toolbar height = 18 icons * 32 pixels + 3 dividers * 16 pixels + fudge + + if(h < y) { + // If there is enough vertical space leave up to 32 pixels between the menu bar and the toolbar. + y -= ((y - h) < 32) ? y - h : 32; + } + + int aleft = 0, aright = 66, atop = y+16+fudge/2, abot = y+16-h; + + bool withinToolbar = + (mx >= aleft && mx <= aright && my <= atop && my >= abot); + + // Initialize/clear hitCommand. + if(hitCommand) *hitCommand = Command::NONE; + + if(!canvas && !withinToolbar) { + // This gets called every MouseMove event, so return quickly. + return false; + } + + if(canvas) { + canvas->DrawRect(aleft, aright, atop, abot, + /*fillColor=*/{ 30, 30, 30, 255 }, + /*outlineColor=*/{}); + } + + bool leftpos = true; + for(ToolIcon &icon : Toolbar) { + if(icon.name.empty()) { // spacer + if(!leftpos) { + leftpos = true; + y -= 32; + x -= 32; + } + y -= 16; + + if(canvas) { + // Draw a separator bar in a slightly different color. + int divw = 30, divh = 2; + canvas->DrawRect(x+16+divw, x+16-divw, y+24+divh, y+24-divh, + /*fillColor=*/{ 45, 45, 45, 255 }, + /*outlineColor=*/{}); + } + + continue; + } + + if(icon.pixmap == nullptr) { + icon.pixmap = LoadPng("icons/graphics-window/" + icon.name + ".png"); + } + + if(canvas) { + canvas->DrawPixmap(icon.pixmap, + x - (int)icon.pixmap->width / 2, + y - (int)icon.pixmap->height / 2); + + if(toolbarHovered == icon.command || + (pending.operation == Pending::COMMAND && + pending.command == icon.command)) { + // Highlight the hovered or pending item. + const int boxhw = 15; + canvas->DrawRect(x+boxhw, x-boxhw, y+boxhw, y-boxhw, + /*fillColor=*/{ 255, 255, 0, 75 }, + /*outlineColor=*/{}); + } + } else { + const int boxhw = 16; + if(mx < (x+boxhw) && mx > (x - boxhw) && + my < (y+boxhw) && my > (y - boxhw)) + { + if(hitCommand) *hitCommand = icon.command; + if(hitX) *hitX = x - boxhw; + if(hitY) *hitY = (int)height - (y + boxhw); + } + } + + if(leftpos) { + x += 32; + leftpos = false; + } else { + x -= 32; + y -= 32; + leftpos = true; + } + } + + return withinToolbar; +} + +} // namespace SolveSpace diff --git a/src/ttf.cpp b/src/ttf.cpp new file mode 100644 index 0000000..2aa928b --- /dev/null +++ b/src/ttf.cpp @@ -0,0 +1,449 @@ +//----------------------------------------------------------------------------- +// Routines to read a TrueType font as vector outlines, and generate them +// as entities, since they're always representable as either lines or +// quadratic Bezier curves. +// +// Copyright 2016 whitequark, Peter Barfuss. +//----------------------------------------------------------------------------- +#include +#include FT_FREETYPE_H +#include FT_OUTLINE_H +#include FT_ADVANCES_H + +/* Yecch. Irritatingly, you need to do this nonsense to get the error string table, + since nobody thought to put this exact function into FreeType itself. */ +#undef __FTERRORS_H__ +#define FT_ERRORDEF(e, v, s) { (e), (s) }, +#define FT_ERROR_START_LIST +#define FT_ERROR_END_LIST { 0, NULL } + +struct ft_error { + int err; + const char *str; +}; + +static const struct ft_error ft_errors[] = { +#include FT_ERRORS_H +}; + +extern "C" const char *ft_error_string(int err) { + const struct ft_error *e; + for(e = ft_errors; e->str; e++) + if(e->err == err) + return e->str; + return "Unknown error"; +} + +/* Okay, we're done with that. */ +#undef FT_ERRORDEF +#undef FT_ERROR_START_LIST +#undef FT_ERROR_END_LIST + +#include "solvespace.h" + +namespace SolveSpace { + +//----------------------------------------------------------------------------- +// Get the list of available font filenames, and load the name for each of +// them. Only that, though, not the glyphs too. +//----------------------------------------------------------------------------- +TtfFontList::TtfFontList() { + FT_Init_FreeType(&fontLibrary); +} + +TtfFontList::~TtfFontList() { + FT_Done_FreeType(fontLibrary); +} + +void TtfFontList::LoadAll() { + if(loaded) return; + + for(const Platform::Path &font : Platform::GetFontFiles()) { + TtfFont tf = {}; + tf.fontFile = font; + if(tf.LoadFromFile(fontLibrary)) + l.Add(&tf); + } + + // Add builtin font to end of font list so it is displayed first in the UI + { + TtfFont tf = {}; + tf.SetResourceID("fonts/BitstreamVeraSans-Roman-builtin.ttf"); + if(tf.LoadFromResource(fontLibrary)) + l.Add(&tf); + } + + // Sort fonts according to their actual name, not filename. + std::sort(l.begin(), l.end(), + [](const TtfFont &a, const TtfFont &b) { return a.name < b.name; }); + + // Filter out fonts with the same family and style name. This is not + // strictly necessarily the exact same font, but it will almost always be. + TtfFont *it = std::unique(l.begin(), l.end(), + [](const TtfFont &a, const TtfFont &b) { return a.name == b.name; }); + l.RemoveLast(&l[l.n] - it); + + loaded = true; +} + +TtfFont *TtfFontList::LoadFont(const std::string &font) +{ + LoadAll(); + + TtfFont *tf = std::find_if(l.begin(), l.end(), + [&font](const TtfFont &tf) { return tf.FontFileBaseName() == font; }); + + if(tf != l.end()) { + if(tf->fontFace == NULL) { + if(tf->IsResource()) + tf->LoadFromResource(fontLibrary, /*keepOpen=*/true); + else + tf->LoadFromFile(fontLibrary, /*keepOpen=*/true); + } + return tf; + } else { + return NULL; + } +} + +void TtfFontList::PlotString(const std::string &font, const std::string &str, + SBezierList *sbl, bool kerning, Vector origin, Vector u, Vector v) +{ + TtfFont *tf = LoadFont(font); + if(!str.empty() && tf != NULL) { + tf->PlotString(str, sbl, kerning, origin, u, v); + } else { + // No text or no font; so draw a big X for an error marker. + SBezier sb; + sb = SBezier::From(origin, origin.Plus(u).Plus(v)); + sbl->l.Add(&sb); + sb = SBezier::From(origin.Plus(v), origin.Plus(u)); + sbl->l.Add(&sb); + } +} + +double TtfFontList::AspectRatio(const std::string &font, const std::string &str, bool kerning) +{ + TtfFont *tf = LoadFont(font); + if(tf != NULL) { + return tf->AspectRatio(str, kerning); + } + + return 0.0; +} + +//----------------------------------------------------------------------------- +// Return the basename of our font filename; that's how the requests and +// entities that reference us will store it. +//----------------------------------------------------------------------------- +std::string TtfFont::FontFileBaseName() const { + return fontFile.FileName(); +} + +//----------------------------------------------------------------------------- +// Convenience method to set fontFile for resource-loaded fonts as res:// +//----------------------------------------------------------------------------- +void TtfFont::SetResourceID(const std::string &resource) { + fontFile = { "res://" + resource }; +} + +bool TtfFont::IsResource() const { + return fontFile.raw.compare(0, 6, "res://") == 0; +} + +//----------------------------------------------------------------------------- +// Load a TrueType font into memory. +//----------------------------------------------------------------------------- +bool TtfFont::LoadFromFile(FT_Library fontLibrary, bool keepOpen) { + ssassert(!IsResource(), "Cannot load a font provided by a resource as a file."); + + FT_Open_Args args = {}; + args.flags = FT_OPEN_PATHNAME; + args.pathname = &fontFile.raw[0]; // FT_String is char* for historical reasons + + // We don't use OpenFile() here to let freetype do its own memory management. + // This is OK because on Linux/OS X we just delegate to fopen and on Windows + // we only look into C:\Windows\Fonts, which has a known short path. + if(int fterr = FT_Open_Face(fontLibrary, &args, 0, &fontFace)) { + dbp("freetype: loading font from file '%s' failed: %s", + fontFile.raw.c_str(), ft_error_string(fterr)); + return false; + } + + return ExtractTTFData(keepOpen); +} + +//----------------------------------------------------------------------------- +// Load a TrueType from resource in memory. Implemented to load bundled fonts +// through theresource system. +//----------------------------------------------------------------------------- +bool TtfFont::LoadFromResource(FT_Library fontLibrary, bool keepOpen) { + ssassert(IsResource(), "Font to be loaded as resource is not provided by a resource " + "or does not have the 'res://' prefix."); + + size_t _size; + // substr to cut off 'res://' (length: 6) + const void *_buffer = Platform::LoadResource(fontFile.raw.substr(6, fontFile.raw.size()), + &_size); + + FT_Long size = static_cast(_size); + const FT_Byte *buffer = reinterpret_cast(_buffer); + + if(int fterr = FT_New_Memory_Face(fontLibrary, buffer, size, 0, &fontFace)) { + dbp("freetype: loading font '%s' from memory failed: %s", + fontFile.raw.c_str(), ft_error_string(fterr)); + return false; + } + + return ExtractTTFData(keepOpen); +} + +//----------------------------------------------------------------------------- +// Extract font information. We care about the font name and unit size. +//----------------------------------------------------------------------------- +bool TtfFont::ExtractTTFData(bool keepOpen) { + if(int fterr = FT_Select_Charmap(fontFace, FT_ENCODING_UNICODE)) { + dbp("freetype: loading unicode CMap for file '%s' failed: %s", + fontFile.raw.c_str(), ft_error_string(fterr)); + FT_Done_Face(fontFace); + fontFace = NULL; + return false; + } + + name = std::string(fontFace->family_name) + + " (" + std::string(fontFace->style_name) + ")"; + + // We always ask Freetype to give us a unit size character. + // It uses fixed point; put the unit size somewhere in the middle of the dynamic + // range of its 26.6 fixed point type, and adjust the factors so that the unit + // matches cap height. + FT_Size_RequestRec sizeRequest; + sizeRequest.type = FT_SIZE_REQUEST_TYPE_REAL_DIM; + sizeRequest.width = 1 << 16; + sizeRequest.height = 1 << 16; + sizeRequest.horiResolution = 128; + sizeRequest.vertResolution = 128; + if(int fterr = FT_Request_Size(fontFace, &sizeRequest)) { + dbp("freetype: size request for file '%s' failed: %s", + fontFile.raw.c_str(), ft_error_string(fterr)); + FT_Done_Face(fontFace); + fontFace = NULL; + return false; + } + + char chr = 'A'; + uint32_t gid = FT_Get_Char_Index(fontFace, 'A'); + if (gid == 0) { + dbp("freetype: CID-to-GID mapping for CID 0x%04x in file '%s' failed: %s; " + "using CID as GID", + chr, fontFile.raw.c_str(), ft_error_string(gid)); + dbp("Assuming cap height is the same as requested height (this is likely wrong)."); + capHeight = (double)sizeRequest.height; + } + + if(gid) { + if(int fterr = FT_Load_Glyph(fontFace, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING)) { + dbp("freetype: cannot load glyph for GID 0x%04x in file '%s': %s", + gid, fontFile.raw.c_str(), ft_error_string(fterr)); + FT_Done_Face(fontFace); + fontFace = NULL; + return false; + } + + FT_BBox bbox; + FT_Outline_Get_CBox(&fontFace->glyph->outline, &bbox); + capHeight = (double)bbox.yMax; + } + + // If we just wanted to get the font's name and figure out if it's actually usable, close + // it now. If we don't do this, and there are a lot of fonts, we can bump into the file + // descriptor limit (especially on Windows), breaking all file operations. + if(!keepOpen) { + FT_Done_Face(fontFace); + fontFace = NULL; + return true; + } + + return true; +} + +typedef struct OutlineData { + Vector origin, u, v; // input parameters + SBezierList *beziers; // output bezier list + float factor; // ratio between freetype and solvespace coordinates + FT_Pos bx; // x offset of the current glyph + FT_Pos px, py; // current point +} OutlineData; + +static Vector Transform(OutlineData *data, FT_Pos x, FT_Pos y) { + Vector r = data->origin; + r = r.Plus(data->u.ScaledBy((float)(data->bx + x) * data->factor)); + r = r.Plus(data->v.ScaledBy((float)y * data->factor)); + return r; +} + +static int MoveTo(const FT_Vector *p, void *cc) +{ + OutlineData *data = (OutlineData *) cc; + data->px = p->x; + data->py = p->y; + return 0; +} + +static int LineTo(const FT_Vector *p, void *cc) +{ + OutlineData *data = (OutlineData *) cc; + SBezier sb = SBezier::From( + Transform(data, data->px, data->py), + Transform(data, p->x, p->y)); + data->beziers->l.Add(&sb); + data->px = p->x; + data->py = p->y; + return 0; +} + +static int ConicTo(const FT_Vector *c, const FT_Vector *p, void *cc) +{ + OutlineData *data = (OutlineData *) cc; + SBezier sb = SBezier::From( + Transform(data, data->px, data->py), + Transform(data, c->x, c->y), + Transform(data, p->x, p->y)); + data->beziers->l.Add(&sb); + data->px = p->x; + data->py = p->y; + return 0; +} + +static int CubicTo(const FT_Vector *c1, const FT_Vector *c2, const FT_Vector *p, void *cc) +{ + OutlineData *data = (OutlineData *) cc; + SBezier sb = SBezier::From( + Transform(data, data->px, data->py), + Transform(data, c1->x, c1->y), + Transform(data, c2->x, c2->y), + Transform(data, p->x, p->y)); + data->beziers->l.Add(&sb); + data->px = p->x; + data->py = p->y; + return 0; +} + +void TtfFont::PlotString(const std::string &str, + SBezierList *sbl, bool kerning, Vector origin, Vector u, Vector v) +{ + ssassert(fontFace != NULL, "Expected font face to be loaded"); + + FT_Outline_Funcs outlineFuncs; + outlineFuncs.move_to = MoveTo; + outlineFuncs.line_to = LineTo; + outlineFuncs.conic_to = ConicTo; + outlineFuncs.cubic_to = CubicTo; + outlineFuncs.shift = 0; + outlineFuncs.delta = 0; + + FT_Pos dx = 0; + uint32_t prevGid = 0; + for(char32_t cid : ReadUTF8(str)) { + uint32_t gid = FT_Get_Char_Index(fontFace, cid); + if (gid == 0) { + dbp("freetype: CID-to-GID mapping for CID 0x%04x in file '%s' failed: %s; " + "using CID as GID", + cid, fontFile.raw.c_str(), ft_error_string(gid)); + gid = cid; + } + + /* + * Stupid hacks: + * - if we want fake-bold, use FT_Outline_Embolden(). This actually looks + * quite good. + * - if we want fake-italic, apply a shear transform [1 s s 1 0 0] here using + * FT_Set_Transform. This looks decent at small font sizes and bad at larger + * ones, antialiasing mitigates this considerably though. + */ + if(int fterr = FT_Load_Glyph(fontFace, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING)) { + dbp("freetype: cannot load glyph for GID 0x%04x in file '%s': %s", + gid, fontFile.raw.c_str(), ft_error_string(fterr)); + return; + } + + /* A point that has x = xMin should be plotted at (dx0 + lsb); fix up + * our x-position so that the curve-generating code will put stuff + * at the right place. + * + * There's no point in getting the glyph BBox here - not only can it be + * needlessly slow sometimes, but because we're about to render a single glyph, + * what we want actually *is* the CBox. + * + * This is notwithstanding that this makes extremely little sense, this + * looks like a workaround for either mishandling the start glyph on a line, + * or as a really hacky pseudo-track-kerning (in which case it works better than + * one would expect! especially since most fonts don't set track kerning). + */ + FT_BBox cbox; + FT_Outline_Get_CBox(&fontFace->glyph->outline, &cbox); + + // Apply Kerning, if any: + FT_Vector kernVector; + if(kerning && FT_Get_Kerning(fontFace, prevGid, gid, FT_KERNING_DEFAULT, &kernVector) == 0) { + dx += kernVector.x; + } + + FT_Pos bx = dx - cbox.xMin; + // Yes, this is what FreeType calls left-side bearing. + // Then interchangeably uses that with "left-side bearing". Sigh. + bx += fontFace->glyph->metrics.horiBearingX; + + OutlineData data = {}; + data.origin = origin; + data.u = u; + data.v = v; + data.beziers = sbl; + data.factor = (float)(1.0 / capHeight); + data.bx = bx; + if(int fterr = FT_Outline_Decompose(&fontFace->glyph->outline, &outlineFuncs, &data)) { + dbp("freetype: bezier decomposition failed for GID 0x%4x in file '%s': %s", + gid, fontFile.raw.c_str(), ft_error_string(fterr)); + } + + // And we're done, so advance our position by the requested advance + // width, plus the user-requested extra advance. + dx += fontFace->glyph->advance.x; + prevGid = gid; + } +} + +double TtfFont::AspectRatio(const std::string &str, bool kerning) { + ssassert(fontFace != NULL, "Expected font face to be loaded"); + + // We always request a unit size character, so the aspect ratio is the same as advance length. + double dx = 0; + uint32_t prevGid = 0; + for(char32_t chr : ReadUTF8(str)) { + uint32_t gid = FT_Get_Char_Index(fontFace, chr); + if (gid == 0) { + dbp("freetype: CID-to-GID mapping for CID 0x%04x in file '%s' failed: %s; " + "using CID as GID", + chr, fontFile.raw.c_str(), ft_error_string(gid)); + } + + if(int fterr = FT_Load_Glyph(fontFace, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING)) { + dbp("freetype: cannot load glyph for GID 0x%04x in file '%s': %s", + gid, fontFile.raw.c_str(), ft_error_string(fterr)); + break; + } + + // Apply Kerning, if any: + FT_Vector kernVector; + if(kerning && FT_Get_Kerning(fontFace, prevGid, gid, FT_KERNING_DEFAULT, &kernVector) == 0) { + dx += (double)kernVector.x / capHeight; + } + + dx += (double)fontFace->glyph->advance.x / capHeight; + prevGid = gid; + } + + return dx; +} + +} // namespace SolveSpace diff --git a/src/ttf.h b/src/ttf.h new file mode 100644 index 0000000..560158d --- /dev/null +++ b/src/ttf.h @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Routines to read a TrueType font as vector outlines, and generate them +// as entities, since they're always representable as either lines or +// quadratic Bezier curves. +// +// Copyright 2016 whitequark, Peter Barfuss. +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_TTF_H +#define SOLVESPACE_TTF_H + +#include + +#include "dsc.h" +#include "platform/platform.h" + +// We declare these in advance instead of simply using FT_Library +// (defined as typedef FT_LibraryRec_* FT_Library) because including +// freetype.h invokes indescribable horrors and we would like to avoid +// doing that every time we include solvespace.h. +struct FT_LibraryRec_; +struct FT_FaceRec_; + +namespace SolveSpace { + +class SBezierList; + +class TtfFont { +public: + Platform::Path fontFile; // or resource path/name as res:// + std::string name; + FT_FaceRec_ *fontFace; + double capHeight; + + void SetResourceID(const std::string &resource); + bool IsResource() const; + + std::string FontFileBaseName() const; + bool LoadFromFile(FT_LibraryRec_ *fontLibrary, bool keepOpen = false); + bool LoadFromResource(FT_LibraryRec_ *fontLibrary, bool keepOpen = false); + + void PlotString(const std::string &str, + SBezierList *sbl, bool kerning, Vector origin, Vector u, Vector v); + double AspectRatio(const std::string &str, bool kerning); + + bool ExtractTTFData(bool keepOpen); +}; + +class TtfFontList { +public: + FT_LibraryRec_ *fontLibrary; + bool loaded; + List l; + + TtfFontList(); + ~TtfFontList(); + + void LoadAll(); + TtfFont *LoadFont(const std::string &font); + + void PlotString(const std::string &font, const std::string &str, + SBezierList *sbl, bool kerning, Vector origin, Vector u, Vector v); + double AspectRatio(const std::string &font, const std::string &str, bool kerning); +}; + +} // namespace SolveSpace + +#endif diff --git a/src/ui.h b/src/ui.h new file mode 100644 index 0000000..3bb789a --- /dev/null +++ b/src/ui.h @@ -0,0 +1,889 @@ +//----------------------------------------------------------------------------- +// Declarations relating to our user interface, in both the graphics and +// text browser window. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- + +#ifndef SOLVESPACE_UI_H +#define SOLVESPACE_UI_H + +#include +#include +#include +#include +#include + +#include "dsc.h" +#include "platform/gui.h" +#include "sketch.h" + +namespace SolveSpace { + +class Camera; +class Lighting; +class Canvas; +class UiCanvas; +class BatchCanvas; +class ViewportCanvas; +class Pixmap; + +class Locale { +public: + std::string language; + std::string region; + uint16_t lcid; + std::string displayName; + + std::string Culture() const { + return language + "-" + region; + } +}; + +struct LocaleLess { + bool operator()(const Locale &a, const Locale &b) const { + return a.language < b.language || + (a.language == b.language && a.region < b.region); + } +}; + +const std::set &Locales(); +bool SetLocale(const std::string &name); +bool SetLocale(uint16_t lcid); + +const std::string &Translate(const char *msgid); +const std::string &Translate(const char *msgctxt, const char *msgid); +const std::string &TranslatePlural(const char *msgid, unsigned n); +const std::string &TranslatePlural(const char *msgctxt, const char *msgid, unsigned n); + +inline const char *N_(const char *msgid) { + return msgid; +} +inline const char *CN_(const char *msgctxt, const char *msgid) { + return msgid; +} +#if defined(LIBRARY) +inline const char *_(const char *msgid) { + return msgid; +} +inline const char *C_(const char *msgctxt, const char *msgid) { + return msgid; +} +#else +inline const char *_(const char *msgid) { + return Translate(msgid).c_str(); +} +inline const char *C_(const char *msgctxt, const char *msgid) { + return Translate(msgctxt, msgid).c_str(); +} +#endif + +// This table describes the top-level menus in the graphics window. +enum class Command : uint32_t { + NONE = 0, + // File + NEW = 100, + OPEN, + OPEN_RECENT, + SAVE, + SAVE_AS, + EXPORT_IMAGE, + EXPORT_MESH, + EXPORT_SURFACES, + EXPORT_VIEW, + EXPORT_SECTION, + EXPORT_WIREFRAME, + IMPORT, + EXIT, + // View + ZOOM_IN, + ZOOM_OUT, + ZOOM_TO_FIT, + SHOW_GRID, + DIM_SOLID_MODEL, + PERSPECTIVE_PROJ, + EXPLODE_SKETCH, + ONTO_WORKPLANE, + NEAREST_ORTHO, + NEAREST_ISO, + CENTER_VIEW, + SHOW_TOOLBAR, + SHOW_TEXT_WND, + UNITS_INCHES, + UNITS_FEET_INCHES, + UNITS_MM, + UNITS_METERS, + FULL_SCREEN, + // Edit + UNDO, + REDO, + CUT, + COPY, + PASTE, + PASTE_TRANSFORM, + DELETE, + SELECT_CHAIN, + SELECT_ALL, + SNAP_TO_GRID, + ROTATE_90, + UNSELECT_ALL, + REGEN_ALL, + EDIT_LINE_STYLES, + VIEW_PROJECTION, + CONFIGURATION, + // Request + SEL_WORKPLANE, + FREE_IN_3D, + DATUM_POINT, + WORKPLANE, + LINE_SEGMENT, + CONSTR_SEGMENT, + CIRCLE, + ARC, + RECTANGLE, + CUBIC, + TTF_TEXT, + IMAGE, + SPLIT_CURVES, + TANGENT_ARC, + CONSTRUCTION, + // Group + GROUP_3D, + GROUP_WRKPL, + GROUP_EXTRUDE, + GROUP_HELIX, + GROUP_LATHE, + GROUP_REVOLVE, + GROUP_ROT, + GROUP_TRANS, + GROUP_LINK, + GROUP_RECENT, + // Constrain + DISTANCE_DIA, + REF_DISTANCE, + ANGLE, + REF_ANGLE, + OTHER_ANGLE, + REFERENCE, + EQUAL, + RATIO, + DIFFERENCE, + ON_ENTITY, + SYMMETRIC, + AT_MIDPOINT, + HORIZONTAL, + VERTICAL, + PARALLEL, + PERPENDICULAR, + ORIENTED_SAME, + WHERE_DRAGGED, + COMMENT, + // Analyze + VOLUME, + AREA, + PERIMETER, + INTERFERENCE, + NAKED_EDGES, + SHOW_DOF, + CENTER_OF_MASS, + TRACE_PT, + STOP_TRACING, + STEP_DIM, + // Help + LOCALE, + WEBSITE, + GITHUB, + ABOUT, +}; + +class Button; + +class TextWindow { +public: + enum { + MAX_COLS = 100, + MIN_COLS = 45, + MAX_ROWS = 4000 + }; + + typedef struct { + char c; + RgbaColor color; + } Color; + static const Color fgColors[]; + static const Color bgColors[]; + + float bgColorTable[256*3]; + float fgColorTable[256*3]; + + enum { + CHAR_WIDTH_ = 9, + CHAR_HEIGHT = 16, + LINE_HEIGHT = 20, + LEFT_MARGIN = 6, + }; + +#define CHECK_FALSE "\xEE\x80\x80" // U+E000 +#define CHECK_TRUE "\xEE\x80\x81" +#define RADIO_FALSE "\xEE\x80\x82" +#define RADIO_TRUE "\xEE\x80\x83" + + int scrollPos; // The scrollbar position, in half-row units + int halfRows; // The height of our window, in half-row units + + uint32_t text[MAX_ROWS][MAX_COLS]; + typedef void LinkFunction(int link, uint32_t v); + enum { NOT_A_LINK = 0 }; + struct { + char fg; + char bg; + RgbaColor bgRgb; + int link; + uint32_t data; + LinkFunction *f; + LinkFunction *h; + } meta[MAX_ROWS][MAX_COLS]; + int hoveredRow, hoveredCol; + + int top[MAX_ROWS]; // in half-line units, or -1 for unused + int rows; + + Platform::WindowRef window; + std::shared_ptr canvas; + + void Draw(Canvas *canvas); + + void Paint(); + void MouseEvent(bool isClick, bool leftDown, double x, double y); + void MouseLeave(); + void ScrollbarEvent(double newPos); + + enum DrawOrHitHow : uint32_t { + PAINT = 0, + HOVER = 1, + CLICK = 2 + }; + void DrawOrHitTestIcons(UiCanvas *canvas, DrawOrHitHow how, + double mx, double my); + Button *hoveredButton; + + Vector HsvToRgb(Vector hsv); + std::shared_ptr HsvPattern2d(int w, int h); + std::shared_ptr HsvPattern1d(double hue, double sat, int w, int h); + void ColorPickerDone(); + bool DrawOrHitTestColorPicker(UiCanvas *canvas, DrawOrHitHow how, + bool leftDown, double x, double y); + + void Init(); + void MakeColorTable(const Color *in, float *out); + void Printf(bool half, const char *fmt, ...); + void ClearScreen(); + + void Show(); + void Resize(); + + // State for the screen that we are showing in the text window. + enum class Screen : uint32_t { + LIST_OF_GROUPS = 0, + GROUP_INFO = 1, + GROUP_SOLVE_INFO = 2, + CONFIGURATION = 3, + STEP_DIMENSION = 4, + LIST_OF_STYLES = 5, + STYLE_INFO = 6, + PASTE_TRANSFORMED = 7, + EDIT_VIEW = 8, + TANGENT_ARC = 9 + }; + typedef struct { + Screen screen; + + hGroup group; + hStyle style; + + hConstraint constraint; + + struct { + int times; + Vector trans; + double theta; + Vector origin; + double scale; + } paste; + } ShownState; + ShownState shown; + + enum class Edit : uint32_t { + NOTHING = 0, + // For multiple groups + TIMES_REPEATED = 1, + GROUP_NAME = 2, + GROUP_SCALE = 3, + GROUP_COLOR = 4, + GROUP_OPACITY = 5, + // For the configuration screen + LIGHT_DIRECTION = 100, + LIGHT_INTENSITY = 101, + COLOR = 102, + CHORD_TOLERANCE = 103, + MAX_SEGMENTS = 104, + CAMERA_TANGENT = 105, + GRID_SPACING = 106, + DIGITS_AFTER_DECIMAL = 107, + DIGITS_AFTER_DECIMAL_DEGREE = 108, + EXPORT_SCALE = 109, + EXPORT_OFFSET = 110, + CANVAS_SIZE = 111, + G_CODE_DEPTH = 112, + G_CODE_SAFE_HEIGHT = 113, + G_CODE_PASSES = 114, + G_CODE_FEED = 115, + G_CODE_PLUNGE_FEED = 116, + AUTOSAVE_INTERVAL = 117, + LIGHT_AMBIENT = 118, + FIND_CONSTRAINT_TIMEOUT = 119, + EXPLODE_DISTANCE = 120, + ANIMATION_SPEED = 121, + // For TTF text + TTF_TEXT = 300, + // For the step dimension screen + STEP_DIM_FINISH = 400, + STEP_DIM_STEPS = 401, + // For the styles stuff + STYLE_WIDTH = 500, + STYLE_TEXT_HEIGHT = 501, + STYLE_TEXT_ANGLE = 502, + STYLE_COLOR = 503, + STYLE_FILL_COLOR = 504, + STYLE_NAME = 505, + BACKGROUND_COLOR = 506, + STYLE_STIPPLE_PERIOD = 508, + // For paste transforming + PASTE_TIMES_REPEATED = 600, + PASTE_ANGLE = 601, + PASTE_SCALE = 602, + // For view + VIEW_SCALE = 700, + VIEW_ORIGIN = 701, + VIEW_PROJ_RIGHT = 702, + VIEW_PROJ_UP = 703, + // For tangent arc + TANGENT_ARC_RADIUS = 800, + // For helix pitch + HELIX_PITCH = 802 + }; + struct { + bool showAgain; + Edit meaning; + int i; + hGroup group; + hRequest request; + hStyle style; + } edit; + + static void ReportHowGroupSolved(hGroup hg); + + struct { + int halfRow; + int col; + + struct { + RgbaColor rgb; + double h, s, v; + bool show; + bool picker1dActive; + bool picker2dActive; + } colorPicker; + } editControl; + + void HideEditControl(); + void ShowEditControl(int col, const std::string &str, int halfRow = -1); + void ShowEditControlWithColorPicker(int col, RgbaColor rgb); + + void ClearSuper(); + + void ShowHeader(bool withNav); + // These are self-contained screens, that show some information about + // the sketch. + void ShowListOfGroups(); + void ShowGroupInfo(); + void ShowGroupSolveInfo(); + void ShowConfiguration(); + void ShowListOfStyles(); + void ShowStyleInfo(); + void ShowStepDimension(); + void ShowPasteTransformed(); + void ShowEditView(); + void ShowTangentArc(); + // Special screen, based on selection + void DescribeSelection(); + + void GoToScreen(Screen screen); + + // All of these are callbacks from the GUI code; first from when + // we're describing an entity + static void ScreenEditTtfText(int link, uint32_t v); + static void ScreenToggleTtfKerning(int link, uint32_t v); + static void ScreenSetTtfFont(int link, uint32_t v); + static void ScreenUnselectAll(int link, uint32_t v); + + // when we're describing a constraint + static void ScreenConstraintToggleReference(int link, uint32_t v); + static void ScreenConstraintShowAsRadius(int link, uint32_t v); + + // and the rest from the stuff in textscreens.cpp + static void ScreenSelectGroup(int link, uint32_t v); + static void ScreenActivateGroup(int link, uint32_t v); + static void ScreenToggleGroupShown(int link, uint32_t v); + static void ScreenHowGroupSolved(int link, uint32_t v); + static void ScreenShowGroupsSpecial(int link, uint32_t v); + static void ScreenDeleteGroup(int link, uint32_t v); + + static void ScreenHoverGroupWorkplane(int link, uint32_t v); + static void ScreenHoverRequest(int link, uint32_t v); + static void ScreenHoverEntity(int link, uint32_t v); + static void ScreenHoverConstraint(int link, uint32_t v); + static void ScreenSelectRequest(int link, uint32_t v); + static void ScreenSelectEntity(int link, uint32_t v); + static void ScreenSelectConstraint(int link, uint32_t v); + + static void ScreenChangeGroupOption(int link, uint32_t v); + static void ScreenColor(int link, uint32_t v); + static void ScreenOpacity(int link, uint32_t v); + + static void ScreenShowListOfStyles(int link, uint32_t v); + static void ScreenShowStyleInfo(int link, uint32_t v); + static void ScreenDeleteStyle(int link, uint32_t v); + static void ScreenChangeStylePatternType(int link, uint32_t v); + static void ScreenChangeStyleYesNo(int link, uint32_t v); + static void ScreenCreateCustomStyle(int link, uint32_t v); + static void ScreenLoadFactoryDefaultStyles(int link, uint32_t v); + static void ScreenAssignSelectionToStyle(int link, uint32_t v); + + static void ScreenShowConfiguration(int link, uint32_t v); + static void ScreenShowEditView(int link, uint32_t v); + static void ScreenGoToWebsite(int link, uint32_t v); + + static void ScreenChangeArcDimDefault(int link, uint32_t v); + static void ScreenChangeShowFullFilePath(int link, uint32_t v); + static void ScreenChangeFixExportColors(int link, uint32_t v); + static void ScreenChangeExportBackgroundColor(int link, uint32_t v); + static void ScreenChangeBackFaces(int link, uint32_t v); + static void ScreenChangeShowContourAreas(int link, uint32_t v); + static void ScreenChangeCheckClosedContour(int link, uint32_t v); + static void ScreenChangeCameraNav(int link, uint32_t v); + static void ScreenChangeTurntableNav(int link, uint32_t v); + static void ScreenChangeImmediatelyEditDimension(int link, uint32_t v); + static void ScreenChangeAutomaticLineConstraints(int link, uint32_t v); + static void ScreenChangePwlCurves(int link, uint32_t v); + static void ScreenChangeCanvasSizeAuto(int link, uint32_t v); + static void ScreenChangeCanvasSize(int link, uint32_t v); + static void ScreenChangeShadedTriangles(int link, uint32_t v); + + static void ScreenAllowRedundant(int link, uint32_t v); + + struct { + bool isDistance; + double finish; + int steps; + + Platform::TimerRef timer; + int64_t time; + int step; + } stepDim; + static void ScreenStepDimSteps(int link, uint32_t v); + static void ScreenStepDimFinish(int link, uint32_t v); + static void ScreenStepDimGo(int link, uint32_t v); + + static void ScreenChangeTangentArc(int link, uint32_t v); + + static void ScreenPasteTransformed(int link, uint32_t v); + + static void ScreenHome(int link, uint32_t v); + + // These ones do stuff with the edit control + static void ScreenChangeExprA(int link, uint32_t v); + static void ScreenChangeGroupName(int link, uint32_t v); + static void ScreenChangeGroupScale(int link, uint32_t v); + static void ScreenChangeHelixPitch(int link, uint32_t v); + static void ScreenChangePitchOption(int link, uint32_t v); + static void ScreenChangeLightDirection(int link, uint32_t v); + static void ScreenChangeLightIntensity(int link, uint32_t v); + static void ScreenChangeLightAmbient(int link, uint32_t v); + static void ScreenChangeColor(int link, uint32_t v); + static void ScreenChangeChordTolerance(int link, uint32_t v); + static void ScreenChangeMaxSegments(int link, uint32_t v); + static void ScreenChangeExportChordTolerance(int link, uint32_t v); + static void ScreenChangeExportMaxSegments(int link, uint32_t v); + static void ScreenChangeCameraTangent(int link, uint32_t v); + static void ScreenChangeGridSpacing(int link, uint32_t v); + static void ScreenChangeExplodeDistance(int link, uint32_t v); + static void ScreenChangeDigitsAfterDecimal(int link, uint32_t v); + static void ScreenChangeDigitsAfterDecimalDegree(int link, uint32_t v); + static void ScreenChangeUseSIPrefixes(int link, uint32_t v); + static void ScreenChangeExportScale(int link, uint32_t v); + static void ScreenChangeExportOffset(int link, uint32_t v); + static void ScreenChangeGCodeParameter(int link, uint32_t v); + static void ScreenChangeAutosaveInterval(int link, uint32_t v); + static void ScreenChangeFindConstraintTimeout(int link, uint32_t v); + static void ScreenChangeAnimationSpeed(int link, uint32_t v); + static void ScreenChangeStyleName(int link, uint32_t v); + static void ScreenChangeStyleMetric(int link, uint32_t v); + static void ScreenChangeStyleTextAngle(int link, uint32_t v); + static void ScreenChangeStyleColor(int link, uint32_t v); + static void ScreenChangeBackgroundColor(int link, uint32_t v); + static void ScreenChangePasteTransformed(int link, uint32_t v); + static void ScreenChangeViewScale(int link, uint32_t v); + static void ScreenChangeViewToFullScale(int link, uint32_t v); + static void ScreenChangeViewOrigin(int link, uint32_t v); + static void ScreenChangeViewProjection(int link, uint32_t v); + + bool EditControlDoneForStyles(const std::string &s); + bool EditControlDoneForConfiguration(const std::string &s); + bool EditControlDoneForPaste(const std::string &s); + bool EditControlDoneForView(const std::string &s); + void EditControlDone(std::string s); +}; + +class GraphicsWindow { +public: + void Init(); + + Platform::WindowRef window; + + void PopulateMainMenu(); + void PopulateRecentFiles(); + + Platform::KeyboardEvent AcceleratorForCommand(Command id); + void ActivateCommand(Command id); + + static void MenuView(Command id); + static void MenuEdit(Command id); + static void MenuRequest(Command id); + void DeleteSelection(); + void CopySelection(); + void PasteClipboard(Vector trans, double theta, double scale); + static void MenuClipboard(Command id); + + Platform::MenuRef openRecentMenu; + Platform::MenuRef linkRecentMenu; + + Platform::MenuItemRef showGridMenuItem; + Platform::MenuItemRef dimSolidModelMenuItem; + Platform::MenuItemRef perspectiveProjMenuItem; + Platform::MenuItemRef explodeMenuItem; + Platform::MenuItemRef showToolbarMenuItem; + Platform::MenuItemRef showTextWndMenuItem; + Platform::MenuItemRef fullScreenMenuItem; + + Platform::MenuItemRef unitsMmMenuItem; + Platform::MenuItemRef unitsMetersMenuItem; + Platform::MenuItemRef unitsInchesMenuItem; + Platform::MenuItemRef unitsFeetInchesMenuItem; + + Platform::MenuItemRef inWorkplaneMenuItem; + Platform::MenuItemRef in3dMenuItem; + + Platform::MenuItemRef undoMenuItem; + Platform::MenuItemRef redoMenuItem; + + std::shared_ptr canvas; + std::shared_ptr persistentCanvas; + bool persistentDirty; + + // These parameters define the map from 2d screen coordinates to the + // coordinates of the 3d sketch points. We will use an axonometric + // projection. + Vector offset; + Vector projRight; + Vector projUp; + double scale; + struct { + bool mouseDown; + Vector offset; + Vector projRight; + Vector projUp; + Point2d mouse; + Point2d mouseOnButtonDown; + Vector marqueePoint; + bool startedMoving; + } orig; + // We need to detect when the projection is changed to invalidate + // caches for drawn items. + struct { + Vector offset; + Vector projRight; + Vector projUp; + double scale; + } cached; + + // Most recent mouse position, updated every time the mouse moves. + Point2d currentMousePosition; + + // When the user is dragging a point, don't solve multiple times without + // allowing a paint in between. The extra solves are wasted if they're + // not displayed. + bool havePainted; + + // Some state for the context menu. + struct { + bool active; + } context; + + Camera GetCamera() const; + Lighting GetLighting() const; + + void NormalizeProjectionVectors(); + Point2d ProjectPoint(Vector p); + Vector ProjectPoint3(Vector p); + Vector ProjectPoint4(Vector p, double *w); + Vector UnProjectPoint(Point2d p); + Vector UnProjectPoint3(Vector p); + + Platform::TimerRef animateTimer; + void AnimateOnto(Quaternion quatf, Vector offsetf); + void AnimateOntoWorkplane(); + + Vector VectorFromProjs(Vector rightUpForward); + void HandlePointForZoomToFit(Vector p, Point2d *pmax, Point2d *pmin, + double *wmin, bool usePerspective, + const Camera &camera); + void ZoomToMouse(double delta); + void LoopOverPoints(const std::vector &entities, + const std::vector &constraints, + const std::vector &faces, + Point2d *pmax, Point2d *pmin, + double *wmin, bool usePerspective, bool includeMesh, + const Camera &camera); + void ZoomToFit(bool includingInvisibles = false, bool useSelection = false); + double ZoomToFit(const Camera &camera, + bool includingInvisibles = false, bool useSelection = false); + + hGroup activeGroup; + void EnsureValidActives(); + bool LockedInWorkplane(); + void SetWorkplaneFreeIn3d(); + hEntity ActiveWorkplane(); + void ForceTextWindowShown(); + + // Operations that must be completed by doing something with the mouse + // are noted here. + enum class Pending : uint32_t { + NONE = 0, + COMMAND = 1, + DRAGGING_POINTS = 2, + DRAGGING_NEW_POINT = 3, + DRAGGING_NEW_LINE_POINT = 4, + DRAGGING_NEW_CUBIC_POINT = 5, + DRAGGING_NEW_ARC_POINT = 6, + DRAGGING_CONSTRAINT = 7, + DRAGGING_RADIUS = 8, + DRAGGING_NORMAL = 9, + DRAGGING_NEW_RADIUS = 10, + DRAGGING_MARQUEE = 11, + }; + + struct { + Pending operation; + Command command; + + hRequest request; + hEntity point; + List points; + List requests; + hEntity circle; + hEntity normal; + hConstraint constraint; + + const char *description; + Platform::Path filename; + + bool hasSuggestion; + Constraint::Type suggestion; + } pending; + void ClearPending(bool scheduleShowTW = true); + bool IsFromPending(hRequest r); + void AddToPending(hRequest r); + void ReplacePending(hRequest before, hRequest after); + + // The constraint that is being edited with the on-screen textbox. + hConstraint constraintBeingEdited; + + bool SuggestLineConstraint(hRequest lineSegment, ConstraintBase::Type *type); + + Vector SnapToGrid(Vector p); + Vector SnapToEntityByScreenPoint(Point2d pp, hEntity he); + bool ConstrainPointByHovered(hEntity pt, const Point2d *projected = NULL); + void DeleteTaggedRequests(); + hRequest AddRequest(Request::Type type, bool rememberForUndo); + hRequest AddRequest(Request::Type type); + + class ParametricCurve { + public: + bool isLine; // else circle + Vector p0, p1; + Vector u, v; + double r, theta0, theta1, dtheta; + + void MakeFromEntity(hEntity he, bool reverse); + Vector PointAt(double t); + Vector TangentAt(double t); + double LengthForAuto(); + + void CreateRequestTrimmedTo(double t, bool reuseOrig, + hEntity orig, hEntity arc, bool arcFinish, bool pointf); + void ConstrainPointIfCoincident(hEntity hpt); + }; + void MakeTangentArc(); + void SplitLinesOrCurves(); + hEntity SplitEntity(hEntity he, Vector pinter); + hEntity SplitLine(hEntity he, Vector pinter); + hEntity SplitCircle(hEntity he, Vector pinter); + hEntity SplitCubic(hEntity he, Vector pinter); + void ReplacePointInConstraints(hEntity oldpt, hEntity newpt); + void RemoveConstraintsForPointBeingDeleted(hEntity hpt); + void FixConstraintsForRequestBeingDeleted(hRequest hr); + void FixConstraintsForPointBeingDeleted(hEntity hpt); + void EditConstraint(hConstraint constraint); + + // A selected entity. + class Selection { + public: + int tag; + + hEntity entity; + hConstraint constraint; + bool emphasized; + + void Draw(bool isHovered, Canvas *canvas); + + void Clear(); + bool IsEmpty(); + bool Equals(Selection *b); + bool HasEndpoints(); + }; + + // A hovered entity, with its location relative to the cursor. + class Hover { + public: + int zIndex; + double distance; + double depth; + Selection selection; + }; + + List hoverList; + Selection hover; + bool hoverWasSelectedOnMousedown; + List selection; + const unsigned MAX_SELECTABLE_FACES = 3u; + + Selection ChooseFromHoverToSelect(); + Selection ChooseFromHoverToDrag(); + void HitTestMakeSelection(Point2d mp); + void ClearSelection(); + void ClearNonexistentSelectionItems(); + /// This structure is filled by a call to GroupSelection(). + struct { + std::vector point; + std::vector entity; + std::vector anyNormal; + std::vector vector; + std::vector face; + std::vector constraint; + int points; + int entities; + int workplanes; + int faces; + int lineSegments; + int circlesOrArcs; + int arcs; + int cubics; + int periodicCubics; + int anyNormals; + int vectors; + int constraints; + int stylables; + int constraintLabels; + int withEndpoints; + int n; ///< Number of selected items + } gs; + void GroupSelection(); + bool IsSelected(Selection *s); + bool IsSelected(hEntity he); + void MakeSelected(hEntity he); + void MakeSelected(hConstraint hc); + void MakeSelected(Selection *s); + void MakeUnselected(hEntity he, bool coincidentPointTrick); + void MakeUnselected(Selection *s, bool coincidentPointTrick); + void SelectByMarquee(); + void ClearSuper(); + + // The toolbar, in toolbar.cpp + bool ToolbarDrawOrHitTest(int x, int y, UiCanvas *canvas, + Command *hitCommand, int *hitX, int *hitY); + void ToolbarDraw(UiCanvas *canvas); + bool ToolbarMouseMoved(int x, int y); + bool ToolbarMouseDown(int x, int y); + Command toolbarHovered; + + + // This sets what gets displayed. + bool showWorkplanes; + bool showNormals; + bool showPoints; + bool showConstruction; + + enum class ShowConstraintMode : unsigned { SCM_NOSHOW, SCM_SHOW_ALL, SCM_SHOW_DIM }; + ShowConstraintMode showConstraints; + + bool showTextWindow; + bool showShaded; + bool showEdges; + bool showOutlines; + bool showFaces; + bool showFacesDrawing; + bool showFacesNonDrawing; + bool showMesh; + void ToggleBool(bool *v); + + enum class DrawOccludedAs : unsigned { INVISIBLE, STIPPLED, VISIBLE }; + DrawOccludedAs drawOccludedAs; + + bool showSnapGrid; + bool dimSolidModel; + void DrawSnapGrid(Canvas *canvas); + + void AddPointToDraggedList(hEntity hp); + void StartDraggingByEntity(hEntity he); + void StartDraggingBySelection(); + void UpdateDraggedNum(Vector *pos, double mx, double my); + void UpdateDraggedPoint(hEntity hp, double mx, double my); + + void Invalidate(bool clearPersistent = false); + void DrawEntities(Canvas *canvas, bool persistent); + void DrawPersistent(Canvas *canvas); + void Draw(Canvas *canvas); + void Paint(); + + bool MouseEvent(Platform::MouseEvent event); + void MouseMoved(double x, double y, bool leftDown, bool middleDown, + bool rightDown, bool shiftDown, bool ctrlDown); + void MouseLeftDown(double x, double y, bool shiftDown, bool ctrlDown); + void MouseLeftUp(double x, double y, bool shiftDown, bool ctrlDown); + void MouseLeftDoubleClick(double x, double y); + void MouseMiddleOrRightDown(double x, double y); + void MouseRightUp(double x, double y); + void MouseScroll(double delta); + void MouseLeave(); + bool KeyboardEvent(Platform::KeyboardEvent event); + void EditControlDone(const std::string &s); + + int64_t last6DofTime; + hGroup last6DofGroup; + void SixDofEvent(Platform::SixDofEvent event); +}; + +} // namespace SolveSpace + +#endif diff --git a/src/undoredo.cpp b/src/undoredo.cpp new file mode 100644 index 0000000..17d1a37 --- /dev/null +++ b/src/undoredo.cpp @@ -0,0 +1,157 @@ +//----------------------------------------------------------------------------- +// The user-visible undo/redo operation; whenever they change something, we +// record our state and push it on a stack, and we pop the stack when they +// select undo. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void SolveSpaceUI::UndoRemember() { + unsaved = true; + PushFromCurrentOnto(&undo); + UndoClearStack(&redo); + UndoEnableMenus(); +} + +void SolveSpaceUI::UndoUndo() { + if(undo.cnt <= 0) return; + + PushFromCurrentOnto(&redo); + PopOntoCurrentFrom(&undo); + UndoEnableMenus(); +} + +void SolveSpaceUI::UndoRedo() { + if(redo.cnt <= 0) return; + + PushFromCurrentOnto(&undo); + PopOntoCurrentFrom(&redo); + UndoEnableMenus(); +} + +void SolveSpaceUI::UndoEnableMenus() { + SS.GW.undoMenuItem->SetEnabled(undo.cnt > 0); + SS.GW.redoMenuItem->SetEnabled(redo.cnt > 0); +} + +void SolveSpaceUI::PushFromCurrentOnto(UndoStack *uk) { + if(uk->cnt == MAX_UNDO) { + UndoClearState(&(uk->d[uk->write])); + // And then write in to this one again + } else { + (uk->cnt)++; + } + + UndoState *ut = &(uk->d[uk->write]); + *ut = {}; + ut->group.ReserveMore(SK.group.n); + for(Group &src : SK.group) { + // Shallow copy + Group dest(src); + // And then clean up all the stuff that needs to be a deep copy, + // and zero out all the dynamic stuff that will get regenerated. + dest.clean = false; + dest.solved = {}; + dest.polyLoops = {}; + dest.bezierLoops = {}; + dest.bezierOpens = {}; + dest.polyError = {}; + dest.thisMesh = {}; + dest.runningMesh = {}; + dest.thisShell = {}; + dest.runningShell = {}; + dest.displayMesh = {}; + dest.displayOutlines = {}; + + dest.remap = src.remap; + + dest.impMesh = {}; + dest.impShell = {}; + dest.impEntity = {}; + ut->group.Add(&dest); + } + for(auto &src : SK.groupOrder) { ut->groupOrder.Add(&src); } + ut->request.ReserveMore(SK.request.n); + for(auto &src : SK.request) { ut->request.Add(&src); } + ut->constraint.ReserveMore(SK.constraint.n); + for(auto &src : SK.constraint) { + // Shallow copy + Constraint dest(src); + ut->constraint.Add(&dest); + } + ut->param.ReserveMore(SK.param.n); + for(auto &src : SK.param) { ut->param.Add(&src); } + ut->style.ReserveMore(SK.style.n); + for(auto &src : SK.style) { ut->style.Add(&src); } + ut->activeGroup = SS.GW.activeGroup; + + uk->write = WRAP(uk->write + 1, MAX_UNDO); +} + +void SolveSpaceUI::PopOntoCurrentFrom(UndoStack *uk) { + ssassert(uk->cnt > 0, "Cannot pop from empty undo stack"); + (uk->cnt)--; + uk->write = WRAP(uk->write - 1, MAX_UNDO); + + UndoState *ut = &(uk->d[uk->write]); + + // Free everything in the main copy of the program before replacing it + for(hGroup hg : SK.groupOrder) { + Group *g = SK.GetGroup(hg); + g->Clear(); + } + SK.group.Clear(); + SK.groupOrder.Clear(); + SK.request.Clear(); + SK.constraint.Clear(); + SK.param.Clear(); + SK.style.Clear(); + + // And then do a shallow copy of the state from the undo list + ut->group.MoveSelfInto(&(SK.group)); + for(auto &gh : ut->groupOrder) { SK.groupOrder.Add(&gh); } + ut->request.MoveSelfInto(&(SK.request)); + ut->constraint.MoveSelfInto(&(SK.constraint)); + ut->param.MoveSelfInto(&(SK.param)); + ut->style.MoveSelfInto(&(SK.style)); + SS.GW.activeGroup = ut->activeGroup; + + // No need to free it, since a shallow copy was made above + *ut = {}; + + // And reset the state everywhere else in the program, since the + // sketch just changed a lot. + SS.GW.ClearSuper(); + SS.TW.ClearSuper(); + SS.ReloadAllLinked(SS.saveFile); + SS.GenerateAll(SolveSpaceUI::Generate::ALL); + SS.ScheduleShowTW(); + + // Activate the group that was active before. + Group *activeGroup = SK.GetGroup(SS.GW.activeGroup); + activeGroup->Activate(); +} + +void SolveSpaceUI::UndoClearStack(UndoStack *uk) { + while(uk->cnt > 0) { + uk->write = WRAP(uk->write - 1, MAX_UNDO); + (uk->cnt)--; + UndoClearState(&(uk->d[uk->write])); + } + *uk = {}; // for good measure +} + +void SolveSpaceUI::UndoClearState(UndoState *ut) { + for(auto &g : ut->group) { g.remap.clear(); } + ut->group.Clear(); + ut->request.Clear(); + ut->constraint.Clear(); + ut->param.Clear(); + ut->style.Clear(); + *ut = {}; +} + +} // namespace SolveSpace diff --git a/src/util.cpp b/src/util.cpp new file mode 100644 index 0000000..d1ea15a --- /dev/null +++ b/src/util.cpp @@ -0,0 +1,1081 @@ +//----------------------------------------------------------------------------- +// Utility functions, mostly various kinds of vector math (working on real +// numbers, not working on quantities in the symbolic algebra system). +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include +#include +#include +#include + +#include "solvespace.h" + +namespace SolveSpace { + +void AssertFailure(const char *file, unsigned line, const char *function, + const char *condition, const char *message) { + std::string formattedMsg; + formattedMsg += ssprintf("File %s, line %u, function %s:\n", file, line, function); + formattedMsg += ssprintf("Assertion failed: %s.\n", condition); + formattedMsg += ssprintf("Message: %s.\n", message); + Platform::FatalError(formattedMsg); +} + +std::string ssprintf(const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + int size = vsnprintf(NULL, 0, fmt, va); + ssassert(size >= 0, "vsnprintf could not encode string"); + va_end(va); + + std::string result; + result.resize(size + 1); + + va_start(va, fmt); + vsnprintf(&result[0], size + 1, fmt, va); + va_end(va); + + result.resize(size); + return result; +} + +char32_t utf8_iterator::operator*() +{ + const uint8_t *it = (const uint8_t*) this->p; + char32_t result = *it; + + if((result & 0x80) != 0) { + unsigned int mask = 0x40; + + do { + result <<= 6; + unsigned int c = (*++it); + mask <<= 5; + result += c - 0x80; + } while((result & mask) != 0); + + result &= mask - 1; + } + + this->n = (const char*) (it + 1); + return result; +} + +int64_t GetMilliseconds() +{ + auto timestamp = std::chrono::steady_clock::now().time_since_epoch(); + return std::chrono::duration_cast(timestamp).count(); +} + +void MakeMatrix(double *mat, + double a11, double a12, double a13, double a14, + double a21, double a22, double a23, double a24, + double a31, double a32, double a33, double a34, + double a41, double a42, double a43, double a44) +{ + mat[ 0] = a11; + mat[ 1] = a21; + mat[ 2] = a31; + mat[ 3] = a41; + mat[ 4] = a12; + mat[ 5] = a22; + mat[ 6] = a32; + mat[ 7] = a42; + mat[ 8] = a13; + mat[ 9] = a23; + mat[10] = a33; + mat[11] = a43; + mat[12] = a14; + mat[13] = a24; + mat[14] = a34; + mat[15] = a44; +} + +void MultMatrix(double *mata, double *matb, double *matr) { + for(int i = 0; i < 4; i++) { + for(int j = 0; j < 4; j++) { + double s = 0.0; + for(int k = 0; k < 4; k++) { + s += mata[k * 4 + j] * matb[i * 4 + k]; + } + matr[i * 4 + j] = s; + } + } +} + +//----------------------------------------------------------------------------- +// Format the string for our message box appropriately, and then display +// that string. +//----------------------------------------------------------------------------- +static void MessageBox(const char *fmt, va_list va, bool error, + std::function onDismiss = std::function()) +{ +#ifndef LIBRARY + va_list va_size; + va_copy(va_size, va); + int size = vsnprintf(NULL, 0, fmt, va_size); + ssassert(size >= 0, "vsnprintf could not encode string"); + va_end(va_size); + + std::string text; + text.resize(size); + + vsnprintf(&text[0], size + 1, fmt, va); + + // Split message text using a heuristic for better presentation. + size_t separatorAt = 0; + while(separatorAt != std::string::npos) { + size_t dotAt = text.find('.', separatorAt + 1), + colonAt = text.find(':', separatorAt + 1); + separatorAt = min(dotAt, colonAt); + if(separatorAt == std::string::npos || + (separatorAt + 1 < text.size() && isspace(text[separatorAt + 1]))) { + break; + } + } + std::string message = text; + std::string description; + if(separatorAt != std::string::npos) { + message = text.substr(0, separatorAt + 1); + if(separatorAt + 1 < text.size()) { + description = text.substr(separatorAt + 1); + } + } + + if(description.length() > 0) { + std::string::iterator it = description.begin(); + while(isspace(*it)) it++; + description = description.substr(it - description.begin()); + } + + Platform::MessageDialogRef dialog = CreateMessageDialog(SS.GW.window); + if (!dialog) { + if (error) { + fprintf(stderr, "Error: %s\n", message.c_str()); + } else { + fprintf(stderr, "Message: %s\n", message.c_str()); + } + if(onDismiss) { + onDismiss(); + } + return; + } + using Platform::MessageDialog; + if(error) { + dialog->SetType(MessageDialog::Type::ERROR); + } else { + dialog->SetType(MessageDialog::Type::INFORMATION); + } + dialog->SetTitle(error ? C_("title", "Error") : C_("title", "Message")); + dialog->SetMessage(message); + if(!description.empty()) { + dialog->SetDescription(description); + } + dialog->AddButton(C_("button", "&OK"), MessageDialog::Response::OK, + /*isDefault=*/true); + + dialog->onResponse = [=](MessageDialog::Response _response) { + if(onDismiss) { + onDismiss(); + } + }; + dialog->ShowModal(); +#endif +} +void Error(const char *fmt, ...) +{ + va_list f; + va_start(f, fmt); + MessageBox(fmt, f, /*error=*/true); + va_end(f); +} +void Message(const char *fmt, ...) +{ + va_list f; + va_start(f, fmt); + MessageBox(fmt, f, /*error=*/false); + va_end(f); +} +void MessageAndRun(std::function onDismiss, const char *fmt, ...) +{ + va_list f; + va_start(f, fmt); + MessageBox(fmt, f, /*error=*/false, onDismiss); + va_end(f); +} + +//----------------------------------------------------------------------------- +// Solve a mostly banded matrix. In a given row, there are LEFT_OF_DIAG +// elements to the left of the diagonal element, and RIGHT_OF_DIAG elements to +// the right (so that the total band width is LEFT_OF_DIAG + RIGHT_OF_DIAG + 1). +// There also may be elements in the last two columns of any row. We solve +// without pivoting. +//----------------------------------------------------------------------------- +void BandedMatrix::Solve() { + int i, ip, j, jp; + double temp; + + // Reduce the matrix to upper triangular form. + for(i = 0; i < n; i++) { + for(ip = i+1; ip < n && ip <= (i + LEFT_OF_DIAG); ip++) { + temp = A[ip][i]/A[i][i]; + + for(jp = i; jp < (n - 2) && jp <= (i + RIGHT_OF_DIAG); jp++) { + A[ip][jp] -= temp*(A[i][jp]); + } + A[ip][n-2] -= temp*(A[i][n-2]); + A[ip][n-1] -= temp*(A[i][n-1]); + + B[ip] -= temp*B[i]; + } + } + + // And back-substitute. + for(i = n - 1; i >= 0; i--) { + temp = B[i]; + + if(i < n-1) temp -= X[n-1]*A[i][n-1]; + if(i < n-2) temp -= X[n-2]*A[i][n-2]; + + for(j = min(n - 3, i + RIGHT_OF_DIAG); j > i; j--) { + temp -= X[j]*A[i][j]; + } + X[i] = temp / A[i][i]; + } +} + +const Quaternion Quaternion::IDENTITY = { 1, 0, 0, 0 }; + +Quaternion Quaternion::From(double w, double vx, double vy, double vz) { + Quaternion q; + q.w = w; + q.vx = vx; + q.vy = vy; + q.vz = vz; + return q; +} + +Quaternion Quaternion::From(hParam w, hParam vx, hParam vy, hParam vz) { + Quaternion q; + q.w = SK.GetParam(w )->val; + q.vx = SK.GetParam(vx)->val; + q.vy = SK.GetParam(vy)->val; + q.vz = SK.GetParam(vz)->val; + return q; +} + +Quaternion Quaternion::From(Vector axis, double dtheta) { + Quaternion q; + double c = cos(dtheta / 2), s = sin(dtheta / 2); + axis = axis.WithMagnitude(s); + q.w = c; + q.vx = axis.x; + q.vy = axis.y; + q.vz = axis.z; + return q; +} + +Quaternion Quaternion::From(Vector u, Vector v) +{ + Vector n = u.Cross(v); + + Quaternion q; + double s, tr = 1 + u.x + v.y + n.z; + if(tr > 1e-4) { + s = 2*sqrt(tr); + q.w = s/4; + q.vx = (v.z - n.y)/s; + q.vy = (n.x - u.z)/s; + q.vz = (u.y - v.x)/s; + } else { + if(u.x > v.y && u.x > n.z) { + s = 2*sqrt(1 + u.x - v.y - n.z); + q.w = (v.z - n.y)/s; + q.vx = s/4; + q.vy = (u.y + v.x)/s; + q.vz = (n.x + u.z)/s; + } else if(v.y > n.z) { + s = 2*sqrt(1 - u.x + v.y - n.z); + q.w = (n.x - u.z)/s; + q.vx = (u.y + v.x)/s; + q.vy = s/4; + q.vz = (v.z + n.y)/s; + } else { + s = 2*sqrt(1 - u.x - v.y + n.z); + q.w = (u.y - v.x)/s; + q.vx = (n.x + u.z)/s; + q.vy = (v.z + n.y)/s; + q.vz = s/4; + } + } + + return q.WithMagnitude(1); +} + +Quaternion Quaternion::Plus(Quaternion b) const { + Quaternion q; + q.w = w + b.w; + q.vx = vx + b.vx; + q.vy = vy + b.vy; + q.vz = vz + b.vz; + return q; +} + +Quaternion Quaternion::Minus(Quaternion b) const { + Quaternion q; + q.w = w - b.w; + q.vx = vx - b.vx; + q.vy = vy - b.vy; + q.vz = vz - b.vz; + return q; +} + +Quaternion Quaternion::ScaledBy(double s) const { + Quaternion q; + q.w = w*s; + q.vx = vx*s; + q.vy = vy*s; + q.vz = vz*s; + return q; +} + +double Quaternion::Magnitude() const { + return sqrt(w*w + vx*vx + vy*vy + vz*vz); +} + +Quaternion Quaternion::WithMagnitude(double s) const { + return ScaledBy(s/Magnitude()); +} + +Vector Quaternion::RotationU() const { + Vector v; + v.x = w*w + vx*vx - vy*vy - vz*vz; + v.y = 2*w *vz + 2*vx*vy; + v.z = 2*vx*vz - 2*w *vy; + return v; +} + +Vector Quaternion::RotationV() const { + Vector v; + v.x = 2*vx*vy - 2*w*vz; + v.y = w*w - vx*vx + vy*vy - vz*vz; + v.z = 2*w*vx + 2*vy*vz; + return v; +} + +Vector Quaternion::RotationN() const { + Vector v; + v.x = 2*w*vy + 2*vx*vz; + v.y = 2*vy*vz - 2*w*vx; + v.z = w*w - vx*vx - vy*vy + vz*vz; + return v; +} + +Vector Quaternion::Rotate(Vector p) const { + // Express the point in the new basis + return (RotationU().ScaledBy(p.x)).Plus( + RotationV().ScaledBy(p.y)).Plus( + RotationN().ScaledBy(p.z)); +} + +Quaternion Quaternion::Inverse() const { + Quaternion r; + r.w = w; + r.vx = -vx; + r.vy = -vy; + r.vz = -vz; + return r.WithMagnitude(1); // not that the normalize should be reqd +} + +Quaternion Quaternion::ToThe(double p) const { + // Avoid division by zero, or arccos of something not in its domain + if(w >= (1 - 1e-6)) { + return From(1, 0, 0, 0); + } else if(w <= (-1 + 1e-6)) { + return From(-1, 0, 0, 0); + } + + Quaternion r; + Vector axis = Vector::From(vx, vy, vz); + double theta = acos(w); // okay, since magnitude is 1, so -1 <= w <= 1 + theta *= p; + r.w = cos(theta); + axis = axis.WithMagnitude(sin(theta)); + r.vx = axis.x; + r.vy = axis.y; + r.vz = axis.z; + return r; +} + +Quaternion Quaternion::Times(Quaternion b) const { + double sa = w, sb = b.w; + Vector va = { vx, vy, vz }; + Vector vb = { b.vx, b.vy, b.vz }; + + Quaternion r; + r.w = sa*sb - va.Dot(vb); + Vector vr = vb.ScaledBy(sa).Plus( + va.ScaledBy(sb).Plus( + va.Cross(vb))); + r.vx = vr.x; + r.vy = vr.y; + r.vz = vr.z; + return r; +} + +Quaternion Quaternion::Mirror() const { + Vector u = RotationU(), + v = RotationV(); + u = u.ScaledBy(-1); + v = v.ScaledBy(-1); + return Quaternion::From(u, v); +} + + +Vector Vector::From(hParam x, hParam y, hParam z) { + Vector v; + v.x = SK.GetParam(x)->val; + v.y = SK.GetParam(y)->val; + v.z = SK.GetParam(z)->val; + return v; +} + +bool Vector::EqualsExactly(Vector v) const { + return EXACT(x == v.x && + y == v.y && + z == v.z); +} + +double Vector::DirectionCosineWith(Vector b) const { + Vector a = this->WithMagnitude(1); + b = b.WithMagnitude(1); + return a.Dot(b); +} + +Vector Vector::Normal(int which) const { + Vector n; + + // Arbitrarily choose one vector that's normal to us, pivoting + // appropriately. + double xa = fabs(x), ya = fabs(y), za = fabs(z); + if(this->Equals(Vector::From(0, 0, 1))) { + // Make DXFs exported in the XY plane work nicely... + n = Vector::From(1, 0, 0); + } else if(xa < ya && xa < za) { + n.x = 0; + n.y = z; + n.z = -y; + } else if(ya < za) { + n.x = -z; + n.y = 0; + n.z = x; + } else { + n.x = y; + n.y = -x; + n.z = 0; + } + + if(which == 0) { + // That's the vector we return. + } else if(which == 1) { + n = this->Cross(n); + } else ssassert(false, "Unexpected vector normal index"); + + n = n.WithMagnitude(1); + + return n; +} + +Vector Vector::RotatedAbout(Vector orig, Vector axis, double theta) const { + Vector r = this->Minus(orig); + r = r.RotatedAbout(axis, theta); + return r.Plus(orig); +} + +Vector Vector::RotatedAbout(Vector axis, double theta) const { + double c = cos(theta); + double s = sin(theta); + + axis = axis.WithMagnitude(1); + + Vector r; + + r.x = (x)*(c + (1 - c)*(axis.x)*(axis.x)) + + (y)*((1 - c)*(axis.x)*(axis.y) - s*(axis.z)) + + (z)*((1 - c)*(axis.x)*(axis.z) + s*(axis.y)); + + r.y = (x)*((1 - c)*(axis.y)*(axis.x) + s*(axis.z)) + + (y)*(c + (1 - c)*(axis.y)*(axis.y)) + + (z)*((1 - c)*(axis.y)*(axis.z) - s*(axis.x)); + + r.z = (x)*((1 - c)*(axis.z)*(axis.x) - s*(axis.y)) + + (y)*((1 - c)*(axis.z)*(axis.y) + s*(axis.x)) + + (z)*(c + (1 - c)*(axis.z)*(axis.z)); + + return r; +} + +Vector Vector::DotInToCsys(Vector u, Vector v, Vector n) const { + Vector r = { + this->Dot(u), + this->Dot(v), + this->Dot(n) + }; + return r; +} + +Vector Vector::ScaleOutOfCsys(Vector u, Vector v, Vector n) const { + Vector r = u.ScaledBy(x).Plus( + v.ScaledBy(y).Plus( + n.ScaledBy(z))); + return r; +} + +Vector Vector::InPerspective(Vector u, Vector v, Vector n, + Vector origin, double cameraTan) const +{ + Vector r = this->Minus(origin); + r = r.DotInToCsys(u, v, n); + // yes, minus; we are assuming a csys where u cross v equals n, backwards + // from the display stuff + double w = (1 - r.z*cameraTan); + r = r.ScaledBy(1/w); + + return r; +} + +double Vector::DistanceToLine(Vector p0, Vector dp) const { + double m = dp.Magnitude(); + return ((this->Minus(p0)).Cross(dp)).Magnitude() / m; +} + +double Vector::DistanceToPlane(Vector normal, Vector origin) const { + return this->Dot(normal) - origin.Dot(normal); +} + +bool Vector::OnLineSegment(Vector a, Vector b, double tol) const { + if(this->Equals(a, tol) || this->Equals(b, tol)) return true; + + Vector d = b.Minus(a); + + double m = d.MagSquared(); + double distsq = ((this->Minus(a)).Cross(d)).MagSquared() / m; + + if(distsq >= tol*tol) return false; + + double t = (this->Minus(a)).DivProjected(d); + // On-endpoint already tested + if(t < 0 || t > 1) return false; + return true; +} + +Vector Vector::ClosestPointOnLine(Vector p0, Vector dp) const { + dp = dp.WithMagnitude(1); + // this, p0, and (p0+dp) define a plane; the min distance is in + // that plane, so calculate its normal + Vector pn = (this->Minus(p0)).Cross(dp); + // The minimum distance line is in that plane, perpendicular + // to the line + Vector n = pn.Cross(dp); + + // Calculate the actual distance + double d = (dp.Cross(p0.Minus(*this))).Magnitude(); + return this->Plus(n.WithMagnitude(d)); +} + +Vector Vector::WithMagnitude(double v) const { + double m = Magnitude(); + if(EXACT(m == 0)) { + // We can do a zero vector with zero magnitude, but not any other cases. + if(fabs(v) > 1e-100) { + dbp("Vector::WithMagnitude(%g) of zero vector!", v); + } + return From(0, 0, 0); + } else { + return ScaledBy(v/m); + } +} + +Vector Vector::ProjectVectorInto(hEntity wrkpl) const { + EntityBase *w = SK.GetEntity(wrkpl); + Vector u = w->Normal()->NormalU(); + Vector v = w->Normal()->NormalV(); + + double up = this->Dot(u); + double vp = this->Dot(v); + + return (u.ScaledBy(up)).Plus(v.ScaledBy(vp)); +} + +Vector Vector::ProjectInto(hEntity wrkpl) const { + EntityBase *w = SK.GetEntity(wrkpl); + Vector p0 = w->WorkplaneGetOffset(); + + Vector f = this->Minus(p0); + + return p0.Plus(f.ProjectVectorInto(wrkpl)); +} + +Point2d Vector::Project2d(Vector u, Vector v) const { + Point2d p; + p.x = this->Dot(u); + p.y = this->Dot(v); + return p; +} + +Point2d Vector::ProjectXy() const { + Point2d p; + p.x = x; + p.y = y; + return p; +} + +Vector4 Vector::Project4d() const { + return Vector4::From(1, x, y, z); +} + +double Vector::DivProjected(Vector delta) const { + return (x*delta.x + y*delta.y + z*delta.z) + / (delta.x*delta.x + delta.y*delta.y + delta.z*delta.z); +} + +Vector Vector::ClosestOrtho() const { + double mx = fabs(x), my = fabs(y), mz = fabs(z); + + if(mx > my && mx > mz) { + return From((x > 0) ? 1 : -1, 0, 0); + } else if(my > mz) { + return From(0, (y > 0) ? 1 : -1, 0); + } else { + return From(0, 0, (z > 0) ? 1 : -1); + } +} + +Vector Vector::ClampWithin(double minv, double maxv) const { + Vector ret = *this; + + if(ret.x < minv) ret.x = minv; + if(ret.y < minv) ret.y = minv; + if(ret.z < minv) ret.z = minv; + + if(ret.x > maxv) ret.x = maxv; + if(ret.y > maxv) ret.y = maxv; + if(ret.z > maxv) ret.z = maxv; + + return ret; +} + +bool Vector::OutsideAndNotOn(Vector maxv, Vector minv) const { + return (x > maxv.x + LENGTH_EPS) || (x < minv.x - LENGTH_EPS) || + (y > maxv.y + LENGTH_EPS) || (y < minv.y - LENGTH_EPS) || + (z > maxv.z + LENGTH_EPS) || (z < minv.z - LENGTH_EPS); +} + +bool Vector::BoundingBoxesDisjoint(Vector amax, Vector amin, + Vector bmax, Vector bmin) +{ + int i; + for(i = 0; i < 3; i++) { + if(amax.Element(i) < bmin.Element(i) - LENGTH_EPS) return true; + if(amin.Element(i) > bmax.Element(i) + LENGTH_EPS) return true; + } + return false; +} + +bool Vector::BoundingBoxIntersectsLine(Vector amax, Vector amin, + Vector p0, Vector p1, bool asSegment) +{ + Vector dp = p1.Minus(p0); + double lp = dp.Magnitude(); + dp = dp.ScaledBy(1.0/lp); + + int i, a; + for(i = 0; i < 3; i++) { + int j = WRAP(i+1, 3), k = WRAP(i+2, 3); + if(lp*fabs(dp.Element(i)) < LENGTH_EPS) continue; // parallel to plane + + for(a = 0; a < 2; a++) { + double d = (a == 0) ? amax.Element(i) : amin.Element(i); + // n dot (p0 + t*dp) = d + // (n dot p0) + t * (n dot dp) = d + double t = (d - p0.Element(i)) / dp.Element(i); + Vector p = p0.Plus(dp.ScaledBy(t)); + + if(asSegment && (t < -LENGTH_EPS || t > (lp+LENGTH_EPS))) continue; + + if(p.Element(j) > amax.Element(j) + LENGTH_EPS) continue; + if(p.Element(k) > amax.Element(k) + LENGTH_EPS) continue; + + if(p.Element(j) < amin.Element(j) - LENGTH_EPS) continue; + if(p.Element(k) < amin.Element(k) - LENGTH_EPS) continue; + + return true; + } + } + + return false; +} + +Vector Vector::AtIntersectionOfPlanes(Vector n1, double d1, + Vector n2, double d2) +{ + double det = (n1.Dot(n1))*(n2.Dot(n2)) - + (n1.Dot(n2))*(n1.Dot(n2)); + double c1 = (d1*n2.Dot(n2) - d2*n1.Dot(n2))/det; + double c2 = (d2*n1.Dot(n1) - d1*n1.Dot(n2))/det; + + return (n1.ScaledBy(c1)).Plus(n2.ScaledBy(c2)); +} + +void Vector::ClosestPointBetweenLines(Vector a0, Vector da, + Vector b0, Vector db, + double *ta, double *tb) +{ + // Make a semi-orthogonal coordinate system from those directions; + // note that dna and dnb need not be perpendicular. + Vector dn = da.Cross(db); // normal to both + Vector dna = dn.Cross(da); // normal to da + Vector dnb = dn.Cross(db); // normal to db + + // At the intersection of the lines + // a0 + pa*da = b0 + pb*db (where pa, pb are scalar params) + // So dot this equation against dna and dnb to get two equations + // to solve for da and db + *tb = ((a0.Minus(b0)).Dot(dna))/(db.Dot(dna)); + *ta = -((a0.Minus(b0)).Dot(dnb))/(da.Dot(dnb)); +} + +Vector Vector::AtIntersectionOfLines(Vector a0, Vector a1, + Vector b0, Vector b1, + bool *skew, + double *parama, double *paramb) +{ + Vector da = a1.Minus(a0), db = b1.Minus(b0); + + double pa, pb; + Vector::ClosestPointBetweenLines(a0, da, b0, db, &pa, &pb); + + if(parama) *parama = pa; + if(paramb) *paramb = pb; + + // And from either of those, we get the intersection point. + Vector pi = a0.Plus(da.ScaledBy(pa)); + + if(skew) { + // Check if the intersection points on each line are actually + // coincident... + if(pi.Equals(b0.Plus(db.ScaledBy(pb)))) { + *skew = false; + } else { + *skew = true; + } + } + return pi; +} + +Vector Vector::AtIntersectionOfPlaneAndLine(Vector n, double d, + Vector p0, Vector p1, + bool *parallel) +{ + Vector dp = p1.Minus(p0); + + if(fabs(n.Dot(dp)) < LENGTH_EPS) { + if(parallel) *parallel = true; + return Vector::From(0, 0, 0); + } + + if(parallel) *parallel = false; + + // n dot (p0 + t*dp) = d + // (n dot p0) + t * (n dot dp) = d + double t = (d - n.Dot(p0)) / (n.Dot(dp)); + + return p0.Plus(dp.ScaledBy(t)); +} + +static double det2(double a1, double b1, + double a2, double b2) +{ + return (a1*b2) - (b1*a2); +} +static double det3(double a1, double b1, double c1, + double a2, double b2, double c2, + double a3, double b3, double c3) +{ + return a1*det2(b2, c2, b3, c3) - + b1*det2(a2, c2, a3, c3) + + c1*det2(a2, b2, a3, b3); +} +Vector Vector::AtIntersectionOfPlanes(Vector na, double da, + Vector nb, double db, + Vector nc, double dc, + bool *parallel) +{ + double det = det3(na.x, na.y, na.z, + nb.x, nb.y, nb.z, + nc.x, nc.y, nc.z); + if(fabs(det) < 1e-10) { // arbitrary tolerance, not so good + *parallel = true; + return Vector::From(0, 0, 0); + } + *parallel = false; + + double detx = det3(da, na.y, na.z, + db, nb.y, nb.z, + dc, nc.y, nc.z); + + double dety = det3(na.x, da, na.z, + nb.x, db, nb.z, + nc.x, dc, nc.z); + + double detz = det3(na.x, na.y, da, + nb.x, nb.y, db, + nc.x, nc.y, dc ); + + return Vector::From(detx/det, dety/det, detz/det); +} + +size_t VectorHash::operator()(const Vector &v) const { + const size_t size = (size_t)pow(std::numeric_limits::max(), 1.0 / 3.0) - 1; + const double eps = 4.0 * LENGTH_EPS; + + double x = fabs(v.x) / eps; + double y = fabs(v.y) / eps; + double z = fabs(v.y) / eps; + + size_t xs = size_t(fmod(x, (double)size)); + size_t ys = size_t(fmod(y, (double)size)); + size_t zs = size_t(fmod(z, (double)size)); + + return (zs * size + ys) * size + xs; +} + +bool VectorPred::operator()(Vector a, Vector b) const { + return a.Equals(b, LENGTH_EPS); +} + +Vector4 Vector4::From(double w, double x, double y, double z) { + Vector4 ret; + ret.w = w; + ret.x = x; + ret.y = y; + ret.z = z; + return ret; +} + +Vector4 Vector4::From(double w, Vector v) { + return Vector4::From(w, w*v.x, w*v.y, w*v.z); +} + +Vector4 Vector4::Blend(Vector4 a, Vector4 b, double t) { + return (a.ScaledBy(1 - t)).Plus(b.ScaledBy(t)); +} + +Vector4 Vector4::Plus(Vector4 b) const { + return Vector4::From(w + b.w, x + b.x, y + b.y, z + b.z); +} + +Vector4 Vector4::Minus(Vector4 b) const { + return Vector4::From(w - b.w, x - b.x, y - b.y, z - b.z); +} + +Vector4 Vector4::ScaledBy(double s) const { + return Vector4::From(w*s, x*s, y*s, z*s); +} + +Vector Vector4::PerspectiveProject() const { + return Vector::From(x / w, y / w, z / w); +} + +Point2d Point2d::From(double x, double y) { + return { x, y }; +} + +Point2d Point2d::FromPolar(double r, double a) { + return { r * cos(a), r * sin(a) }; +} + +double Point2d::Angle() const { + double a = atan2(y, x); + return M_PI + remainder(a - M_PI, 2 * M_PI); +} + +double Point2d::AngleTo(const Point2d &p) const { + return p.Minus(*this).Angle(); +} + +Point2d Point2d::Plus(const Point2d &b) const { + return { x + b.x, y + b.y }; +} + +Point2d Point2d::Minus(const Point2d &b) const { + return { x - b.x, y - b.y }; +} + +Point2d Point2d::ScaledBy(double s) const { + return { x * s, y * s }; +} + +double Point2d::DivProjected(Point2d delta) const { + return (x*delta.x + y*delta.y) / (delta.x*delta.x + delta.y*delta.y); +} + +double Point2d::MagSquared() const { + return x*x + y*y; +} + +double Point2d::Magnitude() const { + return sqrt(x*x + y*y); +} + +Point2d Point2d::WithMagnitude(double v) const { + double m = Magnitude(); + if(m < 1e-20) { + dbp("!!! WithMagnitude() of zero vector"); + return { v, 0 }; + } + return { x * v / m, y * v / m }; +} + +double Point2d::DistanceTo(const Point2d &p) const { + double dx = x - p.x; + double dy = y - p.y; + return sqrt(dx*dx + dy*dy); +} + +double Point2d::Dot(Point2d p) const { + return x*p.x + y*p.y; +} + +double Point2d::DistanceToLine(const Point2d &p0, const Point2d &dp, bool asSegment) const { + double m = dp.x*dp.x + dp.y*dp.y; + if(m < LENGTH_EPS*LENGTH_EPS) return VERY_POSITIVE; + + // Let our line be p = p0 + t*dp, for a scalar t from 0 to 1 + double t = (dp.x*(x - p0.x) + dp.y*(y - p0.y))/m; + + if(asSegment) { + if(t < 0.0) return DistanceTo(p0); + if(t > 1.0) return DistanceTo(p0.Plus(dp)); + } + Point2d closest = p0.Plus(dp.ScaledBy(t)); + return DistanceTo(closest); +} + +double Point2d::DistanceToLineSigned(const Point2d &p0, const Point2d &dp, bool asSegment) const { + double m = dp.x*dp.x + dp.y*dp.y; + if(m < LENGTH_EPS*LENGTH_EPS) return VERY_POSITIVE; + + Point2d n = dp.Normal().WithMagnitude(1.0); + double dist = n.Dot(*this) - n.Dot(p0); + if(asSegment) { + // Let our line be p = p0 + t*dp, for a scalar t from 0 to 1 + double t = (dp.x*(x - p0.x) + dp.y*(y - p0.y))/m; + double sign = (dist > 0.0) ? 1.0 : -1.0; + if(t < 0.0) return DistanceTo(p0) * sign; + if(t > 1.0) return DistanceTo(p0.Plus(dp)) * sign; + } + + return dist; +} + +Point2d Point2d::Normal() const { + return { y, -x }; +} + +bool Point2d::Equals(Point2d v, double tol) const { + double dx = v.x - x; if(dx < -tol || dx > tol) return false; + double dy = v.y - y; if(dy < -tol || dy > tol) return false; + + return (this->Minus(v)).MagSquared() < tol*tol; +} + +BBox BBox::From(const Vector &p0, const Vector &p1) { + BBox bbox; + bbox.minp.x = min(p0.x, p1.x); + bbox.minp.y = min(p0.y, p1.y); + bbox.minp.z = min(p0.z, p1.z); + + bbox.maxp.x = max(p0.x, p1.x); + bbox.maxp.y = max(p0.y, p1.y); + bbox.maxp.z = max(p0.z, p1.z); + return bbox; +} + +Vector BBox::GetOrigin() const { return minp.Plus(maxp.Minus(minp).ScaledBy(0.5)); } +Vector BBox::GetExtents() const { return maxp.Minus(minp).ScaledBy(0.5); } + +void BBox::Include(const Vector &v, double r) { + minp.x = min(minp.x, v.x - r); + minp.y = min(minp.y, v.y - r); + minp.z = min(minp.z, v.z - r); + + maxp.x = max(maxp.x, v.x + r); + maxp.y = max(maxp.y, v.y + r); + maxp.z = max(maxp.z, v.z + r); +} + +bool BBox::Overlaps(const BBox &b1) const { + Vector t = b1.GetOrigin().Minus(GetOrigin()); + Vector e = b1.GetExtents().Plus(GetExtents()); + + return fabs(t.x) < e.x && fabs(t.y) < e.y && fabs(t.z) < e.z; +} + +bool BBox::Contains(const Point2d &p, double r) const { + return p.x >= (minp.x - r) && + p.y >= (minp.y - r) && + p.x <= (maxp.x + r) && + p.y <= (maxp.y + r); +} + +const std::vector& StipplePatternDashes(StipplePattern pattern) { + static bool initialized; + static std::vector dashes[(size_t)StipplePattern::LAST + 1]; + if(!initialized) { + // Inkscape ignores all elements that are exactly zero instead of drawing + // them as dots, so set those to 1e-6. + dashes[(size_t)StipplePattern::CONTINUOUS] = + {}; + dashes[(size_t)StipplePattern::SHORT_DASH] = + { 1.0, 2.0 }; + dashes[(size_t)StipplePattern::DASH] = + { 1.0, 1.0 }; + dashes[(size_t)StipplePattern::DASH_DOT] = + { 1.0, 0.5, 1e-6, 0.5 }; + dashes[(size_t)StipplePattern::DASH_DOT_DOT] = + { 1.0, 0.5, 1e-6, 0.5, 1e-6, 0.5 }; + dashes[(size_t)StipplePattern::DOT] = + { 1e-6, 0.5 }; + dashes[(size_t)StipplePattern::LONG_DASH] = + { 2.0, 0.5 }; + dashes[(size_t)StipplePattern::FREEHAND] = + { 1.0, 2.0 }; + dashes[(size_t)StipplePattern::ZIGZAG] = + { 1.0, 2.0 }; + } + + return dashes[(size_t)pattern]; +} + +double StipplePatternLength(StipplePattern pattern) { + static bool initialized; + static double lengths[(size_t)StipplePattern::LAST + 1]; + if(!initialized) { + for(size_t i = 0; i < (size_t)StipplePattern::LAST; i++) { + const std::vector &dashes = StipplePatternDashes((StipplePattern)i); + double length = 0.0; + for(double dash : dashes) { + length += dash; + } + lengths[i] = length; + } + } + + return lengths[(size_t)pattern]; +} + +} // namespace SolveSpace diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..585b5de --- /dev/null +++ b/src/util.h @@ -0,0 +1,105 @@ +#ifndef SOLVESPACE_UTIL_H +#define SOLVESPACE_UTIL_H + +#include +#include +#include +#include +#include +#include + +// The few floating-point equality comparisons in SolveSpace have been +// carefully considered, so we disable the -Wfloat-equal warning for them +#ifdef __clang__ +# define EXACT(expr) \ + (_Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wfloat-equal\"") \ + (expr) \ + _Pragma("clang diagnostic pop")) +#else +# define EXACT(expr) (expr) +#endif + +// Debugging functions +#if defined(__GNUC__) +#define ssassert(condition, message) \ + do { \ + if(__builtin_expect((condition), true) == false) { \ + SolveSpace::AssertFailure(__FILE__, __LINE__, __func__, #condition, message); \ + __builtin_unreachable(); \ + } \ + } while(0) +#else +#define ssassert(condition, message) \ + do { \ + if((condition) == false) { \ + SolveSpace::AssertFailure(__FILE__, __LINE__, __func__, #condition, message); \ + std::abort(); \ + } \ + } while(0) +#endif + +#define CO(v) (v).x, (v).y, (v).z + +#define dbp SolveSpace::Platform::DebugPrint + +namespace SolveSpace { + +namespace Platform { + +// Debug print function. +void DebugPrint(const char *fmt, ...); + +} // namespace Platform + +[[noreturn]] +void AssertFailure(const char *file, unsigned line, const char *function, + const char *condition, const char *message); + +#if defined(__GNUC__) +__attribute__((__format__ (__printf__, 1, 2))) +#endif +std::string ssprintf(const char *fmt, ...); + +inline bool IsReasonable(double x) { + return std::isnan(x) || x > 1e11 || x < -1e11; +} + +inline int WRAP(int v, int n) { + // Clamp it to the range [0, n) + while(v >= n) v -= n; + while(v < 0) v += n; + return v; +} +inline double WRAP_NOT_0(double v, double n) { + // Clamp it to the range (0, n] + while(v > n) v -= n; + while(v <= 0) v += n; + return v; +} +inline double WRAP_SYMMETRIC(double v, double n) { + // Clamp it to the range (-n/2, n/2] + while(v > n/2) v -= n; + while(v <= -n/2) v += n; + return v; +} + +template +inline constexpr size_t arraylen(const T (&)[N]) { + return N; +} + +void MakeMatrix(double *mat, double a11, double a12, double a13, double a14, + double a21, double a22, double a23, double a24, + double a31, double a32, double a33, double a34, + double a41, double a42, double a43, double a44); +void MultMatrix(double *mata, double *matb, double *matr); + +int64_t GetMilliseconds(); +void Message(const char *fmt, ...); +void MessageAndRun(std::function onDismiss, const char *fmt, ...); +void Error(const char *fmt, ...); + +} // namespace SolveSpace + +#endif // !SOLVESPACE_UTIL_H diff --git a/src/view.cpp b/src/view.cpp new file mode 100644 index 0000000..6260253 --- /dev/null +++ b/src/view.cpp @@ -0,0 +1,174 @@ +//----------------------------------------------------------------------------- +// The View menu, stuff to snap to certain special views of the model, and to +// display our current view of the model to the user. +// +// Copyright 2008-2013 Jonathan Westhues. +//----------------------------------------------------------------------------- +#include "solvespace.h" + +namespace SolveSpace { + +void TextWindow::ShowEditView() { + Printf(true, "%Ft3D VIEW PARAMETERS%E"); + + Printf(true, "%Bd %Ftoverall scale factor%E"); + Printf(false, "%Ba %# px/%s %Fl%Ll%f[edit]%E", + SS.GW.scale * SS.MmPerUnit(), + SS.UnitName(), + &ScreenChangeViewScale); + Printf(false, "%Bd %Fl%Ll%fset to full scale%E", + &ScreenChangeViewToFullScale); + Printf(false, ""); + + Printf(false, "%Bd %Ftorigin (maps to center of screen)%E"); + Printf(false, "%Ba (%s, %s, %s) %Fl%Ll%f[edit]%E", + SS.MmToString(-SS.GW.offset.x).c_str(), + SS.MmToString(-SS.GW.offset.y).c_str(), + SS.MmToString(-SS.GW.offset.z).c_str(), + &ScreenChangeViewOrigin); + Printf(false, ""); + + Vector n = (SS.GW.projRight).Cross(SS.GW.projUp); + Printf(false, "%Bd %Ftprojection onto screen%E"); + Printf(false, "%Ba %Ftright%E (%3, %3, %3) %Fl%Ll%f[edit]%E", + CO(SS.GW.projRight), + &ScreenChangeViewProjection); + Printf(false, "%Bd %Ftup%E (%3, %3, %3)", CO(SS.GW.projUp)); + Printf(false, "%Ba %Ftout%E (%3, %3, %3)", CO(n)); + Printf(false, ""); + + Printf(false, "%Ft perspective factor (0 for parallel)%E"); + Printf(false, "%Ba %# %Fl%Ll%f%D[change]%E", + SS.cameraTangent*1000, + &ScreenChangeCameraTangent, 0); + + Printf(false, ""); + Printf(false, "%Ft light direction intensity"); + for(int i = 0; i < 2; i++) { + Printf(false, "%Bp #%d (%2,%2,%2)%Fl%D%f%Ll[c]%E " + "%2 %Fl%D%f%Ll[c]%E", + (i & 1) ? 'd' : 'a', i, + CO(SS.lightDir[i]), i, &ScreenChangeLightDirection, + SS.lightIntensity[i], i, &ScreenChangeLightIntensity); + } + Printf(false, "%Ba ambient lighting %2 %Fl%f%Ll[c]%E", + SS.ambientIntensity, &ScreenChangeLightAmbient); + + Printf(false, ""); + Printf(false, "%Ft explode distance%E"); + Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E", + SS.MmToString(SS.explodeDistance).c_str(), + &ScreenChangeExplodeDistance, 0); + +} + +void TextWindow::ScreenChangeViewScale(int link, uint32_t v) { + SS.TW.edit.meaning = Edit::VIEW_SCALE; + SS.TW.ShowEditControl(3, ssprintf("%.3f", SS.GW.scale * SS.MmPerUnit())); +} + +void TextWindow::ScreenChangeViewToFullScale(int link, uint32_t v) { + SS.GW.scale = SS.GW.window->GetPixelDensity() / 25.4; +} + +void TextWindow::ScreenChangeViewOrigin(int link, uint32_t v) { + std::string edit_value = + ssprintf("%s, %s, %s", + SS.MmToString(-SS.GW.offset.x, true).c_str(), + SS.MmToString(-SS.GW.offset.y, true).c_str(), + SS.MmToString(-SS.GW.offset.z, true).c_str()); + + SS.TW.edit.meaning = Edit::VIEW_ORIGIN; + SS.TW.ShowEditControl(3, edit_value); +} + +void TextWindow::ScreenChangeViewProjection(int link, uint32_t v) { + std::string edit_value = + ssprintf("%.3f, %.3f, %.3f", CO(SS.GW.projRight)); + SS.TW.edit.meaning = Edit::VIEW_PROJ_RIGHT; + SS.TW.ShowEditControl(10, edit_value); +} + +void TextWindow::ScreenChangeLightDirection(int link, uint32_t v) { + SS.TW.ShowEditControl(8, ssprintf("%.2f, %.2f, %.2f", CO(SS.lightDir[v]))); + SS.TW.edit.meaning = Edit::LIGHT_DIRECTION; + SS.TW.edit.i = v; +} + +void TextWindow::ScreenChangeLightIntensity(int link, uint32_t v) { + SS.TW.ShowEditControl(31, ssprintf("%.2f", SS.lightIntensity[v])); + SS.TW.edit.meaning = Edit::LIGHT_INTENSITY; + SS.TW.edit.i = v; +} + +void TextWindow::ScreenChangeLightAmbient(int link, uint32_t v) { + SS.TW.ShowEditControl(31, ssprintf("%.2f", SS.ambientIntensity)); + SS.TW.edit.meaning = Edit::LIGHT_AMBIENT; + SS.TW.edit.i = 0; +} + +void TextWindow::ScreenChangeCameraTangent(int link, uint32_t v) { + SS.TW.ShowEditControl(3, ssprintf("%.3f", 1000*SS.cameraTangent)); + SS.TW.edit.meaning = Edit::CAMERA_TANGENT; +} + +void TextWindow::ScreenChangeExplodeDistance(int link, uint32_t v) { + SS.TW.ShowEditControl(3, SS.MmToString(SS.explodeDistance, true)); + SS.TW.edit.meaning = Edit::EXPLODE_DISTANCE; +} + +bool TextWindow::EditControlDoneForView(const std::string &s) { + switch(edit.meaning) { + case Edit::VIEW_SCALE: { + Expr *e = Expr::From(s, /*popUpError=*/true); + if(e) { + double v = e->Eval() / SS.MmPerUnit(); + if(v > LENGTH_EPS) { + SS.GW.scale = v; + } else { + Error(_("Scale cannot be zero or negative.")); + } + } + break; + } + + case Edit::VIEW_ORIGIN: { + Vector pt; + if(sscanf(s.c_str(), "%lf, %lf, %lf", &pt.x, &pt.y, &pt.z) == 3) { + pt = pt.ScaledBy(SS.MmPerUnit()); + SS.GW.offset = pt.ScaledBy(-1); + } else { + Error(_("Bad format: specify x, y, z")); + } + break; + } + + case Edit::VIEW_PROJ_RIGHT: + case Edit::VIEW_PROJ_UP: { + Vector pt; + if(sscanf(s.c_str(), "%lf, %lf, %lf", &pt.x, &pt.y, &pt.z) != 3) { + Error(_("Bad format: specify x, y, z")); + break; + } + if(edit.meaning == Edit::VIEW_PROJ_RIGHT) { + SS.GW.projRight = pt; + SS.GW.NormalizeProjectionVectors(); + edit.meaning = Edit::VIEW_PROJ_UP; + HideEditControl(); + ShowEditControl(10, ssprintf("%.3f, %.3f, %.3f", CO(SS.GW.projUp)), + editControl.halfRow + 2); + edit.showAgain = true; + } else { + SS.GW.projUp = pt; + SS.GW.NormalizeProjectionVectors(); + } + break; + } + + default: + return false; + } + return true; +} + +} // namespace SolveSpace diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..eb6cf60 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,141 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR}) + +foreach(pkg_config_lib CAIRO) + include_directories(${${pkg_config_lib}_INCLUDE_DIRS}) + link_directories(${${pkg_config_lib}_LIBRARY_DIRS}) +endforeach() + +if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") + add_definitions(-DTEST_BUILD_ON_WINDOWS) +endif() + +# test suite + +set(testsuite_SOURCES + harness.cpp + analysis/contour_area/test.cpp + core/expr/test.cpp + core/locale/test.cpp + core/path/test.cpp + constraint/points_coincident/test.cpp + constraint/pt_pt_distance/test.cpp + constraint/pt_plane_distance/test.cpp + constraint/pt_line_distance/test.cpp + constraint/pt_face_distance/test.cpp + constraint/proj_pt_distance/test.cpp + constraint/pt_in_plane/test.cpp + constraint/pt_on_line/test.cpp + constraint/pt_on_face/test.cpp + constraint/equal_length_lines/test.cpp + constraint/length_ratio/test.cpp + constraint/eq_len_pt_line_d/test.cpp + constraint/eq_pt_ln_distances/test.cpp + constraint/equal_angle/test.cpp + constraint/equal_line_arc_len/test.cpp + constraint/length_difference/test.cpp + constraint/symmetric/test.cpp + constraint/symmetric_horiz/test.cpp + constraint/symmetric_vert/test.cpp + constraint/symmetric_line/test.cpp + constraint/at_midpoint/test.cpp + constraint/horizontal/test.cpp + constraint/vertical/test.cpp + constraint/diameter/test.cpp + constraint/pt_on_circle/test.cpp + constraint/same_orientation/test.cpp + constraint/angle/test.cpp + constraint/parallel/test.cpp + constraint/perpendicular/test.cpp + constraint/arc_line_tangent/test.cpp + constraint/cubic_line_tangent/test.cpp + constraint/curve_curve_tangent/test.cpp + constraint/equal_radius/test.cpp + constraint/where_dragged/test.cpp + constraint/comment/test.cpp + request/arc_of_circle/test.cpp + request/circle/test.cpp + request/cubic/test.cpp + request/cubic_periodic/test.cpp + request/datum_point/test.cpp + request/image/test.cpp + request/line_segment/test.cpp + request/ttf_text/test.cpp + request/workplane/test.cpp + group/link/test.cpp + group/translate_asy/test.cpp + group/translate_nd/test.cpp +) + +add_executable(solvespace-testsuite + ${testsuite_SOURCES} + $) + +target_link_libraries(solvespace-testsuite + solvespace-headless + ${COVERAGE_LIBRARY}) + +target_include_directories(solvespace-testsuite + PRIVATE + ${EIGEN3_INCLUDE_DIRS}) +add_dependencies(solvespace-testsuite + resources) + +add_custom_target(test_solvespace + COMMAND $ + COMMENT "Testing SolveSpace" + VERBATIM) + +# coverage reports + +if(ENABLE_COVERAGE) + set(LCOV_FLAGS -q --gcov-tool ${GCOV}) + set(LCOV_FLAGS ${LCOV_FLAGS} --rc lcov_branch_coverage=1) + set(LCOV_FLAGS ${LCOV_FLAGS} --rc "lcov_excl_line=(ssassert|switch)") + set(LCOV_FLAGS ${LCOV_FLAGS} --rc "lcov_excl_br_line=BRANCH_ALWAYS_TAKEN") + set(LCOV_COLLECT -c -b ${CMAKE_SOURCE_DIR}/src -d ${CMAKE_BINARY_DIR}/src --no-external) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/coverage_base.info + COMMAND ${LCOV} ${LCOV_FLAGS} ${LCOV_COLLECT} + -o ${CMAKE_BINARY_DIR}/coverage_base.info -i + DEPENDS solvespace-testsuite + COMMENT "Importing baseline coverage data" + VERBATIM) + + add_custom_target(coverage_solvespace ALL + COMMAND ${LCOV} ${LCOV_FLAGS} ${LCOV_COLLECT} + -o ${CMAKE_BINARY_DIR}/coverage_test.info + COMMAND ${LCOV} ${LCOV_FLAGS} + -o ${CMAKE_BINARY_DIR}/coverage_full.info + -a ${CMAKE_BINARY_DIR}/coverage_base.info + -a ${CMAKE_BINARY_DIR}/coverage_test.info + COMMAND ${LCOV} ${LCOV_FLAGS} --summary + ${CMAKE_BINARY_DIR}/coverage_full.info + COMMAND ${GENHTML} -q --branch-coverage --demangle-cpp --legend + ${CMAKE_BINARY_DIR}/coverage_full.info + -o ${CMAKE_BINARY_DIR}/coverage/ + -t "SolveSpace testbench" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/coverage_base.info + DEPENDS test_solvespace + COMMENT "Generating coverage report" + VERBATIM) +endif() + +# debug runner + +set(debugtool_SOURCES + debugtool.cpp +) + +add_executable(solvespace-debugtool + ${debugtool_SOURCES} + $) + +target_link_libraries(solvespace-debugtool + solvespace-core + solvespace-headless) + +add_dependencies(solvespace-debugtool + resources) diff --git a/test/Gentium-R.ttf b/test/Gentium-R.ttf new file mode 100644 index 0000000..3b44ad1 Binary files /dev/null and b/test/Gentium-R.ttf differ diff --git a/test/analysis/contour_area/normal.png b/test/analysis/contour_area/normal.png new file mode 100644 index 0000000..3b50df9 Binary files /dev/null and b/test/analysis/contour_area/normal.png differ diff --git a/test/analysis/contour_area/normal.slvs b/test/analysis/contour_area/normal.slvs new file mode 100644 index 0000000..15dc34a --- /dev/null +++ b/test/analysis/contour_area/normal.slvs @@ -0,0 +1,512 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00050002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060001 +Constraint.ptB.v=00070002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00070001 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000005 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000006 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000007 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000008 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00070000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/analysis/contour_area/test.cpp b/test/analysis/contour_area/test.cpp new file mode 100644 index 0000000..eae410d --- /dev/null +++ b/test/analysis/contour_area/test.cpp @@ -0,0 +1,9 @@ +#include "solvespace.h" + +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + SS.showContourAreas = true; + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); +} diff --git a/test/commit.sh b/test/commit.sh new file mode 100755 index 0000000..d49708e --- /dev/null +++ b/test/commit.sh @@ -0,0 +1,9 @@ +#!/bin/sh -ex + +make -C build solvespace-testsuite +./build/test/solvespace-testsuite $* || true +for e in slvs png; do + for i in `find . -name *.out.$e`; do + mv $i `dirname $i`/`basename $i .out.$e`.$e; + done; +done diff --git a/test/constraint/angle/free_in_3d.png b/test/constraint/angle/free_in_3d.png new file mode 100644 index 0000000..2fef8c1 Binary files /dev/null and b/test/constraint/angle/free_in_3d.png differ diff --git a/test/constraint/angle/free_in_3d.slvs b/test/constraint/angle/free_in_3d.slvs new file mode 100644 index 0000000..dd9a053 --- /dev/null +++ b/test/constraint/angle/free_in_3d.slvs @@ -0,0 +1,355 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=0.51894056308654845644 +Constraint.disp.offset.y=3.99584233576642278152 +AddConstraint + diff --git a/test/constraint/angle/free_in_3d_v20.slvs b/test/constraint/angle/free_in_3d_v20.slvs new file mode 100644 index 0000000..7f118f9 --- /dev/null +++ b/test/constraint/angle/free_in_3d_v20.slvs @@ -0,0 +1,355 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000090000 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000090000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=0.51894056308654846000 +Constraint.disp.offset.y=3.99584233576642280000 +AddConstraint + diff --git a/test/constraint/angle/free_in_3d_v22.slvs b/test/constraint/angle/free_in_3d_v22.slvs new file mode 100644 index 0000000..488f552 --- /dev/null +++ b/test/constraint/angle/free_in_3d_v22.slvs @@ -0,0 +1,355 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=0.51894056308654845644 +Constraint.disp.offset.y=3.99584233576642278152 +AddConstraint + diff --git a/test/constraint/angle/normal.png b/test/constraint/angle/normal.png new file mode 100644 index 0000000..40b2d0e Binary files /dev/null and b/test/constraint/angle/normal.png differ diff --git a/test/constraint/angle/normal.slvs b/test/constraint/angle/normal.slvs new file mode 100644 index 0000000..4ba1958 --- /dev/null +++ b/test/constraint/angle/normal.slvs @@ -0,0 +1,352 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=4.50000000000000000000 +AddConstraint + diff --git a/test/constraint/angle/normal_v20.slvs b/test/constraint/angle/normal_v20.slvs new file mode 100644 index 0000000..c080183 --- /dev/null +++ b/test/constraint/angle/normal_v20.slvs @@ -0,0 +1,352 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000090000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000090000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=4.50000000000000000000 +AddConstraint + diff --git a/test/constraint/angle/normal_v22.slvs b/test/constraint/angle/normal_v22.slvs new file mode 100644 index 0000000..4f1dfd0 --- /dev/null +++ b/test/constraint/angle/normal_v22.slvs @@ -0,0 +1,352 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000090000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000090000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=4.50000000000000000000 +AddConstraint + diff --git a/test/constraint/angle/reference.png b/test/constraint/angle/reference.png new file mode 100644 index 0000000..e59f481 Binary files /dev/null and b/test/constraint/angle/reference.png differ diff --git a/test/constraint/angle/reference.slvs b/test/constraint/angle/reference.slvs new file mode 100644 index 0000000..a8824df --- /dev/null +++ b/test/constraint/angle/reference.slvs @@ -0,0 +1,366 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=4.50000000000000000000 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=135.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=-1.99273176225234482928 +Constraint.disp.offset.y=1.12091161626694391096 +AddConstraint + diff --git a/test/constraint/angle/reference_free_in_3d.png b/test/constraint/angle/reference_free_in_3d.png new file mode 100644 index 0000000..8292411 Binary files /dev/null and b/test/constraint/angle/reference_free_in_3d.png differ diff --git a/test/constraint/angle/reference_free_in_3d.slvs b/test/constraint/angle/reference_free_in_3d.slvs new file mode 100644 index 0000000..bfc1723 --- /dev/null +++ b/test/constraint/angle/reference_free_in_3d.slvs @@ -0,0 +1,355 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=0.51894056308654845644 +Constraint.disp.offset.y=3.99584233576642278152 +AddConstraint + diff --git a/test/constraint/angle/reference_free_in_3d_v20.slvs b/test/constraint/angle/reference_free_in_3d_v20.slvs new file mode 100644 index 0000000..8a6aef6 --- /dev/null +++ b/test/constraint/angle/reference_free_in_3d_v20.slvs @@ -0,0 +1,355 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000090000 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000090000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=0.51894056308654846000 +Constraint.disp.offset.y=3.99584233576642280000 +AddConstraint + diff --git a/test/constraint/angle/reference_free_in_3d_v22.slvs b/test/constraint/angle/reference_free_in_3d_v22.slvs new file mode 100644 index 0000000..dd91a68 --- /dev/null +++ b/test/constraint/angle/reference_free_in_3d_v22.slvs @@ -0,0 +1,355 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=0.51894056308654845644 +Constraint.disp.offset.y=3.99584233576642278152 +AddConstraint + diff --git a/test/constraint/angle/reference_v20.slvs b/test/constraint/angle/reference_v20.slvs new file mode 100644 index 0000000..1ba8cb6 --- /dev/null +++ b/test/constraint/angle/reference_v20.slvs @@ -0,0 +1,366 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000090000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000090000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=4.50000000000000000000 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=135.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=-1.99273176225234480000 +Constraint.disp.offset.y=1.12091161626694390000 +AddConstraint + diff --git a/test/constraint/angle/reference_v22.slvs b/test/constraint/angle/reference_v22.slvs new file mode 100644 index 0000000..0408a83 --- /dev/null +++ b/test/constraint/angle/reference_v22.slvs @@ -0,0 +1,366 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000088818 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=45.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=4.50000000000000000000 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=135.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=-1.99273176225234482928 +Constraint.disp.offset.y=1.12091161626694391096 +AddConstraint + diff --git a/test/constraint/angle/skew.png b/test/constraint/angle/skew.png new file mode 100644 index 0000000..92d7577 Binary files /dev/null and b/test/constraint/angle/skew.png differ diff --git a/test/constraint/angle/skew.slvs b/test/constraint/angle/skew.slvs new file mode 100644 index 0000000..e793f93 --- /dev/null +++ b/test/constraint/angle/skew.slvs @@ -0,0 +1,340 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=90.00000000000000000000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=2.50000000000000044409 +Constraint.disp.offset.y=-2.50000000000000000000 +Constraint.disp.offset.z=-2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/angle/skew_v22.slvs b/test/constraint/angle/skew_v22.slvs new file mode 100644 index 0000000..e793f93 --- /dev/null +++ b/test/constraint/angle/skew_v22.slvs @@ -0,0 +1,340 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=120 +Constraint.group.v=00000002 +Constraint.valA=90.00000000000000000000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=2.50000000000000044409 +Constraint.disp.offset.y=-2.50000000000000000000 +Constraint.disp.offset.z=-2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/angle/test.cpp b/test/constraint/angle/test.cpp new file mode 100644 index 0000000..668394d --- /dev/null +++ b/test/constraint/angle/test.cpp @@ -0,0 +1,70 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_free_in_3d_roundtrip) { + CHECK_LOAD("reference_free_in_3d.slvs"); + CHECK_RENDER("reference_free_in_3d.png"); + CHECK_SAVE("reference_free_in_3d.slvs"); +} + +TEST_CASE(reference_free_in_3d_migrate_from_v20) { + CHECK_LOAD("reference_free_in_3d_v20.slvs"); + CHECK_SAVE("reference_free_in_3d.slvs"); +} + +TEST_CASE(reference_free_in_3d_migrate_from_v22) { + CHECK_LOAD("reference_free_in_3d_v22.slvs"); + CHECK_SAVE("reference_free_in_3d.slvs"); +} + +TEST_CASE(skew_render) { + CHECK_LOAD("skew.slvs"); + CHECK_RENDER("skew.png"); +} diff --git a/test/constraint/arc_line_tangent/normal.png b/test/constraint/arc_line_tangent/normal.png new file mode 100644 index 0000000..ab59db7 Binary files /dev/null and b/test/constraint/arc_line_tangent/normal.png differ diff --git a/test/constraint/arc_line_tangent/normal.slvs b/test/constraint/arc_line_tangent/normal.slvs new file mode 100644 index 0000000..7572139 --- /dev/null +++ b/test/constraint/arc_line_tangent/normal.slvs @@ -0,0 +1,450 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=25.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=25.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=123 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040003 +Constraint.ptB.v=00060001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=123 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/arc_line_tangent/normal_v20.slvs b/test/constraint/arc_line_tangent/normal_v20.slvs new file mode 100644 index 0000000..402d9de --- /dev/null +++ b/test/constraint/arc_line_tangent/normal_v20.slvs @@ -0,0 +1,450 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=25.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=25.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=123 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040003 +Constraint.ptB.v=00060001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=123 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/arc_line_tangent/normal_v22.slvs b/test/constraint/arc_line_tangent/normal_v22.slvs new file mode 100644 index 0000000..86a7d82 --- /dev/null +++ b/test/constraint/arc_line_tangent/normal_v22.slvs @@ -0,0 +1,450 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=25.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=25.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=123 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040003 +Constraint.ptB.v=00060001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=123 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/arc_line_tangent/test.cpp b/test/constraint/arc_line_tangent/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/arc_line_tangent/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/at_midpoint/line_plane_free_in_3d.png b/test/constraint/at_midpoint/line_plane_free_in_3d.png new file mode 100644 index 0000000..9f41d0f Binary files /dev/null and b/test/constraint/at_midpoint/line_plane_free_in_3d.png differ diff --git a/test/constraint/at_midpoint/line_plane_free_in_3d.slvs b/test/constraint/at_midpoint/line_plane_free_in_3d.slvs new file mode 100644 index 0000000..5442ec6 --- /dev/null +++ b/test/constraint/at_midpoint/line_plane_free_in_3d.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_plane_free_in_3d_v20.slvs b/test/constraint/at_midpoint/line_plane_free_in_3d_v20.slvs new file mode 100644 index 0000000..fa47c43 --- /dev/null +++ b/test/constraint/at_midpoint/line_plane_free_in_3d_v20.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_plane_free_in_3d_v22.slvs b/test/constraint/at_midpoint/line_plane_free_in_3d_v22.slvs new file mode 100644 index 0000000..be8a12c --- /dev/null +++ b/test/constraint/at_midpoint/line_plane_free_in_3d_v22.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_plane_normal.png b/test/constraint/at_midpoint/line_plane_normal.png new file mode 100644 index 0000000..9f41d0f Binary files /dev/null and b/test/constraint/at_midpoint/line_plane_normal.png differ diff --git a/test/constraint/at_midpoint/line_plane_normal.slvs b/test/constraint/at_midpoint/line_plane_normal.slvs new file mode 100644 index 0000000..9741904 --- /dev/null +++ b/test/constraint/at_midpoint/line_plane_normal.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_plane_normal_v20.slvs b/test/constraint/at_midpoint/line_plane_normal_v20.slvs new file mode 100644 index 0000000..fa644cf --- /dev/null +++ b/test/constraint/at_midpoint/line_plane_normal_v20.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_plane_normal_v22.slvs b/test/constraint/at_midpoint/line_plane_normal_v22.slvs new file mode 100644 index 0000000..1c40c4c --- /dev/null +++ b/test/constraint/at_midpoint/line_plane_normal_v22.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_pt_free_in_3d.png b/test/constraint/at_midpoint/line_pt_free_in_3d.png new file mode 100644 index 0000000..0e43d59 Binary files /dev/null and b/test/constraint/at_midpoint/line_pt_free_in_3d.png differ diff --git a/test/constraint/at_midpoint/line_pt_free_in_3d.slvs b/test/constraint/at_midpoint/line_pt_free_in_3d.slvs new file mode 100644 index 0000000..f40d499 --- /dev/null +++ b/test/constraint/at_midpoint/line_pt_free_in_3d.slvs @@ -0,0 +1,315 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_pt_free_in_3d_v20.slvs b/test/constraint/at_midpoint/line_pt_free_in_3d_v20.slvs new file mode 100644 index 0000000..63806c5 --- /dev/null +++ b/test/constraint/at_midpoint/line_pt_free_in_3d_v20.slvs @@ -0,0 +1,313 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_pt_free_in_3d_v22.slvs b/test/constraint/at_midpoint/line_pt_free_in_3d_v22.slvs new file mode 100644 index 0000000..2933389 --- /dev/null +++ b/test/constraint/at_midpoint/line_pt_free_in_3d_v22.slvs @@ -0,0 +1,315 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_pt_normal.png b/test/constraint/at_midpoint/line_pt_normal.png new file mode 100644 index 0000000..0e43d59 Binary files /dev/null and b/test/constraint/at_midpoint/line_pt_normal.png differ diff --git a/test/constraint/at_midpoint/line_pt_normal.slvs b/test/constraint/at_midpoint/line_pt_normal.slvs new file mode 100644 index 0000000..483bc76 --- /dev/null +++ b/test/constraint/at_midpoint/line_pt_normal.slvs @@ -0,0 +1,313 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_pt_normal_v20.slvs b/test/constraint/at_midpoint/line_pt_normal_v20.slvs new file mode 100644 index 0000000..76d63eb --- /dev/null +++ b/test/constraint/at_midpoint/line_pt_normal_v20.slvs @@ -0,0 +1,311 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/line_pt_normal_v22.slvs b/test/constraint/at_midpoint/line_pt_normal_v22.slvs new file mode 100644 index 0000000..07761c1 --- /dev/null +++ b/test/constraint/at_midpoint/line_pt_normal_v22.slvs @@ -0,0 +1,313 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=70 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/at_midpoint/test.cpp b/test/constraint/at_midpoint/test.cpp new file mode 100644 index 0000000..3525df9 --- /dev/null +++ b/test/constraint/at_midpoint/test.cpp @@ -0,0 +1,65 @@ +#include "harness.h" + +TEST_CASE(line_pt_normal_roundtrip) { + CHECK_LOAD("line_pt_normal.slvs"); + CHECK_RENDER("line_pt_normal.png"); + CHECK_SAVE("line_pt_normal.slvs"); +} + +TEST_CASE(line_pt_normal_migrate_from_v20) { + CHECK_LOAD("line_pt_normal_v20.slvs"); + CHECK_SAVE("line_pt_normal.slvs"); +} + +TEST_CASE(line_pt_normal_migrate_from_v22) { + CHECK_LOAD("line_pt_normal_v22.slvs"); + CHECK_SAVE("line_pt_normal.slvs"); +} + +TEST_CASE(line_pt_free_in_3d_roundtrip) { + CHECK_LOAD("line_pt_free_in_3d.slvs"); + CHECK_RENDER("line_pt_free_in_3d.png"); + CHECK_SAVE("line_pt_free_in_3d.slvs"); +} + +TEST_CASE(line_pt_free_in_3d_migrate_from_v20) { + CHECK_LOAD("line_pt_free_in_3d_v20.slvs"); + CHECK_SAVE("line_pt_free_in_3d.slvs"); +} + +TEST_CASE(line_pt_free_in_3d_migrate_from_v22) { + CHECK_LOAD("line_pt_free_in_3d_v22.slvs"); + CHECK_SAVE("line_pt_free_in_3d.slvs"); +} + +TEST_CASE(line_plane_normal_roundtrip) { + CHECK_LOAD("line_plane_normal.slvs"); + CHECK_RENDER("line_plane_normal.png"); + CHECK_SAVE("line_plane_normal.slvs"); +} + +TEST_CASE(line_plane_normal_migrate_from_v20) { + CHECK_LOAD("line_plane_normal_v20.slvs"); + CHECK_SAVE("line_plane_normal.slvs"); +} + +TEST_CASE(line_plane_normal_migrate_from_v22) { + CHECK_LOAD("line_plane_normal_v22.slvs"); + CHECK_SAVE("line_plane_normal.slvs"); +} + +TEST_CASE(line_plane_free_in_3d_roundtrip) { + CHECK_LOAD("line_plane_free_in_3d.slvs"); + CHECK_RENDER("line_plane_free_in_3d.png"); + CHECK_SAVE("line_plane_free_in_3d.slvs"); +} + +TEST_CASE(line_plane_free_in_3d_migrate_from_v20) { + CHECK_LOAD("line_plane_free_in_3d_v20.slvs"); + CHECK_SAVE("line_plane_free_in_3d.slvs"); +} + +TEST_CASE(line_plane_free_in_3d_migrate_from_v22) { + CHECK_LOAD("line_plane_free_in_3d_v22.slvs"); + CHECK_SAVE("line_plane_free_in_3d.slvs"); +} diff --git a/test/constraint/comment/normal.png b/test/constraint/comment/normal.png new file mode 100644 index 0000000..5a7036c Binary files /dev/null and b/test/constraint/comment/normal.png differ diff --git a/test/constraint/comment/normal.slvs b/test/constraint/comment/normal.slvs new file mode 100644 index 0000000..ca73674 --- /dev/null +++ b/test/constraint/comment/normal.slvs @@ -0,0 +1,240 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=1000 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.comment=Text +Constraint.disp.offset.x=-5.50000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/comment/normal_v20.slvs b/test/constraint/comment/normal_v20.slvs new file mode 100644 index 0000000..101e898 --- /dev/null +++ b/test/constraint/comment/normal_v20.slvs @@ -0,0 +1,238 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=1000 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.comment=Text +Constraint.disp.offset.x=-5.50000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/comment/normal_v22.slvs b/test/constraint/comment/normal_v22.slvs new file mode 100644 index 0000000..5082ebf --- /dev/null +++ b/test/constraint/comment/normal_v22.slvs @@ -0,0 +1,240 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=1000 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.comment=Text +Constraint.disp.offset.x=-5.50000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/comment/test.cpp b/test/constraint/comment/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/comment/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/cubic_line_tangent/free_in_3d.png b/test/constraint/cubic_line_tangent/free_in_3d.png new file mode 100644 index 0000000..5b57692 Binary files /dev/null and b/test/constraint/cubic_line_tangent/free_in_3d.png differ diff --git a/test/constraint/cubic_line_tangent/free_in_3d.slvs b/test/constraint/cubic_line_tangent/free_in_3d.slvs new file mode 100644 index 0000000..fe3e29a --- /dev/null +++ b/test/constraint/cubic_line_tangent/free_in_3d.slvs @@ -0,0 +1,397 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040018 +AddParam + +Param.h.v.=00040019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=0004001b +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050015 +AddParam + +Param.h.v.=40000002 +Param.val=-1.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.valP.v=40000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/cubic_line_tangent/free_in_3d_v20.slvs b/test/constraint/cubic_line_tangent/free_in_3d_v20.slvs new file mode 100644 index 0000000..2717b89 --- /dev/null +++ b/test/constraint/cubic_line_tangent/free_in_3d_v20.slvs @@ -0,0 +1,392 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040018 +AddParam + +Param.h.v.=00040019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=0004001b +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/cubic_line_tangent/free_in_3d_v22.slvs b/test/constraint/cubic_line_tangent/free_in_3d_v22.slvs new file mode 100644 index 0000000..d5ca7c6 --- /dev/null +++ b/test/constraint/cubic_line_tangent/free_in_3d_v22.slvs @@ -0,0 +1,392 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040018 +AddParam + +Param.h.v.=00040019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=0004001b +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/cubic_line_tangent/normal.png b/test/constraint/cubic_line_tangent/normal.png new file mode 100644 index 0000000..394f8ff Binary files /dev/null and b/test/constraint/cubic_line_tangent/normal.png differ diff --git a/test/constraint/cubic_line_tangent/normal.slvs b/test/constraint/cubic_line_tangent/normal.slvs new file mode 100644 index 0000000..f8a534c --- /dev/null +++ b/test/constraint/cubic_line_tangent/normal.slvs @@ -0,0 +1,446 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040017 +AddParam + +Param.h.v.=00040019 +AddParam + +Param.h.v.=0004001a +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +AddParam + +Param.h.v.=00060013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040004 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00060001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/cubic_line_tangent/normal_v20.slvs b/test/constraint/cubic_line_tangent/normal_v20.slvs new file mode 100644 index 0000000..c141192 --- /dev/null +++ b/test/constraint/cubic_line_tangent/normal_v20.slvs @@ -0,0 +1,446 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040017 +AddParam + +Param.h.v.=00040019 +AddParam + +Param.h.v.=0004001a +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +AddParam + +Param.h.v.=00060013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040004 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00060001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/cubic_line_tangent/normal_v22.slvs b/test/constraint/cubic_line_tangent/normal_v22.slvs new file mode 100644 index 0000000..049bd73 --- /dev/null +++ b/test/constraint/cubic_line_tangent/normal_v22.slvs @@ -0,0 +1,446 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040017 +AddParam + +Param.h.v.=00040019 +AddParam + +Param.h.v.=0004001a +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +AddParam + +Param.h.v.=00060013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040004 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00060001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=124 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/cubic_line_tangent/test.cpp b/test/constraint/cubic_line_tangent/test.cpp new file mode 100644 index 0000000..4dcc334 --- /dev/null +++ b/test/constraint/cubic_line_tangent/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} diff --git a/test/constraint/curve_curve_tangent/arc_arc.png b/test/constraint/curve_curve_tangent/arc_arc.png new file mode 100644 index 0000000..c83e0a8 Binary files /dev/null and b/test/constraint/curve_curve_tangent/arc_arc.png differ diff --git a/test/constraint/curve_curve_tangent/arc_arc.slvs b/test/constraint/curve_curve_tangent/arc_arc.slvs new file mode 100644 index 0000000..6b90c57 --- /dev/null +++ b/test/constraint/curve_curve_tangent/arc_arc.slvs @@ -0,0 +1,406 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050016 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00050017 +Param.val=25.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.point[2].v=00050003 +Entity.normal.v=00050020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=25.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050002 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/curve_curve_tangent/arc_arc_v20.slvs b/test/constraint/curve_curve_tangent/arc_arc_v20.slvs new file mode 100644 index 0000000..8d4cefe --- /dev/null +++ b/test/constraint/curve_curve_tangent/arc_arc_v20.slvs @@ -0,0 +1,404 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050016 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00050017 +Param.val=25.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.point[2].v=00050003 +Entity.normal.v=00050020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=25.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050002 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/curve_curve_tangent/arc_arc_v22.slvs b/test/constraint/curve_curve_tangent/arc_arc_v22.slvs new file mode 100644 index 0000000..995d11e --- /dev/null +++ b/test/constraint/curve_curve_tangent/arc_arc_v22.slvs @@ -0,0 +1,406 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050016 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00050017 +Param.val=25.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.point[2].v=00050003 +Entity.normal.v=00050020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=25.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050002 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/curve_curve_tangent/arc_cubic.png b/test/constraint/curve_curve_tangent/arc_cubic.png new file mode 100644 index 0000000..8c7f0dc Binary files /dev/null and b/test/constraint/curve_curve_tangent/arc_cubic.png differ diff --git a/test/constraint/curve_curve_tangent/arc_cubic.slvs b/test/constraint/curve_curve_tangent/arc_cubic.slvs new file mode 100644 index 0000000..4e8be1b --- /dev/null +++ b/test/constraint/curve_curve_tangent/arc_cubic.slvs @@ -0,0 +1,506 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050016 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0005001a +AddParam + +Param.h.v.=00060010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +AddParam + +Param.h.v.=00060016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060017 +Param.val=-10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=300 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.point[2].v=00050003 +Entity.point[3].v=00050004 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.point[2].v=00060003 +Entity.normal.v=00060020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040003 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=1 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050004 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/curve_curve_tangent/arc_cubic_v20.slvs b/test/constraint/curve_curve_tangent/arc_cubic_v20.slvs new file mode 100644 index 0000000..975b487 --- /dev/null +++ b/test/constraint/curve_curve_tangent/arc_cubic_v20.slvs @@ -0,0 +1,506 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050016 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0005001a +AddParam + +Param.h.v.=00060010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +AddParam + +Param.h.v.=00060016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060017 +Param.val=-10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=300 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.point[2].v=00050003 +Entity.point[3].v=00050004 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.point[2].v=00060003 +Entity.normal.v=00060020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040003 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=1 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050004 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/curve_curve_tangent/arc_cubic_v22.slvs b/test/constraint/curve_curve_tangent/arc_cubic_v22.slvs new file mode 100644 index 0000000..554b38a --- /dev/null +++ b/test/constraint/curve_curve_tangent/arc_cubic_v22.slvs @@ -0,0 +1,506 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050016 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0005001a +AddParam + +Param.h.v.=00060010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +AddParam + +Param.h.v.=00060016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060017 +Param.val=-10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=300 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.point[2].v=00050003 +Entity.point[3].v=00050004 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.point[2].v=00060003 +Entity.normal.v=00060020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040003 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=1 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050004 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=125 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/curve_curve_tangent/test.cpp b/test/constraint/curve_curve_tangent/test.cpp new file mode 100644 index 0000000..8122b90 --- /dev/null +++ b/test/constraint/curve_curve_tangent/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(arc_arc_roundtrip) { + CHECK_LOAD("arc_arc.slvs"); + CHECK_RENDER("arc_arc.png"); + CHECK_SAVE("arc_arc.slvs"); +} + +TEST_CASE(arc_arc_migrate_from_v20) { + CHECK_LOAD("arc_arc_v20.slvs"); + CHECK_SAVE("arc_arc.slvs"); +} + +TEST_CASE(arc_arc_migrate_from_v22) { + CHECK_LOAD("arc_arc_v22.slvs"); + CHECK_SAVE("arc_arc.slvs"); +} + +TEST_CASE(arc_cubic_roundtrip) { + CHECK_LOAD("arc_cubic.slvs"); + CHECK_RENDER("arc_cubic.png"); + CHECK_SAVE("arc_cubic.slvs"); +} + +TEST_CASE(arc_cubic_migrate_from_v20) { + CHECK_LOAD("arc_cubic_v20.slvs"); + CHECK_SAVE("arc_cubic.slvs"); +} + +TEST_CASE(arc_cubic_migrate_from_v22) { + CHECK_LOAD("arc_cubic_v22.slvs"); + CHECK_SAVE("arc_cubic.slvs"); +} diff --git a/test/constraint/diameter/normal.png b/test/constraint/diameter/normal.png new file mode 100644 index 0000000..fc57623 Binary files /dev/null and b/test/constraint/diameter/normal.png differ diff --git a/test/constraint/diameter/normal.slvs b/test/constraint/diameter/normal.slvs new file mode 100644 index 0000000..583b3ac --- /dev/null +++ b/test/constraint/diameter/normal.slvs @@ -0,0 +1,296 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=5.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/diameter/normal_v20.slvs b/test/constraint/diameter/normal_v20.slvs new file mode 100644 index 0000000..7427519 --- /dev/null +++ b/test/constraint/diameter/normal_v20.slvs @@ -0,0 +1,294 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=5.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/diameter/normal_v22.slvs b/test/constraint/diameter/normal_v22.slvs new file mode 100644 index 0000000..81a24e2 --- /dev/null +++ b/test/constraint/diameter/normal_v22.slvs @@ -0,0 +1,296 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=5.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/diameter/reference.png b/test/constraint/diameter/reference.png new file mode 100644 index 0000000..09a3f28 Binary files /dev/null and b/test/constraint/diameter/reference.png differ diff --git a/test/constraint/diameter/reference.slvs b/test/constraint/diameter/reference.slvs new file mode 100644 index 0000000..b403a72 --- /dev/null +++ b/test/constraint/diameter/reference.slvs @@ -0,0 +1,296 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=5.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/diameter/reference_v20.slvs b/test/constraint/diameter/reference_v20.slvs new file mode 100644 index 0000000..eb80eb9 --- /dev/null +++ b/test/constraint/diameter/reference_v20.slvs @@ -0,0 +1,296 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=5.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/diameter/reference_v22.slvs b/test/constraint/diameter/reference_v22.slvs new file mode 100644 index 0000000..4f8455b --- /dev/null +++ b/test/constraint/diameter/reference_v22.slvs @@ -0,0 +1,296 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=5.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/diameter/test.cpp b/test/constraint/diameter/test.cpp new file mode 100644 index 0000000..7e2a06e --- /dev/null +++ b/test/constraint/diameter/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/eq_len_pt_line_d/normal.png b/test/constraint/eq_len_pt_line_d/normal.png new file mode 100644 index 0000000..9daa892 Binary files /dev/null and b/test/constraint/eq_len_pt_line_d/normal.png differ diff --git a/test/constraint/eq_len_pt_line_d/normal.slvs b/test/constraint/eq_len_pt_line_d/normal.slvs new file mode 100644 index 0000000..779430c --- /dev/null +++ b/test/constraint/eq_len_pt_line_d/normal.slvs @@ -0,0 +1,364 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=52 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00060000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/eq_len_pt_line_d/normal_v20.slvs b/test/constraint/eq_len_pt_line_d/normal_v20.slvs new file mode 100644 index 0000000..6ce37fd --- /dev/null +++ b/test/constraint/eq_len_pt_line_d/normal_v20.slvs @@ -0,0 +1,362 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=52 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00060000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/eq_len_pt_line_d/normal_v22.slvs b/test/constraint/eq_len_pt_line_d/normal_v22.slvs new file mode 100644 index 0000000..78b22b0 --- /dev/null +++ b/test/constraint/eq_len_pt_line_d/normal_v22.slvs @@ -0,0 +1,364 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=52 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00060000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/eq_len_pt_line_d/test.cpp b/test/constraint/eq_len_pt_line_d/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/eq_len_pt_line_d/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/eq_pt_ln_distances/normal.png b/test/constraint/eq_pt_ln_distances/normal.png new file mode 100644 index 0000000..4d04003 Binary files /dev/null and b/test/constraint/eq_pt_ln_distances/normal.png differ diff --git a/test/constraint/eq_pt_ln_distances/normal.slvs b/test/constraint/eq_pt_ln_distances/normal.slvs new file mode 100644 index 0000000..6a196e3 --- /dev/null +++ b/test/constraint/eq_pt_ln_distances/normal.slvs @@ -0,0 +1,389 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=53 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00070000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/eq_pt_ln_distances/normal_v20.slvs b/test/constraint/eq_pt_ln_distances/normal_v20.slvs new file mode 100644 index 0000000..2d878b9 --- /dev/null +++ b/test/constraint/eq_pt_ln_distances/normal_v20.slvs @@ -0,0 +1,387 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=53 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00070000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/eq_pt_ln_distances/normal_v22.slvs b/test/constraint/eq_pt_ln_distances/normal_v22.slvs new file mode 100644 index 0000000..1e4968b --- /dev/null +++ b/test/constraint/eq_pt_ln_distances/normal_v22.slvs @@ -0,0 +1,389 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=53 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00070000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/eq_pt_ln_distances/test.cpp b/test/constraint/eq_pt_ln_distances/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/eq_pt_ln_distances/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/equal_angle/normal.png b/test/constraint/equal_angle/normal.png new file mode 100644 index 0000000..aecf315 Binary files /dev/null and b/test/constraint/equal_angle/normal.png differ diff --git a/test/constraint/equal_angle/normal.slvs b/test/constraint/equal_angle/normal.slvs new file mode 100644 index 0000000..60e7b92 --- /dev/null +++ b/test/constraint/equal_angle/normal.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000088818 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=10.29878739785912600269 +AddParam + +Param.h.v.=00060011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.29878739785912422633 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=5.29878739785912422633 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=10.29878739785912600269 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000088818 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.29878739785912600269 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.29878739785912422633 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.29878739785912422633 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.29878739785912600269 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/normal_old_version.slvs b/test/constraint/equal_angle/normal_old_version.slvs new file mode 100644 index 0000000..b1d538f --- /dev/null +++ b/test/constraint/equal_angle/normal_old_version.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/normal_v20.slvs b/test/constraint/equal_angle/normal_v20.slvs new file mode 100644 index 0000000..25b9634 --- /dev/null +++ b/test/constraint/equal_angle/normal_v20.slvs @@ -0,0 +1,461 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/normal_v22.slvs b/test/constraint/equal_angle/normal_v22.slvs new file mode 100644 index 0000000..6fb46d0 --- /dev/null +++ b/test/constraint/equal_angle/normal_v22.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/other.png b/test/constraint/equal_angle/other.png new file mode 100644 index 0000000..85bf826 Binary files /dev/null and b/test/constraint/equal_angle/other.png differ diff --git a/test/constraint/equal_angle/other.slvs b/test/constraint/equal_angle/other.slvs new file mode 100644 index 0000000..c1fe293 --- /dev/null +++ b/test/constraint/equal_angle/other.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/other_v20.slvs b/test/constraint/equal_angle/other_v20.slvs new file mode 100644 index 0000000..5e976dd --- /dev/null +++ b/test/constraint/equal_angle/other_v20.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/other_v22.slvs b/test/constraint/equal_angle/other_v22.slvs new file mode 100644 index 0000000..94cfdf2 --- /dev/null +++ b/test/constraint/equal_angle/other_v22.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040002 +Constraint.ptB.v=00050001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060002 +Constraint.ptB.v=00070001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=54 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.entityC.v=00070000 +Constraint.entityD.v=00060000 +Constraint.other=1 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_angle/test.cpp b/test/constraint/equal_angle/test.cpp new file mode 100644 index 0000000..e96c709 --- /dev/null +++ b/test/constraint/equal_angle/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal_old_version.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal_old_version.slvs"); +} + +TEST_CASE(other_roundtrip) { + CHECK_LOAD("other.slvs"); + CHECK_RENDER("other.png"); + CHECK_SAVE("other.slvs"); +} + +TEST_CASE(other_migrate_from_v20) { + CHECK_LOAD("other_v20.slvs"); + CHECK_SAVE("other.slvs"); +} + +TEST_CASE(other_migrate_from_v22) { + CHECK_LOAD("other_v22.slvs"); + CHECK_SAVE("other.slvs"); +} diff --git a/test/constraint/equal_length_lines/normal.png b/test/constraint/equal_length_lines/normal.png new file mode 100644 index 0000000..9e4e665 Binary files /dev/null and b/test/constraint/equal_length_lines/normal.png differ diff --git a/test/constraint/equal_length_lines/normal.slvs b/test/constraint/equal_length_lines/normal.slvs new file mode 100644 index 0000000..b832564 --- /dev/null +++ b/test/constraint/equal_length_lines/normal.slvs @@ -0,0 +1,339 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=50 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_length_lines/normal_v20.slvs b/test/constraint/equal_length_lines/normal_v20.slvs new file mode 100644 index 0000000..0711882 --- /dev/null +++ b/test/constraint/equal_length_lines/normal_v20.slvs @@ -0,0 +1,337 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=50 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_length_lines/normal_v22.slvs b/test/constraint/equal_length_lines/normal_v22.slvs new file mode 100644 index 0000000..a84e4f1 --- /dev/null +++ b/test/constraint/equal_length_lines/normal_v22.slvs @@ -0,0 +1,339 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=50 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_length_lines/test.cpp b/test/constraint/equal_length_lines/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/equal_length_lines/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/equal_line_arc_len/normal.png b/test/constraint/equal_line_arc_len/normal.png new file mode 100644 index 0000000..b2456fe Binary files /dev/null and b/test/constraint/equal_line_arc_len/normal.png differ diff --git a/test/constraint/equal_line_arc_len/normal.slvs b/test/constraint/equal_line_arc_len/normal.slvs new file mode 100644 index 0000000..1f7869e --- /dev/null +++ b/test/constraint/equal_line_arc_len/normal.slvs @@ -0,0 +1,367 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-4.99993226121819223096 +AddParam + +Param.h.v.=00040011 +Param.val=10.00006773878180865722 +AddParam + +Param.h.v.=00040013 +Param.val=-9.99975209012342425297 +AddParam + +Param.h.v.=00040014 +Param.val=9.99968435134161737210 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00031564865838440426 +AddParam + +Param.h.v.=00040017 +Param.val=5.00024790987657663521 +AddParam + +Param.h.v.=00050010 +Param.val=4.99990506249655908277 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=12.85283693258537773829 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-4.99993226121819223096 +Entity.actPoint.y=10.00006773878180865722 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-9.99975209012342425297 +Entity.actPoint.y=9.99968435134161737210 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00031564865838440426 +Entity.actPoint.y=5.00024790987657663521 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=4.99990506249655908277 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=12.85283693258537773829 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=55 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_line_arc_len/normal_v20.slvs b/test/constraint/equal_line_arc_len/normal_v20.slvs new file mode 100644 index 0000000..9f4b27b --- /dev/null +++ b/test/constraint/equal_line_arc_len/normal_v20.slvs @@ -0,0 +1,367 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-4.99993226121819220000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00006773878180900000 +AddParam + +Param.h.v.=00040013 +Param.val=-9.99975209012342430000 +AddParam + +Param.h.v.=00040014 +Param.val=9.99968435134161740000 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00031564865838440000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00024790987657660000 +AddParam + +Param.h.v.=00050010 +Param.val=4.99990506249655910000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=12.85283693258537800000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-4.99993226121819220000 +Entity.actPoint.y=10.00006773878180900000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-9.99975209012342430000 +Entity.actPoint.y=9.99968435134161740000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00031564865838440000 +Entity.actPoint.y=5.00024790987657660000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=4.99990506249655910000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=12.85283693258537800000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=55 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_line_arc_len/normal_v22.slvs b/test/constraint/equal_line_arc_len/normal_v22.slvs new file mode 100644 index 0000000..733864b --- /dev/null +++ b/test/constraint/equal_line_arc_len/normal_v22.slvs @@ -0,0 +1,367 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-4.99993226121819220000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00006773878180900000 +AddParam + +Param.h.v.=00040013 +Param.val=-9.99975209012342430000 +AddParam + +Param.h.v.=00040014 +Param.val=9.99968435134161740000 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00031564865838440000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00024790987657660000 +AddParam + +Param.h.v.=00050010 +Param.val=4.99990506249655910000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=12.85283693258537800000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-4.99993226121819220000 +Entity.actPoint.y=10.00006773878180900000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-9.99975209012342430000 +Entity.actPoint.y=9.99968435134161740000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00031564865838440000 +Entity.actPoint.y=5.00024790987657660000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=4.99990506249655910000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=12.85283693258537800000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=55 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_line_arc_len/pi.png b/test/constraint/equal_line_arc_len/pi.png new file mode 100644 index 0000000..4e06218 Binary files /dev/null and b/test/constraint/equal_line_arc_len/pi.png differ diff --git a/test/constraint/equal_line_arc_len/pi.slvs b/test/constraint/equal_line_arc_len/pi.slvs new file mode 100644 index 0000000..009148c --- /dev/null +++ b/test/constraint/equal_line_arc_len/pi.slvs @@ -0,0 +1,367 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-4.99999651845403381145 +AddParam + +Param.h.v.=00040011 +Param.val=9.99999682365714548382 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000349810587607635 +AddParam + +Param.h.v.=00040014 +Param.val=14.99999363650495176614 +AddParam + +Param.h.v.=00040016 +Param.val=-5.00000000434181757214 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000001080568345913 +AddParam + +Param.h.v.=00050010 +Param.val=4.99998746596540222242 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=20.70793025565613021399 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-4.99999651845403381145 +Entity.actPoint.y=9.99999682365714548382 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000349810587607635 +Entity.actPoint.y=14.99999363650495176614 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000434181757214 +Entity.actPoint.y=5.00000001080568345913 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=4.99998746596540222242 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.70793025565613021399 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=55 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_line_arc_len/tau.png b/test/constraint/equal_line_arc_len/tau.png new file mode 100644 index 0000000..1abd363 Binary files /dev/null and b/test/constraint/equal_line_arc_len/tau.png differ diff --git a/test/constraint/equal_line_arc_len/tau.slvs b/test/constraint/equal_line_arc_len/tau.slvs new file mode 100644 index 0000000..252f0db --- /dev/null +++ b/test/constraint/equal_line_arc_len/tau.slvs @@ -0,0 +1,367 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00017546830115566792 +AddParam + +Param.h.v.=00040014 +Param.val=14.99944877586899494304 +AddParam + +Param.h.v.=00040016 +Param.val=-3.60558569714161292197 +AddParam + +Param.h.v.=00040017 +Param.val=14.80105163951722957449 +AddParam + +Param.h.v.=00050010 +Param.val=-14.99961021487080792269 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000098153893191011 +AddParam + +Param.h.v.=00050013 +Param.val=14.99952004548601536271 +AddParam + +Param.h.v.=00050014 +Param.val=-5.00000000001570388264 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00017546830115566792 +Entity.actPoint.y=14.99944877586899494304 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-3.60558569714161292197 +Entity.actPoint.y=14.80105163951722957449 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-14.99961021487080792269 +Entity.actPoint.y=-5.00000098153893191011 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=14.99952004548601536271 +Entity.actPoint.y=-5.00000000001570388264 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=55 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_line_arc_len/test.cpp b/test/constraint/equal_line_arc_len/test.cpp new file mode 100644 index 0000000..78aee21 --- /dev/null +++ b/test/constraint/equal_line_arc_len/test.cpp @@ -0,0 +1,27 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(pi) { + CHECK_LOAD("pi.slvs"); + CHECK_RENDER("pi.png"); +} + +TEST_CASE(tau) { + CHECK_LOAD("tau.slvs"); + CHECK_RENDER("tau.png"); +} diff --git a/test/constraint/equal_radius/normal.png b/test/constraint/equal_radius/normal.png new file mode 100644 index 0000000..2d338c9 Binary files /dev/null and b/test/constraint/equal_radius/normal.png differ diff --git a/test/constraint/equal_radius/normal.slvs b/test/constraint/equal_radius/normal.slvs new file mode 100644 index 0000000..978b12c --- /dev/null +++ b/test/constraint/equal_radius/normal.slvs @@ -0,0 +1,349 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.normal.v=00050020 +Entity.distance.v=00050040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=130 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_radius/normal_v20.slvs b/test/constraint/equal_radius/normal_v20.slvs new file mode 100644 index 0000000..cd891bf --- /dev/null +++ b/test/constraint/equal_radius/normal_v20.slvs @@ -0,0 +1,347 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.normal.v=00050020 +Entity.distance.v=00050040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=130 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_radius/normal_v22.slvs b/test/constraint/equal_radius/normal_v22.slvs new file mode 100644 index 0000000..57b6d9b --- /dev/null +++ b/test/constraint/equal_radius/normal_v22.slvs @@ -0,0 +1,349 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.normal.v=00050020 +Entity.distance.v=00050040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=130 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/equal_radius/test.cpp b/test/constraint/equal_radius/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/equal_radius/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/horizontal/line.png b/test/constraint/horizontal/line.png new file mode 100644 index 0000000..cd911e5 Binary files /dev/null and b/test/constraint/horizontal/line.png differ diff --git a/test/constraint/horizontal/line.slvs b/test/constraint/horizontal/line.slvs new file mode 100644 index 0000000..cebb650 --- /dev/null +++ b/test/constraint/horizontal/line.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/horizontal/line_v20.slvs b/test/constraint/horizontal/line_v20.slvs new file mode 100644 index 0000000..8909c0f --- /dev/null +++ b/test/constraint/horizontal/line_v20.slvs @@ -0,0 +1,286 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/horizontal/line_v22.slvs b/test/constraint/horizontal/line_v22.slvs new file mode 100644 index 0000000..8b2dd43 --- /dev/null +++ b/test/constraint/horizontal/line_v22.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/horizontal/pt_pt.png b/test/constraint/horizontal/pt_pt.png new file mode 100644 index 0000000..7614ea8 Binary files /dev/null and b/test/constraint/horizontal/pt_pt.png differ diff --git a/test/constraint/horizontal/pt_pt.slvs b/test/constraint/horizontal/pt_pt.slvs new file mode 100644 index 0000000..ac91222 --- /dev/null +++ b/test/constraint/horizontal/pt_pt.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/horizontal/pt_pt_v20.slvs b/test/constraint/horizontal/pt_pt_v20.slvs new file mode 100644 index 0000000..6a38678 --- /dev/null +++ b/test/constraint/horizontal/pt_pt_v20.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/horizontal/pt_pt_v22.slvs b/test/constraint/horizontal/pt_pt_v22.slvs new file mode 100644 index 0000000..cadcdba --- /dev/null +++ b/test/constraint/horizontal/pt_pt_v22.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/horizontal/test.cpp b/test/constraint/horizontal/test.cpp new file mode 100644 index 0000000..c08b5e1 --- /dev/null +++ b/test/constraint/horizontal/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(line_roundtrip) { + CHECK_LOAD("line.slvs"); + CHECK_RENDER("line.png"); + CHECK_SAVE("line.slvs"); +} + +TEST_CASE(line_migrate_from_v20) { + CHECK_LOAD("line_v20.slvs"); + CHECK_SAVE("line.slvs"); +} + +TEST_CASE(line_migrate_from_v22) { + CHECK_LOAD("line_v22.slvs"); + CHECK_SAVE("line.slvs"); +} + +TEST_CASE(pt_pt_roundtrip) { + CHECK_LOAD("pt_pt.slvs"); + CHECK_RENDER("pt_pt.png"); + CHECK_SAVE("pt_pt.slvs"); +} + +TEST_CASE(pt_pt_migrate_from_v20) { + CHECK_LOAD("pt_pt_v20.slvs"); + CHECK_SAVE("pt_pt.slvs"); +} + +TEST_CASE(pt_pt_migrate_from_v22) { + CHECK_LOAD("pt_pt_v22.slvs"); + CHECK_SAVE("pt_pt.slvs"); +} diff --git a/test/constraint/length_difference/normal.png b/test/constraint/length_difference/normal.png new file mode 100644 index 0000000..eec3931 Binary files /dev/null and b/test/constraint/length_difference/normal.png differ diff --git a/test/constraint/length_difference/normal.slvs b/test/constraint/length_difference/normal.slvs new file mode 100644 index 0000000..eeef933 --- /dev/null +++ b/test/constraint/length_difference/normal.slvs @@ -0,0 +1,341 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=56 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=10.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_difference/normal_v22.slvs b/test/constraint/length_difference/normal_v22.slvs new file mode 100644 index 0000000..1d85e47 --- /dev/null +++ b/test/constraint/length_difference/normal_v22.slvs @@ -0,0 +1,341 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=56 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=10.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_difference/reference.png b/test/constraint/length_difference/reference.png new file mode 100644 index 0000000..93437f1 Binary files /dev/null and b/test/constraint/length_difference/reference.png differ diff --git a/test/constraint/length_difference/reference.slvs b/test/constraint/length_difference/reference.slvs new file mode 100644 index 0000000..c9bb8d7 --- /dev/null +++ b/test/constraint/length_difference/reference.slvs @@ -0,0 +1,341 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=56 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=10.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_difference/reference_v22.slvs b/test/constraint/length_difference/reference_v22.slvs new file mode 100644 index 0000000..08c5db8 --- /dev/null +++ b/test/constraint/length_difference/reference_v22.slvs @@ -0,0 +1,341 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=56 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=10.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_difference/test.cpp b/test/constraint/length_difference/test.cpp new file mode 100644 index 0000000..9fc456e --- /dev/null +++ b/test/constraint/length_difference/test.cpp @@ -0,0 +1,23 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/length_ratio/normal.png b/test/constraint/length_ratio/normal.png new file mode 100644 index 0000000..894c618 Binary files /dev/null and b/test/constraint/length_ratio/normal.png differ diff --git a/test/constraint/length_ratio/normal.slvs b/test/constraint/length_ratio/normal.slvs new file mode 100644 index 0000000..0286fc1 --- /dev/null +++ b/test/constraint/length_ratio/normal.slvs @@ -0,0 +1,342 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=51 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=0.50000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_ratio/normal_v20.slvs b/test/constraint/length_ratio/normal_v20.slvs new file mode 100644 index 0000000..a73f06b --- /dev/null +++ b/test/constraint/length_ratio/normal_v20.slvs @@ -0,0 +1,340 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=51 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=0.50000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_ratio/normal_v22.slvs b/test/constraint/length_ratio/normal_v22.slvs new file mode 100644 index 0000000..08957de --- /dev/null +++ b/test/constraint/length_ratio/normal_v22.slvs @@ -0,0 +1,342 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=51 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=0.50000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_ratio/reference.png b/test/constraint/length_ratio/reference.png new file mode 100644 index 0000000..5a5bfc9 Binary files /dev/null and b/test/constraint/length_ratio/reference.png differ diff --git a/test/constraint/length_ratio/reference.slvs b/test/constraint/length_ratio/reference.slvs new file mode 100644 index 0000000..7c696ba --- /dev/null +++ b/test/constraint/length_ratio/reference.slvs @@ -0,0 +1,342 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=51 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=0.50000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_ratio/reference_v20.slvs b/test/constraint/length_ratio/reference_v20.slvs new file mode 100644 index 0000000..2645f7b --- /dev/null +++ b/test/constraint/length_ratio/reference_v20.slvs @@ -0,0 +1,342 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=51 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=0.50000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_ratio/reference_v22.slvs b/test/constraint/length_ratio/reference_v22.slvs new file mode 100644 index 0000000..c0ca95c --- /dev/null +++ b/test/constraint/length_ratio/reference_v22.slvs @@ -0,0 +1,342 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=51 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=0.50000000000000000000 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=5.00000000000000000000 +AddConstraint + diff --git a/test/constraint/length_ratio/test.cpp b/test/constraint/length_ratio/test.cpp new file mode 100644 index 0000000..7e2a06e --- /dev/null +++ b/test/constraint/length_ratio/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/parallel/free_in_3d.png b/test/constraint/parallel/free_in_3d.png new file mode 100644 index 0000000..ee78f87 Binary files /dev/null and b/test/constraint/parallel/free_in_3d.png differ diff --git a/test/constraint/parallel/free_in_3d.slvs b/test/constraint/parallel/free_in_3d.slvs new file mode 100644 index 0000000..1a054ed --- /dev/null +++ b/test/constraint/parallel/free_in_3d.slvs @@ -0,0 +1,295 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=40000001 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=121 +Constraint.group.v=00000002 +Constraint.valP.v=40000001 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/parallel/free_in_3d_v20.slvs b/test/constraint/parallel/free_in_3d_v20.slvs new file mode 100644 index 0000000..421eb11 --- /dev/null +++ b/test/constraint/parallel/free_in_3d_v20.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=121 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/parallel/free_in_3d_v22.slvs b/test/constraint/parallel/free_in_3d_v22.slvs new file mode 100644 index 0000000..1628203 --- /dev/null +++ b/test/constraint/parallel/free_in_3d_v22.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=121 +Constraint.group.v=00000002 +Constraint.entityA.v=00040000 +Constraint.entityB.v=00030020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/parallel/normal.png b/test/constraint/parallel/normal.png new file mode 100644 index 0000000..599c82b Binary files /dev/null and b/test/constraint/parallel/normal.png differ diff --git a/test/constraint/parallel/normal.slvs b/test/constraint/parallel/normal.slvs new file mode 100644 index 0000000..c9fc2aa --- /dev/null +++ b/test/constraint/parallel/normal.slvs @@ -0,0 +1,339 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=121 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/parallel/normal_v20.slvs b/test/constraint/parallel/normal_v20.slvs new file mode 100644 index 0000000..56abd5e --- /dev/null +++ b/test/constraint/parallel/normal_v20.slvs @@ -0,0 +1,337 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=121 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/parallel/normal_v22.slvs b/test/constraint/parallel/normal_v22.slvs new file mode 100644 index 0000000..8584018 --- /dev/null +++ b/test/constraint/parallel/normal_v22.slvs @@ -0,0 +1,339 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=15.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=121 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/parallel/test.cpp b/test/constraint/parallel/test.cpp new file mode 100644 index 0000000..4dcc334 --- /dev/null +++ b/test/constraint/parallel/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} diff --git a/test/constraint/perpendicular/normal.png b/test/constraint/perpendicular/normal.png new file mode 100644 index 0000000..415dc88 Binary files /dev/null and b/test/constraint/perpendicular/normal.png differ diff --git a/test/constraint/perpendicular/normal.slvs b/test/constraint/perpendicular/normal.slvs new file mode 100644 index 0000000..a0d5930 --- /dev/null +++ b/test/constraint/perpendicular/normal.slvs @@ -0,0 +1,339 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=122 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/perpendicular/normal_v20.slvs b/test/constraint/perpendicular/normal_v20.slvs new file mode 100644 index 0000000..905594d --- /dev/null +++ b/test/constraint/perpendicular/normal_v20.slvs @@ -0,0 +1,337 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=122 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/perpendicular/normal_v22.slvs b/test/constraint/perpendicular/normal_v22.slvs new file mode 100644 index 0000000..342a049 --- /dev/null +++ b/test/constraint/perpendicular/normal_v22.slvs @@ -0,0 +1,339 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=122 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.entityB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/perpendicular/test.cpp b/test/constraint/perpendicular/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/perpendicular/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/points_coincident/free_in_3d.png b/test/constraint/points_coincident/free_in_3d.png new file mode 100644 index 0000000..df5a660 Binary files /dev/null and b/test/constraint/points_coincident/free_in_3d.png differ diff --git a/test/constraint/points_coincident/free_in_3d.slvs b/test/constraint/points_coincident/free_in_3d.slvs new file mode 100644 index 0000000..22c7cf3 --- /dev/null +++ b/test/constraint/points_coincident/free_in_3d.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/points_coincident/free_in_3d_v20.slvs b/test/constraint/points_coincident/free_in_3d_v20.slvs new file mode 100644 index 0000000..af7bd14 --- /dev/null +++ b/test/constraint/points_coincident/free_in_3d_v20.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/points_coincident/free_in_3d_v22.slvs b/test/constraint/points_coincident/free_in_3d_v22.slvs new file mode 100644 index 0000000..81f0989 --- /dev/null +++ b/test/constraint/points_coincident/free_in_3d_v22.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/points_coincident/normal.png b/test/constraint/points_coincident/normal.png new file mode 100644 index 0000000..df5a660 Binary files /dev/null and b/test/constraint/points_coincident/normal.png differ diff --git a/test/constraint/points_coincident/normal.slvs b/test/constraint/points_coincident/normal.slvs new file mode 100644 index 0000000..ff85ce3 --- /dev/null +++ b/test/constraint/points_coincident/normal.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/points_coincident/normal_v20.slvs b/test/constraint/points_coincident/normal_v20.slvs new file mode 100644 index 0000000..8b072f7 --- /dev/null +++ b/test/constraint/points_coincident/normal_v20.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/points_coincident/normal_v22.slvs b/test/constraint/points_coincident/normal_v22.slvs new file mode 100644 index 0000000..cf4d13f --- /dev/null +++ b/test/constraint/points_coincident/normal_v22.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/points_coincident/test.cpp b/test/constraint/points_coincident/test.cpp new file mode 100644 index 0000000..4dcc334 --- /dev/null +++ b/test/constraint/points_coincident/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} diff --git a/test/constraint/proj_pt_distance/normal.png b/test/constraint/proj_pt_distance/normal.png new file mode 100644 index 0000000..d57c16a Binary files /dev/null and b/test/constraint/proj_pt_distance/normal.png differ diff --git a/test/constraint/proj_pt_distance/normal.slvs b/test/constraint/proj_pt_distance/normal.slvs new file mode 100644 index 0000000..1658c3e --- /dev/null +++ b/test/constraint/proj_pt_distance/normal.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=34 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.entityA.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=-4.00000000000000000000 +AddConstraint + diff --git a/test/constraint/proj_pt_distance/normal_v20.slvs b/test/constraint/proj_pt_distance/normal_v20.slvs new file mode 100644 index 0000000..7dd3084 --- /dev/null +++ b/test/constraint/proj_pt_distance/normal_v20.slvs @@ -0,0 +1,293 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=34 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.entityA.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=0.00000000000000000000 +Constraint.disp.offset.y=-4.00000000000000000000 +AddConstraint + diff --git a/test/constraint/proj_pt_distance/normal_v22.slvs b/test/constraint/proj_pt_distance/normal_v22.slvs new file mode 100644 index 0000000..01ba48e --- /dev/null +++ b/test/constraint/proj_pt_distance/normal_v22.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=34 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.entityA.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=-4.00000000000000000000 +AddConstraint + diff --git a/test/constraint/proj_pt_distance/reference.png b/test/constraint/proj_pt_distance/reference.png new file mode 100644 index 0000000..571927b Binary files /dev/null and b/test/constraint/proj_pt_distance/reference.png differ diff --git a/test/constraint/proj_pt_distance/reference.slvs b/test/constraint/proj_pt_distance/reference.slvs new file mode 100644 index 0000000..d1203b9 --- /dev/null +++ b/test/constraint/proj_pt_distance/reference.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=34 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.entityA.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=-4.00000000000000000000 +AddConstraint + diff --git a/test/constraint/proj_pt_distance/reference_v20.slvs b/test/constraint/proj_pt_distance/reference_v20.slvs new file mode 100644 index 0000000..d5f3860 --- /dev/null +++ b/test/constraint/proj_pt_distance/reference_v20.slvs @@ -0,0 +1,292 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=34 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.entityA.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=-4.00000000000000000000 +AddConstraint + diff --git a/test/constraint/proj_pt_distance/reference_v22.slvs b/test/constraint/proj_pt_distance/reference_v22.slvs new file mode 100644 index 0000000..6461182 --- /dev/null +++ b/test/constraint/proj_pt_distance/reference_v22.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=34 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.entityA.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=-4.00000000000000000000 +AddConstraint + diff --git a/test/constraint/proj_pt_distance/test.cpp b/test/constraint/proj_pt_distance/test.cpp new file mode 100644 index 0000000..7e2a06e --- /dev/null +++ b/test/constraint/proj_pt_distance/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/pt_face_distance/normal.png b/test/constraint/pt_face_distance/normal.png new file mode 100644 index 0000000..5fe4272 Binary files /dev/null and b/test/constraint/pt_face_distance/normal.png differ diff --git a/test/constraint/pt_face_distance/normal.slvs b/test/constraint/pt_face_distance/normal.slvs new file mode 100644 index 0000000..f2fd334 --- /dev/null +++ b/test/constraint/pt_face_distance/normal.slvs @@ -0,0 +1,713 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=00020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=00020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=00010000 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=00020000 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=1 +Entity.workplane.v=00010000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=00020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=33 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valA=-10.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 80030012 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 +TrimBy 00000001 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +TrimBy 00000007 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030011 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000002 1 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000001 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +TrimBy 00000005 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000004 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000006 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000007 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000009 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000a 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 0000000c 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.00000000000000000000 4.91652684208287205081 0.90981526206072360630 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 0.00000000000000000000 4.18497755609325672310 2.73604876692571252761 +CurvePt 0 0.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 2.73604876692571252761 4.18497755609325672310 +CurvePt 0 0.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 0 0.00000000000000000000 0.90981526206072382834 4.91652684208287205081 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 10.00000000000000000000 4.91652684208287205081 0.90981526206072360630 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 10.00000000000000000000 4.18497755609325672310 2.73604876692571252761 +CurvePt 0 10.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 2.73604876692571252761 4.18497755609325672310 +CurvePt 0 10.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 0 10.00000000000000000000 0.90981526206072382834 4.91652684208287205081 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 0.00000000000000000000 -0.90981526206072327323 4.91652684208287205081 +CurvePt 0 0.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 0.00000000000000000000 -2.73604876692571208352 4.18497755609325672310 +CurvePt 0 0.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 -4.18497755609325672310 2.73604876692571297170 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 0 0.00000000000000000000 -4.91652684208287205081 0.90981526206072405039 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 10.00000000000000000000 -0.90981526206072327323 4.91652684208287205081 +CurvePt 0 10.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 10.00000000000000000000 -2.73604876692571208352 4.18497755609325672310 +CurvePt 0 10.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 -4.18497755609325672310 2.73604876692571297170 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 0 10.00000000000000000000 -4.91652684208287205081 0.90981526206072405039 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 0.00000000000000000000 -4.91652684208287205081 -0.90981526206072305119 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 0.00000000000000000000 -4.18497755609325672310 -2.73604876692571208352 +CurvePt 0 0.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 0.00000000000000000000 -2.73604876692571297170 -4.18497755609325672310 +CurvePt 0 0.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 0 0.00000000000000000000 -0.90981526206072438345 -4.91652684208287205081 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 10.00000000000000000000 -4.91652684208287205081 -0.90981526206072305119 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 10.00000000000000000000 -4.18497755609325672310 -2.73604876692571208352 +CurvePt 0 10.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 10.00000000000000000000 -2.73604876692571297170 -4.18497755609325672310 +CurvePt 0 10.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 0 10.00000000000000000000 -0.90981526206072438345 -4.91652684208287205081 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 0.00000000000000000000 0.90981526206072282914 -4.91652684208287205081 +CurvePt 0 0.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 0.00000000000000000000 2.73604876692571163943 -4.18497755609325672310 +CurvePt 0 0.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 0.00000000000000000000 4.18497755609325583492 -2.73604876692571297170 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 0 0.00000000000000000000 4.91652684208287205081 -0.90981526206072471652 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 10.00000000000000000000 0.90981526206072282914 -4.91652684208287205081 +CurvePt 0 10.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 10.00000000000000000000 2.73604876692571163943 -4.18497755609325672310 +CurvePt 0 10.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 10.00000000000000000000 4.18497755609325583492 -2.73604876692571297170 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 0 10.00000000000000000000 4.91652684208287205081 -0.90981526206072471652 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve diff --git a/test/constraint/pt_face_distance/normal_v20.slvs b/test/constraint/pt_face_distance/normal_v20.slvs new file mode 100644 index 0000000..c8a4c23 --- /dev/null +++ b/test/constraint/pt_face_distance/normal_v20.slvs @@ -0,0 +1,712 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=00020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=00020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=00010000 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=00020000 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00010000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=00020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=33 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valA=-10.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 80030012 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 +TrimBy 00000001 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +TrimBy 00000007 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030011 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000002 1 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000001 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +TrimBy 00000005 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000004 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000007 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000c 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000a 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.00000000000000000000 4.91652684208287210000 0.90981526206072361000 +CurvePt 0 0.00000000000000000000 4.64894150531215190000 1.84047354780936390000 +CurvePt 0 0.00000000000000000000 4.18497755609325670000 2.73604876692571250000 +CurvePt 0 0.00000000000000000000 3.53553390593273780000 3.53553390593273780000 +CurvePt 0 0.00000000000000000000 2.73604876692571250000 4.18497755609325670000 +CurvePt 0 0.00000000000000000000 1.84047354780936410000 4.64894150531215190000 +CurvePt 0 0.00000000000000000000 0.90981526206072383000 4.91652684208287210000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 10.00000000000000000000 4.91652684208287210000 0.90981526206072361000 +CurvePt 0 10.00000000000000000000 4.64894150531215190000 1.84047354780936390000 +CurvePt 0 10.00000000000000000000 4.18497755609325670000 2.73604876692571250000 +CurvePt 0 10.00000000000000000000 3.53553390593273780000 3.53553390593273780000 +CurvePt 0 10.00000000000000000000 2.73604876692571250000 4.18497755609325670000 +CurvePt 0 10.00000000000000000000 1.84047354780936410000 4.64894150531215190000 +CurvePt 0 10.00000000000000000000 0.90981526206072383000 4.91652684208287210000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 0.00000000000000000000 -0.90981526206072327000 4.91652684208287210000 +CurvePt 0 0.00000000000000000000 -1.84047354780936320000 4.64894150531215190000 +CurvePt 0 0.00000000000000000000 -2.73604876692571210000 4.18497755609325670000 +CurvePt 0 0.00000000000000000000 -3.53553390593273780000 3.53553390593273780000 +CurvePt 0 0.00000000000000000000 -4.18497755609325670000 2.73604876692571300000 +CurvePt 0 0.00000000000000000000 -4.64894150531215190000 1.84047354780936430000 +CurvePt 0 0.00000000000000000000 -4.91652684208287210000 0.90981526206072405000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 10.00000000000000000000 -0.90981526206072327000 4.91652684208287210000 +CurvePt 0 10.00000000000000000000 -1.84047354780936320000 4.64894150531215190000 +CurvePt 0 10.00000000000000000000 -2.73604876692571210000 4.18497755609325670000 +CurvePt 0 10.00000000000000000000 -3.53553390593273780000 3.53553390593273780000 +CurvePt 0 10.00000000000000000000 -4.18497755609325670000 2.73604876692571300000 +CurvePt 0 10.00000000000000000000 -4.64894150531215190000 1.84047354780936430000 +CurvePt 0 10.00000000000000000000 -4.91652684208287210000 0.90981526206072405000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 0.00000000000000000000 -4.91652684208287210000 -0.90981526206072305000 +CurvePt 0 0.00000000000000000000 -4.64894150531215190000 -1.84047354780936300000 +CurvePt 0 0.00000000000000000000 -4.18497755609325670000 -2.73604876692571210000 +CurvePt 0 0.00000000000000000000 -3.53553390593273860000 -3.53553390593273730000 +CurvePt 0 0.00000000000000000000 -2.73604876692571300000 -4.18497755609325670000 +CurvePt 0 0.00000000000000000000 -1.84047354780936480000 -4.64894150531215190000 +CurvePt 0 0.00000000000000000000 -0.90981526206072438000 -4.91652684208287210000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 10.00000000000000000000 -4.91652684208287210000 -0.90981526206072305000 +CurvePt 0 10.00000000000000000000 -4.64894150531215190000 -1.84047354780936300000 +CurvePt 0 10.00000000000000000000 -4.18497755609325670000 -2.73604876692571210000 +CurvePt 0 10.00000000000000000000 -3.53553390593273860000 -3.53553390593273730000 +CurvePt 0 10.00000000000000000000 -2.73604876692571300000 -4.18497755609325670000 +CurvePt 0 10.00000000000000000000 -1.84047354780936480000 -4.64894150531215190000 +CurvePt 0 10.00000000000000000000 -0.90981526206072438000 -4.91652684208287210000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 0.00000000000000000000 0.90981526206072283000 -4.91652684208287210000 +CurvePt 0 0.00000000000000000000 1.84047354780936300000 -4.64894150531215190000 +CurvePt 0 0.00000000000000000000 2.73604876692571160000 -4.18497755609325670000 +CurvePt 0 0.00000000000000000000 3.53553390593273730000 -3.53553390593273860000 +CurvePt 0 0.00000000000000000000 4.18497755609325580000 -2.73604876692571300000 +CurvePt 0 0.00000000000000000000 4.64894150531215190000 -1.84047354780936500000 +CurvePt 0 0.00000000000000000000 4.91652684208287210000 -0.90981526206072472000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 10.00000000000000000000 0.90981526206072283000 -4.91652684208287210000 +CurvePt 0 10.00000000000000000000 1.84047354780936300000 -4.64894150531215190000 +CurvePt 0 10.00000000000000000000 2.73604876692571160000 -4.18497755609325670000 +CurvePt 0 10.00000000000000000000 3.53553390593273730000 -3.53553390593273860000 +CurvePt 0 10.00000000000000000000 4.18497755609325580000 -2.73604876692571300000 +CurvePt 0 10.00000000000000000000 4.64894150531215190000 -1.84047354780936500000 +CurvePt 0 10.00000000000000000000 4.91652684208287210000 -0.90981526206072472000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve diff --git a/test/constraint/pt_face_distance/normal_v22.slvs b/test/constraint/pt_face_distance/normal_v22.slvs new file mode 100644 index 0000000..2e4195e --- /dev/null +++ b/test/constraint/pt_face_distance/normal_v22.slvs @@ -0,0 +1,681 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=00020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=00020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=00010000 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=00020000 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00010000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=00020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=33 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valA=-10.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 80030012 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 +TrimBy 00000001 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +TrimBy 00000007 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030011 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000002 1 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000001 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +TrimBy 00000005 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000004 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000006 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000007 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000009 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000a 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 0000000c 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 0.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 10.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 0.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 0.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 10.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 10.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 0.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 0.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 10.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 10.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 0.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 0.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 10.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 10.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve diff --git a/test/constraint/pt_face_distance/reference.png b/test/constraint/pt_face_distance/reference.png new file mode 100644 index 0000000..6e392b3 Binary files /dev/null and b/test/constraint/pt_face_distance/reference.png differ diff --git a/test/constraint/pt_face_distance/reference.slvs b/test/constraint/pt_face_distance/reference.slvs new file mode 100644 index 0000000..2d89471 --- /dev/null +++ b/test/constraint/pt_face_distance/reference.slvs @@ -0,0 +1,713 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=00020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=00020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=00010000 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=00020000 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=1 +Entity.workplane.v=00010000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=00020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=33 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valA=-10.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + +Surface 00000001 00646464 80030012 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 +TrimBy 00000001 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +TrimBy 00000007 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030011 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000002 1 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000001 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +TrimBy 00000005 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000004 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000006 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000007 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000009 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000a 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 0000000c 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.00000000000000000000 4.91652684208287205081 0.90981526206072360630 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 0.00000000000000000000 4.18497755609325672310 2.73604876692571252761 +CurvePt 0 0.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 2.73604876692571252761 4.18497755609325672310 +CurvePt 0 0.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 0 0.00000000000000000000 0.90981526206072382834 4.91652684208287205081 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 10.00000000000000000000 4.91652684208287205081 0.90981526206072360630 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 10.00000000000000000000 4.18497755609325672310 2.73604876692571252761 +CurvePt 0 10.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 2.73604876692571252761 4.18497755609325672310 +CurvePt 0 10.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 0 10.00000000000000000000 0.90981526206072382834 4.91652684208287205081 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 0.00000000000000000000 -0.90981526206072327323 4.91652684208287205081 +CurvePt 0 0.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 0.00000000000000000000 -2.73604876692571208352 4.18497755609325672310 +CurvePt 0 0.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 -4.18497755609325672310 2.73604876692571297170 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 0 0.00000000000000000000 -4.91652684208287205081 0.90981526206072405039 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 10.00000000000000000000 -0.90981526206072327323 4.91652684208287205081 +CurvePt 0 10.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 10.00000000000000000000 -2.73604876692571208352 4.18497755609325672310 +CurvePt 0 10.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 -4.18497755609325672310 2.73604876692571297170 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 0 10.00000000000000000000 -4.91652684208287205081 0.90981526206072405039 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 0.00000000000000000000 -4.91652684208287205081 -0.90981526206072305119 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 0.00000000000000000000 -4.18497755609325672310 -2.73604876692571208352 +CurvePt 0 0.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 0.00000000000000000000 -2.73604876692571297170 -4.18497755609325672310 +CurvePt 0 0.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 0 0.00000000000000000000 -0.90981526206072438345 -4.91652684208287205081 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 10.00000000000000000000 -4.91652684208287205081 -0.90981526206072305119 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 10.00000000000000000000 -4.18497755609325672310 -2.73604876692571208352 +CurvePt 0 10.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 10.00000000000000000000 -2.73604876692571297170 -4.18497755609325672310 +CurvePt 0 10.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 0 10.00000000000000000000 -0.90981526206072438345 -4.91652684208287205081 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 0.00000000000000000000 0.90981526206072282914 -4.91652684208287205081 +CurvePt 0 0.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 0.00000000000000000000 2.73604876692571163943 -4.18497755609325672310 +CurvePt 0 0.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 0.00000000000000000000 4.18497755609325583492 -2.73604876692571297170 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 0 0.00000000000000000000 4.91652684208287205081 -0.90981526206072471652 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 10.00000000000000000000 0.90981526206072282914 -4.91652684208287205081 +CurvePt 0 10.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 10.00000000000000000000 2.73604876692571163943 -4.18497755609325672310 +CurvePt 0 10.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 10.00000000000000000000 4.18497755609325583492 -2.73604876692571297170 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 0 10.00000000000000000000 4.91652684208287205081 -0.90981526206072471652 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve diff --git a/test/constraint/pt_face_distance/reference_v20.slvs b/test/constraint/pt_face_distance/reference_v20.slvs new file mode 100644 index 0000000..c506e9b --- /dev/null +++ b/test/constraint/pt_face_distance/reference_v20.slvs @@ -0,0 +1,712 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=00020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=00020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=00010000 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=00020000 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00010000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=00020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=33 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valA=-10.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + +Surface 00000001 00646464 80030012 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 +TrimBy 00000001 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +TrimBy 00000007 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030011 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000002 1 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000001 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +TrimBy 00000005 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000004 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000007 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +SCtrl 1 1 10.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000c 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000a 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.00000000000000000000 4.91652684208287210000 0.90981526206072361000 +CurvePt 0 0.00000000000000000000 4.64894150531215190000 1.84047354780936390000 +CurvePt 0 0.00000000000000000000 4.18497755609325670000 2.73604876692571250000 +CurvePt 0 0.00000000000000000000 3.53553390593273780000 3.53553390593273780000 +CurvePt 0 0.00000000000000000000 2.73604876692571250000 4.18497755609325670000 +CurvePt 0 0.00000000000000000000 1.84047354780936410000 4.64894150531215190000 +CurvePt 0 0.00000000000000000000 0.90981526206072383000 4.91652684208287210000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 10.00000000000000000000 4.91652684208287210000 0.90981526206072361000 +CurvePt 0 10.00000000000000000000 4.64894150531215190000 1.84047354780936390000 +CurvePt 0 10.00000000000000000000 4.18497755609325670000 2.73604876692571250000 +CurvePt 0 10.00000000000000000000 3.53553390593273780000 3.53553390593273780000 +CurvePt 0 10.00000000000000000000 2.73604876692571250000 4.18497755609325670000 +CurvePt 0 10.00000000000000000000 1.84047354780936410000 4.64894150531215190000 +CurvePt 0 10.00000000000000000000 0.90981526206072383000 4.91652684208287210000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 0.00000000000000000000 -0.90981526206072327000 4.91652684208287210000 +CurvePt 0 0.00000000000000000000 -1.84047354780936320000 4.64894150531215190000 +CurvePt 0 0.00000000000000000000 -2.73604876692571210000 4.18497755609325670000 +CurvePt 0 0.00000000000000000000 -3.53553390593273780000 3.53553390593273780000 +CurvePt 0 0.00000000000000000000 -4.18497755609325670000 2.73604876692571300000 +CurvePt 0 0.00000000000000000000 -4.64894150531215190000 1.84047354780936430000 +CurvePt 0 0.00000000000000000000 -4.91652684208287210000 0.90981526206072405000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -4.99999999999999910000 5.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 10.00000000000000000000 -0.90981526206072327000 4.91652684208287210000 +CurvePt 0 10.00000000000000000000 -1.84047354780936320000 4.64894150531215190000 +CurvePt 0 10.00000000000000000000 -2.73604876692571210000 4.18497755609325670000 +CurvePt 0 10.00000000000000000000 -3.53553390593273780000 3.53553390593273780000 +CurvePt 0 10.00000000000000000000 -4.18497755609325670000 2.73604876692571300000 +CurvePt 0 10.00000000000000000000 -4.64894150531215190000 1.84047354780936430000 +CurvePt 0 10.00000000000000000000 -4.91652684208287210000 0.90981526206072405000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 0.00000000000000000000 -4.91652684208287210000 -0.90981526206072305000 +CurvePt 0 0.00000000000000000000 -4.64894150531215190000 -1.84047354780936300000 +CurvePt 0 0.00000000000000000000 -4.18497755609325670000 -2.73604876692571210000 +CurvePt 0 0.00000000000000000000 -3.53553390593273860000 -3.53553390593273730000 +CurvePt 0 0.00000000000000000000 -2.73604876692571300000 -4.18497755609325670000 +CurvePt 0 0.00000000000000000000 -1.84047354780936480000 -4.64894150531215190000 +CurvePt 0 0.00000000000000000000 -0.90981526206072438000 -4.91652684208287210000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000090000 -4.99999999999999910000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 10.00000000000000000000 -4.91652684208287210000 -0.90981526206072305000 +CurvePt 0 10.00000000000000000000 -4.64894150531215190000 -1.84047354780936300000 +CurvePt 0 10.00000000000000000000 -4.18497755609325670000 -2.73604876692571210000 +CurvePt 0 10.00000000000000000000 -3.53553390593273860000 -3.53553390593273730000 +CurvePt 0 10.00000000000000000000 -2.73604876692571300000 -4.18497755609325670000 +CurvePt 0 10.00000000000000000000 -1.84047354780936480000 -4.64894150531215190000 +CurvePt 0 10.00000000000000000000 -0.90981526206072438000 -4.91652684208287210000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 0.00000000000000000000 0.90981526206072283000 -4.91652684208287210000 +CurvePt 0 0.00000000000000000000 1.84047354780936300000 -4.64894150531215190000 +CurvePt 0 0.00000000000000000000 2.73604876692571160000 -4.18497755609325670000 +CurvePt 0 0.00000000000000000000 3.53553390593273730000 -3.53553390593273860000 +CurvePt 0 0.00000000000000000000 4.18497755609325580000 -2.73604876692571300000 +CurvePt 0 0.00000000000000000000 4.64894150531215190000 -1.84047354780936500000 +CurvePt 0 0.00000000000000000000 4.91652684208287210000 -0.90981526206072472000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 4.99999999999999910000 -5.00000000000000090000 Weight 0.70710678118654757000 +CCtrl 2 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 10.00000000000000000000 0.90981526206072283000 -4.91652684208287210000 +CurvePt 0 10.00000000000000000000 1.84047354780936300000 -4.64894150531215190000 +CurvePt 0 10.00000000000000000000 2.73604876692571160000 -4.18497755609325670000 +CurvePt 0 10.00000000000000000000 3.53553390593273730000 -3.53553390593273860000 +CurvePt 0 10.00000000000000000000 4.18497755609325580000 -2.73604876692571300000 +CurvePt 0 10.00000000000000000000 4.64894150531215190000 -1.84047354780936500000 +CurvePt 0 10.00000000000000000000 4.91652684208287210000 -0.90981526206072472000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve diff --git a/test/constraint/pt_face_distance/reference_v22.slvs b/test/constraint/pt_face_distance/reference_v22.slvs new file mode 100644 index 0000000..a57b808 --- /dev/null +++ b/test/constraint/pt_face_distance/reference_v22.slvs @@ -0,0 +1,681 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=00020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=00020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=00020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=00010000 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=00020000 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=00020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=00010000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=00020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=33 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valA=-10.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + +Surface 00000001 00646464 80030012 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 +TrimBy 00000001 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +TrimBy 00000007 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030011 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000002 1 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 -0.00000000000000044409 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000044409 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000001 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +TrimBy 00000005 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000004 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000003 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +TrimBy 00000006 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000007 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000006 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +TrimBy 00000009 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 1 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +SCtrl 2 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +TrimBy 0000000a 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 00000009 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +TrimBy 0000000c 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 0.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 1.84047354780936389673 +CurvePt 0 10.00000000000000000000 3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 1.84047354780936411878 4.64894150531215188948 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 0.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 0.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -4.99999999999999911182 5.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 +CurvePt 0 10.00000000000000000000 -1.84047354780936323060 4.64894150531215188948 +CurvePt 0 10.00000000000000000000 -3.53553390593273775266 3.53553390593273775266 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 1.84047354780936434082 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 0.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 0.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 0.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000088818 -4.99999999999999911182 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 +CurvePt 0 10.00000000000000000000 -4.64894150531215188948 -1.84047354780936300855 +CurvePt 0 10.00000000000000000000 -3.53553390593273864084 -3.53553390593273730858 +CurvePt 0 10.00000000000000000000 -1.84047354780936478491 -4.64894150531215188948 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 0.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 0.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 0.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 4.99999999999999911182 -5.00000000000000088818 Weight 0.70710678118654757274 +CCtrl 2 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 +CurvePt 0 10.00000000000000000000 1.84047354780936300855 -4.64894150531215188948 +CurvePt 0 10.00000000000000000000 3.53553390593273730858 -3.53553390593273864084 +CurvePt 0 10.00000000000000000000 4.64894150531215188948 -1.84047354780936500696 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 +AddCurve diff --git a/test/constraint/pt_face_distance/test.cpp b/test/constraint/pt_face_distance/test.cpp new file mode 100644 index 0000000..7e2a06e --- /dev/null +++ b/test/constraint/pt_face_distance/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/pt_in_plane/normal.png b/test/constraint/pt_in_plane/normal.png new file mode 100644 index 0000000..b770451 Binary files /dev/null and b/test/constraint/pt_in_plane/normal.png differ diff --git a/test/constraint/pt_in_plane/normal.slvs b/test/constraint/pt_in_plane/normal.slvs new file mode 100644 index 0000000..ba8931b --- /dev/null +++ b/test/constraint/pt_in_plane/normal.slvs @@ -0,0 +1,261 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=41 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_in_plane/normal_v20.slvs b/test/constraint/pt_in_plane/normal_v20.slvs new file mode 100644 index 0000000..946fc8a --- /dev/null +++ b/test/constraint/pt_in_plane/normal_v20.slvs @@ -0,0 +1,259 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=41 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_in_plane/normal_v22.slvs b/test/constraint/pt_in_plane/normal_v22.slvs new file mode 100644 index 0000000..1bec718 --- /dev/null +++ b/test/constraint/pt_in_plane/normal_v22.slvs @@ -0,0 +1,261 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=41 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_in_plane/test.cpp b/test/constraint/pt_in_plane/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/pt_in_plane/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/pt_line_distance/extended.png b/test/constraint/pt_line_distance/extended.png new file mode 100644 index 0000000..bdf7cff Binary files /dev/null and b/test/constraint/pt_line_distance/extended.png differ diff --git a/test/constraint/pt_line_distance/extended.slvs b/test/constraint/pt_line_distance/extended.slvs new file mode 100644 index 0000000..c73570d --- /dev/null +++ b/test/constraint/pt_line_distance/extended.slvs @@ -0,0 +1,316 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=-10.00000000000000000000 +Constraint.disp.offset.y=0.0000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_line_distance/free_in_3d.png b/test/constraint/pt_line_distance/free_in_3d.png new file mode 100644 index 0000000..db351df Binary files /dev/null and b/test/constraint/pt_line_distance/free_in_3d.png differ diff --git a/test/constraint/pt_line_distance/free_in_3d.slvs b/test/constraint/pt_line_distance/free_in_3d.slvs new file mode 100644 index 0000000..4791536 --- /dev/null +++ b/test/constraint/pt_line_distance/free_in_3d.slvs @@ -0,0 +1,316 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_line_distance/free_in_3d_v20.slvs b/test/constraint/pt_line_distance/free_in_3d_v20.slvs new file mode 100644 index 0000000..b4c4c2a --- /dev/null +++ b/test/constraint/pt_line_distance/free_in_3d_v20.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_line_distance/free_in_3d_v22.slvs b/test/constraint/pt_line_distance/free_in_3d_v22.slvs new file mode 100644 index 0000000..896cfa9 --- /dev/null +++ b/test/constraint/pt_line_distance/free_in_3d_v22.slvs @@ -0,0 +1,316 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_line_distance/normal.png b/test/constraint/pt_line_distance/normal.png new file mode 100644 index 0000000..db351df Binary files /dev/null and b/test/constraint/pt_line_distance/normal.png differ diff --git a/test/constraint/pt_line_distance/normal.slvs b/test/constraint/pt_line_distance/normal.slvs new file mode 100644 index 0000000..6a5573e --- /dev/null +++ b/test/constraint/pt_line_distance/normal.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_line_distance/normal_v20.slvs b/test/constraint/pt_line_distance/normal_v20.slvs new file mode 100644 index 0000000..d565607 --- /dev/null +++ b/test/constraint/pt_line_distance/normal_v20.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_line_distance/normal_v22.slvs b/test/constraint/pt_line_distance/normal_v22.slvs new file mode 100644 index 0000000..f36ada9 --- /dev/null +++ b/test/constraint/pt_line_distance/normal_v22.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_line_distance/reference.png b/test/constraint/pt_line_distance/reference.png new file mode 100644 index 0000000..3722fad Binary files /dev/null and b/test/constraint/pt_line_distance/reference.png differ diff --git a/test/constraint/pt_line_distance/reference.slvs b/test/constraint/pt_line_distance/reference.slvs new file mode 100644 index 0000000..6b2630d --- /dev/null +++ b/test/constraint/pt_line_distance/reference.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + diff --git a/test/constraint/pt_line_distance/reference_v20.slvs b/test/constraint/pt_line_distance/reference_v20.slvs new file mode 100644 index 0000000..8481ec4 --- /dev/null +++ b/test/constraint/pt_line_distance/reference_v20.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + diff --git a/test/constraint/pt_line_distance/reference_v22.slvs b/test/constraint/pt_line_distance/reference_v22.slvs new file mode 100644 index 0000000..7c54d8a --- /dev/null +++ b/test/constraint/pt_line_distance/reference_v22.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=32 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-5.00000000000000000000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + diff --git a/test/constraint/pt_line_distance/test.cpp b/test/constraint/pt_line_distance/test.cpp new file mode 100644 index 0000000..933f65d --- /dev/null +++ b/test/constraint/pt_line_distance/test.cpp @@ -0,0 +1,54 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(extended_render) { + CHECK_LOAD("extended.slvs"); + CHECK_RENDER("extended.png"); +} diff --git a/test/constraint/pt_on_circle/negative_dia.slvs b/test/constraint/pt_on_circle/negative_dia.slvs new file mode 100644 index 0000000..268c9a5 --- /dev/null +++ b/test/constraint/pt_on_circle/negative_dia.slvs @@ -0,0 +1,364 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=9.99958442064562014195 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=-4.99958442064562014195 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=14.99916884129124028391 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=9.99958442064562014195 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=-4.99958442064562014195 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=14.99916884129124028391 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=90 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=-9.99916884129124028391 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.x=5.09750582376745420277 +Constraint.disp.offset.y=5.06841431955496624084 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=100 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=100 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_circle/normal.png b/test/constraint/pt_on_circle/normal.png new file mode 100644 index 0000000..406aa81 Binary files /dev/null and b/test/constraint/pt_on_circle/normal.png differ diff --git a/test/constraint/pt_on_circle/normal.slvs b/test/constraint/pt_on_circle/normal.slvs new file mode 100644 index 0000000..462e0cd --- /dev/null +++ b/test/constraint/pt_on_circle/normal.slvs @@ -0,0 +1,318 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-9.99999912024158099655 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=4.99999824048316199310 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000087975841900345 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-9.99999912024158099655 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=4.99999824048316199310 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000087975841900345 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=100 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_circle/normal_v20.slvs b/test/constraint/pt_on_circle/normal_v20.slvs new file mode 100644 index 0000000..d36fc3b --- /dev/null +++ b/test/constraint/pt_on_circle/normal_v20.slvs @@ -0,0 +1,318 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-9.99999912024158100000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=4.99999824048316200000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000087975841900000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-9.99999912024158100000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=4.99999824048316200000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000087975841900000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=100 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_circle/normal_v22.slvs b/test/constraint/pt_on_circle/normal_v22.slvs new file mode 100644 index 0000000..fea01e6 --- /dev/null +++ b/test/constraint/pt_on_circle/normal_v22.slvs @@ -0,0 +1,318 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-9.99999912024158100000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=4.99999824048316200000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000087975841900000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-9.99999912024158100000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=4.99999824048316200000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000087975841900000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=100 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_circle/test.cpp b/test/constraint/pt_on_circle/test.cpp new file mode 100644 index 0000000..3b4c470 --- /dev/null +++ b/test/constraint/pt_on_circle/test.cpp @@ -0,0 +1,25 @@ +#include "solvespace.h" + +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(negative_dia) { + CHECK_LOAD("negative_dia.slvs"); + Entity *e = SK.GetEntity(hRequest { 4 }.entity(0)); + CHECK_TRUE(e->CircleGetRadiusNum() > 0); +} diff --git a/test/constraint/pt_on_face/normal.png b/test/constraint/pt_on_face/normal.png new file mode 100644 index 0000000..0d6ef82 Binary files /dev/null and b/test/constraint/pt_on_face/normal.png differ diff --git a/test/constraint/pt_on_face/normal.slvs b/test/constraint/pt_on_face/normal.slvs new file mode 100644 index 0000000..7656071 --- /dev/null +++ b/test/constraint/pt_on_face/normal.slvs @@ -0,0 +1,703 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=1 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.z=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=43 +Constraint.group.v=00000003 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 80030011 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000088818 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000010000000827 -5.00000000000000088818 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000010000000827 4.99999999999999911182 -10.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 -0.00000000000000177636 -5.00000000000000088818 -10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 -10.00000000000000000000 +TrimBy 00000001 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +TrimBy 00000007 0 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -0.00000000000000177636 -5.00000000000000088818 -10.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030012 1 1 +SCtrl 0 0 5.00000000010000000827 -5.00000000000000088818 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000088818 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000010000000827 4.99999999999999911182 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 4.99999999999999911182 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 4.99999999999999911182 0.00000000000000000000 +TrimBy 00000002 1 0.00000000000000000000 4.99999999999999911182 0.00000000000000000000 5.00000000000000088818 -0.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 5.00000000000000088818 -0.00000000000000088818 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000088818 0.00000000000000000000 +TrimBy 00000008 1 -0.00000000000000088818 -5.00000000000000088818 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000001 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +TrimBy 0000000c 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -4.99999999999999911182 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 -4.99999999999999911182 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 0 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +TrimBy 00000004 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000003 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000006 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000088818 -4.99999999999999911182 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 -5.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000007 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +TrimBy 00000006 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +TrimBy 00000009 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 4.99999999999999911182 -5.00000000000000088818 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 4.99999999999999911182 -5.00000000000000088818 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000b 0 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +TrimBy 0000000a 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000009 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +CurvePt 0 4.91652684208287205081 0.90981526206072360630 -10.00000000000000000000 +CurvePt 0 4.64894150531215188948 1.84047354780936389673 -10.00000000000000000000 +CurvePt 0 4.18497755609325672310 2.73604876692571252761 -10.00000000000000000000 +CurvePt 0 3.53553390593273775266 3.53553390593273775266 -10.00000000000000000000 +CurvePt 0 2.73604876692571252761 4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 1.84047354780936411878 4.64894150531215188948 -10.00000000000000000000 +CurvePt 0 0.90981526206072382834 4.91652684208287205081 -10.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 0 4.91652684208287205081 0.90981526206072360630 0.00000000000000000000 +CurvePt 0 4.64894150531215188948 1.84047354780936389673 0.00000000000000000000 +CurvePt 0 4.18497755609325672310 2.73604876692571252761 0.00000000000000000000 +CurvePt 0 3.53553390593273775266 3.53553390593273775266 0.00000000000000000000 +CurvePt 0 2.73604876692571252761 4.18497755609325672310 0.00000000000000000000 +CurvePt 0 1.84047354780936411878 4.64894150531215188948 0.00000000000000000000 +CurvePt 0 0.90981526206072382834 4.91652684208287205081 0.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -4.99999999999999911182 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +CurvePt 0 -0.90981526206072327323 4.91652684208287205081 -10.00000000000000000000 +CurvePt 0 -1.84047354780936323060 4.64894150531215188948 -10.00000000000000000000 +CurvePt 0 -2.73604876692571208352 4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 -3.53553390593273775266 3.53553390593273775266 -10.00000000000000000000 +CurvePt 0 -4.18497755609325672310 2.73604876692571297170 -10.00000000000000000000 +CurvePt 0 -4.64894150531215188948 1.84047354780936434082 -10.00000000000000000000 +CurvePt 0 -4.91652684208287205081 0.90981526206072405039 -10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -4.99999999999999911182 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 -0.90981526206072327323 4.91652684208287205081 0.00000000000000000000 +CurvePt 0 -1.84047354780936323060 4.64894150531215188948 0.00000000000000000000 +CurvePt 0 -2.73604876692571208352 4.18497755609325672310 0.00000000000000000000 +CurvePt 0 -3.53553390593273775266 3.53553390593273775266 0.00000000000000000000 +CurvePt 0 -4.18497755609325672310 2.73604876692571297170 0.00000000000000000000 +CurvePt 0 -4.64894150531215188948 1.84047354780936434082 0.00000000000000000000 +CurvePt 0 -4.91652684208287205081 0.90981526206072405039 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000088818 -4.99999999999999911182 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +CurvePt 0 -4.91652684208287205081 -0.90981526206072305119 -10.00000000000000000000 +CurvePt 0 -4.64894150531215188948 -1.84047354780936300855 -10.00000000000000000000 +CurvePt 0 -4.18497755609325672310 -2.73604876692571208352 -10.00000000000000000000 +CurvePt 0 -3.53553390593273864084 -3.53553390593273730858 -10.00000000000000000000 +CurvePt 0 -2.73604876692571297170 -4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 -1.84047354780936478491 -4.64894150531215188948 -10.00000000000000000000 +CurvePt 0 -0.90981526206072438345 -4.91652684208287205081 -10.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +CurvePt 0 -4.91652684208287205081 -0.90981526206072305119 0.00000000000000000000 +CurvePt 0 -4.64894150531215188948 -1.84047354780936300855 0.00000000000000000000 +CurvePt 0 -4.18497755609325672310 -2.73604876692571208352 0.00000000000000000000 +CurvePt 0 -3.53553390593273864084 -3.53553390593273730858 0.00000000000000000000 +CurvePt 0 -2.73604876692571297170 -4.18497755609325672310 0.00000000000000000000 +CurvePt 0 -1.84047354780936478491 -4.64894150531215188948 0.00000000000000000000 +CurvePt 0 -0.90981526206072438345 -4.91652684208287205081 0.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 4.99999999999999911182 -5.00000000000000088818 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +CurvePt 0 0.90981526206072282914 -4.91652684208287205081 -10.00000000000000000000 +CurvePt 0 1.84047354780936300855 -4.64894150531215188948 -10.00000000000000000000 +CurvePt 0 2.73604876692571163943 -4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 3.53553390593273730858 -3.53553390593273864084 -10.00000000000000000000 +CurvePt 0 4.18497755609325583492 -2.73604876692571297170 -10.00000000000000000000 +CurvePt 0 4.64894150531215188948 -1.84047354780936500696 -10.00000000000000000000 +CurvePt 0 4.91652684208287205081 -0.90981526206072471652 -10.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 4.99999999999999911182 -5.00000000000000088818 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +CurvePt 0 0.90981526206072282914 -4.91652684208287205081 0.00000000000000000000 +CurvePt 0 1.84047354780936300855 -4.64894150531215188948 0.00000000000000000000 +CurvePt 0 2.73604876692571163943 -4.18497755609325672310 0.00000000000000000000 +CurvePt 0 3.53553390593273730858 -3.53553390593273864084 0.00000000000000000000 +CurvePt 0 4.18497755609325583492 -2.73604876692571297170 0.00000000000000000000 +CurvePt 0 4.64894150531215188948 -1.84047354780936500696 0.00000000000000000000 +CurvePt 0 4.91652684208287205081 -0.90981526206072471652 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +AddCurve diff --git a/test/constraint/pt_on_face/normal_v20.slvs b/test/constraint/pt_on_face/normal_v20.slvs new file mode 100644 index 0000000..e3c7212 --- /dev/null +++ b/test/constraint/pt_on_face/normal_v20.slvs @@ -0,0 +1,670 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.z=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=43 +Constraint.group.v=00000003 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 80030011 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000090000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000010000000000 -5.00000000000000090000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 4.99999999999999910000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000010000000000 4.99999999999999910000 -10.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 -0.00000000000000177636 -5.00000000000000090000 -10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 -10.00000000000000000000 +TrimBy 00000001 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 4.99999999999999910000 -10.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 4.99999999999999910000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +TrimBy 00000007 0 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -0.00000000000000177636 -5.00000000000000090000 -10.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030012 1 1 +SCtrl 0 0 5.00000000010000000000 -5.00000000000000090000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000090000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000010000000000 4.99999999999999910000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 4.99999999999999910000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 4.99999999999999910000 0.00000000000000000000 +TrimBy 00000002 1 0.00000000000000000000 4.99999999999999910000 0.00000000000000000000 5.00000000000000090000 -0.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 5.00000000000000090000 -0.00000000000000088818 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000090000 0.00000000000000000000 +TrimBy 00000008 1 -0.00000000000000088818 -5.00000000000000090000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000001 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +TrimBy 0000000c 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -4.99999999999999910000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 -4.99999999999999910000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 0 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +TrimBy 00000006 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +TrimBy 00000004 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000003 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000090000 -4.99999999999999910000 -10.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 -5.00000000000000090000 -4.99999999999999910000 0.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000009 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000007 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +TrimBy 00000006 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 4.99999999999999910000 -5.00000000000000090000 -10.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 1 1 4.99999999999999910000 -5.00000000000000090000 0.00000000000000000000 Weight 0.70710678118654757000 +SCtrl 2 0 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000b 0 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +TrimBy 0000000c 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +TrimBy 0000000a 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000009 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +CurvePt 0 4.64894150531215190000 1.84047354780936390000 -10.00000000000000000000 +CurvePt 0 3.53553390593273780000 3.53553390593273780000 -10.00000000000000000000 +CurvePt 0 1.84047354780936410000 4.64894150531215190000 -10.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 0 4.64894150531215190000 1.84047354780936390000 0.00000000000000000000 +CurvePt 0 3.53553390593273780000 3.53553390593273780000 0.00000000000000000000 +CurvePt 0 1.84047354780936410000 4.64894150531215190000 0.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -4.99999999999999910000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +CurvePt 0 -1.84047354780936320000 4.64894150531215190000 -10.00000000000000000000 +CurvePt 0 -3.53553390593273780000 3.53553390593273780000 -10.00000000000000000000 +CurvePt 0 -4.64894150531215190000 1.84047354780936430000 -10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -4.99999999999999910000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 -1.84047354780936320000 4.64894150531215190000 0.00000000000000000000 +CurvePt 0 -3.53553390593273780000 3.53553390593273780000 0.00000000000000000000 +CurvePt 0 -4.64894150531215190000 1.84047354780936430000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000090000 -4.99999999999999910000 -10.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +CurvePt 0 -4.64894150531215190000 -1.84047354780936300000 -10.00000000000000000000 +CurvePt 0 -3.53553390593273860000 -3.53553390593273730000 -10.00000000000000000000 +CurvePt 0 -1.84047354780936480000 -4.64894150531215190000 -10.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000090000 -4.99999999999999910000 0.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +CurvePt 0 -4.64894150531215190000 -1.84047354780936300000 0.00000000000000000000 +CurvePt 0 -3.53553390593273860000 -3.53553390593273730000 0.00000000000000000000 +CurvePt 0 -1.84047354780936480000 -4.64894150531215190000 0.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 4.99999999999999910000 -5.00000000000000090000 -10.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +CurvePt 0 1.84047354780936300000 -4.64894150531215190000 -10.00000000000000000000 +CurvePt 0 3.53553390593273730000 -3.53553390593273860000 -10.00000000000000000000 +CurvePt 0 4.64894150531215190000 -1.84047354780936500000 -10.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 4.99999999999999910000 -5.00000000000000090000 0.00000000000000000000 Weight 0.70710678118654757000 +CCtrl 2 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +CurvePt 0 1.84047354780936300000 -4.64894150531215190000 0.00000000000000000000 +CurvePt 0 3.53553390593273730000 -3.53553390593273860000 0.00000000000000000000 +CurvePt 0 4.64894150531215190000 -1.84047354780936500000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +AddCurve diff --git a/test/constraint/pt_on_face/normal_v22.slvs b/test/constraint/pt_on_face/normal_v22.slvs new file mode 100644 index 0000000..03ee428 --- /dev/null +++ b/test/constraint/pt_on_face/normal_v22.slvs @@ -0,0 +1,687 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040020 1002 + 4 00040040 1002 + 5 00040000 1001 + 6 00040001 1001 + 7 00040020 1001 + 8 00040040 1001 + 9 00040001 1003 + 10 80020000 1002 + 11 80020000 1001 + 12 80020001 1002 + 13 80020002 1002 + 14 80020001 1001 + 15 80020002 1001 + 16 80020002 1003 + 17 00000000 1001 + 18 00000000 1002 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000003 +Request.construction=1 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.normal.v=80030003 +Entity.distance.v=80030004 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.normal.v=80030007 +Entity.distance.v=80030008 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=4001 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.actPoint.z=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003000d +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=43 +Constraint.group.v=00000003 +Constraint.ptA.v=00050000 +Constraint.entityA.v=80030012 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 80030011 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000088818 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000010000000827 -5.00000000000000088818 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000010000000827 4.99999999999999911182 -10.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 0 -0.00000000000000177636 -5.00000000000000088818 -10.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 -10.00000000000000000000 +TrimBy 00000001 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 +TrimBy 00000004 0 0.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +TrimBy 00000007 0 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -0.00000000000000177636 -5.00000000000000088818 -10.00000000000000000000 +AddSurface +Surface 00000002 00646464 80030012 1 1 +SCtrl 0 0 5.00000000010000000827 -5.00000000000000088818 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000088818 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000010000000827 4.99999999999999911182 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 4.99999999999999911182 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 4.99999999999999911182 0.00000000000000000000 +TrimBy 00000002 1 0.00000000000000000000 4.99999999999999911182 0.00000000000000000000 5.00000000000000088818 -0.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 5.00000000000000088818 -0.00000000000000088818 0.00000000000000000000 -0.00000000000000088818 -5.00000000000000088818 0.00000000000000000000 +TrimBy 00000008 1 -0.00000000000000088818 -5.00000000000000088818 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 00000000 2 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000001 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +TrimBy 0000000c 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +AddSurface +Surface 00000004 00646464 00000000 2 1 +SCtrl 0 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -4.99999999999999911182 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 -4.99999999999999911182 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000005 0 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +TrimBy 00000004 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000003 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000006 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +AddSurface +Surface 00000005 00646464 00000000 2 1 +SCtrl 0 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000088818 -4.99999999999999911182 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 -5.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 0 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000007 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +TrimBy 00000006 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +TrimBy 00000009 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +AddSurface +Surface 00000006 00646464 00000000 2 1 +SCtrl 0 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 4.99999999999999911182 -5.00000000000000088818 -10.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 1 1 4.99999999999999911182 -5.00000000000000088818 0.00000000000000000000 Weight 0.70710678118654757274 +SCtrl 2 0 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 2 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000b 0 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +TrimBy 0000000a 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +TrimBy 00000009 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +AddSurface +Curve 00000001 1 2 00000001 00000003 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 +CurvePt 0 4.64894150531215188948 1.84047354780936389673 -10.00000000000000000000 +CurvePt 0 4.18497755609325672310 2.73604876692571252761 -10.00000000000000000000 +CurvePt 0 3.53553390593273775266 3.53553390593273775266 -10.00000000000000000000 +CurvePt 0 2.73604876692571252761 4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 1.84047354780936411878 4.64894150531215188948 -10.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +AddCurve +Curve 00000002 1 2 00000002 00000003 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 0 4.64894150531215188948 1.84047354780936389673 0.00000000000000000000 +CurvePt 0 4.18497755609325672310 2.73604876692571252761 0.00000000000000000000 +CurvePt 0 3.53553390593273775266 3.53553390593273775266 0.00000000000000000000 +CurvePt 0 2.73604876692571252761 4.18497755609325672310 0.00000000000000000000 +CurvePt 0 1.84047354780936411878 4.64894150531215188948 0.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 2 00000001 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -4.99999999999999911182 5.00000000000000000000 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 -10.00000000000000000000 +CurvePt 0 -1.84047354780936323060 4.64894150531215188948 -10.00000000000000000000 +CurvePt 0 -2.73604876692571208352 4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 -3.53553390593273775266 3.53553390593273775266 -10.00000000000000000000 +CurvePt 0 -4.18497755609325672310 2.73604876692571297170 -10.00000000000000000000 +CurvePt 0 -4.64894150531215188948 1.84047354780936434082 -10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +AddCurve +Curve 00000005 1 2 00000002 00000004 +CCtrl 0 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -4.99999999999999911182 5.00000000000000000000 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000030616 5.00000000000000000000 0.00000000000000000000 +CurvePt 0 -1.84047354780936323060 4.64894150531215188948 0.00000000000000000000 +CurvePt 0 -2.73604876692571208352 4.18497755609325672310 0.00000000000000000000 +CurvePt 0 -3.53553390593273775266 3.53553390593273775266 0.00000000000000000000 +CurvePt 0 -4.18497755609325672310 2.73604876692571297170 0.00000000000000000000 +CurvePt 0 -4.64894150531215188948 1.84047354780936434082 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +AddCurve +Curve 00000007 1 2 00000001 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000088818 -4.99999999999999911182 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 -10.00000000000000000000 +CurvePt 0 -4.64894150531215188948 -1.84047354780936300855 -10.00000000000000000000 +CurvePt 0 -4.18497755609325672310 -2.73604876692571208352 -10.00000000000000000000 +CurvePt 0 -3.53553390593273864084 -3.53553390593273730858 -10.00000000000000000000 +CurvePt 0 -2.73604876692571297170 -4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 -1.84047354780936478491 -4.64894150531215188948 -10.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +AddCurve +Curve 00000008 1 2 00000002 00000005 +CCtrl 0 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000061232 0.00000000000000000000 +CurvePt 0 -4.64894150531215188948 -1.84047354780936300855 0.00000000000000000000 +CurvePt 0 -4.18497755609325672310 -2.73604876692571208352 0.00000000000000000000 +CurvePt 0 -3.53553390593273864084 -3.53553390593273730858 0.00000000000000000000 +CurvePt 0 -2.73604876692571297170 -4.18497755609325672310 0.00000000000000000000 +CurvePt 0 -1.84047354780936478491 -4.64894150531215188948 0.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000a 1 2 00000001 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 4.99999999999999911182 -5.00000000000000088818 -10.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 -10.00000000000000000000 +CurvePt 0 1.84047354780936300855 -4.64894150531215188948 -10.00000000000000000000 +CurvePt 0 2.73604876692571163943 -4.18497755609325672310 -10.00000000000000000000 +CurvePt 0 3.53553390593273730858 -3.53553390593273864084 -10.00000000000000000000 +CurvePt 0 4.18497755609325583492 -2.73604876692571297170 -10.00000000000000000000 +CurvePt 0 4.64894150531215188948 -1.84047354780936500696 -10.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +AddCurve +Curve 0000000b 1 2 00000002 00000006 +CCtrl 0 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 4.99999999999999911182 -5.00000000000000088818 0.00000000000000000000 Weight 0.70710678118654757274 +CCtrl 2 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -0.00000000000000091849 -5.00000000000000000000 0.00000000000000000000 +CurvePt 0 1.84047354780936300855 -4.64894150531215188948 0.00000000000000000000 +CurvePt 0 2.73604876692571163943 -4.18497755609325672310 0.00000000000000000000 +CurvePt 0 3.53553390593273730858 -3.53553390593273864084 0.00000000000000000000 +CurvePt 0 4.18497755609325583492 -2.73604876692571297170 0.00000000000000000000 +CurvePt 0 4.64894150531215188948 -1.84047354780936500696 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 -10.00000000000000000000 +CurvePt 1 5.00000000000000000000 -0.00000000000000122465 0.00000000000000000000 +AddCurve diff --git a/test/constraint/pt_on_face/test.cpp b/test/constraint/pt_on_face/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/pt_on_face/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/pt_on_line/free_in_3d_v20.slvs b/test/constraint/pt_on_line/free_in_3d_v20.slvs new file mode 100644 index 0000000..bc5ecec --- /dev/null +++ b/test/constraint/pt_on_line/free_in_3d_v20.slvs @@ -0,0 +1,315 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-20.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/free_in_3d_v22.slvs b/test/constraint/pt_on_line/free_in_3d_v22.slvs new file mode 100644 index 0000000..250f93c --- /dev/null +++ b/test/constraint/pt_on_line/free_in_3d_v22.slvs @@ -0,0 +1,315 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-20.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/left_free_in_3d.png b/test/constraint/pt_on_line/left_free_in_3d.png new file mode 100644 index 0000000..13b2a6a Binary files /dev/null and b/test/constraint/pt_on_line/left_free_in_3d.png differ diff --git a/test/constraint/pt_on_line/left_free_in_3d.slvs b/test/constraint/pt_on_line/left_free_in_3d.slvs new file mode 100644 index 0000000..5a20987 --- /dev/null +++ b/test/constraint/pt_on_line/left_free_in_3d.slvs @@ -0,0 +1,320 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=40000001 +Param.val=0.33333333333333331483 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-20.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.valP.v=40000001 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/normal.png b/test/constraint/pt_on_line/normal.png new file mode 100644 index 0000000..06d8d70 Binary files /dev/null and b/test/constraint/pt_on_line/normal.png differ diff --git a/test/constraint/pt_on_line/normal.slvs b/test/constraint/pt_on_line/normal.slvs new file mode 100644 index 0000000..6bd8985 --- /dev/null +++ b/test/constraint/pt_on_line/normal.slvs @@ -0,0 +1,318 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=40000001 +Param.val=0.33333333333333331483 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valP.v=40000001 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/normal_v20.slvs b/test/constraint/pt_on_line/normal_v20.slvs new file mode 100644 index 0000000..2c3eec5 --- /dev/null +++ b/test/constraint/pt_on_line/normal_v20.slvs @@ -0,0 +1,315 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/normal_v22.slvs b/test/constraint/pt_on_line/normal_v22.slvs new file mode 100644 index 0000000..5a74c34 --- /dev/null +++ b/test/constraint/pt_on_line/normal_v22.slvs @@ -0,0 +1,313 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/right_free_in_3d.png b/test/constraint/pt_on_line/right_free_in_3d.png new file mode 100644 index 0000000..fca580f Binary files /dev/null and b/test/constraint/pt_on_line/right_free_in_3d.png differ diff --git a/test/constraint/pt_on_line/right_free_in_3d.slvs b/test/constraint/pt_on_line/right_free_in_3d.slvs new file mode 100644 index 0000000..2d80531 --- /dev/null +++ b/test/constraint/pt_on_line/right_free_in_3d.slvs @@ -0,0 +1,320 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040015 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=40000001 +Param.val=0.66666666666666662966 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-20.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=42 +Constraint.group.v=00000002 +Constraint.valP.v=40000001 +Constraint.ptA.v=00050000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_on_line/test.cpp b/test/constraint/pt_on_line/test.cpp new file mode 100644 index 0000000..b5956d3 --- /dev/null +++ b/test/constraint/pt_on_line/test.cpp @@ -0,0 +1,39 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(left_free_in_3d_roundtrip) { + CHECK_LOAD("left_free_in_3d.slvs"); + CHECK_RENDER("left_free_in_3d.png"); + CHECK_SAVE("left_free_in_3d.slvs"); +} + +TEST_CASE(right_free_in_3d_roundtrip) { + CHECK_LOAD("right_free_in_3d.slvs"); + CHECK_RENDER("right_free_in_3d.png"); + CHECK_SAVE("right_free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("left_free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("left_free_in_3d.slvs"); +} diff --git a/test/constraint/pt_plane_distance/normal.png b/test/constraint/pt_plane_distance/normal.png new file mode 100644 index 0000000..c358d3b Binary files /dev/null and b/test/constraint/pt_plane_distance/normal.png differ diff --git a/test/constraint/pt_plane_distance/normal.slvs b/test/constraint/pt_plane_distance/normal.slvs new file mode 100644 index 0000000..a0324f5 --- /dev/null +++ b/test/constraint/pt_plane_distance/normal.slvs @@ -0,0 +1,264 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=31 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_plane_distance/normal_v20.slvs b/test/constraint/pt_plane_distance/normal_v20.slvs new file mode 100644 index 0000000..0e49089 --- /dev/null +++ b/test/constraint/pt_plane_distance/normal_v20.slvs @@ -0,0 +1,262 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=31 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_plane_distance/normal_v22.slvs b/test/constraint/pt_plane_distance/normal_v22.slvs new file mode 100644 index 0000000..665268f --- /dev/null +++ b/test/constraint/pt_plane_distance/normal_v22.slvs @@ -0,0 +1,264 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=31 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/pt_plane_distance/reference.png b/test/constraint/pt_plane_distance/reference.png new file mode 100644 index 0000000..60048a4 Binary files /dev/null and b/test/constraint/pt_plane_distance/reference.png differ diff --git a/test/constraint/pt_plane_distance/reference.slvs b/test/constraint/pt_plane_distance/reference.slvs new file mode 100644 index 0000000..cbc3c93 --- /dev/null +++ b/test/constraint/pt_plane_distance/reference.slvs @@ -0,0 +1,264 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=31 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + diff --git a/test/constraint/pt_plane_distance/reference_v20.slvs b/test/constraint/pt_plane_distance/reference_v20.slvs new file mode 100644 index 0000000..9579a3d --- /dev/null +++ b/test/constraint/pt_plane_distance/reference_v20.slvs @@ -0,0 +1,264 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=31 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + diff --git a/test/constraint/pt_plane_distance/reference_v22.slvs b/test/constraint/pt_plane_distance/reference_v22.slvs new file mode 100644 index 0000000..8e6cbf3 --- /dev/null +++ b/test/constraint/pt_plane_distance/reference_v22.slvs @@ -0,0 +1,264 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=31 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=5.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +AddConstraint + diff --git a/test/constraint/pt_plane_distance/test.cpp b/test/constraint/pt_plane_distance/test.cpp new file mode 100644 index 0000000..7e2a06e --- /dev/null +++ b/test/constraint/pt_plane_distance/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/pt_pt_distance/free_in_3d.png b/test/constraint/pt_pt_distance/free_in_3d.png new file mode 100644 index 0000000..8d89015 Binary files /dev/null and b/test/constraint/pt_pt_distance/free_in_3d.png differ diff --git a/test/constraint/pt_pt_distance/free_in_3d.slvs b/test/constraint/pt_pt_distance/free_in_3d.slvs new file mode 100644 index 0000000..3da9edc --- /dev/null +++ b/test/constraint/pt_pt_distance/free_in_3d.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=-1.49454882168925862196 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/free_in_3d_v20.slvs b/test/constraint/pt_pt_distance/free_in_3d_v20.slvs new file mode 100644 index 0000000..e9b6d25 --- /dev/null +++ b/test/constraint/pt_pt_distance/free_in_3d_v20.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=-1.49454882168925860000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/free_in_3d_v22.slvs b/test/constraint/pt_pt_distance/free_in_3d_v22.slvs new file mode 100644 index 0000000..c5b1af5 --- /dev/null +++ b/test/constraint/pt_pt_distance/free_in_3d_v22.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=-1.49454882168925862196 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/normal.png b/test/constraint/pt_pt_distance/normal.png new file mode 100644 index 0000000..b6524ac Binary files /dev/null and b/test/constraint/pt_pt_distance/normal.png differ diff --git a/test/constraint/pt_pt_distance/normal.slvs b/test/constraint/pt_pt_distance/normal.slvs new file mode 100644 index 0000000..98664cf --- /dev/null +++ b/test/constraint/pt_pt_distance/normal.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/normal_v20.slvs b/test/constraint/pt_pt_distance/normal_v20.slvs new file mode 100644 index 0000000..653c99e --- /dev/null +++ b/test/constraint/pt_pt_distance/normal_v20.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/normal_v22.slvs b/test/constraint/pt_pt_distance/normal_v22.slvs new file mode 100644 index 0000000..1697435 --- /dev/null +++ b/test/constraint/pt_pt_distance/normal_v22.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.y=2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/reference.png b/test/constraint/pt_pt_distance/reference.png new file mode 100644 index 0000000..b545f08 Binary files /dev/null and b/test/constraint/pt_pt_distance/reference.png differ diff --git a/test/constraint/pt_pt_distance/reference.slvs b/test/constraint/pt_pt_distance/reference.slvs new file mode 100644 index 0000000..2cf72b5 --- /dev/null +++ b/test/constraint/pt_pt_distance/reference.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/reference_v20.slvs b/test/constraint/pt_pt_distance/reference_v20.slvs new file mode 100644 index 0000000..0888aa8 --- /dev/null +++ b/test/constraint/pt_pt_distance/reference_v20.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/reference_v22.slvs b/test/constraint/pt_pt_distance/reference_v22.slvs new file mode 100644 index 0000000..8a3b2a3 --- /dev/null +++ b/test/constraint/pt_pt_distance/reference_v22.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=30 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.valA=10.00000000000000000000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=1 +Constraint.disp.offset.y=2.50000000000000000000 +AddConstraint + diff --git a/test/constraint/pt_pt_distance/test.cpp b/test/constraint/pt_pt_distance/test.cpp new file mode 100644 index 0000000..97bef40 --- /dev/null +++ b/test/constraint/pt_pt_distance/test.cpp @@ -0,0 +1,49 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(reference_roundtrip) { + CHECK_LOAD("reference.slvs"); + CHECK_RENDER("reference.png"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v20) { + CHECK_LOAD("reference_v20.slvs"); + CHECK_SAVE("reference.slvs"); +} + +TEST_CASE(reference_migrate_from_v22) { + CHECK_LOAD("reference_v22.slvs"); + CHECK_SAVE("reference.slvs"); +} diff --git a/test/constraint/same_orientation/normal.png b/test/constraint/same_orientation/normal.png new file mode 100644 index 0000000..7bcd4c5 Binary files /dev/null and b/test/constraint/same_orientation/normal.png differ diff --git a/test/constraint/same_orientation/normal.slvs b/test/constraint/same_orientation/normal.slvs new file mode 100644 index 0000000..fcadecd --- /dev/null +++ b/test/constraint/same_orientation/normal.slvs @@ -0,0 +1,309 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.70710678118654757274 +AddParam + +Param.h.v.=00040021 +Param.val=-0.70710678118654746172 +AddParam + +Param.h.v.=00040022 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=40000002 +Param.val=1.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.70710678118654757274 +Entity.actNormal.vx=-0.70710678118654746172 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000002 +Constraint.type=110 +Constraint.group.v=00000002 +Constraint.valP.v=40000002 +Constraint.entityA.v=00040020 +Constraint.entityB.v=00030020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/same_orientation/normal_v20.slvs b/test/constraint/same_orientation/normal_v20.slvs new file mode 100644 index 0000000..99cbe1f --- /dev/null +++ b/test/constraint/same_orientation/normal_v20.slvs @@ -0,0 +1,302 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.70710678118654757000 +AddParam + +Param.h.v.=00040021 +Param.val=-0.70710678118654746000 +AddParam + +Param.h.v.=00040022 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.70710678118654757000 +Entity.actNormal.vx=-0.70710678118654746000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000002 +Constraint.type=110 +Constraint.group.v=00000002 +Constraint.entityA.v=00040020 +Constraint.entityB.v=00030020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/same_orientation/normal_v22.slvs b/test/constraint/same_orientation/normal_v22.slvs new file mode 100644 index 0000000..c29b8d7 --- /dev/null +++ b/test/constraint/same_orientation/normal_v22.slvs @@ -0,0 +1,304 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.70710678118654757000 +AddParam + +Param.h.v.=00040021 +Param.val=-0.70710678118654746000 +AddParam + +Param.h.v.=00040022 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.70710678118654757000 +Entity.actNormal.vx=-0.70710678118654746000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000002 +Constraint.type=110 +Constraint.group.v=00000002 +Constraint.entityA.v=00040020 +Constraint.entityB.v=00030020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/same_orientation/same_group.png b/test/constraint/same_orientation/same_group.png new file mode 100644 index 0000000..ce3f77b Binary files /dev/null and b/test/constraint/same_orientation/same_group.png differ diff --git a/test/constraint/same_orientation/same_group.slvs b/test/constraint/same_orientation/same_group.slvs new file mode 100644 index 0000000..7944b1e --- /dev/null +++ b/test/constraint/same_orientation/same_group.slvs @@ -0,0 +1,379 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-25.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.70710678118654757274 +AddParam + +Param.h.v.=00040021 +AddParam + +Param.h.v.=00040022 +Param.val=0.70710678118654746172 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00050020 +Param.val=0.70710678118654757274 +AddParam + +Param.h.v.=00050021 +AddParam + +Param.h.v.=00050022 +Param.val=-0.70710678118654757274 +AddParam + +Param.h.v.=00050023 +AddParam + +Param.h.v.=00050040 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=40000002 +Param.val=-1.00000000000000022204 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-25.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.70710678118654757274 +Entity.actNormal.vy=0.70710678118654746172 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.normal.v=00050020 +Entity.distance.v=00050040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.actNormal.w=0.70710678118654757274 +Entity.actNormal.vy=-0.70710678118654757274 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000002 +Constraint.type=110 +Constraint.group.v=00000002 +Constraint.valP.v=40000002 +Constraint.entityA.v=00050020 +Constraint.entityB.v=00040020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/same_orientation/test.cpp b/test/constraint/same_orientation/test.cpp new file mode 100644 index 0000000..9377b28 --- /dev/null +++ b/test/constraint/same_orientation/test.cpp @@ -0,0 +1,23 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(same_group_roundtrip) { + CHECK_LOAD("same_group.slvs"); + CHECK_RENDER("same_group.png"); + CHECK_SAVE("same_group.slvs"); +} diff --git a/test/constraint/symmetric/free_in_3d.png b/test/constraint/symmetric/free_in_3d.png new file mode 100644 index 0000000..58c2ecc Binary files /dev/null and b/test/constraint/symmetric/free_in_3d.png differ diff --git a/test/constraint/symmetric/free_in_3d.slvs b/test/constraint/symmetric/free_in_3d.slvs new file mode 100644 index 0000000..863a794 --- /dev/null +++ b/test/constraint/symmetric/free_in_3d.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00060010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=60 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00060000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric/free_in_3d_v20.slvs b/test/constraint/symmetric/free_in_3d_v20.slvs new file mode 100644 index 0000000..a6a0cea --- /dev/null +++ b/test/constraint/symmetric/free_in_3d_v20.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00060010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=60 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00060000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric/free_in_3d_v22.slvs b/test/constraint/symmetric/free_in_3d_v22.slvs new file mode 100644 index 0000000..ff95075 --- /dev/null +++ b/test/constraint/symmetric/free_in_3d_v22.slvs @@ -0,0 +1,289 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050012 +AddParam + +Param.h.v.=00060010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=60 +Constraint.group.v=00000002 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00060000 +Constraint.entityA.v=00030000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric/normal.png b/test/constraint/symmetric/normal.png new file mode 100644 index 0000000..d497e0f Binary files /dev/null and b/test/constraint/symmetric/normal.png differ diff --git a/test/constraint/symmetric/normal.slvs b/test/constraint/symmetric/normal.slvs new file mode 100644 index 0000000..87eaf1f --- /dev/null +++ b/test/constraint/symmetric/normal.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=60 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.entityA.v=00020000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric/normal_v20.slvs b/test/constraint/symmetric/normal_v20.slvs new file mode 100644 index 0000000..170f393 --- /dev/null +++ b/test/constraint/symmetric/normal_v20.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=60 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.entityA.v=00020000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric/normal_v22.slvs b/test/constraint/symmetric/normal_v22.slvs new file mode 100644 index 0000000..1078e05 --- /dev/null +++ b/test/constraint/symmetric/normal_v22.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=60 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00040000 +Constraint.entityA.v=00020000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric/test.cpp b/test/constraint/symmetric/test.cpp new file mode 100644 index 0000000..4dcc334 --- /dev/null +++ b/test/constraint/symmetric/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} diff --git a/test/constraint/symmetric_horiz/normal.png b/test/constraint/symmetric_horiz/normal.png new file mode 100644 index 0000000..d497e0f Binary files /dev/null and b/test/constraint/symmetric_horiz/normal.png differ diff --git a/test/constraint/symmetric_horiz/normal.slvs b/test/constraint/symmetric_horiz/normal.slvs new file mode 100644 index 0000000..1afcd4b --- /dev/null +++ b/test/constraint/symmetric_horiz/normal.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=61 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_horiz/normal_v20.slvs b/test/constraint/symmetric_horiz/normal_v20.slvs new file mode 100644 index 0000000..88ce8a9 --- /dev/null +++ b/test/constraint/symmetric_horiz/normal_v20.slvs @@ -0,0 +1,285 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=61 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_horiz/normal_v22.slvs b/test/constraint/symmetric_horiz/normal_v22.slvs new file mode 100644 index 0000000..62852b6 --- /dev/null +++ b/test/constraint/symmetric_horiz/normal_v22.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=61 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_horiz/test.cpp b/test/constraint/symmetric_horiz/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/symmetric_horiz/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/symmetric_line/normal.png b/test/constraint/symmetric_line/normal.png new file mode 100644 index 0000000..adce4f4 Binary files /dev/null and b/test/constraint/symmetric_line/normal.png differ diff --git a/test/constraint/symmetric_line/normal.slvs b/test/constraint/symmetric_line/normal.slvs new file mode 100644 index 0000000..22a436a --- /dev/null +++ b/test/constraint/symmetric_line/normal.slvs @@ -0,0 +1,338 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=63 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00060000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_line/normal_v20.slvs b/test/constraint/symmetric_line/normal_v20.slvs new file mode 100644 index 0000000..f1c4562 --- /dev/null +++ b/test/constraint/symmetric_line/normal_v20.slvs @@ -0,0 +1,336 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=63 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00060000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_line/normal_v22.slvs b/test/constraint/symmetric_line/normal_v22.slvs new file mode 100644 index 0000000..f0d4dca --- /dev/null +++ b/test/constraint/symmetric_line/normal_v22.slvs @@ -0,0 +1,338 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=63 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050000 +Constraint.ptB.v=00060000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_line/test.cpp b/test/constraint/symmetric_line/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/symmetric_line/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/symmetric_vert/normal.png b/test/constraint/symmetric_vert/normal.png new file mode 100644 index 0000000..58c2ecc Binary files /dev/null and b/test/constraint/symmetric_vert/normal.png differ diff --git a/test/constraint/symmetric_vert/normal.slvs b/test/constraint/symmetric_vert/normal.slvs new file mode 100644 index 0000000..dc23f9e --- /dev/null +++ b/test/constraint/symmetric_vert/normal.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=62 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_vert/normal_v20.slvs b/test/constraint/symmetric_vert/normal_v20.slvs new file mode 100644 index 0000000..c6f5a6d --- /dev/null +++ b/test/constraint/symmetric_vert/normal_v20.slvs @@ -0,0 +1,285 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=62 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_vert/normal_v22.slvs b/test/constraint/symmetric_vert/normal_v22.slvs new file mode 100644 index 0000000..602bee1 --- /dev/null +++ b/test/constraint/symmetric_vert/normal_v22.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=62 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/symmetric_vert/test.cpp b/test/constraint/symmetric_vert/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/constraint/symmetric_vert/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/constraint/vertical/line.png b/test/constraint/vertical/line.png new file mode 100644 index 0000000..096ca41 Binary files /dev/null and b/test/constraint/vertical/line.png differ diff --git a/test/constraint/vertical/line.slvs b/test/constraint/vertical/line.slvs new file mode 100644 index 0000000..6a1fe00 --- /dev/null +++ b/test/constraint/vertical/line.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/vertical/line_v20.slvs b/test/constraint/vertical/line_v20.slvs new file mode 100644 index 0000000..eeef577 --- /dev/null +++ b/test/constraint/vertical/line_v20.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/vertical/line_v22.slvs b/test/constraint/vertical/line_v22.slvs new file mode 100644 index 0000000..00da9f7 --- /dev/null +++ b/test/constraint/vertical/line_v22.slvs @@ -0,0 +1,288 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/vertical/pt_pt.png b/test/constraint/vertical/pt_pt.png new file mode 100644 index 0000000..92cdbf0 Binary files /dev/null and b/test/constraint/vertical/pt_pt.png differ diff --git a/test/constraint/vertical/pt_pt.slvs b/test/constraint/vertical/pt_pt.slvs new file mode 100644 index 0000000..0381c60 --- /dev/null +++ b/test/constraint/vertical/pt_pt.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/vertical/pt_pt_v20.slvs b/test/constraint/vertical/pt_pt_v20.slvs new file mode 100644 index 0000000..648dbca --- /dev/null +++ b/test/constraint/vertical/pt_pt_v20.slvs @@ -0,0 +1,285 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/vertical/pt_pt_v22.slvs b/test/constraint/vertical/pt_pt_v22.slvs new file mode 100644 index 0000000..458c241 --- /dev/null +++ b/test/constraint/vertical/pt_pt_v22.slvs @@ -0,0 +1,287 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.ptB.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/vertical/test.cpp b/test/constraint/vertical/test.cpp new file mode 100644 index 0000000..c08b5e1 --- /dev/null +++ b/test/constraint/vertical/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(line_roundtrip) { + CHECK_LOAD("line.slvs"); + CHECK_RENDER("line.png"); + CHECK_SAVE("line.slvs"); +} + +TEST_CASE(line_migrate_from_v20) { + CHECK_LOAD("line_v20.slvs"); + CHECK_SAVE("line.slvs"); +} + +TEST_CASE(line_migrate_from_v22) { + CHECK_LOAD("line_v22.slvs"); + CHECK_SAVE("line.slvs"); +} + +TEST_CASE(pt_pt_roundtrip) { + CHECK_LOAD("pt_pt.slvs"); + CHECK_RENDER("pt_pt.png"); + CHECK_SAVE("pt_pt.slvs"); +} + +TEST_CASE(pt_pt_migrate_from_v20) { + CHECK_LOAD("pt_pt_v20.slvs"); + CHECK_SAVE("pt_pt.slvs"); +} + +TEST_CASE(pt_pt_migrate_from_v22) { + CHECK_LOAD("pt_pt_v22.slvs"); + CHECK_SAVE("pt_pt.slvs"); +} diff --git a/test/constraint/where_dragged/free_in_3d.png b/test/constraint/where_dragged/free_in_3d.png new file mode 100644 index 0000000..7ee4884 Binary files /dev/null and b/test/constraint/where_dragged/free_in_3d.png differ diff --git a/test/constraint/where_dragged/free_in_3d.slvs b/test/constraint/where_dragged/free_in_3d.slvs new file mode 100644 index 0000000..a2ac62c --- /dev/null +++ b/test/constraint/where_dragged/free_in_3d.slvs @@ -0,0 +1,261 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=200 +Constraint.group.v=00000002 +Constraint.ptA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/where_dragged/free_in_3d_v20.slvs b/test/constraint/where_dragged/free_in_3d_v20.slvs new file mode 100644 index 0000000..7ad175e --- /dev/null +++ b/test/constraint/where_dragged/free_in_3d_v20.slvs @@ -0,0 +1,261 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=200 +Constraint.group.v=00000002 +Constraint.ptA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/where_dragged/free_in_3d_v22.slvs b/test/constraint/where_dragged/free_in_3d_v22.slvs new file mode 100644 index 0000000..c134f7e --- /dev/null +++ b/test/constraint/where_dragged/free_in_3d_v22.slvs @@ -0,0 +1,261 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=200 +Constraint.group.v=00000002 +Constraint.ptA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/where_dragged/normal.png b/test/constraint/where_dragged/normal.png new file mode 100644 index 0000000..7ee4884 Binary files /dev/null and b/test/constraint/where_dragged/normal.png differ diff --git a/test/constraint/where_dragged/normal.slvs b/test/constraint/where_dragged/normal.slvs new file mode 100644 index 0000000..4eb987c --- /dev/null +++ b/test/constraint/where_dragged/normal.slvs @@ -0,0 +1,262 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=200 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/where_dragged/normal_v20.slvs b/test/constraint/where_dragged/normal_v20.slvs new file mode 100644 index 0000000..397ee40 --- /dev/null +++ b/test/constraint/where_dragged/normal_v20.slvs @@ -0,0 +1,260 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=200 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/where_dragged/normal_v22.slvs b/test/constraint/where_dragged/normal_v22.slvs new file mode 100644 index 0000000..75bc443 --- /dev/null +++ b/test/constraint/where_dragged/normal_v22.slvs @@ -0,0 +1,262 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=200 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/constraint/where_dragged/test.cpp b/test/constraint/where_dragged/test.cpp new file mode 100644 index 0000000..4dcc334 --- /dev/null +++ b/test/constraint/where_dragged/test.cpp @@ -0,0 +1,33 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} diff --git a/test/core/expr/test.cpp b/test/core/expr/test.cpp new file mode 100644 index 0000000..bbd1176 --- /dev/null +++ b/test/core/expr/test.cpp @@ -0,0 +1,114 @@ +#include "expr.h" + +#include "harness.h" + +#define CHECK_PARSE(var, expr) \ + do { \ + var = Expr::From(expr, false); \ + CHECK_TRUE(var != NULL); \ + } while(0) + +#define CHECK_PARSE_ERR(expr, msg) \ + do { \ + std::string err; \ + Expr *e = Expr::Parse(expr, &err); \ + CHECK_TRUE(e == NULL); \ + CHECK_TRUE(err.find(msg) != std::string::npos); \ + } while(0) + +TEST_CASE(constant) { + Expr *e; + CHECK_PARSE(e, "pi"); + CHECK_EQ_EPS(e->Eval(), 3.1415926); +} + +TEST_CASE(literal) { + Expr *e; + CHECK_PARSE(e, "42"); + CHECK_TRUE(e->Eval() == 42); + CHECK_PARSE(e, "42.5"); + CHECK_TRUE(e->Eval() == 42.5); + CHECK_PARSE(e, "1_000_000"); + CHECK_TRUE(e->Eval() == 1000000); +} + +TEST_CASE(unary_ops) { + Expr *e; + CHECK_PARSE(e, "-10"); + CHECK_TRUE(e->Eval() == -10); +} + +TEST_CASE(binary_ops) { + Expr *e; + CHECK_PARSE(e, "1 + 2"); + CHECK_TRUE(e->Eval() == 3); + CHECK_PARSE(e, "1 - 2"); + CHECK_TRUE(e->Eval() == -1); + CHECK_PARSE(e, "3 * 4"); + CHECK_TRUE(e->Eval() == 12); + CHECK_PARSE(e, "3 / 4"); + CHECK_TRUE(e->Eval() == 0.75); +} + +TEST_CASE(parentheses) { + Expr *e; + CHECK_PARSE(e, "(1 + 2) * 3"); + CHECK_TRUE(e->Eval() == 9); + CHECK_PARSE(e, "1 + (2 * 3)"); + CHECK_TRUE(e->Eval() == 7); +} + +TEST_CASE(functions) { + Expr *e; + CHECK_PARSE(e, "sqrt(2)"); + CHECK_EQ_EPS(e->Eval(), 1.414213); + CHECK_PARSE(e, "square(3)"); + CHECK_EQ_EPS(e->Eval(), 9); + CHECK_PARSE(e, "sin(180)"); + CHECK_EQ_EPS(e->Eval(), 0); + CHECK_PARSE(e, "sin(90)"); + CHECK_EQ_EPS(e->Eval(), 1); + CHECK_PARSE(e, "cos(180)"); + CHECK_EQ_EPS(e->Eval(), -1); + CHECK_PARSE(e, "asin(1)"); + CHECK_EQ_EPS(e->Eval(), 90); + CHECK_PARSE(e, "acos(0)"); + CHECK_EQ_EPS(e->Eval(), 90); +} + +TEST_CASE(variable) { + Expr *e; + CHECK_PARSE(e, "Var"); + CHECK_TRUE(e->op == Expr::Op::VARIABLE); +} + +TEST_CASE(precedence) { + Expr *e; + CHECK_PARSE(e, "2 + 3 * 4"); + CHECK_TRUE(e->Eval() == 14); + CHECK_PARSE(e, "2 - 3 / 4"); + CHECK_TRUE(e->Eval() == 1.25); + CHECK_PARSE(e, "-3 + 2"); + CHECK_TRUE(e->Eval() == -1); + CHECK_PARSE(e, "2 + 3 - 4"); + CHECK_TRUE(e->Eval() == 1); +} + +TEST_CASE(errors) { + CHECK_PARSE_ERR("\x01", + "Unexpected character"); + CHECK_PARSE_ERR("notavar", + "'notavar' is not a valid variable, function or constant"); + CHECK_PARSE_ERR("1e2e3", + "'1e2e3' is not a valid number"); + CHECK_PARSE_ERR("_", + "'_' is not a valid operator"); + CHECK_PARSE_ERR("2 2", + "Expected an operator"); + CHECK_PARSE_ERR("2 + +", + "Expected an operand"); + CHECK_PARSE_ERR("( 2 + 2", + "Expected ')'"); + CHECK_PARSE_ERR("(", + "Expected ')'"); +} diff --git a/test/core/locale/test.cpp b/test/core/locale/test.cpp new file mode 100644 index 0000000..2b0a92b --- /dev/null +++ b/test/core/locale/test.cpp @@ -0,0 +1,10 @@ +#include "ui.h" + +#include "harness.h" + +TEST_CASE(parseable) { + for(auto locale : Locales()) { + SetLocale(locale.Culture()); + } + CHECK_TRUE(true); // didn't crash +} diff --git a/test/core/path/test.cpp b/test/core/path/test.cpp new file mode 100644 index 0000000..90ff124 --- /dev/null +++ b/test/core/path/test.cpp @@ -0,0 +1,248 @@ +#include "harness.h" + +using Platform::Path; + +#if defined(WIN32) +#define S "\\" +#define R "C:" +#define U "\\\\?\\C:" +#else +#define S "/" +#define R "" +#define U "" +#endif + +TEST_CASE(from_raw) { + Path path = Path::From("/foo"); + CHECK_EQ_STR(path.raw, "/foo"); +} + +#if defined(WIN32) || defined(__APPLE__) +TEST_CASE(equals_win32_apple) { + CHECK_TRUE(Path::From(R S "foo").Equals(Path::From(R S "foo"))); + CHECK_TRUE(Path::From(R S "foo").Equals(Path::From(R S "FOO"))); + CHECK_FALSE(Path::From(R S "foo").Equals(Path::From(R S "bar"))); +} +#else +TEST_CASE(equals_unix) { + CHECK_TRUE(Path::From(R S "foo").Equals(Path::From(R S "foo"))); + CHECK_FALSE(Path::From(R S "foo").Equals(Path::From(R S "FOO"))); + CHECK_FALSE(Path::From(R S "foo").Equals(Path::From(R S "bar"))); +} +#endif + +#if defined(WIN32) +TEST_CASE(is_absolute_win32) { + CHECK_TRUE(Path::From("c:\\foo").IsAbsolute()); + CHECK_TRUE(Path::From("\\\\?\\c:\\").IsAbsolute()); + CHECK_TRUE(Path::From("\\\\server\\share\\").IsAbsolute()); + CHECK_FALSE(Path::From("c:/foo").IsAbsolute()); + CHECK_FALSE(Path::From("c:foo").IsAbsolute()); + CHECK_FALSE(Path::From("\\\\?").IsAbsolute()); + CHECK_FALSE(Path::From("\\\\server\\").IsAbsolute()); + CHECK_FALSE(Path::From("\\\\?\\c:").IsAbsolute()); + CHECK_FALSE(Path::From("\\\\server\\share").IsAbsolute()); + CHECK_FALSE(Path::From("foo").IsAbsolute()); + CHECK_FALSE(Path::From("/foo").IsAbsolute()); +} +#else +TEST_CASE(is_absolute_unix) { + CHECK_TRUE(Path::From("/foo").IsAbsolute()); + CHECK_FALSE(Path::From("c:/foo").IsAbsolute()); + CHECK_FALSE(Path::From("c:\\foo").IsAbsolute()); + CHECK_FALSE(Path::From("\\\\?\\foo").IsAbsolute()); + CHECK_FALSE(Path::From("c:foo").IsAbsolute()); + CHECK_FALSE(Path::From("foo").IsAbsolute()); +} +#endif + +TEST_CASE(has_extension) { + CHECK_TRUE(Path::From("foo.bar").HasExtension("bar")); + CHECK_TRUE(Path::From("foo.bar").HasExtension("BAR")); + CHECK_TRUE(Path::From("foo.bAr").HasExtension("BaR")); + CHECK_TRUE(Path::From("foo.bar").HasExtension("bar")); + CHECK_FALSE(Path::From("foo.bar").HasExtension("baz")); +} + +TEST_CASE(file_name) { + CHECK_EQ_STR(Path::From("foo").FileName(), "foo"); + CHECK_EQ_STR(Path::From("foo" S "bar").FileName(), "bar"); +} + +TEST_CASE(file_stem) { + CHECK_EQ_STR(Path::From("foo").FileStem(), "foo"); + CHECK_EQ_STR(Path::From("foo" S "bar").FileStem(), "bar"); + CHECK_EQ_STR(Path::From("foo.ext").FileStem(), "foo"); + CHECK_EQ_STR(Path::From("foo" S "bar.ext").FileStem(), "bar"); +} + +TEST_CASE(extension) { + CHECK_EQ_STR(Path::From("foo").Extension(), ""); + CHECK_EQ_STR(Path::From("foo.bar").Extension(), "bar"); + CHECK_EQ_STR(Path::From("foo.bar.baz").Extension(), "baz"); +} + +TEST_CASE(with_extension) { + CHECK_EQ_STR(Path::From("foo.bar").WithExtension("").raw, "foo"); + CHECK_EQ_STR(Path::From("foo.bar").WithExtension("baz").raw, "foo.baz"); + CHECK_EQ_STR(Path::From("foo").WithExtension("baz").raw, "foo.baz"); +} + +TEST_CASE(parent) { + Path path; + path = Path::From("foo" S "bar"); + CHECK_EQ_STR(path.Parent().raw, "foo" S); + path = Path::From("foo" S "bar" S); + CHECK_EQ_STR(path.Parent().raw, "foo" S); + path = Path::From(R S "foo" S "bar"); + CHECK_EQ_STR(path.Parent().raw, R S "foo" S); + path = Path::From(R S "foo"); + CHECK_EQ_STR(path.Parent().raw, R S); + + path = Path::From(""); + CHECK_TRUE(path.Parent().IsEmpty()); + path = Path::From("foo"); + CHECK_TRUE(path.Parent().IsEmpty()); + path = Path::From("foo" S); + CHECK_TRUE(path.Parent().IsEmpty()); + path = Path::From(R S); + CHECK_TRUE(path.Parent().IsEmpty()); +} + +#if defined(WIN32) +TEST_CASE(parent_win32) { + Path path; + path = Path::From(U S); + CHECK_TRUE(path.Parent().IsEmpty()); +} +#endif + +TEST_CASE(join) { + Path path; + path = Path::From("foo"); + CHECK_EQ_STR(path.Join(Path::From("bar")).raw, "foo" S "bar"); + path = Path::From("foo" S); + CHECK_EQ_STR(path.Join(Path::From("bar")).raw, "foo" S "bar"); + + path = Path::From(""); + CHECK_EQ_STR(path.Join(Path::From("bar")).raw, "." S "bar"); + path = Path::From("foo"); + CHECK_EQ_STR(path.Join(Path::From("")).raw, "foo" S); + path = Path::From("foo"); + CHECK_TRUE(path.Join(Path::From(R S "bar")).IsEmpty()); + path = Path::From(""); + CHECK_EQ_STR(path.Join(Path::From("")).raw, "." S); +} + +TEST_CASE(expand) { + Path path; + path = Path::From("foo"); + CHECK_EQ_STR(path.Expand().raw, "foo"); + path = Path::From("foo" S "bar"); + CHECK_EQ_STR(path.Expand().raw, "foo" S "bar"); + path = Path::From("foo" S); + CHECK_EQ_STR(path.Expand().raw, "foo"); + path = Path::From("foo" S "."); + CHECK_EQ_STR(path.Expand().raw, "foo"); + path = Path::From("foo" S "." S "bar"); + CHECK_EQ_STR(path.Expand().raw, "foo" S "bar"); + path = Path::From("foo" S ".." S "bar"); + CHECK_EQ_STR(path.Expand().raw, "bar"); + path = Path::From("foo" S ".."); + CHECK_EQ_STR(path.Expand().raw, "."); + path = Path::From(R S "foo" S ".."); + CHECK_EQ_STR(path.Expand().raw, U S); + path = Path::From(R S); + CHECK_EQ_STR(path.Expand().raw, U S); + + path = Path::From(R S ".."); + CHECK_TRUE(path.Expand().IsEmpty()); + path = Path::From(R S ".." S "foo"); + CHECK_TRUE(path.Expand().IsEmpty()); + path = Path::From(".."); + CHECK_TRUE(path.Expand().IsEmpty()); +} + +#if defined(WIN32) +TEST_CASE(expand_win32) { + Path path; + path = Path::From(R S "foo"); + CHECK_EQ_STR(path.Expand().raw, U S "foo"); + path = Path::From(U S "foo"); + CHECK_EQ_STR(path.Expand().raw, U S "foo"); +} +#endif + +TEST_CASE(expand_from_cwd) { + Path cwd = Path::CurrentDirectory().Expand(); + + Path path; + path = Path::From(R S "foo"); + CHECK_EQ_STR(path.Expand(/*fromCurrentDirectory=*/true).raw, + U S "foo"); + path = Path::From("foo" S "bar"); + CHECK_EQ_STR(path.Expand(/*fromCurrentDirectory=*/true).raw, + cwd.raw + S "foo" S "bar"); + path = Path::From(".." S "bar"); + CHECK_EQ_STR(path.Expand(/*fromCurrentDirectory=*/true).raw, + cwd.Parent().raw + "bar"); +} + +TEST_CASE(relative_to) { + Path base; + base = Path::From(R S "foo" S "bar"); + CHECK_EQ_STR(Path::From(R S "foo").RelativeTo(base).raw, + ".."); + base = Path::From(R S "foo" S "bar"); + CHECK_EQ_STR(Path::From(R S "foo" S "baz").RelativeTo(base).raw, + ".." S "baz"); + base = Path::From(R S "foo" S "bar"); + CHECK_EQ_STR(Path::From(R S "foo" S "bar" S "quux").RelativeTo(base).raw, + "quux"); + base = Path::From(R S "foo" S "bar"); + CHECK_EQ_STR(Path::From(R S "foo" S "bar").RelativeTo(base).raw, + "."); + + base = Path::From("foo"); + CHECK_TRUE(Path::From(R S "foo" S "bar").RelativeTo(base).IsEmpty()); + base = Path::From(R S "foo" S "bar"); + CHECK_TRUE(Path::From("foo").RelativeTo(base).IsEmpty()); +} + +#if defined(WIN32) +TEST_CASE(relative_to_win32) { + Path base; + base = Path::From("C:\\foo"); + CHECK_EQ_STR(Path::From("\\\\?\\C:\\bar").RelativeTo(base).raw, + "..\\bar"); + base = Path::From("C:\\foo"); + CHECK_EQ_STR(Path::From("c:\\FOO").RelativeTo(base).raw, + "."); + + base = Path::From("C:\\foo"); + CHECK_TRUE(Path::From("D:\\bar").RelativeTo(base).IsEmpty()); + CHECK_TRUE(Path::From("\\\\server\\share\\bar").RelativeTo(base).IsEmpty()); +} +#elif defined(__APPLE__) +TEST_CASE(relative_to_apple) { + Path base; + base = Path::From("/users/foo"); + CHECK_EQ_STR(Path::From("/Users/FOO").RelativeTo(base).raw, + "."); +} +#else +TEST_CASE(relative_to_unix) { + Path base; + base = Path::From("/users/foo"); + CHECK_EQ_STR(Path::From("/Users/FOO").RelativeTo(base).raw, + "../../Users/FOO"); +} +#endif + +TEST_CASE(from_portable) { + CHECK_EQ_STR(Path::FromPortable("foo/bar").raw, "foo" S "bar"); +} + +TEST_CASE(to_portable) { + CHECK_EQ_STR(Path::From("foo" S "bar").ToPortable(), "foo/bar"); +} diff --git a/test/debugtool.cpp b/test/debugtool.cpp new file mode 100644 index 0000000..aea6b84 --- /dev/null +++ b/test/debugtool.cpp @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Our entry point for exposing various internal mechanisms. +// +// Copyright 2017 whitequark +//----------------------------------------------------------------------------- + +#include "expr.h" +#include "platform/platform.h" + +using namespace SolveSpace; + +int main(int argc, char **argv) { + std::vector args = Platform::InitCli(argc, argv); + + if(args.size() == 3 && args[1] == "expr") { + std::string expr = args[2], err; + Expr *e = Expr::Parse(expr.c_str(), &err); + if(e == NULL) { + fprintf(stderr, "cannot parse: %s\n", err.c_str()); + } else { + fprintf(stderr, "%g\n", e->Eval()); + } + Platform::FreeAllTemporary(); + } else { + fprintf(stderr, "Usage: %s \n", args[0].c_str()); +//-----------------------------------------------------------------------------> 80 col */ + fprintf(stderr, R"( +Commands: + expr [expr] + Evaluate an expression. +)"); + } + + return 0; +} diff --git a/test/group/link/normal.png b/test/group/link/normal.png new file mode 100644 index 0000000..b3295bc Binary files /dev/null and b/test/group/link/normal.png differ diff --git a/test/group/link/normal.slvs b/test/group/link/normal.slvs new file mode 100644 index 0000000..97ba795 --- /dev/null +++ b/test/group/link/normal.slvs @@ -0,0 +1,465 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5300 +Group.order=2 +Group.name=rect-v20 +Group.activeWorkplane.v=00010000 +Group.color=00646464 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00010000 0 + 2 00010001 0 + 3 00010020 0 + 4 00020000 0 + 5 00020001 0 + 6 00020020 0 + 7 00030000 0 + 8 00030001 0 + 9 00030020 0 + 10 00040000 0 + 11 00040001 0 + 12 00040002 0 + 13 00050000 0 + 14 00050001 0 + 15 00050002 0 + 16 00060000 0 + 17 00060001 0 + 18 00060002 0 + 19 00070000 0 + 20 00070001 0 + 21 00070002 0 + 22 80020000 0 + 23 80020001 0 + 24 80020002 0 +} +Group.impFile=/TESTROOT/rect_v20.slvs +Group.impFileRel=rect_v20.slvs +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030001 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030002 +AddParam + +Param.h.v.=80030003 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=80030004 +AddParam + +Param.h.v.=80030005 +AddParam + +Param.h.v.=80030006 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030008 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030011 +Entity.point[1].v=80030012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + diff --git a/test/group/link/normal_v20.slvs b/test/group/link/normal_v20.slvs new file mode 100644 index 0000000..f06c81d --- /dev/null +++ b/test/group/link/normal_v20.slvs @@ -0,0 +1,463 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000003 +Group.type=5300 +Group.order=2 +Group.name=rect-v20 +Group.activeWorkplane.v=00010000 +Group.opA.v=00000002 +Group.color=00646464 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00010000 0 + 2 00010001 0 + 3 00010020 0 + 4 00020000 0 + 5 00020001 0 + 6 00020020 0 + 7 00030000 0 + 8 00030001 0 + 9 00030020 0 + 10 00040000 0 + 11 00040001 0 + 12 00040002 0 + 13 00050000 0 + 14 00050001 0 + 15 00050002 0 + 16 00060000 0 + 17 00060001 0 + 18 00060002 0 + 19 00070000 0 + 20 00070001 0 + 21 00070002 0 + 22 80020000 0 + 23 80020001 0 + 24 80020002 0 +} +Group.impFile=Z:\TESTROOT\rect_v20.slvs +Group.impFileRel=rect_v20.slvs +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030001 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030002 +AddParam + +Param.h.v.=80030003 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=80030004 +AddParam + +Param.h.v.=80030005 +AddParam + +Param.h.v.=80030006 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030008 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030011 +Entity.point[1].v=80030012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + diff --git a/test/group/link/normal_v22.slvs b/test/group/link/normal_v22.slvs new file mode 100644 index 0000000..fb39ea2 --- /dev/null +++ b/test/group/link/normal_v22.slvs @@ -0,0 +1,465 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5300 +Group.order=2 +Group.name=rect-v20 +Group.activeWorkplane.v=00010000 +Group.color=00646464 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00010000 0 + 2 00010001 0 + 3 00010020 0 + 4 00020000 0 + 5 00020001 0 + 6 00020020 0 + 7 00030000 0 + 8 00030001 0 + 9 00030020 0 + 10 00040000 0 + 11 00040001 0 + 12 00040002 0 + 13 00050000 0 + 14 00050001 0 + 15 00050002 0 + 16 00060000 0 + 17 00060001 0 + 18 00060002 0 + 19 00070000 0 + 20 00070001 0 + 21 00070002 0 + 22 80020000 0 + 23 80020001 0 + 24 80020002 0 +} +Group.impFile=/TESTROOT/rect_v20.slvs +Group.impFileRel=rect_v20.slvs +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030001 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030002 +AddParam + +Param.h.v.=80030003 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=80030004 +AddParam + +Param.h.v.=80030005 +AddParam + +Param.h.v.=80030006 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030008 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030011 +Entity.point[1].v=80030012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + diff --git a/test/group/link/rect_v20.slvs b/test/group/link/rect_v20.slvs new file mode 100644 index 0000000..3bebad4 --- /dev/null +++ b/test/group/link/rect_v20.slvs @@ -0,0 +1,510 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00050002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060001 +Constraint.ptB.v=00070002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00070001 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000005 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000006 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000007 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000008 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00070000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/group/link/test.cpp b/test/group/link/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/group/link/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/group/translate_asy/normal.png b/test/group/translate_asy/normal.png new file mode 100644 index 0000000..c9b4e4e Binary files /dev/null and b/test/group/translate_asy/normal.png differ diff --git a/test/group/translate_asy/normal.slvs b/test/group/translate_asy/normal.slvs new file mode 100644 index 0000000..b097270 --- /dev/null +++ b/test/group/translate_asy/normal.slvs @@ -0,0 +1,2104 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040002 1002 + 4 00040000 1001 + 5 00040001 1001 + 6 00040002 1001 + 7 00040000 1004 + 8 00040001 1003 + 9 00040002 1003 + 10 00050000 1002 + 11 00050001 1002 + 12 00050002 1002 + 13 00050000 1001 + 14 00050001 1001 + 15 00050002 1001 + 16 00050000 1004 + 17 00050001 1003 + 18 00050002 1003 + 19 00060000 1002 + 20 00060001 1002 + 21 00060002 1002 + 22 00060000 1001 + 23 00060001 1001 + 24 00060002 1001 + 25 00060000 1004 + 26 00060001 1003 + 27 00060002 1003 + 28 00070000 1002 + 29 00070001 1002 + 30 00070002 1002 + 31 00070000 1001 + 32 00070001 1001 + 33 00070002 1001 + 34 00070000 1004 + 35 00070001 1003 + 36 00070002 1003 + 37 80020000 1002 + 38 80020000 1001 + 39 80020001 1002 + 40 80020002 1002 + 41 80020001 1001 + 42 80020002 1001 + 43 80020002 1003 + 44 00000000 1001 + 45 00000000 1002 +} +AddGroup + +Group.h.v=00000004 +Group.type=5201 +Group.order=3 +Group.name=translate +Group.opA.v=00000003 +Group.valA=2.00000000000000000000 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 80030001 0 + 2 80030002 0 + 3 80030003 0 + 4 80030004 0 + 5 80030005 0 + 6 80030006 0 + 7 80030007 0 + 8 80030008 0 + 9 80030009 0 + 10 8003000a 0 + 11 8003000b 0 + 12 8003000c 0 + 13 8003000d 0 + 14 8003000e 0 + 15 8003000f 0 + 16 80030010 0 + 17 80030011 0 + 18 80030012 0 + 19 80030013 0 + 20 80030014 0 + 21 80030015 0 + 22 80030016 0 + 23 80030017 0 + 24 80030018 0 + 25 80030019 0 + 26 8003001a 0 + 27 8003001b 0 + 28 8003001c 0 + 29 8003001d 0 + 30 8003001e 0 + 31 8003001f 0 + 32 80030020 0 + 33 80030021 0 + 34 80030022 0 + 35 80030023 0 + 36 80030024 0 + 37 80030027 0 + 38 80030028 0 + 39 80030029 0 + 40 8003002a 0 + 41 8003002b 0 + 42 8003002c 0 + 43 8003002d 0 + 44 80030001 1 + 45 80030002 1 + 46 80030003 1 + 47 80030004 1 + 48 80030005 1 + 49 80030006 1 + 50 80030007 1 + 51 80030008 1 + 52 80030009 1 + 53 8003000a 1 + 54 8003000b 1 + 55 8003000c 1 + 56 8003000d 1 + 57 8003000e 1 + 58 8003000f 1 + 59 80030010 1 + 60 80030011 1 + 61 80030012 1 + 62 80030013 1 + 63 80030014 1 + 64 80030015 1 + 65 80030016 1 + 66 80030017 1 + 67 80030018 1 + 68 80030019 1 + 69 8003001a 1 + 70 8003001b 1 + 71 8003001c 1 + 72 8003001d 1 + 73 8003001e 1 + 74 8003001f 1 + 75 80030020 1 + 76 80030021 1 + 77 80030022 1 + 78 80030023 1 + 79 80030024 1 + 80 80030027 1 + 81 80030028 1 + 82 80030029 1 + 83 8003002a 1 + 84 8003002b 1 + 85 8003002c 1 + 86 8003002d 1 + 87 80030001 1000 + 88 80030002 1000 + 89 80030003 1000 + 90 80030004 1000 + 91 80030005 1000 + 92 80030006 1000 + 93 80030007 1000 + 94 80030008 1000 + 95 80030009 1000 + 96 8003000a 1000 + 97 8003000b 1000 + 98 8003000c 1000 + 99 8003000d 1000 + 100 8003000e 1000 + 101 8003000f 1000 + 102 80030010 1000 + 103 80030011 1000 + 104 80030012 1000 + 105 80030013 1000 + 106 80030014 1000 + 107 80030015 1000 + 108 80030016 1000 + 109 80030017 1000 + 110 80030018 1000 + 111 80030019 1000 + 112 8003001a 1000 + 113 8003001b 1000 + 114 8003001c 1000 + 115 8003001d 1000 + 116 8003001e 1000 + 117 8003001f 1000 + 118 80030020 1000 + 119 80030021 1000 + 120 80030022 1000 + 121 80030023 1000 + 122 80030024 1000 + 123 80030027 1000 + 124 80030028 1000 + 125 80030029 1000 + 126 8003002a 1000 + 127 8003002b 1000 + 128 8003002c 1000 + 129 8003002d 1000 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80040000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80040001 +Param.val=2.50000000000000000000 +AddParam + +Param.h.v.=80040002 +Param.val=-2.50000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030006 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030019 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003001d +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=80030021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030020 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030022 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=8003001d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030024 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030021 +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030027 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030028 +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030029 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002a +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002b +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8003002a +Entity.point[1].v=80030028 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002c +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actPoint.z=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002d +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040002 +Entity.point[1].v=80040003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040003 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040004 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040005 +Entity.point[1].v=80040006 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040005 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040007 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040005 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040008 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040005 +Entity.point[1].v=80040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040006 +Entity.point[1].v=80040003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000b +Entity.point[1].v=8004000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000e +Entity.point[1].v=8004000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040010 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8004000e +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000e +Entity.point[1].v=8004000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040012 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000f +Entity.point[1].v=8004000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040014 +Entity.point[1].v=80040015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040015 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040017 +Entity.point[1].v=80040018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040017 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040019 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040017 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040017 +Entity.point[1].v=80040014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040018 +Entity.point[1].v=80040015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004001d +Entity.point[1].v=8004001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040020 +Entity.point[1].v=80040021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040020 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040022 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040020 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040020 +Entity.point[1].v=8004001d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040024 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040021 +Entity.point[1].v=8004001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040025 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80040026 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040026 +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040027 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80040028 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040028 +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040029 +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=80040028 +Entity.point[1].v=80040026 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004002a +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040028 +Entity.actPoint.z=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004002b +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040026 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040057 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040058 +Entity.point[1].v=80040059 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040058 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040059 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004005b +Entity.point[1].v=8004005c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005d +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8004005b +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004005b +Entity.point[1].v=80040058 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004005c +Entity.point[1].v=80040059 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040060 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040061 +Entity.point[1].v=80040062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040061 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040062 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040063 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040064 +Entity.point[1].v=80040065 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040064 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040065 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040066 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040064 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040067 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040064 +Entity.point[1].v=80040061 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040068 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040065 +Entity.point[1].v=80040062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040069 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006a +Entity.point[1].v=8004006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006d +Entity.point[1].v=8004006e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8004006d +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040070 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006d +Entity.point[1].v=8004006a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040071 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006e +Entity.point[1].v=8004006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040072 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040073 +Entity.point[1].v=80040074 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040073 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040074 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040075 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040076 +Entity.point[1].v=80040077 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040076 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040077 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040078 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80040076 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040079 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040076 +Entity.point[1].v=80040073 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040077 +Entity.point[1].v=80040074 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007b +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8004007c +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007c +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007d +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8004007e +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007e +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007f +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8004007e +Entity.point[1].v=8004007c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040080 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8004007e +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040081 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8004007c +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00050002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060001 +Constraint.ptB.v=00070002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00070001 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000005 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000006 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000007 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000008 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00070000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 8004002a 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000001 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000004 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000007 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 0000000a 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +AddSurface +Surface 00000002 00646464 8004002b 1 1 +SCtrl 0 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000005 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 80040010 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000001 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 0000000c 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 80040019 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000004 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000005 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000006 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000003 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000005 00646464 80040022 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000007 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000008 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000009 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000006 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000006 00646464 80040007 1 1 +SCtrl 0 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000009 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000007 00646464 80040080 1 1 +SCtrl 0 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000d 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000010 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000013 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000016 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +AddSurface +Surface 00000008 00646464 80040081 1 1 +SCtrl 0 0 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000e 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 00000011 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 00000014 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +TrimBy 00000017 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 00000009 00646464 80040066 1 1 +SCtrl 0 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000d 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 0000000e 0 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 0000000f 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000018 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 0000000a 00646464 8004006f 1 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000010 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000011 0 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +TrimBy 00000012 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 0000000f 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 0000000b 00646464 80040078 1 1 +SCtrl 0 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000013 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000014 0 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +TrimBy 00000015 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000012 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 0000000c 00646464 8004005d 1 1 +SCtrl 0 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000016 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000017 0 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 00000018 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000015 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddSurface +Curve 00000001 1 1 00000001 00000003 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 00000002 1 1 00000002 00000003 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 1 00000001 00000004 +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 00000005 1 1 00000002 00000004 +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000007 1 1 00000001 00000005 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 00000008 1 1 00000002 00000005 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000a 1 1 00000001 00000006 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 0000000b 1 1 00000002 00000006 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000d 1 1 00000007 00000009 +CCtrl 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 0000000e 1 1 00000008 00000009 +CCtrl 0 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 0000000f 1 1 00000009 0000000a +CCtrl 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000010 1 1 00000007 0000000a +CCtrl 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 00000011 1 1 00000008 0000000a +CCtrl 0 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000012 1 1 0000000a 0000000b +CCtrl 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000013 1 1 00000007 0000000b +CCtrl 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 00000014 1 1 00000008 0000000b +CCtrl 0 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000015 1 1 0000000b 0000000c +CCtrl 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000016 1 1 00000007 0000000c +CCtrl 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 00000017 1 1 00000008 0000000c +CCtrl 0 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000018 1 1 0000000c 00000009 +CCtrl 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve diff --git a/test/group/translate_asy/normal_v22.slvs b/test/group/translate_asy/normal_v22.slvs new file mode 100644 index 0000000..2f013bc --- /dev/null +++ b/test/group/translate_asy/normal_v22.slvs @@ -0,0 +1,2088 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040002 1002 + 4 00040000 1001 + 5 00040001 1001 + 6 00040002 1001 + 7 00040000 1004 + 8 00040001 1003 + 9 00040002 1003 + 10 00050000 1002 + 11 00050001 1002 + 12 00050002 1002 + 13 00050000 1001 + 14 00050001 1001 + 15 00050002 1001 + 16 00050000 1004 + 17 00050001 1003 + 18 00050002 1003 + 19 00060000 1002 + 20 00060001 1002 + 21 00060002 1002 + 22 00060000 1001 + 23 00060001 1001 + 24 00060002 1001 + 25 00060000 1004 + 26 00060001 1003 + 27 00060002 1003 + 28 00070000 1002 + 29 00070001 1002 + 30 00070002 1002 + 31 00070000 1001 + 32 00070001 1001 + 33 00070002 1001 + 34 00070000 1004 + 35 00070001 1003 + 36 00070002 1003 + 37 80020000 1002 + 38 80020000 1001 + 39 80020001 1002 + 40 80020002 1002 + 41 80020001 1001 + 42 80020002 1001 + 43 80020002 1003 + 44 00000000 1001 + 45 00000000 1002 +} +AddGroup + +Group.h.v=00000004 +Group.type=5201 +Group.order=3 +Group.name=translate +Group.opA.v=00000003 +Group.valA=2.00000000000000000000 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 80030001 0 + 2 80030002 0 + 3 80030003 0 + 4 80030004 0 + 5 80030005 0 + 6 80030006 0 + 7 80030007 0 + 8 80030008 0 + 9 80030009 0 + 10 8003000a 0 + 11 8003000b 0 + 12 8003000c 0 + 13 8003000d 0 + 14 8003000e 0 + 15 8003000f 0 + 16 80030010 0 + 17 80030011 0 + 18 80030012 0 + 19 80030013 0 + 20 80030014 0 + 21 80030015 0 + 22 80030016 0 + 23 80030017 0 + 24 80030018 0 + 25 80030019 0 + 26 8003001a 0 + 27 8003001b 0 + 28 8003001c 0 + 29 8003001d 0 + 30 8003001e 0 + 31 8003001f 0 + 32 80030020 0 + 33 80030021 0 + 34 80030022 0 + 35 80030023 0 + 36 80030024 0 + 37 80030027 0 + 38 80030028 0 + 39 80030029 0 + 40 8003002a 0 + 41 8003002b 0 + 42 8003002c 0 + 43 8003002d 0 + 44 80030001 1 + 45 80030002 1 + 46 80030003 1 + 47 80030004 1 + 48 80030005 1 + 49 80030006 1 + 50 80030007 1 + 51 80030008 1 + 52 80030009 1 + 53 8003000a 1 + 54 8003000b 1 + 55 8003000c 1 + 56 8003000d 1 + 57 8003000e 1 + 58 8003000f 1 + 59 80030010 1 + 60 80030011 1 + 61 80030012 1 + 62 80030013 1 + 63 80030014 1 + 64 80030015 1 + 65 80030016 1 + 66 80030017 1 + 67 80030018 1 + 68 80030019 1 + 69 8003001a 1 + 70 8003001b 1 + 71 8003001c 1 + 72 8003001d 1 + 73 8003001e 1 + 74 8003001f 1 + 75 80030020 1 + 76 80030021 1 + 77 80030022 1 + 78 80030023 1 + 79 80030024 1 + 80 80030027 1 + 81 80030028 1 + 82 80030029 1 + 83 8003002a 1 + 84 8003002b 1 + 85 8003002c 1 + 86 8003002d 1 + 87 80030001 1000 + 88 80030002 1000 + 89 80030003 1000 + 90 80030004 1000 + 91 80030005 1000 + 92 80030006 1000 + 93 80030007 1000 + 94 80030008 1000 + 95 80030009 1000 + 96 8003000a 1000 + 97 8003000b 1000 + 98 8003000c 1000 + 99 8003000d 1000 + 100 8003000e 1000 + 101 8003000f 1000 + 102 80030010 1000 + 103 80030011 1000 + 104 80030012 1000 + 105 80030013 1000 + 106 80030014 1000 + 107 80030015 1000 + 108 80030016 1000 + 109 80030017 1000 + 110 80030018 1000 + 111 80030019 1000 + 112 8003001a 1000 + 113 8003001b 1000 + 114 8003001c 1000 + 115 8003001d 1000 + 116 8003001e 1000 + 117 8003001f 1000 + 118 80030020 1000 + 119 80030021 1000 + 120 80030022 1000 + 121 80030023 1000 + 122 80030024 1000 + 123 80030027 1000 + 124 80030028 1000 + 125 80030029 1000 + 126 8003002a 1000 + 127 8003002b 1000 + 128 8003002c 1000 + 129 8003002d 1000 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80040000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80040001 +Param.val=2.50000000000000000000 +AddParam + +Param.h.v.=80040002 +Param.val=-2.50000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030006 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030019 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003001d +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=80030021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030020 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030022 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=8003001d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030024 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030021 +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030027 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030028 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030029 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.point[1].v=80030028 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002c +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actPoint.z=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002d +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040002 +Entity.point[1].v=80040003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040003 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040004 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040005 +Entity.point[1].v=80040006 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040005 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040007 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040008 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040005 +Entity.point[1].v=80040002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040006 +Entity.point[1].v=80040003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000b +Entity.point[1].v=8004000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000e +Entity.point[1].v=8004000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040010 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000e +Entity.point[1].v=8004000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040012 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004000f +Entity.point[1].v=8004000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040014 +Entity.point[1].v=80040015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040015 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040017 +Entity.point[1].v=80040018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040017 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040019 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040017 +Entity.point[1].v=80040014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040018 +Entity.point[1].v=80040015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004001d +Entity.point[1].v=8004001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040020 +Entity.point[1].v=80040021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040020 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040022 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040020 +Entity.point[1].v=8004001d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040024 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040021 +Entity.point[1].v=8004001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040025 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80040026 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040026 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040027 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80040028 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040028 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040028 +Entity.point[1].v=80040026 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004002a +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.z=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004002b +Entity.type=5003 +Entity.construction=0 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040057 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040058 +Entity.point[1].v=80040059 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040058 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040059 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004005b +Entity.point[1].v=8004005c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005d +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004005b +Entity.point[1].v=80040058 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004005f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004005c +Entity.point[1].v=80040059 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040060 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040061 +Entity.point[1].v=80040062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040061 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040062 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040063 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040064 +Entity.point[1].v=80040065 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040064 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040065 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040066 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040067 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040064 +Entity.point[1].v=80040061 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040068 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040065 +Entity.point[1].v=80040062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040069 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006a +Entity.point[1].v=8004006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006d +Entity.point[1].v=8004006e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004006f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040070 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006d +Entity.point[1].v=8004006a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040071 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004006e +Entity.point[1].v=8004006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040072 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040073 +Entity.point[1].v=80040074 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040073 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040074 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040075 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040076 +Entity.point[1].v=80040077 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040076 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040077 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040078 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040079 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040076 +Entity.point[1].v=80040073 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80040077 +Entity.point[1].v=80040074 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007b +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8004007c +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007d +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8004007e +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8004007f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8004007e +Entity.point[1].v=8004007c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040080 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=5.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040081 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=-5.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00050002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060001 +Constraint.ptB.v=00070002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00070001 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000005 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000006 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000007 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000008 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00070000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 8004002a 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000010000000827 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -5.00000000010000000827 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000010000000827 -5.00000000010000000827 10.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000001 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000004 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000007 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 0000000a 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +AddSurface +Surface 00000002 00646464 8004002b 1 1 +SCtrl 0 0 10.00000000010000000827 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000010000000827 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000002 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000005 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000008 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 80040010 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000001 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000002 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 0000000c 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 80040019 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000004 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000005 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000006 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000003 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000005 00646464 80040022 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000007 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000008 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000009 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 00000006 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000006 00646464 80040007 1 1 +SCtrl 0 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +TrimBy 0000000b 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +TrimBy 00000009 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000007 00646464 80040080 1 1 +SCtrl 0 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000010000178463 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -0.00000000010000000827 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000010000178463 -0.00000000010000000827 5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000d 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000010 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000013 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000016 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +AddSurface +Surface 00000008 00646464 80040081 1 1 +SCtrl 0 0 20.00000000010000178463 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000010000178463 -0.00000000010000000827 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -0.00000000010000000827 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000e 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 00000011 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 00000014 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +TrimBy 00000017 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 00000009 00646464 80040066 1 1 +SCtrl 0 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000d 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 0000000e 0 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 0000000f 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000018 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 0000000a 00646464 8004006f 1 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000010 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000011 0 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +TrimBy 00000012 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 0000000f 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 0000000b 00646464 80040078 1 1 +SCtrl 0 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000013 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000014 0 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +TrimBy 00000015 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000012 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddSurface +Surface 0000000c 00646464 8004005d 1 1 +SCtrl 0 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000016 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +TrimBy 00000017 0 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +TrimBy 00000018 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +TrimBy 00000015 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddSurface +Curve 00000001 1 1 00000001 00000003 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 00000002 1 1 00000002 00000003 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 1 00000001 00000004 +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 00000005 1 1 00000002 00000004 +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000007 1 1 00000001 00000005 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 00000008 1 1 00000002 00000005 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000a 1 1 00000001 00000006 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +AddCurve +Curve 0000000b 1 1 00000002 00000006 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000d 1 1 00000007 00000009 +CCtrl 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 0000000e 1 1 00000008 00000009 +CCtrl 0 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 0000000f 1 1 00000009 0000000a +CCtrl 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000010 1 1 00000007 0000000a +CCtrl 0 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 00000011 1 1 00000008 0000000a +CCtrl 0 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000012 1 1 0000000a 0000000b +CCtrl 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000013 1 1 00000007 0000000b +CCtrl 0 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 00000014 1 1 00000008 0000000b +CCtrl 0 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000015 1 1 0000000b 0000000c +CCtrl 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000016 1 1 00000007 0000000c +CCtrl 0 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +AddCurve +Curve 00000017 1 1 00000008 0000000c +CCtrl 0 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve +Curve 00000018 1 1 0000000c 00000009 +CCtrl 0 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 5.00000000000000000000 +CurvePt 1 20.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 +AddCurve diff --git a/test/group/translate_asy/test.cpp b/test/group/translate_asy/test.cpp new file mode 100644 index 0000000..979081d --- /dev/null +++ b/test/group/translate_asy/test.cpp @@ -0,0 +1,31 @@ +#include "solvespace.h" + +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER_ISO("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_inters) { + CHECK_LOAD("normal.slvs"); + + Group *g = SK.GetGroup(SS.GW.activeGroup); + g->GenerateDisplayItems(); + SMesh *m = &g->displayMesh; + + SEdgeList el = {}; + bool inters, leaks; + SKdNode::From(m)->MakeCertainEdgesInto(&el, + EdgeKind::SELF_INTER, /*coplanarIsInter=*/false, &inters, &leaks); + el.Clear(); + + // The assembly is supposed to interfere. + CHECK_TRUE(inters); +} diff --git a/test/group/translate_nd/normal.png b/test/group/translate_nd/normal.png new file mode 100644 index 0000000..4f5ee2c Binary files /dev/null and b/test/group/translate_nd/normal.png differ diff --git a/test/group/translate_nd/normal.slvs b/test/group/translate_nd/normal.slvs new file mode 100644 index 0000000..c204519 --- /dev/null +++ b/test/group/translate_nd/normal.slvs @@ -0,0 +1,8396 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040002 1002 + 4 00040000 1001 + 5 00040001 1001 + 6 00040002 1001 + 7 00040000 1004 + 8 00040001 1003 + 9 00040002 1003 + 10 00050000 1002 + 11 00050001 1002 + 12 00050002 1002 + 13 00050000 1001 + 14 00050001 1001 + 15 00050002 1001 + 16 00050000 1004 + 17 00050001 1003 + 18 00050002 1003 + 19 00060000 1002 + 20 00060001 1002 + 21 00060002 1002 + 22 00060000 1001 + 23 00060001 1001 + 24 00060002 1001 + 25 00060000 1004 + 26 00060001 1003 + 27 00060002 1003 + 28 00070000 1002 + 29 00070001 1002 + 30 00070002 1002 + 31 00070000 1001 + 32 00070001 1001 + 33 00070002 1001 + 34 00070000 1004 + 35 00070001 1003 + 36 00070002 1003 + 37 80020000 1002 + 38 80020000 1001 + 39 80020001 1002 + 40 80020002 1002 + 41 80020001 1001 + 42 80020002 1001 + 43 80020002 1003 + 44 00000000 1001 + 45 00000000 1002 +} +AddGroup + +Group.h.v=00000004 +Group.type=5001 +Group.order=3 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80040000 +Group.color=00646464 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=80030028 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000005 +Group.type=5100 +Group.order=4 +Group.name=extrude +Group.opA.v=00000004 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=1 +Group.predef.entityB.v=80040000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00080000 1002 + 2 00080001 1002 + 3 00080020 1002 + 4 00080040 1002 + 5 00080000 1001 + 6 00080001 1001 + 7 00080020 1001 + 8 00080040 1001 + 9 00080001 1003 + 10 80040000 1002 + 11 80040000 1001 + 12 80040001 1002 + 13 80040002 1002 + 14 80040001 1001 + 15 80040002 1001 + 16 80040002 1003 + 17 00000000 1001 + 18 00000000 1002 + 19 00080002 1002 + 20 00080002 1001 + 21 00080000 1004 + 22 00080002 1003 + 23 00090000 1002 + 24 00090001 1002 + 25 00090002 1002 + 26 00090000 1001 + 27 00090001 1001 + 28 00090002 1001 + 29 00090000 1004 + 30 00090001 1003 + 31 00090002 1003 + 32 000a0000 1002 + 33 000a0001 1002 + 34 000a0002 1002 + 35 000a0000 1001 + 36 000a0001 1001 + 37 000a0002 1001 + 38 000a0000 1004 + 39 000a0001 1003 + 40 000a0002 1003 + 41 000b0000 1002 + 42 000b0001 1002 + 43 000b0002 1002 + 44 000b0000 1001 + 45 000b0001 1001 + 46 000b0002 1001 + 47 000b0000 1004 + 48 000b0001 1003 + 49 000b0002 1003 +} +AddGroup + +Group.h.v=00000006 +Group.type=5201 +Group.order=5 +Group.name=translate +Group.activeWorkplane.v=00010000 +Group.opA.v=00000005 +Group.valA=3.00000000000000000000 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=1 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 80050001 0 + 2 80050002 0 + 3 80050003 0 + 4 80050004 0 + 5 80050005 0 + 6 80050006 0 + 7 80050007 0 + 8 80050008 0 + 9 80050009 0 + 10 8005000c 0 + 11 8005000d 0 + 12 8005000e 0 + 13 8005000f 0 + 14 80050010 0 + 15 80050011 0 + 16 80050012 0 + 17 80050001 1 + 18 80050002 1 + 19 80050003 1 + 20 80050004 1 + 21 80050005 1 + 22 80050006 1 + 23 80050007 1 + 24 80050008 1 + 25 80050009 1 + 26 8005000c 1 + 27 8005000d 1 + 28 8005000e 1 + 29 8005000f 1 + 30 80050010 1 + 31 80050011 1 + 32 80050012 1 + 33 80050001 1000 + 34 80050002 1000 + 35 80050003 1000 + 36 80050004 1000 + 37 80050005 1000 + 38 80050006 1000 + 39 80050007 1000 + 40 80050008 1000 + 41 80050009 1000 + 42 8005000c 1000 + 43 8005000d 1000 + 44 8005000e 1000 + 45 8005000f 1000 + 46 80050010 1000 + 47 80050011 1000 + 48 80050012 1000 + 49 80050013 0 + 50 80050014 0 + 51 80050015 0 + 52 80050016 0 + 53 80050017 0 + 54 80050018 0 + 55 80050019 0 + 56 8005001a 0 + 57 8005001b 0 + 58 8005001c 0 + 59 8005001d 0 + 60 8005001e 0 + 61 8005001f 0 + 62 80050020 0 + 63 80050021 0 + 64 80050022 0 + 65 80050023 0 + 66 80050024 0 + 67 80050025 0 + 68 80050026 0 + 69 80050027 0 + 70 80050028 0 + 71 80050029 0 + 72 8005002a 0 + 73 8005002b 0 + 74 8005002c 0 + 75 8005002d 0 + 76 8005002e 0 + 77 8005002f 0 + 78 80050030 0 + 79 80050031 0 + 80 80050013 1 + 81 80050014 1 + 82 80050015 1 + 83 80050016 1 + 84 80050017 1 + 85 80050018 1 + 86 80050019 1 + 87 8005001a 1 + 88 8005001b 1 + 89 8005001c 1 + 90 8005001d 1 + 91 8005001e 1 + 92 8005001f 1 + 93 80050020 1 + 94 80050021 1 + 95 80050022 1 + 96 80050023 1 + 97 80050024 1 + 98 80050025 1 + 99 80050026 1 + 100 80050027 1 + 101 80050028 1 + 102 80050029 1 + 103 8005002a 1 + 104 8005002b 1 + 105 8005002c 1 + 106 8005002d 1 + 107 8005002e 1 + 108 8005002f 1 + 109 80050030 1 + 110 80050031 1 + 111 80050013 1000 + 112 80050014 1000 + 113 80050015 1000 + 114 80050016 1000 + 115 80050017 1000 + 116 80050018 1000 + 117 80050019 1000 + 118 8005001a 1000 + 119 8005001b 1000 + 120 8005001c 1000 + 121 8005001d 1000 + 122 8005001e 1000 + 123 8005001f 1000 + 124 80050020 1000 + 125 80050021 1000 + 126 80050022 1000 + 127 80050023 1000 + 128 80050024 1000 + 129 80050025 1000 + 130 80050026 1000 + 131 80050027 1000 + 132 80050028 1000 + 133 80050029 1000 + 134 8005002a 1000 + 135 8005002b 1000 + 136 8005002c 1000 + 137 8005002d 1000 + 138 8005002e 1000 + 139 8005002f 1000 + 140 80050030 1000 + 141 80050031 1000 +} +AddGroup + +Group.h.v=00000007 +Group.type=5201 +Group.order=6 +Group.name=translate +Group.activeWorkplane.v=00010000 +Group.opA.v=00000006 +Group.valA=3.00000000000000000000 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=1 +Group.predef.entityB.v=00010000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 80060001 0 + 2 80060002 0 + 3 80060003 0 + 4 80060004 0 + 5 80060005 0 + 6 80060006 0 + 7 80060007 0 + 8 80060008 0 + 9 80060009 0 + 10 8006000a 0 + 11 8006000b 0 + 12 8006000c 0 + 13 8006000d 0 + 14 8006000e 0 + 15 8006000f 0 + 16 80060010 0 + 17 80060011 0 + 18 80060012 0 + 19 80060013 0 + 20 80060014 0 + 21 80060015 0 + 22 80060016 0 + 23 80060017 0 + 24 80060018 0 + 25 80060019 0 + 26 8006001a 0 + 27 8006001b 0 + 28 8006001c 0 + 29 8006001d 0 + 30 8006001e 0 + 31 8006001f 0 + 32 80060020 0 + 33 80060021 0 + 34 80060022 0 + 35 80060023 0 + 36 80060024 0 + 37 80060025 0 + 38 80060026 0 + 39 80060027 0 + 40 80060028 0 + 41 80060029 0 + 42 8006002a 0 + 43 8006002b 0 + 44 8006002c 0 + 45 8006002d 0 + 46 8006002e 0 + 47 8006002f 0 + 48 80060030 0 + 49 80060001 1 + 50 80060002 1 + 51 80060003 1 + 52 80060004 1 + 53 80060005 1 + 54 80060006 1 + 55 80060007 1 + 56 80060008 1 + 57 80060009 1 + 58 8006000a 1 + 59 8006000b 1 + 60 8006000c 1 + 61 8006000d 1 + 62 8006000e 1 + 63 8006000f 1 + 64 80060010 1 + 65 80060011 1 + 66 80060012 1 + 67 80060013 1 + 68 80060014 1 + 69 80060015 1 + 70 80060016 1 + 71 80060017 1 + 72 80060018 1 + 73 80060019 1 + 74 8006001a 1 + 75 8006001b 1 + 76 8006001c 1 + 77 8006001d 1 + 78 8006001e 1 + 79 8006001f 1 + 80 80060020 1 + 81 80060021 1 + 82 80060022 1 + 83 80060023 1 + 84 80060024 1 + 85 80060025 1 + 86 80060026 1 + 87 80060027 1 + 88 80060028 1 + 89 80060029 1 + 90 8006002a 1 + 91 8006002b 1 + 92 8006002c 1 + 93 8006002d 1 + 94 8006002e 1 + 95 8006002f 1 + 96 80060030 1 + 97 80060001 1000 + 98 80060002 1000 + 99 80060003 1000 + 100 80060004 1000 + 101 80060005 1000 + 102 80060006 1000 + 103 80060007 1000 + 104 80060008 1000 + 105 80060009 1000 + 106 8006000a 1000 + 107 8006000b 1000 + 108 8006000c 1000 + 109 8006000d 1000 + 110 8006000e 1000 + 111 8006000f 1000 + 112 80060010 1000 + 113 80060011 1000 + 114 80060012 1000 + 115 80060013 1000 + 116 80060014 1000 + 117 80060015 1000 + 118 80060016 1000 + 119 80060017 1000 + 120 80060018 1000 + 121 80060019 1000 + 122 8006001a 1000 + 123 8006001b 1000 + 124 8006001c 1000 + 125 8006001d 1000 + 126 8006001e 1000 + 127 8006001f 1000 + 128 80060020 1000 + 129 80060021 1000 + 130 80060022 1000 + 131 80060023 1000 + 132 80060024 1000 + 133 80060025 1000 + 134 80060026 1000 + 135 80060027 1000 + 136 80060028 1000 + 137 80060029 1000 + 138 8006002a 1000 + 139 8006002b 1000 + 140 8006002c 1000 + 141 8006002d 1000 + 142 8006002e 1000 + 143 8006002f 1000 + 144 80060030 1000 + 145 80060031 0 + 146 80060032 0 + 147 80060050 0 + 148 80060051 0 + 149 8006006f 0 + 150 80060070 0 + 151 80060033 0 + 152 80060034 0 + 153 80060035 0 + 154 80060036 0 + 155 80060037 0 + 156 80060038 0 + 157 80060039 0 + 158 8006003a 0 + 159 8006003b 0 + 160 8006003c 0 + 161 8006003d 0 + 162 8006003e 0 + 163 8006003f 0 + 164 80060040 0 + 165 80060041 0 + 166 80060042 0 + 167 80060043 0 + 168 80060044 0 + 169 80060045 0 + 170 80060046 0 + 171 80060047 0 + 172 80060048 0 + 173 80060049 0 + 174 8006004a 0 + 175 8006004b 0 + 176 8006004c 0 + 177 8006004d 0 + 178 8006004e 0 + 179 8006004f 0 + 180 80060052 0 + 181 80060053 0 + 182 80060054 0 + 183 80060055 0 + 184 80060056 0 + 185 80060057 0 + 186 80060058 0 + 187 80060059 0 + 188 8006005a 0 + 189 8006005b 0 + 190 8006005c 0 + 191 8006005d 0 + 192 8006005e 0 + 193 8006005f 0 + 194 80060060 0 + 195 80060061 0 + 196 80060062 0 + 197 80060063 0 + 198 80060064 0 + 199 80060065 0 + 200 80060066 0 + 201 80060067 0 + 202 80060068 0 + 203 80060069 0 + 204 8006006a 0 + 205 8006006b 0 + 206 8006006c 0 + 207 8006006d 0 + 208 8006006e 0 + 209 80060071 0 + 210 80060072 0 + 211 80060073 0 + 212 80060074 0 + 213 80060075 0 + 214 80060076 0 + 215 80060077 0 + 216 80060078 0 + 217 80060079 0 + 218 8006007a 0 + 219 8006007b 0 + 220 8006007c 0 + 221 8006007d 0 + 222 8006007e 0 + 223 8006007f 0 + 224 80060080 0 + 225 80060081 0 + 226 80060082 0 + 227 80060083 0 + 228 80060084 0 + 229 80060085 0 + 230 80060086 0 + 231 80060087 0 + 232 80060088 0 + 233 80060089 0 + 234 8006008a 0 + 235 8006008b 0 + 236 8006008c 0 + 237 8006008d 0 + 238 80060031 1 + 239 80060032 1 + 240 80060050 1 + 241 80060051 1 + 242 8006006f 1 + 243 80060070 1 + 244 80060033 1 + 245 80060034 1 + 246 80060035 1 + 247 80060036 1 + 248 80060037 1 + 249 80060038 1 + 250 80060039 1 + 251 8006003a 1 + 252 8006003b 1 + 253 8006003c 1 + 254 8006003d 1 + 255 8006003e 1 + 256 8006003f 1 + 257 80060040 1 + 258 80060041 1 + 259 80060042 1 + 260 80060043 1 + 261 80060044 1 + 262 80060045 1 + 263 80060046 1 + 264 80060047 1 + 265 80060048 1 + 266 80060049 1 + 267 8006004a 1 + 268 8006004b 1 + 269 8006004c 1 + 270 8006004d 1 + 271 8006004e 1 + 272 8006004f 1 + 273 80060052 1 + 274 80060053 1 + 275 80060054 1 + 276 80060055 1 + 277 80060056 1 + 278 80060057 1 + 279 80060058 1 + 280 80060059 1 + 281 8006005a 1 + 282 8006005b 1 + 283 8006005c 1 + 284 8006005d 1 + 285 8006005e 1 + 286 8006005f 1 + 287 80060060 1 + 288 80060061 1 + 289 80060062 1 + 290 80060063 1 + 291 80060064 1 + 292 80060065 1 + 293 80060066 1 + 294 80060067 1 + 295 80060068 1 + 296 80060069 1 + 297 8006006a 1 + 298 8006006b 1 + 299 8006006c 1 + 300 8006006d 1 + 301 8006006e 1 + 302 80060071 1 + 303 80060072 1 + 304 80060073 1 + 305 80060074 1 + 306 80060075 1 + 307 80060076 1 + 308 80060077 1 + 309 80060078 1 + 310 80060079 1 + 311 8006007a 1 + 312 8006007b 1 + 313 8006007c 1 + 314 8006007d 1 + 315 8006007e 1 + 316 8006007f 1 + 317 80060080 1 + 318 80060081 1 + 319 80060082 1 + 320 80060083 1 + 321 80060084 1 + 322 80060085 1 + 323 80060086 1 + 324 80060087 1 + 325 80060088 1 + 326 80060089 1 + 327 8006008a 1 + 328 8006008b 1 + 329 8006008c 1 + 330 8006008d 1 + 331 80060031 1000 + 332 80060032 1000 + 333 80060050 1000 + 334 80060051 1000 + 335 8006006f 1000 + 336 80060070 1000 + 337 80060033 1000 + 338 80060034 1000 + 339 80060035 1000 + 340 80060036 1000 + 341 80060037 1000 + 342 80060038 1000 + 343 80060039 1000 + 344 8006003a 1000 + 345 8006003b 1000 + 346 8006003c 1000 + 347 8006003d 1000 + 348 8006003e 1000 + 349 8006003f 1000 + 350 80060040 1000 + 351 80060041 1000 + 352 80060042 1000 + 353 80060043 1000 + 354 80060044 1000 + 355 80060045 1000 + 356 80060046 1000 + 357 80060047 1000 + 358 80060048 1000 + 359 80060049 1000 + 360 8006004a 1000 + 361 8006004b 1000 + 362 8006004c 1000 + 363 8006004d 1000 + 364 8006004e 1000 + 365 8006004f 1000 + 366 80060052 1000 + 367 80060053 1000 + 368 80060054 1000 + 369 80060055 1000 + 370 80060056 1000 + 371 80060057 1000 + 372 80060058 1000 + 373 80060059 1000 + 374 8006005a 1000 + 375 8006005b 1000 + 376 8006005c 1000 + 377 8006005d 1000 + 378 8006005e 1000 + 379 8006005f 1000 + 380 80060060 1000 + 381 80060061 1000 + 382 80060062 1000 + 383 80060063 1000 + 384 80060064 1000 + 385 80060065 1000 + 386 80060066 1000 + 387 80060067 1000 + 388 80060068 1000 + 389 80060069 1000 + 390 8006006a 1000 + 391 8006006b 1000 + 392 8006006c 1000 + 393 8006006d 1000 + 394 8006006e 1000 + 395 80060071 1000 + 396 80060072 1000 + 397 80060073 1000 + 398 80060074 1000 + 399 80060075 1000 + 400 80060076 1000 + 401 80060077 1000 + 402 80060078 1000 + 403 80060079 1000 + 404 8006007a 1000 + 405 8006007b 1000 + 406 8006007c 1000 + 407 8006007d 1000 + 408 8006007e 1000 + 409 8006007f 1000 + 410 80060080 1000 + 411 80060081 1000 + 412 80060082 1000 + 413 80060083 1000 + 414 80060084 1000 + 415 80060085 1000 + 416 80060086 1000 + 417 80060087 1000 + 418 80060088 1000 + 419 80060089 1000 + 420 8006008a 1000 + 421 8006008b 1000 + 422 8006008c 1000 + 423 8006008d 1000 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00080010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00080011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00080013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00080014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00090010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00090011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00090013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00090014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=000a0010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=000a0011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=000a0013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=000a0014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=000b0010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=000b0011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=000b0013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=000b0014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=80050000 +AddParam + +Param.h.v.=80050001 +AddParam + +Param.h.v.=80050002 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=80060000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80060001 +AddParam + +Param.h.v.=80060002 +AddParam + +Param.h.v.=80070000 +AddParam + +Param.h.v.=80070001 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=80070002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000008 +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Request.h.v=00000009 +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Request.h.v=0000000a +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Request.h.v=0000000b +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00080000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00080001 +Entity.point[1].v=00080002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00080001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00080002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00090000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00090001 +Entity.point[1].v=00090002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00090001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00090002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000a0000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=000a0001 +Entity.point[1].v=000a0002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000a0001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000a0002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000b0000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=000b0001 +Entity.point[1].v=000b0002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000b0001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000b0002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030006 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030019 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003001d +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=80030021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030020 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030022 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=8003001d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030024 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030021 +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030027 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030028 +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030029 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002a +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002b +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8003002a +Entity.point[1].v=80030028 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002c +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002d +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80040002 +Entity.normal.v=80040001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80040001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80040002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050002 +Entity.point[1].v=80050013 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050005 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050006 +Entity.point[1].v=80050014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050006 +Entity.point[1].v=80050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8005000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000d +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8005000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000f +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050010 +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8005000f +Entity.point[1].v=8005000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8005000f +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8005000d +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050013 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050015 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80050006 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050014 +Entity.point[1].v=80050013 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050017 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050018 +Entity.point[1].v=80050019 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050019 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005001b +Entity.point[1].v=8005001c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001d +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=8005001b +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005001b +Entity.point[1].v=80050018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005001c +Entity.point[1].v=80050019 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050020 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050021 +Entity.point[1].v=80050022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050022 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050024 +Entity.point[1].v=80050025 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050024 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050025 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050026 +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=80050024 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050027 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050024 +Entity.point[1].v=80050021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050028 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050025 +Entity.point[1].v=80050022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002a +Entity.point[1].v=8005002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002d +Entity.point[1].v=8005002e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002f +Entity.type=5001 +Entity.construction=0 +Entity.point[0].v=8005002d +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050030 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002d +Entity.point[1].v=8005002a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050031 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002e +Entity.point[1].v=8005002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060002 +Entity.point[1].v=80060031 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060005 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060006 +Entity.point[1].v=80060032 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060006 +Entity.point[1].v=80060002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006000b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000b +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8006000d +Entity.point[1].v=8006000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006000d +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060010 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006000b +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060012 +Entity.point[1].v=80060050 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060012 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060015 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060016 +Entity.point[1].v=80060051 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060016 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060019 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060016 +Entity.point[1].v=80060012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006001b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006001d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8006001d +Entity.point[1].v=8006001b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006001d +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060020 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006001b +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060021 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060022 +Entity.point[1].v=8006006f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060022 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060025 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060026 +Entity.point[1].v=80060070 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060026 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060026 +Entity.point[1].v=80060022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006002b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006002d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8006002d +Entity.point[1].v=8006002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006002d +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060030 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006002b +Entity.actPoint.x=20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060031 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060032 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060033 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060006 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060034 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060032 +Entity.point[1].v=80060031 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060035 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060036 +Entity.point[1].v=80060037 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060036 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060037 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060038 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060039 +Entity.point[1].v=8006003a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060039 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003b +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060039 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060039 +Entity.point[1].v=80060036 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006003a +Entity.point[1].v=80060037 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006003f +Entity.point[1].v=80060040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060040 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060041 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060042 +Entity.point[1].v=80060043 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060042 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060043 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060044 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060042 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060045 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060042 +Entity.point[1].v=8006003f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060046 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060043 +Entity.point[1].v=80060040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060047 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060048 +Entity.point[1].v=80060049 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060048 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060049 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006004b +Entity.point[1].v=8006004c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004d +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006004b +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006004b +Entity.point[1].v=80060048 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006004c +Entity.point[1].v=80060049 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060050 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060051 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060052 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060016 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060053 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060051 +Entity.point[1].v=80060050 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060054 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060055 +Entity.point[1].v=80060056 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060055 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060056 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060057 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060058 +Entity.point[1].v=80060059 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060058 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060059 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005a +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060058 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060058 +Entity.point[1].v=80060055 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060059 +Entity.point[1].v=80060056 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006005e +Entity.point[1].v=8006005f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060060 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060061 +Entity.point[1].v=80060062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060061 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060062 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060063 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060061 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060064 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060061 +Entity.point[1].v=8006005e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060065 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060062 +Entity.point[1].v=8006005f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060066 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060067 +Entity.point[1].v=80060068 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060067 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060068 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060069 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006006a +Entity.point[1].v=8006006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006c +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8006006a +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006006a +Entity.point[1].v=80060067 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006006b +Entity.point[1].v=80060068 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060070 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060071 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060026 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060072 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060070 +Entity.point[1].v=8006006f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060073 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060074 +Entity.point[1].v=80060075 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060074 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060075 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060076 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060077 +Entity.point[1].v=80060078 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060077 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060078 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060079 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060077 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060077 +Entity.point[1].v=80060074 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060078 +Entity.point[1].v=80060075 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006007d +Entity.point[1].v=8006007e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060080 +Entity.point[1].v=80060081 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060080 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060081 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060082 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060080 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060083 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060080 +Entity.point[1].v=8006007d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060084 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060081 +Entity.point[1].v=8006007e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060085 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060086 +Entity.point[1].v=80060087 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060086 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060087 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060088 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060089 +Entity.point[1].v=8006008a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060089 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008b +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80060089 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060089 +Entity.point[1].v=80060086 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006008a +Entity.point[1].v=80060087 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070002 +Entity.point[1].v=80070091 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070005 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070006 +Entity.point[1].v=80070092 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070006 +Entity.point[1].v=80070002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007000b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000b +Entity.type=2010 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007000d +Entity.point[1].v=8007000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007000d +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070010 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007000b +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070012 +Entity.point[1].v=80070093 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070012 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070015 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070016 +Entity.point[1].v=80070094 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070016 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070019 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070016 +Entity.point[1].v=80070012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007001b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007001d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007001d +Entity.point[1].v=8007001b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007001d +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070020 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007001b +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070021 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070022 +Entity.point[1].v=80070095 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070022 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070025 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070026 +Entity.point[1].v=80070096 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070026 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070026 +Entity.point[1].v=80070022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007002b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007002d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007002d +Entity.point[1].v=8007002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007002d +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070030 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007002b +Entity.actPoint.x=20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070031 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070032 +Entity.point[1].v=800700ee +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070032 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070035 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070036 +Entity.point[1].v=800700ef +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070036 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070039 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070036 +Entity.point[1].v=80070032 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007003b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007003d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007003d +Entity.point[1].v=8007003b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007003d +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070040 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007003b +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070041 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070042 +Entity.point[1].v=800700f0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070042 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070045 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070046 +Entity.point[1].v=800700f1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070046 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070049 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070046 +Entity.point[1].v=80070042 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007004b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007004d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007004d +Entity.point[1].v=8007004b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007004d +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070050 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007004b +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070051 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070052 +Entity.point[1].v=800700f2 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070052 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070055 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070056 +Entity.point[1].v=800700f3 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070056 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070059 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070056 +Entity.point[1].v=80070052 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007005b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007005d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007005d +Entity.point[1].v=8007005b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007005d +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070060 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007005b +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070061 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070062 +Entity.point[1].v=8007014b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070062 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070065 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070066 +Entity.point[1].v=8007014c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070066 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070069 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070066 +Entity.point[1].v=80070062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007006b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007006d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007006d +Entity.point[1].v=8007006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007006d +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070070 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007006b +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070071 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070072 +Entity.point[1].v=8007014d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070072 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070075 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070076 +Entity.point[1].v=8007014e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070076 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070079 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070076 +Entity.point[1].v=80070072 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007007b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007007d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007007d +Entity.point[1].v=8007007b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007007d +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070080 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007007b +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070081 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070082 +Entity.point[1].v=8007014f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070082 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070085 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070086 +Entity.point[1].v=80070150 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070086 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070089 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070086 +Entity.point[1].v=80070082 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007008b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008b +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007008d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008d +Entity.type=2010 +Entity.construction=1 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008e +Entity.type=11000 +Entity.construction=1 +Entity.point[0].v=8007008d +Entity.point[1].v=8007008b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007008d +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070090 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007008b +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070091 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070092 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070093 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070094 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070095 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070096 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070097 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070006 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070098 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070092 +Entity.point[1].v=80070091 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070099 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009a +Entity.point[1].v=8007009b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009d +Entity.point[1].v=8007009e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007009d +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a0 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009d +Entity.point[1].v=8007009a +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a1 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009e +Entity.point[1].v=8007009b +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a3 +Entity.point[1].v=800700a4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a6 +Entity.point[1].v=800700a7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a6 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a8 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700a6 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a9 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a6 +Entity.point[1].v=800700a3 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700aa +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a7 +Entity.point[1].v=800700a4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ab +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ac +Entity.point[1].v=800700ad +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ac +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ad +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ae +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700af +Entity.point[1].v=800700b0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700af +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b1 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700af +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700af +Entity.point[1].v=800700ac +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b3 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700b0 +Entity.point[1].v=800700ad +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b4 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070016 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070094 +Entity.point[1].v=80070093 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700b7 +Entity.point[1].v=800700b8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b8 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b9 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ba +Entity.point[1].v=800700bb +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ba +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bb +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bc +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700ba +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bd +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ba +Entity.point[1].v=800700b7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700be +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700bb +Entity.point[1].v=800700b8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bf +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c0 +Entity.point[1].v=800700c1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c3 +Entity.point[1].v=800700c4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c5 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700c3 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c3 +Entity.point[1].v=800700c0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c7 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c4 +Entity.point[1].v=800700c1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c8 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c9 +Entity.point[1].v=800700ca +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c9 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ca +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cb +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700cc +Entity.point[1].v=800700cd +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cc +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cd +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ce +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700cc +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cf +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700cc +Entity.point[1].v=800700c9 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d0 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700cd +Entity.point[1].v=800700ca +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d1 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070026 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070096 +Entity.point[1].v=80070095 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d3 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d4 +Entity.point[1].v=800700d5 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d5 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d7 +Entity.point[1].v=800700d8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d8 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d9 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700d7 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700da +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d7 +Entity.point[1].v=800700d4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700db +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d8 +Entity.point[1].v=800700d5 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700dc +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700dd +Entity.point[1].v=800700de +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700dd +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700de +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700df +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e0 +Entity.point[1].v=800700e1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e2 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700e0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e3 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e0 +Entity.point[1].v=800700dd +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e4 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e1 +Entity.point[1].v=800700de +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e6 +Entity.point[1].v=800700e7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e6 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e8 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e9 +Entity.point[1].v=800700ea +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e9 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ea +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700eb +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700e9 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ec +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e9 +Entity.point[1].v=800700e6 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ed +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ea +Entity.point[1].v=800700e7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ee +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ef +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f2 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f4 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070036 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ef +Entity.point[1].v=800700ee +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700f7 +Entity.point[1].v=800700f8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f8 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f9 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700fa +Entity.point[1].v=800700fb +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fa +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fb +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fc +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800700fa +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fd +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700fa +Entity.point[1].v=800700f7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fe +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700fb +Entity.point[1].v=800700f8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ff +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070100 +Entity.point[1].v=80070101 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070100 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070101 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070102 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070103 +Entity.point[1].v=80070104 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070103 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070104 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070105 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070103 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070106 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070103 +Entity.point[1].v=80070100 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070107 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070104 +Entity.point[1].v=80070101 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070108 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070109 +Entity.point[1].v=8007010a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070109 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007010c +Entity.point[1].v=8007010d +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010e +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007010c +Entity.actPoint.x=-5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007010c +Entity.point[1].v=80070109 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070110 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007010d +Entity.point[1].v=8007010a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070111 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070046 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070112 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700f1 +Entity.point[1].v=800700f0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070113 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070114 +Entity.point[1].v=80070115 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070114 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070115 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070116 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070117 +Entity.point[1].v=80070118 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070117 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070118 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070119 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070117 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070117 +Entity.point[1].v=80070114 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070118 +Entity.point[1].v=80070115 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007011d +Entity.point[1].v=8007011e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070120 +Entity.point[1].v=80070121 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070120 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070121 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070122 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070120 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070123 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070120 +Entity.point[1].v=8007011d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070124 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070121 +Entity.point[1].v=8007011e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070125 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070126 +Entity.point[1].v=80070127 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070126 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070127 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070128 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070129 +Entity.point[1].v=8007012a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070129 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012b +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070129 +Entity.actPoint.x=5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070129 +Entity.point[1].v=80070126 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007012a +Entity.point[1].v=80070127 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012e +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070056 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700f3 +Entity.point[1].v=800700f2 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070130 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070131 +Entity.point[1].v=80070132 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070131 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070132 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070133 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070134 +Entity.point[1].v=80070135 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070134 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070135 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070136 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070134 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070137 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070134 +Entity.point[1].v=80070131 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070138 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070135 +Entity.point[1].v=80070132 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070139 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013a +Entity.point[1].v=8007013b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013d +Entity.point[1].v=8007013e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007013d +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070140 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013d +Entity.point[1].v=8007013a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070141 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013e +Entity.point[1].v=8007013b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070142 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070143 +Entity.point[1].v=80070144 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070143 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070144 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070145 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070146 +Entity.point[1].v=80070147 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070146 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070147 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070148 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070146 +Entity.actPoint.x=15.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070149 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070146 +Entity.point[1].v=80070143 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070147 +Entity.point[1].v=80070144 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070150 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070151 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070066 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070152 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007014c +Entity.point[1].v=8007014b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070153 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070154 +Entity.point[1].v=80070155 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070154 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070155 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070156 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070157 +Entity.point[1].v=80070158 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070157 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070158 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070159 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070157 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070157 +Entity.point[1].v=80070154 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070158 +Entity.point[1].v=80070155 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007015d +Entity.point[1].v=8007015e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070160 +Entity.point[1].v=80070161 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070160 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070161 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070162 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070160 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070163 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070160 +Entity.point[1].v=8007015d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070164 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070161 +Entity.point[1].v=8007015e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070165 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070166 +Entity.point[1].v=80070167 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070166 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070167 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070168 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070169 +Entity.point[1].v=8007016a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070169 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016b +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070169 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070169 +Entity.point[1].v=80070166 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007016a +Entity.point[1].v=80070167 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016e +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070076 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007014e +Entity.point[1].v=8007014d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070170 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070171 +Entity.point[1].v=80070172 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070171 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070172 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070173 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070174 +Entity.point[1].v=80070175 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070174 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070175 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070176 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070174 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070177 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070174 +Entity.point[1].v=80070171 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070178 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070175 +Entity.point[1].v=80070172 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070179 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017a +Entity.point[1].v=8007017b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017d +Entity.point[1].v=8007017e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017f +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007017d +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070180 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017d +Entity.point[1].v=8007017a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070181 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017e +Entity.point[1].v=8007017b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070182 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070183 +Entity.point[1].v=80070184 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070183 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070184 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070185 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070186 +Entity.point[1].v=80070187 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070186 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070187 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070188 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070186 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070189 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070186 +Entity.point[1].v=80070183 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070187 +Entity.point[1].v=80070184 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018b +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070086 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070150 +Entity.point[1].v=8007014f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007018e +Entity.point[1].v=8007018f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070190 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070191 +Entity.point[1].v=80070192 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070191 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070192 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070193 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=80070191 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070194 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070191 +Entity.point[1].v=8007018e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070195 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070192 +Entity.point[1].v=8007018f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070196 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070197 +Entity.point[1].v=80070198 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070197 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070198 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070199 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007019a +Entity.point[1].v=8007019b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019c +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=8007019a +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007019a +Entity.point[1].v=80070197 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007019b +Entity.point[1].v=80070198 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a0 +Entity.point[1].v=800701a1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a3 +Entity.point[1].v=800701a4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a5 +Entity.type=5003 +Entity.construction=0 +Entity.point[0].v=800701a3 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a3 +Entity.point[1].v=800701a0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a7 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a4 +Entity.point[1].v=800701a1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00050002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060001 +Constraint.ptB.v=00070002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00070001 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000005 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000006 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000007 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000008 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00070000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000a +Constraint.type=30 +Constraint.group.v=00000003 +Constraint.valA=1.00000000000000000000 +Constraint.ptA.v=80030018 +Constraint.ptB.v=80030015 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=-1.11433618504280240735 +Constraint.disp.offset.y=-1.07366998595325924271 +AddConstraint + +Constraint.h.v=0000000b +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=00080001 +Constraint.ptB.v=00090002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000c +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=00090001 +Constraint.ptB.v=000a0002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000d +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=000a0001 +Constraint.ptB.v=000b0002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000e +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=000b0001 +Constraint.ptB.v=00080002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000f +Constraint.type=81 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=00080000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000010 +Constraint.type=80 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=00090000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000011 +Constraint.type=81 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=000a0000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000012 +Constraint.type=80 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=000b0000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 8003002c 1 1 +SCtrl 0 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000009 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000006 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 0000000c 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 0000000a 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000080 0 -5.00000000000000000000 5.00000000000000088818 1.00000000000000000000 -5.00000000000000088818 10.00000000000000177636 1.00000000000000000000 +TrimBy 0000007a 0 -10.00000000000000177636 5.00000000000000088818 1.00000000000000000000 -5.00000000000000000000 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000007c 0 -10.00000000000000000000 10.00000000000000177636 1.00000000000000000000 -10.00000000000000177636 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000007e 0 -5.00000000000000088818 10.00000000000000177636 1.00000000000000000000 -10.00000000000000000000 10.00000000000000177636 1.00000000000000000000 +TrimBy 00000088 0 4.99999999999999911182 5.00000000000000000000 1.00000000000000000000 4.99999999999999911182 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000082 0 0.00000000000000000000 5.00000000000000177636 1.00000000000000000000 4.99999999999999911182 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000084 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 5.00000000000000177636 1.00000000000000000000 +TrimBy 00000086 0 4.99999999999999911182 10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000090 0 15.00000000000000000000 5.00000000000000088818 1.00000000000000000000 15.00000000000000000000 10.00000000000000177636 1.00000000000000000000 +TrimBy 0000008a 0 10.00000000000000000000 5.00000000000000088818 1.00000000000000000000 15.00000000000000000000 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000008c 0 10.00000000000000177636 10.00000000000000177636 1.00000000000000000000 10.00000000000000000000 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000008e 0 15.00000000000000000000 10.00000000000000177636 1.00000000000000000000 10.00000000000000177636 10.00000000000000177636 1.00000000000000000000 +TrimBy 00000098 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -5.00000000000000177636 -0.00000000000000044409 1.00000000000000000000 +TrimBy 00000092 0 -10.00000000000000000000 -4.99999999999999822364 1.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000094 0 -10.00000000000000177636 -0.00000000000000022204 1.00000000000000000000 -10.00000000000000000000 -4.99999999999999822364 1.00000000000000000000 +TrimBy 00000096 0 -5.00000000000000177636 -0.00000000000000044409 1.00000000000000000000 -10.00000000000000177636 -0.00000000000000022204 1.00000000000000000000 +TrimBy 000000a0 0 4.99999999999999822364 -4.99999999999999911182 1.00000000000000000000 4.99999999999999911182 0.00000000000000088818 1.00000000000000000000 +TrimBy 0000009a 0 0.00000000000000000000 -4.99999999999999911182 1.00000000000000000000 4.99999999999999822364 -4.99999999999999911182 1.00000000000000000000 +TrimBy 0000009c 0 0.00000000000000000000 -0.00000000000000088818 1.00000000000000000000 0.00000000000000000000 -4.99999999999999911182 1.00000000000000000000 +TrimBy 0000009e 0 4.99999999999999911182 0.00000000000000088818 1.00000000000000000000 0.00000000000000000000 -0.00000000000000088818 1.00000000000000000000 +TrimBy 000000a8 0 14.99999999999999822364 -4.99999999999999822364 1.00000000000000000000 14.99999999999999644729 0.00000000000000000000 1.00000000000000000000 +TrimBy 000000a2 0 10.00000000000000177636 -5.00000000000000000000 1.00000000000000000000 14.99999999999999822364 -4.99999999999999822364 1.00000000000000000000 +TrimBy 000000a4 0 10.00000000000000177636 0.00000000000000000000 1.00000000000000000000 10.00000000000000177636 -5.00000000000000000000 1.00000000000000000000 +TrimBy 000000a6 0 14.99999999999999644729 0.00000000000000000000 1.00000000000000000000 10.00000000000000177636 0.00000000000000000000 1.00000000000000000000 +TrimBy 000000b0 0 -5.00000000000000266454 -15.00000000000000000000 1.00000000000000000000 -5.00000000000000088818 -10.00000000000000000000 1.00000000000000000000 +TrimBy 000000aa 0 -10.00000000000000177636 -14.99999999999999822364 1.00000000000000000000 -5.00000000000000266454 -15.00000000000000000000 1.00000000000000000000 +TrimBy 000000ac 0 -10.00000000000000177636 -10.00000000000000177636 1.00000000000000000000 -10.00000000000000177636 -14.99999999999999822364 1.00000000000000000000 +TrimBy 000000ae 0 -5.00000000000000088818 -10.00000000000000000000 1.00000000000000000000 -10.00000000000000177636 -10.00000000000000177636 1.00000000000000000000 +TrimBy 000000b8 0 4.99999999999999822364 -14.99999999999999822364 1.00000000000000000000 4.99999999999999911182 -10.00000000000000000000 1.00000000000000000000 +TrimBy 000000b2 0 0.00000000000000000000 -14.99999999999999644729 1.00000000000000000000 4.99999999999999822364 -14.99999999999999822364 1.00000000000000000000 +TrimBy 000000b4 0 0.00000000000000000000 -10.00000000000000177636 1.00000000000000000000 0.00000000000000000000 -14.99999999999999644729 1.00000000000000000000 +TrimBy 000000b6 0 4.99999999999999911182 -10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -10.00000000000000177636 1.00000000000000000000 +TrimBy 000000c0 0 14.99999999999999822364 -14.99999999999999822364 1.00000000000000000000 15.00000000000000000000 -10.00000000000000177636 1.00000000000000000000 +TrimBy 000000ba 0 10.00000000000000177636 -15.00000000000000000000 1.00000000000000000000 14.99999999999999822364 -14.99999999999999822364 1.00000000000000000000 +TrimBy 000000bc 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 10.00000000000000177636 -15.00000000000000000000 1.00000000000000000000 +TrimBy 000000be 0 15.00000000000000000000 -10.00000000000000177636 1.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000002 00646464 8003002d 1 1 +SCtrl 0 0 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000007 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000001 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000008 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +TrimBy 00000002 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +TrimBy 0000007f 0 -5.00000000000000088818 10.00000000000000177636 0.00000000000000000000 -5.00000000000000000000 5.00000000000000088818 0.00000000000000000000 +TrimBy 0000007b 0 -10.00000000000000000000 5.00000000000000088818 0.00000000000000000000 -10.00000000000000000000 10.00000000000000177636 0.00000000000000000000 +TrimBy 0000007d 0 -10.00000000000000000000 10.00000000000000177636 0.00000000000000000000 -5.00000000000000088818 10.00000000000000177636 0.00000000000000000000 +TrimBy 00000079 0 -5.00000000000000000000 5.00000000000000088818 0.00000000000000000000 -10.00000000000000000000 5.00000000000000088818 0.00000000000000000000 +TrimBy 00000087 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000177636 0.00000000000000000000 +TrimBy 00000083 0 0.00000000000000044409 5.00000000000000000000 0.00000000000000000000 0.00000000000000111022 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000085 0 0.00000000000000111022 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000081 0 5.00000000000000000000 5.00000000000000177636 0.00000000000000000000 0.00000000000000044409 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000008f 0 14.99999999999999822364 10.00000000000000177636 0.00000000000000000000 15.00000000000000177636 5.00000000000000088818 0.00000000000000000000 +TrimBy 0000008b 0 9.99999999999999822364 5.00000000000000088818 0.00000000000000000000 10.00000000000000177636 10.00000000000000177636 0.00000000000000000000 +TrimBy 0000008d 0 10.00000000000000177636 10.00000000000000177636 0.00000000000000000000 14.99999999999999822364 10.00000000000000177636 0.00000000000000000000 +TrimBy 00000089 0 15.00000000000000177636 5.00000000000000088818 0.00000000000000000000 9.99999999999999822364 5.00000000000000088818 0.00000000000000000000 +TrimBy 00000097 0 -5.00000000000000177636 0.00000000000000000000 0.00000000000000000000 -5.00000000000000177636 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000093 0 -9.99999999999999822364 -4.99999999999999822364 0.00000000000000000000 -9.99999999999999822364 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000095 0 -9.99999999999999822364 0.00000000000000000000 0.00000000000000000000 -5.00000000000000177636 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000091 0 -5.00000000000000177636 -5.00000000000000000000 0.00000000000000000000 -9.99999999999999822364 -4.99999999999999822364 0.00000000000000000000 +TrimBy 0000009f 0 5.00000000000000000000 -0.00000000000000088818 0.00000000000000000000 5.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 +TrimBy 0000009b 0 0.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 0.00000000000000133227 0.00000000000000088818 0.00000000000000000000 +TrimBy 0000009d 0 0.00000000000000133227 0.00000000000000088818 0.00000000000000000000 5.00000000000000000000 -0.00000000000000088818 0.00000000000000000000 +TrimBy 00000099 0 5.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 0.00000000000000088818 -4.99999999999999911182 0.00000000000000000000 +TrimBy 000000a7 0 15.00000000000000355271 -0.00000000000000022204 0.00000000000000000000 14.99999999999999822364 -4.99999999999999822364 0.00000000000000000000 +TrimBy 000000a3 0 10.00000000000000177636 -5.00000000000000000000 0.00000000000000000000 10.00000000000000177636 -0.00000000000000044409 0.00000000000000000000 +TrimBy 000000a5 0 10.00000000000000177636 -0.00000000000000044409 0.00000000000000000000 15.00000000000000355271 -0.00000000000000022204 0.00000000000000000000 +TrimBy 000000a1 0 14.99999999999999822364 -4.99999999999999822364 0.00000000000000000000 10.00000000000000177636 -5.00000000000000000000 0.00000000000000000000 +TrimBy 000000af 0 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -5.00000000000000177636 -15.00000000000000000000 0.00000000000000000000 +TrimBy 000000ab 0 -9.99999999999999822364 -14.99999999999999822364 0.00000000000000000000 -10.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000ad 0 -10.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 000000a9 0 -5.00000000000000177636 -15.00000000000000000000 0.00000000000000000000 -9.99999999999999822364 -14.99999999999999822364 0.00000000000000000000 +TrimBy 000000b7 0 5.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 5.00000000000000000000 -14.99999999999999644729 0.00000000000000000000 +TrimBy 000000b3 0 0.00000000000000088818 -14.99999999999999822364 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 000000b5 0 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000b1 0 5.00000000000000000000 -14.99999999999999644729 0.00000000000000000000 0.00000000000000088818 -14.99999999999999822364 0.00000000000000000000 +TrimBy 000000bf 0 15.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 15.00000000000000177636 -14.99999999999999822364 0.00000000000000000000 +TrimBy 000000bb 0 10.00000000000000177636 -15.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 000000bd 0 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000b9 0 15.00000000000000177636 -14.99999999999999822364 0.00000000000000000000 10.00000000000000177636 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 80030010 1 1 +SCtrl 0 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000c 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 00000008 0 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +TrimBy 00000004 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 0000000b 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 80030019 1 1 +SCtrl 0 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000009 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 00000002 0 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000005 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000004 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000005 00646464 80030022 1 1 +SCtrl 0 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000007 0 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000005 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000006 00646464 80030007 1 1 +SCtrl 0 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000006 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000001 0 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 00000003 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000007 00646464 8007000f 1 1 +SCtrl 0 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000008 00646464 80070010 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000009 00646464 8007009f 1 1 +SCtrl 0 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000001b 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000000e 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000004f 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000023 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000a 00646464 800700a8 1 1 +SCtrl 0 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000003c 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000021 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000036 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000004f 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000b 00646464 800700b1 1 1 +SCtrl 0 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000002d 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000034 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000014 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000036 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000c 00646464 80070097 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000006c 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000003b 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000023 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000014 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000d 00646464 8007001f 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000000e 00646464 80070020 1 1 +SCtrl 0 0 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000000f 00646464 800700bc 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000069 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000049 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000033 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000012 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000010 00646464 800700c5 1 1 +SCtrl 0 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000075 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000001f 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000006d 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000033 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000011 00646464 800700ce 1 1 +SCtrl 0 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000031 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000054 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000005d 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000006d 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000012 00646464 800700b4 1 1 +SCtrl 0 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000059 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000003e 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000012 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000005d 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000013 00646464 8007002f 1 1 +SCtrl 0 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000014 00646464 80070030 1 1 +SCtrl 0 0 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000015 00646464 800700d9 1 1 +SCtrl 0 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000001d 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000042 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000037 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000013 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000016 00646464 800700e2 1 1 +SCtrl 0 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000025 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000f 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000013 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000002f 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000017 00646464 800700eb 1 1 +SCtrl 0 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000015 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000071 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000002f 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000004a 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000018 00646464 800700d1 1 1 +SCtrl 0 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000055 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000004e 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000004a 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000037 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000019 00646464 8007003f 1 1 +SCtrl 0 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000001a 00646464 80070040 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000001b 00646464 800700fc 1 1 +SCtrl 0 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000011 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000056 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000010 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000005c 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001c 00646464 80070105 1 1 +SCtrl 0 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000027 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 0000003d 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000001c 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000010 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001d 00646464 8007010e 1 1 +SCtrl 0 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000053 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000030 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000068 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000001c 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001e 00646464 800700f4 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000061 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000074 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000005c 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000068 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001f 00646464 8007004f 1 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000020 00646464 80070050 1 1 +SCtrl 0 0 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000021 00646464 80070119 1 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000044 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000002b 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000017 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000006b 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000022 00646464 80070122 1 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000077 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 0000006f 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000005b 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000017 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000023 00646464 8007012b 1 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000057 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000063 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000016 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000005b 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000024 00646464 80070111 1 1 +SCtrl 0 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000066 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000000d 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000006b 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000016 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000025 00646464 8007005f 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000026 00646464 80070060 1 1 +SCtrl 0 0 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000027 00646464 80070136 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000002e 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000024 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000062 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000026 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000028 00646464 8007013f 1 1 +SCtrl 0 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000070 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000002a 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000026 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000004b 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000029 00646464 80070148 1 1 +SCtrl 0 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000040 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000047 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 0000004b 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000018 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002a 00646464 8007012e 1 1 +SCtrl 0 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000048 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000005f 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000018 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000062 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002b 00646464 8007006f 1 1 +SCtrl 0 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000002c 00646464 80070070 1 1 +SCtrl 0 0 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000002d 00646464 80070159 1 1 +SCtrl 0 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000067 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000028 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000039 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000003f 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002e 00646464 80070162 1 1 +SCtrl 0 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000004c 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000041 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000003f 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000003a 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002f 00646464 8007016b 1 1 +SCtrl 0 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000006e 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 0000005e 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000003a 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000076 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000030 00646464 80070151 1 1 +SCtrl 0 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000035 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000052 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000076 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000039 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000031 00646464 8007007f 1 1 +SCtrl 0 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000032 00646464 80070080 1 1 +SCtrl 0 0 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000033 00646464 80070176 1 1 +SCtrl 0 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000005a 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000043 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000078 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000045 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000034 00646464 8007017f 1 1 +SCtrl 0 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000051 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000020 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000045 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000006a 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000035 00646464 80070188 1 1 +SCtrl 0 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000004d 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000046 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000006a 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000050 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000036 00646464 8007016e 1 1 +SCtrl 0 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000058 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 0000001a 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000050 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000078 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000037 00646464 8007008f 1 1 +SCtrl 0 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000038 00646464 80070090 1 1 +SCtrl 0 0 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000039 00646464 80070193 1 1 +SCtrl 0 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000065 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000002c 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000032 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000060 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000003a 00646464 8007019c 1 1 +SCtrl 0 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000001e 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000019 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000038 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000032 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000003b 00646464 800701a5 1 1 +SCtrl 0 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000073 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000072 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000064 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000038 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000003c 00646464 8007018b 1 1 +SCtrl 0 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000022 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000029 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000060 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000064 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddSurface +Curve 00000001 1 1 00000002 00000006 +CCtrl 0 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000002 1 1 00000002 00000004 +CCtrl 0 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000005 00000006 +CCtrl 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 1 00000003 00000004 +CCtrl 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000005 1 1 00000004 00000005 +CCtrl 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000001 00000006 +CCtrl 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000007 1 1 00000002 00000005 +CCtrl 0 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000008 1 1 00000002 00000003 +CCtrl 0 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000001 00000004 +CCtrl 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000000a 1 1 00000001 00000005 +CCtrl 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000000b 1 1 00000006 00000003 +CCtrl 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000001 00000003 +CCtrl 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000000d 1 1 00000020 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000e 1 1 00000008 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000f 1 1 00000013 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000010 1 1 0000001b 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000011 1 1 00000019 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000012 1 1 00000012 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000013 1 1 00000015 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000014 1 1 0000000b 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000015 1 1 00000014 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000016 1 1 00000023 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000017 1 1 00000021 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000018 1 1 00000029 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000019 1 1 00000038 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001a 1 1 00000031 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000001b 1 1 00000007 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000001c 1 1 0000001c 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001d 1 1 00000014 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001e 1 1 00000037 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000001f 1 1 0000000e 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000020 1 1 00000031 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000021 1 1 00000008 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000022 1 1 00000037 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000023 1 1 0000000c 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000024 1 1 00000025 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000025 1 1 00000014 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000026 1 1 00000027 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000027 1 1 00000019 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000028 1 1 0000002b 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000029 1 1 00000038 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002a 1 1 00000025 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000002b 1 1 00000020 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002c 1 1 00000038 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002d 1 1 00000007 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000002e 1 1 00000026 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002f 1 1 00000016 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000030 1 1 0000001a 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000031 1 1 0000000d 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000032 1 1 00000039 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000033 1 1 0000000f 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000034 1 1 00000008 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000035 1 1 0000002c 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000036 1 1 0000000a 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000037 1 1 00000018 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000038 1 1 0000003a 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000039 1 1 00000030 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003a 1 1 0000002e 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003b 1 1 00000008 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003c 1 1 00000007 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000003d 1 1 0000001a 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003e 1 1 0000000e 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003f 1 1 0000002d 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000040 1 1 00000026 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000041 1 1 0000002b 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000042 1 1 00000013 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000043 1 1 00000031 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000044 1 1 0000001f 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000045 1 1 00000033 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000046 1 1 00000031 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000047 1 1 00000025 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000048 1 1 00000026 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000049 1 1 0000000e 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004a 1 1 00000017 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004b 1 1 00000028 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004c 1 1 0000002c 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004d 1 1 00000032 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004e 1 1 00000013 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000004f 1 1 00000009 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000050 1 1 00000035 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000051 1 1 00000032 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000052 1 1 0000002b 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000053 1 1 00000019 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000054 1 1 0000000e 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000055 1 1 00000014 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000056 1 1 0000001a 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000057 1 1 0000001f 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000058 1 1 00000032 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000059 1 1 0000000d 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000005a 1 1 00000032 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005b 1 1 00000022 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005c 1 1 0000001e 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005d 1 1 00000011 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005e 1 1 0000002b 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000005f 1 1 00000025 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000060 1 1 0000003c 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000061 1 1 00000019 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000062 1 1 0000002a 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000063 1 1 00000020 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000064 1 1 0000003b 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000065 1 1 00000037 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000066 1 1 0000001f 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000067 1 1 0000002c 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000068 1 1 0000001d 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000069 1 1 0000000d 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000006a 1 1 00000034 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006b 1 1 00000024 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006c 1 1 00000007 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000006d 1 1 00000010 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006e 1 1 0000002c 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006f 1 1 00000020 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000070 1 1 00000026 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000071 1 1 00000013 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000072 1 1 00000038 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000073 1 1 00000037 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000074 1 1 0000001a 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000075 1 1 0000000d 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000076 1 1 0000002f 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000077 1 1 0000001f 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000078 1 1 00000036 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000079 1 1 00000002 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000007a 1 1 00000001 00000009 +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007b 1 1 00000002 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000007c 1 1 00000001 0000000a +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007d 1 1 00000002 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000007e 1 1 00000001 0000000b +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007f 1 1 00000002 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000080 1 1 00000001 0000000c +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000081 1 1 00000002 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000082 1 1 00000001 0000000f +CCtrl 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000083 1 1 00000002 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000084 1 1 00000001 00000010 +CCtrl 0 -0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000085 1 1 00000002 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000086 1 1 00000001 00000011 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000087 1 1 00000002 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000088 1 1 00000001 00000012 +CCtrl 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000089 1 1 00000002 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000008a 1 1 00000001 00000015 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008b 1 1 00000002 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000008c 1 1 00000001 00000016 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008d 1 1 00000002 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000008e 1 1 00000001 00000017 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008f 1 1 00000002 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000090 1 1 00000001 00000018 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000091 1 1 00000002 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000092 1 1 00000001 0000001b +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000093 1 1 00000002 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000094 1 1 00000001 0000001c +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000095 1 1 00000002 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000096 1 1 00000001 0000001d +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000097 1 1 00000002 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000098 1 1 00000001 0000001e +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000099 1 1 00000002 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000009a 1 1 00000001 00000021 +CCtrl 0 -0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009b 1 1 00000002 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000009c 1 1 00000001 00000022 +CCtrl 0 -0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009d 1 1 00000002 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000009e 1 1 00000001 00000023 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009f 1 1 00000002 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a0 1 1 00000001 00000024 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000a1 1 1 00000002 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a2 1 1 00000001 00000027 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000a3 1 1 00000002 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a4 1 1 00000001 00000028 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000a5 1 1 00000002 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a6 1 1 00000001 00000029 +CCtrl 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000a7 1 1 00000002 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a8 1 1 00000001 0000002a +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000a9 1 1 00000002 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000aa 1 1 00000001 0000002d +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000ab 1 1 00000002 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ac 1 1 00000001 0000002e +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000ad 1 1 00000002 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ae 1 1 00000001 0000002f +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000af 1 1 00000002 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b0 1 1 00000001 00000030 +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000b1 1 1 00000002 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b2 1 1 00000001 00000033 +CCtrl 0 -0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000b3 1 1 00000002 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b4 1 1 00000001 00000034 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000b5 1 1 00000002 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b6 1 1 00000001 00000035 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000b7 1 1 00000002 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b8 1 1 00000001 00000036 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000b9 1 1 00000002 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ba 1 1 00000001 00000039 +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000bb 1 1 00000002 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000bc 1 1 00000001 0000003a +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000bd 1 1 00000002 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000be 1 1 00000001 0000003b +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 000000bf 1 1 00000002 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000c0 1 1 00000001 0000003c +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve diff --git a/test/group/translate_nd/normal_v22.slvs b/test/group/translate_nd/normal_v22.slvs new file mode 100644 index 0000000..691b57e --- /dev/null +++ b/test/group/translate_nd/normal_v22.slvs @@ -0,0 +1,8316 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5100 +Group.order=2 +Group.name=extrude +Group.opA.v=00000002 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.predef.entityB.v=80020000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00040000 1002 + 2 00040001 1002 + 3 00040002 1002 + 4 00040000 1001 + 5 00040001 1001 + 6 00040002 1001 + 7 00040000 1004 + 8 00040001 1003 + 9 00040002 1003 + 10 00050000 1002 + 11 00050001 1002 + 12 00050002 1002 + 13 00050000 1001 + 14 00050001 1001 + 15 00050002 1001 + 16 00050000 1004 + 17 00050001 1003 + 18 00050002 1003 + 19 00060000 1002 + 20 00060001 1002 + 21 00060002 1002 + 22 00060000 1001 + 23 00060001 1001 + 24 00060002 1001 + 25 00060000 1004 + 26 00060001 1003 + 27 00060002 1003 + 28 00070000 1002 + 29 00070001 1002 + 30 00070002 1002 + 31 00070000 1001 + 32 00070001 1001 + 33 00070002 1001 + 34 00070000 1004 + 35 00070001 1003 + 36 00070002 1003 + 37 80020000 1002 + 38 80020000 1001 + 39 80020001 1002 + 40 80020002 1002 + 41 80020001 1001 + 42 80020002 1001 + 43 80020002 1003 + 44 00000000 1001 + 45 00000000 1002 +} +AddGroup + +Group.h.v=00000004 +Group.type=5001 +Group.order=3 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80040000 +Group.color=00646464 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=80030028 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000005 +Group.type=5100 +Group.order=4 +Group.name=extrude +Group.opA.v=00000004 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=1 +Group.predef.entityB.v=80040000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00080000 1002 + 2 00080001 1002 + 3 00080020 1002 + 4 00080040 1002 + 5 00080000 1001 + 6 00080001 1001 + 7 00080020 1001 + 8 00080040 1001 + 9 00080001 1003 + 10 80040000 1002 + 11 80040000 1001 + 12 80040001 1002 + 13 80040002 1002 + 14 80040001 1001 + 15 80040002 1001 + 16 80040002 1003 + 17 00000000 1001 + 18 00000000 1002 + 19 00080002 1002 + 20 00080002 1001 + 21 00080000 1004 + 22 00080002 1003 + 23 00090000 1002 + 24 00090001 1002 + 25 00090002 1002 + 26 00090000 1001 + 27 00090001 1001 + 28 00090002 1001 + 29 00090000 1004 + 30 00090001 1003 + 31 00090002 1003 + 32 000a0000 1002 + 33 000a0001 1002 + 34 000a0002 1002 + 35 000a0000 1001 + 36 000a0001 1001 + 37 000a0002 1001 + 38 000a0000 1004 + 39 000a0001 1003 + 40 000a0002 1003 + 41 000b0000 1002 + 42 000b0001 1002 + 43 000b0002 1002 + 44 000b0000 1001 + 45 000b0001 1001 + 46 000b0002 1001 + 47 000b0000 1004 + 48 000b0001 1003 + 49 000b0002 1003 +} +AddGroup + +Group.h.v=00000006 +Group.type=5201 +Group.order=5 +Group.name=translate +Group.activeWorkplane.v=00010000 +Group.opA.v=00000005 +Group.valA=3.00000000000000000000 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=1 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 80050001 0 + 2 80050002 0 + 3 80050003 0 + 4 80050004 0 + 5 80050005 0 + 6 80050006 0 + 7 80050007 0 + 8 80050008 0 + 9 80050009 0 + 10 8005000c 0 + 11 8005000d 0 + 12 8005000e 0 + 13 8005000f 0 + 14 80050010 0 + 15 80050011 0 + 16 80050012 0 + 17 80050001 1 + 18 80050002 1 + 19 80050003 1 + 20 80050004 1 + 21 80050005 1 + 22 80050006 1 + 23 80050007 1 + 24 80050008 1 + 25 80050009 1 + 26 8005000c 1 + 27 8005000d 1 + 28 8005000e 1 + 29 8005000f 1 + 30 80050010 1 + 31 80050011 1 + 32 80050012 1 + 33 80050001 1000 + 34 80050002 1000 + 35 80050003 1000 + 36 80050004 1000 + 37 80050005 1000 + 38 80050006 1000 + 39 80050007 1000 + 40 80050008 1000 + 41 80050009 1000 + 42 8005000c 1000 + 43 8005000d 1000 + 44 8005000e 1000 + 45 8005000f 1000 + 46 80050010 1000 + 47 80050011 1000 + 48 80050012 1000 + 49 80050013 0 + 50 80050014 0 + 51 80050015 0 + 52 80050016 0 + 53 80050017 0 + 54 80050018 0 + 55 80050019 0 + 56 8005001a 0 + 57 8005001b 0 + 58 8005001c 0 + 59 8005001d 0 + 60 8005001e 0 + 61 8005001f 0 + 62 80050020 0 + 63 80050021 0 + 64 80050022 0 + 65 80050023 0 + 66 80050024 0 + 67 80050025 0 + 68 80050026 0 + 69 80050027 0 + 70 80050028 0 + 71 80050029 0 + 72 8005002a 0 + 73 8005002b 0 + 74 8005002c 0 + 75 8005002d 0 + 76 8005002e 0 + 77 8005002f 0 + 78 80050030 0 + 79 80050031 0 + 80 80050013 1 + 81 80050014 1 + 82 80050015 1 + 83 80050016 1 + 84 80050017 1 + 85 80050018 1 + 86 80050019 1 + 87 8005001a 1 + 88 8005001b 1 + 89 8005001c 1 + 90 8005001d 1 + 91 8005001e 1 + 92 8005001f 1 + 93 80050020 1 + 94 80050021 1 + 95 80050022 1 + 96 80050023 1 + 97 80050024 1 + 98 80050025 1 + 99 80050026 1 + 100 80050027 1 + 101 80050028 1 + 102 80050029 1 + 103 8005002a 1 + 104 8005002b 1 + 105 8005002c 1 + 106 8005002d 1 + 107 8005002e 1 + 108 8005002f 1 + 109 80050030 1 + 110 80050031 1 + 111 80050013 1000 + 112 80050014 1000 + 113 80050015 1000 + 114 80050016 1000 + 115 80050017 1000 + 116 80050018 1000 + 117 80050019 1000 + 118 8005001a 1000 + 119 8005001b 1000 + 120 8005001c 1000 + 121 8005001d 1000 + 122 8005001e 1000 + 123 8005001f 1000 + 124 80050020 1000 + 125 80050021 1000 + 126 80050022 1000 + 127 80050023 1000 + 128 80050024 1000 + 129 80050025 1000 + 130 80050026 1000 + 131 80050027 1000 + 132 80050028 1000 + 133 80050029 1000 + 134 8005002a 1000 + 135 8005002b 1000 + 136 8005002c 1000 + 137 8005002d 1000 + 138 8005002e 1000 + 139 8005002f 1000 + 140 80050030 1000 + 141 80050031 1000 +} +AddGroup + +Group.h.v=00000007 +Group.type=5201 +Group.order=6 +Group.name=translate +Group.activeWorkplane.v=00010000 +Group.opA.v=00000006 +Group.valA=3.00000000000000000000 +Group.color=00646464 +Group.subtype=7000 +Group.skipFirst=0 +Group.meshCombine=1 +Group.predef.entityB.v=00010000 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 80060001 0 + 2 80060002 0 + 3 80060003 0 + 4 80060004 0 + 5 80060005 0 + 6 80060006 0 + 7 80060007 0 + 8 80060008 0 + 9 80060009 0 + 10 8006000a 0 + 11 8006000b 0 + 12 8006000c 0 + 13 8006000d 0 + 14 8006000e 0 + 15 8006000f 0 + 16 80060010 0 + 17 80060011 0 + 18 80060012 0 + 19 80060013 0 + 20 80060014 0 + 21 80060015 0 + 22 80060016 0 + 23 80060017 0 + 24 80060018 0 + 25 80060019 0 + 26 8006001a 0 + 27 8006001b 0 + 28 8006001c 0 + 29 8006001d 0 + 30 8006001e 0 + 31 8006001f 0 + 32 80060020 0 + 33 80060021 0 + 34 80060022 0 + 35 80060023 0 + 36 80060024 0 + 37 80060025 0 + 38 80060026 0 + 39 80060027 0 + 40 80060028 0 + 41 80060029 0 + 42 8006002a 0 + 43 8006002b 0 + 44 8006002c 0 + 45 8006002d 0 + 46 8006002e 0 + 47 8006002f 0 + 48 80060030 0 + 49 80060001 1 + 50 80060002 1 + 51 80060003 1 + 52 80060004 1 + 53 80060005 1 + 54 80060006 1 + 55 80060007 1 + 56 80060008 1 + 57 80060009 1 + 58 8006000a 1 + 59 8006000b 1 + 60 8006000c 1 + 61 8006000d 1 + 62 8006000e 1 + 63 8006000f 1 + 64 80060010 1 + 65 80060011 1 + 66 80060012 1 + 67 80060013 1 + 68 80060014 1 + 69 80060015 1 + 70 80060016 1 + 71 80060017 1 + 72 80060018 1 + 73 80060019 1 + 74 8006001a 1 + 75 8006001b 1 + 76 8006001c 1 + 77 8006001d 1 + 78 8006001e 1 + 79 8006001f 1 + 80 80060020 1 + 81 80060021 1 + 82 80060022 1 + 83 80060023 1 + 84 80060024 1 + 85 80060025 1 + 86 80060026 1 + 87 80060027 1 + 88 80060028 1 + 89 80060029 1 + 90 8006002a 1 + 91 8006002b 1 + 92 8006002c 1 + 93 8006002d 1 + 94 8006002e 1 + 95 8006002f 1 + 96 80060030 1 + 97 80060001 1000 + 98 80060002 1000 + 99 80060003 1000 + 100 80060004 1000 + 101 80060005 1000 + 102 80060006 1000 + 103 80060007 1000 + 104 80060008 1000 + 105 80060009 1000 + 106 8006000a 1000 + 107 8006000b 1000 + 108 8006000c 1000 + 109 8006000d 1000 + 110 8006000e 1000 + 111 8006000f 1000 + 112 80060010 1000 + 113 80060011 1000 + 114 80060012 1000 + 115 80060013 1000 + 116 80060014 1000 + 117 80060015 1000 + 118 80060016 1000 + 119 80060017 1000 + 120 80060018 1000 + 121 80060019 1000 + 122 8006001a 1000 + 123 8006001b 1000 + 124 8006001c 1000 + 125 8006001d 1000 + 126 8006001e 1000 + 127 8006001f 1000 + 128 80060020 1000 + 129 80060021 1000 + 130 80060022 1000 + 131 80060023 1000 + 132 80060024 1000 + 133 80060025 1000 + 134 80060026 1000 + 135 80060027 1000 + 136 80060028 1000 + 137 80060029 1000 + 138 8006002a 1000 + 139 8006002b 1000 + 140 8006002c 1000 + 141 8006002d 1000 + 142 8006002e 1000 + 143 8006002f 1000 + 144 80060030 1000 + 145 80060031 0 + 146 80060032 0 + 147 80060050 0 + 148 80060051 0 + 149 8006006f 0 + 150 80060070 0 + 151 80060033 0 + 152 80060034 0 + 153 80060035 0 + 154 80060036 0 + 155 80060037 0 + 156 80060038 0 + 157 80060039 0 + 158 8006003a 0 + 159 8006003b 0 + 160 8006003c 0 + 161 8006003d 0 + 162 8006003e 0 + 163 8006003f 0 + 164 80060040 0 + 165 80060041 0 + 166 80060042 0 + 167 80060043 0 + 168 80060044 0 + 169 80060045 0 + 170 80060046 0 + 171 80060047 0 + 172 80060048 0 + 173 80060049 0 + 174 8006004a 0 + 175 8006004b 0 + 176 8006004c 0 + 177 8006004d 0 + 178 8006004e 0 + 179 8006004f 0 + 180 80060052 0 + 181 80060053 0 + 182 80060054 0 + 183 80060055 0 + 184 80060056 0 + 185 80060057 0 + 186 80060058 0 + 187 80060059 0 + 188 8006005a 0 + 189 8006005b 0 + 190 8006005c 0 + 191 8006005d 0 + 192 8006005e 0 + 193 8006005f 0 + 194 80060060 0 + 195 80060061 0 + 196 80060062 0 + 197 80060063 0 + 198 80060064 0 + 199 80060065 0 + 200 80060066 0 + 201 80060067 0 + 202 80060068 0 + 203 80060069 0 + 204 8006006a 0 + 205 8006006b 0 + 206 8006006c 0 + 207 8006006d 0 + 208 8006006e 0 + 209 80060071 0 + 210 80060072 0 + 211 80060073 0 + 212 80060074 0 + 213 80060075 0 + 214 80060076 0 + 215 80060077 0 + 216 80060078 0 + 217 80060079 0 + 218 8006007a 0 + 219 8006007b 0 + 220 8006007c 0 + 221 8006007d 0 + 222 8006007e 0 + 223 8006007f 0 + 224 80060080 0 + 225 80060081 0 + 226 80060082 0 + 227 80060083 0 + 228 80060084 0 + 229 80060085 0 + 230 80060086 0 + 231 80060087 0 + 232 80060088 0 + 233 80060089 0 + 234 8006008a 0 + 235 8006008b 0 + 236 8006008c 0 + 237 8006008d 0 + 238 80060031 1 + 239 80060032 1 + 240 80060050 1 + 241 80060051 1 + 242 8006006f 1 + 243 80060070 1 + 244 80060033 1 + 245 80060034 1 + 246 80060035 1 + 247 80060036 1 + 248 80060037 1 + 249 80060038 1 + 250 80060039 1 + 251 8006003a 1 + 252 8006003b 1 + 253 8006003c 1 + 254 8006003d 1 + 255 8006003e 1 + 256 8006003f 1 + 257 80060040 1 + 258 80060041 1 + 259 80060042 1 + 260 80060043 1 + 261 80060044 1 + 262 80060045 1 + 263 80060046 1 + 264 80060047 1 + 265 80060048 1 + 266 80060049 1 + 267 8006004a 1 + 268 8006004b 1 + 269 8006004c 1 + 270 8006004d 1 + 271 8006004e 1 + 272 8006004f 1 + 273 80060052 1 + 274 80060053 1 + 275 80060054 1 + 276 80060055 1 + 277 80060056 1 + 278 80060057 1 + 279 80060058 1 + 280 80060059 1 + 281 8006005a 1 + 282 8006005b 1 + 283 8006005c 1 + 284 8006005d 1 + 285 8006005e 1 + 286 8006005f 1 + 287 80060060 1 + 288 80060061 1 + 289 80060062 1 + 290 80060063 1 + 291 80060064 1 + 292 80060065 1 + 293 80060066 1 + 294 80060067 1 + 295 80060068 1 + 296 80060069 1 + 297 8006006a 1 + 298 8006006b 1 + 299 8006006c 1 + 300 8006006d 1 + 301 8006006e 1 + 302 80060071 1 + 303 80060072 1 + 304 80060073 1 + 305 80060074 1 + 306 80060075 1 + 307 80060076 1 + 308 80060077 1 + 309 80060078 1 + 310 80060079 1 + 311 8006007a 1 + 312 8006007b 1 + 313 8006007c 1 + 314 8006007d 1 + 315 8006007e 1 + 316 8006007f 1 + 317 80060080 1 + 318 80060081 1 + 319 80060082 1 + 320 80060083 1 + 321 80060084 1 + 322 80060085 1 + 323 80060086 1 + 324 80060087 1 + 325 80060088 1 + 326 80060089 1 + 327 8006008a 1 + 328 8006008b 1 + 329 8006008c 1 + 330 8006008d 1 + 331 80060031 1000 + 332 80060032 1000 + 333 80060050 1000 + 334 80060051 1000 + 335 8006006f 1000 + 336 80060070 1000 + 337 80060033 1000 + 338 80060034 1000 + 339 80060035 1000 + 340 80060036 1000 + 341 80060037 1000 + 342 80060038 1000 + 343 80060039 1000 + 344 8006003a 1000 + 345 8006003b 1000 + 346 8006003c 1000 + 347 8006003d 1000 + 348 8006003e 1000 + 349 8006003f 1000 + 350 80060040 1000 + 351 80060041 1000 + 352 80060042 1000 + 353 80060043 1000 + 354 80060044 1000 + 355 80060045 1000 + 356 80060046 1000 + 357 80060047 1000 + 358 80060048 1000 + 359 80060049 1000 + 360 8006004a 1000 + 361 8006004b 1000 + 362 8006004c 1000 + 363 8006004d 1000 + 364 8006004e 1000 + 365 8006004f 1000 + 366 80060052 1000 + 367 80060053 1000 + 368 80060054 1000 + 369 80060055 1000 + 370 80060056 1000 + 371 80060057 1000 + 372 80060058 1000 + 373 80060059 1000 + 374 8006005a 1000 + 375 8006005b 1000 + 376 8006005c 1000 + 377 8006005d 1000 + 378 8006005e 1000 + 379 8006005f 1000 + 380 80060060 1000 + 381 80060061 1000 + 382 80060062 1000 + 383 80060063 1000 + 384 80060064 1000 + 385 80060065 1000 + 386 80060066 1000 + 387 80060067 1000 + 388 80060068 1000 + 389 80060069 1000 + 390 8006006a 1000 + 391 8006006b 1000 + 392 8006006c 1000 + 393 8006006d 1000 + 394 8006006e 1000 + 395 80060071 1000 + 396 80060072 1000 + 397 80060073 1000 + 398 80060074 1000 + 399 80060075 1000 + 400 80060076 1000 + 401 80060077 1000 + 402 80060078 1000 + 403 80060079 1000 + 404 8006007a 1000 + 405 8006007b 1000 + 406 8006007c 1000 + 407 8006007d 1000 + 408 8006007e 1000 + 409 8006007f 1000 + 410 80060080 1000 + 411 80060081 1000 + 412 80060082 1000 + 413 80060083 1000 + 414 80060084 1000 + 415 80060085 1000 + 416 80060086 1000 + 417 80060087 1000 + 418 80060088 1000 + 419 80060089 1000 + 420 8006008a 1000 + 421 8006008b 1000 + 422 8006008c 1000 + 423 8006008d 1000 +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00050010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00050011 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00050013 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00050014 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00060010 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00060013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00060014 +Param.val=-20.00000000000000000000 +AddParam + +Param.h.v.=00070010 +Param.val=20.00000000000000000000 +AddParam + +Param.h.v.=00070011 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00070013 +Param.val=-15.00000000000000000000 +AddParam + +Param.h.v.=00070014 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00080010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00080011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00080013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00080014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00090010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00090011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00090013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00090014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=000a0010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=000a0011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=000a0013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=000a0014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=000b0010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=000b0011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=000b0013 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=000b0014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=80030000 +AddParam + +Param.h.v.=80030001 +AddParam + +Param.h.v.=80030002 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=80050000 +AddParam + +Param.h.v.=80050001 +AddParam + +Param.h.v.=80050002 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=80060000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80060001 +AddParam + +Param.h.v.=80060002 +AddParam + +Param.h.v.=80070000 +AddParam + +Param.h.v.=80070001 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=80070002 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000005 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000006 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000007 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Request.h.v=00000008 +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Request.h.v=00000009 +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Request.h.v=0000000a +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Request.h.v=0000000b +Request.type=200 +Request.workplane.v=80040000 +Request.group.v=00000004 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00050001 +Entity.point[1].v=00050002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00050002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00060001 +Entity.point[1].v=00060002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00060002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00070001 +Entity.point[1].v=00070002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00070002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00080000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00080001 +Entity.point[1].v=00080002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00080001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00080002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00090000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00090001 +Entity.point[1].v=00090002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00090001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00090002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000a0000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=000a0001 +Entity.point[1].v=000a0002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000a0001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000a0002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000b0000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=000b0001 +Entity.point[1].v=000b0002 +Entity.workplane.v=80040000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000b0001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=000b0002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80040000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030004 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030006 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030007 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.point[1].v=80030002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030006 +Entity.point[1].v=80030003 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030010 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000e +Entity.point[1].v=8003000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003000f +Entity.point[1].v=8003000c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030013 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030014 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030015 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030017 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030019 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030017 +Entity.point[1].v=80030014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030018 +Entity.point[1].v=80030015 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003001d +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=80030021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030020 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-15.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030022 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030020 +Entity.point[1].v=8003001d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030024 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80030021 +Entity.point[1].v=8003001e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030027 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030028 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030029 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.point[1].v=80030028 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002c +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8003002a +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003002d +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=80030028 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80040002 +Entity.normal.v=80040001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80040001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80040002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80040002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050002 +Entity.point[1].v=80050013 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050005 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050006 +Entity.point[1].v=80050014 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050006 +Entity.point[1].v=80050002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8005000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000e +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8005000f +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005000f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050010 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005000f +Entity.point[1].v=8005000d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050011 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8005000f +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050012 +Entity.type=5000 +Entity.construction=0 +Entity.point[0].v=8005000d +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050013 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050014 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050015 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050016 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050014 +Entity.point[1].v=80050013 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050017 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050018 +Entity.point[1].v=80050019 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050018 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050019 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005001b +Entity.point[1].v=8005001c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001d +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005001b +Entity.point[1].v=80050018 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005001f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005001c +Entity.point[1].v=80050019 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050020 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050021 +Entity.point[1].v=80050022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050021 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050022 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050023 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050024 +Entity.point[1].v=80050025 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050024 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050025 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050026 +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050027 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050024 +Entity.point[1].v=80050021 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050028 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80050025 +Entity.point[1].v=80050022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002a +Entity.point[1].v=8005002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002d +Entity.point[1].v=8005002e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8005002f +Entity.type=5001 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050030 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002d +Entity.point[1].v=8005002a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80050031 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8005002e +Entity.point[1].v=8005002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060002 +Entity.point[1].v=80060031 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060005 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060006 +Entity.point[1].v=80060032 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060006 +Entity.point[1].v=80060002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006000b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000b +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006000d +Entity.point[1].v=8006000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006000f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060010 +Entity.type=5003 +Entity.construction=0 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060012 +Entity.point[1].v=80060050 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060012 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060015 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060016 +Entity.point[1].v=80060051 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060016 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060019 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060016 +Entity.point[1].v=80060012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006001b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006001d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006001d +Entity.point[1].v=8006001b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006001f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060020 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060021 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060022 +Entity.point[1].v=8006006f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060022 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060025 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060026 +Entity.point[1].v=80060070 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060026 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060026 +Entity.point[1].v=80060022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006002b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8006002d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006002d +Entity.point[1].v=8006002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006002f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060030 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060031 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060032 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060033 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060034 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060032 +Entity.point[1].v=80060031 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060035 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060036 +Entity.point[1].v=80060037 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060036 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060037 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060038 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060039 +Entity.point[1].v=8006003a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060039 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003b +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060039 +Entity.point[1].v=80060036 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006003a +Entity.point[1].v=80060037 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006003f +Entity.point[1].v=80060040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006003f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060040 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060041 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060042 +Entity.point[1].v=80060043 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060042 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060043 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060044 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060045 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060042 +Entity.point[1].v=8006003f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060046 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060043 +Entity.point[1].v=80060040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060047 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060048 +Entity.point[1].v=80060049 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060048 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060049 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006004b +Entity.point[1].v=8006004c +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004d +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006004b +Entity.point[1].v=80060048 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006004f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006004c +Entity.point[1].v=80060049 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060050 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060051 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060052 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060053 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060051 +Entity.point[1].v=80060050 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060054 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060055 +Entity.point[1].v=80060056 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060055 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060056 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060057 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060058 +Entity.point[1].v=80060059 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060058 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060059 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005a +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060058 +Entity.point[1].v=80060055 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060059 +Entity.point[1].v=80060056 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006005e +Entity.point[1].v=8006005f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006005f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060060 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060061 +Entity.point[1].v=80060062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060061 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060062 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060063 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060064 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060061 +Entity.point[1].v=8006005e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060065 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060062 +Entity.point[1].v=8006005f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060066 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060067 +Entity.point[1].v=80060068 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060067 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060068 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060069 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006006a +Entity.point[1].v=8006006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006c +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006006a +Entity.point[1].v=80060067 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006006b +Entity.point[1].v=80060068 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006006f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060070 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060071 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060072 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060070 +Entity.point[1].v=8006006f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060073 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060074 +Entity.point[1].v=80060075 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060074 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060075 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060076 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060077 +Entity.point[1].v=80060078 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060077 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060078 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060079 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060077 +Entity.point[1].v=80060074 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060078 +Entity.point[1].v=80060075 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006007d +Entity.point[1].v=8006007e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006007f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060080 +Entity.point[1].v=80060081 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060080 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060081 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060082 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060083 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060080 +Entity.point[1].v=8006007d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060084 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060081 +Entity.point[1].v=8006007e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060085 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060086 +Entity.point[1].v=80060087 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060086 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060087 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060088 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060089 +Entity.point[1].v=8006008a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80060089 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008b +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80060089 +Entity.point[1].v=80060086 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8006008d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8006008a +Entity.point[1].v=80060087 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070001 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070002 +Entity.point[1].v=80070091 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070002 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070005 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070006 +Entity.point[1].v=80070092 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070006 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070009 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070006 +Entity.point[1].v=80070002 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007000b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000b +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007000d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007000d +Entity.point[1].v=8007000b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007000f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070010 +Entity.type=5003 +Entity.construction=0 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070011 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070012 +Entity.point[1].v=80070093 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070012 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070015 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070016 +Entity.point[1].v=80070094 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070016 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070019 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070016 +Entity.point[1].v=80070012 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007001b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007001d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007001d +Entity.point[1].v=8007001b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007001f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070020 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070021 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070022 +Entity.point[1].v=80070095 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070022 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070025 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070026 +Entity.point[1].v=80070096 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070026 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070029 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070026 +Entity.point[1].v=80070022 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007002b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007002d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007002d +Entity.point[1].v=8007002b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007002f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070030 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070031 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070032 +Entity.point[1].v=800700ee +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070032 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070035 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070036 +Entity.point[1].v=800700ef +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070036 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070039 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070036 +Entity.point[1].v=80070032 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007003b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007003d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007003d +Entity.point[1].v=8007003b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007003f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070040 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070041 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070042 +Entity.point[1].v=800700f0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070042 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070045 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070046 +Entity.point[1].v=800700f1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070046 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070049 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070046 +Entity.point[1].v=80070042 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007004b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007004d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007004d +Entity.point[1].v=8007004b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007004f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070050 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070051 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070052 +Entity.point[1].v=800700f2 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070052 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070055 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070056 +Entity.point[1].v=800700f3 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070056 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070059 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070056 +Entity.point[1].v=80070052 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007005b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007005d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007005d +Entity.point[1].v=8007005b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007005f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070060 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070061 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070062 +Entity.point[1].v=8007014b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070062 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070065 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070066 +Entity.point[1].v=8007014c +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070066 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070069 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070066 +Entity.point[1].v=80070062 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007006b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007006d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007006d +Entity.point[1].v=8007006b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007006f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070070 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070071 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070072 +Entity.point[1].v=8007014d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070072 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070075 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070076 +Entity.point[1].v=8007014e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070076 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070079 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070076 +Entity.point[1].v=80070072 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007007b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007007d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007007d +Entity.point[1].v=8007007b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007007f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070080 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070081 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070082 +Entity.point[1].v=8007014f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070082 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070085 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070086 +Entity.point[1].v=80070150 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070086 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070089 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070086 +Entity.point[1].v=80070082 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008a +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007008b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008c +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=8007008d +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007008d +Entity.point[1].v=8007008b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007008f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070090 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=-20.00000000000000000000 +Entity.actNormal.vz=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070091 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070092 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070093 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070094 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070095 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070096 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070097 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070098 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070092 +Entity.point[1].v=80070091 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070099 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009a +Entity.point[1].v=8007009b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009d +Entity.point[1].v=8007009e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007009f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a0 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009d +Entity.point[1].v=8007009a +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a1 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007009e +Entity.point[1].v=8007009b +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a3 +Entity.point[1].v=800700a4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a6 +Entity.point[1].v=800700a7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a6 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a8 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700a9 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a6 +Entity.point[1].v=800700a3 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700aa +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700a7 +Entity.point[1].v=800700a4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ab +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ac +Entity.point[1].v=800700ad +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ac +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ad +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ae +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700af +Entity.point[1].v=800700b0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700af +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b1 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700af +Entity.point[1].v=800700ac +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b3 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700b0 +Entity.point[1].v=800700ad +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b4 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070094 +Entity.point[1].v=80070093 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700b7 +Entity.point[1].v=800700b8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b8 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700b9 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ba +Entity.point[1].v=800700bb +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ba +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bb +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bc +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bd +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ba +Entity.point[1].v=800700b7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700be +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700bb +Entity.point[1].v=800700b8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700bf +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c0 +Entity.point[1].v=800700c1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c3 +Entity.point[1].v=800700c4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c5 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c3 +Entity.point[1].v=800700c0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c7 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c4 +Entity.point[1].v=800700c1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c8 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700c9 +Entity.point[1].v=800700ca +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700c9 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ca +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cb +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700cc +Entity.point[1].v=800700cd +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cc +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cd +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ce +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700cf +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700cc +Entity.point[1].v=800700c9 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d0 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700cd +Entity.point[1].v=800700ca +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d1 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070096 +Entity.point[1].v=80070095 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d3 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d4 +Entity.point[1].v=800700d5 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d5 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d7 +Entity.point[1].v=800700d8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d8 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700d9 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700da +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d7 +Entity.point[1].v=800700d4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700db +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700d8 +Entity.point[1].v=800700d5 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700dc +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700dd +Entity.point[1].v=800700de +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700dd +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700de +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700df +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e0 +Entity.point[1].v=800700e1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e2 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e3 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e0 +Entity.point[1].v=800700dd +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e4 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e1 +Entity.point[1].v=800700de +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e6 +Entity.point[1].v=800700e7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e6 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e8 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e9 +Entity.point[1].v=800700ea +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700e9 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ea +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700eb +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ec +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700e9 +Entity.point[1].v=800700e6 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ed +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ea +Entity.point[1].v=800700e7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ee +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ef +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f2 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f4 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f5 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700ef +Entity.point[1].v=800700ee +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700f7 +Entity.point[1].v=800700f8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f7 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f8 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700f9 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700fa +Entity.point[1].v=800700fb +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fa +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fb +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fc +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fd +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700fa +Entity.point[1].v=800700f7 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700fe +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700fb +Entity.point[1].v=800700f8 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800700ff +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070100 +Entity.point[1].v=80070101 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070100 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070101 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070102 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070103 +Entity.point[1].v=80070104 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070103 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070104 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070105 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070106 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070103 +Entity.point[1].v=80070100 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070107 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070104 +Entity.point[1].v=80070101 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070108 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070109 +Entity.point[1].v=8007010a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070109 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007010c +Entity.point[1].v=8007010d +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010e +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007010f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007010c +Entity.point[1].v=80070109 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070110 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007010d +Entity.point[1].v=8007010a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070111 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070112 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700f1 +Entity.point[1].v=800700f0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070113 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070114 +Entity.point[1].v=80070115 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070114 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070115 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070116 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070117 +Entity.point[1].v=80070118 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070117 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070118 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070119 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070117 +Entity.point[1].v=80070114 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070118 +Entity.point[1].v=80070115 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007011d +Entity.point[1].v=8007011e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011d +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007011f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070120 +Entity.point[1].v=80070121 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070120 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070121 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070122 +Entity.type=5003 +Entity.construction=0 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070123 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070120 +Entity.point[1].v=8007011d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070124 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070121 +Entity.point[1].v=8007011e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070125 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070126 +Entity.point[1].v=80070127 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070126 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070127 +Entity.type=2010 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070128 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070129 +Entity.point[1].v=8007012a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070129 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012b +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070129 +Entity.point[1].v=80070126 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007012a +Entity.point[1].v=80070127 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012e +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007012f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800700f3 +Entity.point[1].v=800700f2 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070130 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070131 +Entity.point[1].v=80070132 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070131 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070132 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070133 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070134 +Entity.point[1].v=80070135 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070134 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070135 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070136 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070137 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070134 +Entity.point[1].v=80070131 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070138 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070135 +Entity.point[1].v=80070132 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070139 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013a +Entity.point[1].v=8007013b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013d +Entity.point[1].v=8007013e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007013f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070140 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013d +Entity.point[1].v=8007013a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070141 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007013e +Entity.point[1].v=8007013b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070142 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070143 +Entity.point[1].v=80070144 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070143 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070144 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070145 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070146 +Entity.point[1].v=80070147 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070146 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070147 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070148 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070149 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070146 +Entity.point[1].v=80070143 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070147 +Entity.point[1].v=80070144 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014c +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007014f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070150 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070151 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070152 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007014c +Entity.point[1].v=8007014b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070153 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070154 +Entity.point[1].v=80070155 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070154 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070155 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070156 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070157 +Entity.point[1].v=80070158 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070157 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070158 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070159 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070157 +Entity.point[1].v=80070154 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015b +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070158 +Entity.point[1].v=80070155 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007015d +Entity.point[1].v=8007015e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007015f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070160 +Entity.point[1].v=80070161 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070160 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070161 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070162 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070163 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070160 +Entity.point[1].v=8007015d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070164 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070161 +Entity.point[1].v=8007015e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070165 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070166 +Entity.point[1].v=80070167 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070166 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070167 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070168 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070169 +Entity.point[1].v=8007016a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070169 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016b +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070169 +Entity.point[1].v=80070166 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007016a +Entity.point[1].v=80070167 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016e +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007016f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007014e +Entity.point[1].v=8007014d +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070170 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070171 +Entity.point[1].v=80070172 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070171 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070172 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070173 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070174 +Entity.point[1].v=80070175 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070174 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070175 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070176 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070177 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070174 +Entity.point[1].v=80070171 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070178 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070175 +Entity.point[1].v=80070172 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070179 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017a +Entity.point[1].v=8007017b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017d +Entity.point[1].v=8007017e +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017d +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007017f +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070180 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017d +Entity.point[1].v=8007017a +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070181 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007017e +Entity.point[1].v=8007017b +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070182 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070183 +Entity.point[1].v=80070184 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070183 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070184 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070185 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070186 +Entity.point[1].v=80070187 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070186 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070187 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070188 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070189 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070186 +Entity.point[1].v=80070183 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018a +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070187 +Entity.point[1].v=80070184 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018b +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vx=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018c +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070150 +Entity.point[1].v=8007014f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007018e +Entity.point[1].v=8007018f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018e +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007018f +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070190 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070191 +Entity.point[1].v=80070192 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070191 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070192 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070193 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actNormal.vy=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070194 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070191 +Entity.point[1].v=8007018e +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070195 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070192 +Entity.point[1].v=8007018f +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070196 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=80070197 +Entity.point[1].v=80070198 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070197 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070198 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80070199 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007019a +Entity.point[1].v=8007019b +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019a +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019b +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-15.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019c +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vx=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019d +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007019a +Entity.point[1].v=80070197 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019e +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=8007019b +Entity.point[1].v=80070198 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8007019f +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a0 +Entity.point[1].v=800701a1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a0 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a1 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a2 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a3 +Entity.point[1].v=800701a4 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a3 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a4 +Entity.type=2010 +Entity.construction=0 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actPoint.z=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a5 +Entity.type=5003 +Entity.construction=0 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actNormal.vy=-1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a6 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a3 +Entity.point[1].v=800701a0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=800701a7 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=800701a4 +Entity.point[1].v=800701a1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00040001 +Constraint.ptB.v=00050002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000002 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00050001 +Constraint.ptB.v=00060002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000003 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00060001 +Constraint.ptB.v=00070002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000004 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.ptA.v=00070001 +Constraint.ptB.v=00040002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000005 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00040000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000006 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00050000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000007 +Constraint.type=81 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00060000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000008 +Constraint.type=80 +Constraint.group.v=00000002 +Constraint.workplane.v=80020000 +Constraint.entityA.v=00070000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000a +Constraint.type=30 +Constraint.group.v=00000003 +Constraint.valA=1.00000000000000000000 +Constraint.ptA.v=80030018 +Constraint.ptB.v=80030015 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +Constraint.disp.offset.x=-1.11433618504280240735 +Constraint.disp.offset.y=-1.07366998595325924271 +AddConstraint + +Constraint.h.v=0000000b +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=00080001 +Constraint.ptB.v=00090002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000c +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=00090001 +Constraint.ptB.v=000a0002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000d +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=000a0001 +Constraint.ptB.v=000b0002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000e +Constraint.type=20 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.ptA.v=000b0001 +Constraint.ptB.v=00080002 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=0000000f +Constraint.type=81 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=00080000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000010 +Constraint.type=80 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=00090000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000011 +Constraint.type=81 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=000a0000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Constraint.h.v=00000012 +Constraint.type=80 +Constraint.group.v=00000004 +Constraint.workplane.v=80040000 +Constraint.entityA.v=000b0000 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + +Surface 00000001 00646464 8003002c 1 1 +SCtrl 0 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000010000178463 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -15.00000000000000000000 -20.00000000010000178463 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000010000178463 -20.00000000010000178463 1.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000004 0 -15.00000000000000000000 -20.00000000010000178463 1.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 0000000a 0 20.00000000010000178463 15.00000000000000000000 1.00000000000000000000 20.00000000010000178463 -20.00000000010000178463 1.00000000000000000000 +TrimBy 00000001 0 20.00000000010000178463 -20.00000000010000178463 1.00000000000000000000 -15.00000000000000000000 -20.00000000010000178463 1.00000000000000000000 +TrimBy 00000007 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 20.00000000010000178463 15.00000000000000000000 1.00000000000000000000 +TrimBy 0000007c 0 -5.00000000000000088818 5.00000000000000088818 1.00000000000000000000 -5.00000000000000177636 10.00000000000000177636 1.00000000000000000000 +TrimBy 00000079 0 -10.00000000000000177636 5.00000000000000266454 1.00000000000000000000 -5.00000000000000088818 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000007a 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -10.00000000000000177636 5.00000000000000266454 1.00000000000000000000 +TrimBy 0000007b 0 -5.00000000000000177636 10.00000000000000177636 1.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000080 0 4.99999999999999644729 5.00000000000000088818 1.00000000000000000000 4.99999999999999822364 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000007d 0 -0.00000000000000133227 5.00000000000000088818 1.00000000000000000000 4.99999999999999644729 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000007e 0 -0.00000000000000111022 10.00000000000000000000 1.00000000000000000000 -0.00000000000000133227 5.00000000000000088818 1.00000000000000000000 +TrimBy 0000007f 0 4.99999999999999822364 10.00000000000000000000 1.00000000000000000000 -0.00000000000000111022 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000084 0 14.99999999999999822364 5.00000000000000000000 1.00000000000000000000 14.99999999999999644729 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000081 0 10.00000000000000000000 5.00000000000000177636 1.00000000000000000000 14.99999999999999822364 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000082 0 10.00000000000000177636 10.00000000000000000000 1.00000000000000000000 10.00000000000000000000 5.00000000000000177636 1.00000000000000000000 +TrimBy 00000083 0 14.99999999999999644729 10.00000000000000000000 1.00000000000000000000 10.00000000000000177636 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000088 0 -5.00000000000000088818 -4.99999999999999644729 1.00000000000000000000 -5.00000000000000088818 0.00000000000000177636 1.00000000000000000000 +TrimBy 00000085 0 -10.00000000000000177636 -4.99999999999999911182 1.00000000000000000000 -5.00000000000000088818 -4.99999999999999644729 1.00000000000000000000 +TrimBy 00000086 0 -10.00000000000000000000 0.00000000000000044409 1.00000000000000000000 -10.00000000000000177636 -4.99999999999999911182 1.00000000000000000000 +TrimBy 00000087 0 -5.00000000000000088818 0.00000000000000177636 1.00000000000000000000 -10.00000000000000000000 0.00000000000000044409 1.00000000000000000000 +TrimBy 0000008c 0 4.99999999999999822364 -4.99999999999999822364 1.00000000000000000000 4.99999999999999911182 0.00000000000000177636 1.00000000000000000000 +TrimBy 00000089 0 -0.00000000000000177636 -4.99999999999999911182 1.00000000000000000000 4.99999999999999822364 -4.99999999999999822364 1.00000000000000000000 +TrimBy 0000008a 0 -0.00000000000000088818 0.00000000000000177636 1.00000000000000000000 -0.00000000000000177636 -4.99999999999999911182 1.00000000000000000000 +TrimBy 0000008b 0 4.99999999999999911182 0.00000000000000177636 1.00000000000000000000 -0.00000000000000088818 0.00000000000000177636 1.00000000000000000000 +TrimBy 00000090 0 14.99999999999999644729 -4.99999999999999822364 1.00000000000000000000 15.00000000000000000000 0.00000000000000266454 1.00000000000000000000 +TrimBy 0000008d 0 10.00000000000000177636 -4.99999999999999822364 1.00000000000000000000 14.99999999999999644729 -4.99999999999999822364 1.00000000000000000000 +TrimBy 0000008e 0 10.00000000000000177636 0.00000000000000266454 1.00000000000000000000 10.00000000000000177636 -4.99999999999999822364 1.00000000000000000000 +TrimBy 0000008f 0 15.00000000000000000000 0.00000000000000266454 1.00000000000000000000 10.00000000000000177636 0.00000000000000266454 1.00000000000000000000 +TrimBy 00000094 0 -5.00000000000000000000 -14.99999999999999822364 1.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000091 0 -10.00000000000000000000 -14.99999999999999644729 1.00000000000000000000 -5.00000000000000000000 -14.99999999999999822364 1.00000000000000000000 +TrimBy 00000092 0 -10.00000000000000000000 -10.00000000000000177636 1.00000000000000000000 -10.00000000000000000000 -14.99999999999999644729 1.00000000000000000000 +TrimBy 00000093 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -10.00000000000000177636 1.00000000000000000000 +TrimBy 00000098 0 4.99999999999999911182 -14.99999999999999644729 1.00000000000000000000 4.99999999999999822364 -10.00000000000000177636 1.00000000000000000000 +TrimBy 00000095 0 -0.00000000000000177636 -14.99999999999999822364 1.00000000000000000000 4.99999999999999911182 -14.99999999999999644729 1.00000000000000000000 +TrimBy 00000096 0 -0.00000000000000266454 -10.00000000000000000000 1.00000000000000000000 -0.00000000000000177636 -14.99999999999999822364 1.00000000000000000000 +TrimBy 00000097 0 4.99999999999999822364 -10.00000000000000177636 1.00000000000000000000 -0.00000000000000266454 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000009c 0 14.99999999999999644729 -14.99999999999999644729 1.00000000000000000000 14.99999999999999644729 -10.00000000000000177636 1.00000000000000000000 +TrimBy 00000099 0 10.00000000000000177636 -14.99999999999999644729 1.00000000000000000000 14.99999999999999644729 -14.99999999999999644729 1.00000000000000000000 +TrimBy 0000009a 0 10.00000000000000355271 -10.00000000000000355271 1.00000000000000000000 10.00000000000000177636 -14.99999999999999644729 1.00000000000000000000 +TrimBy 0000009b 0 14.99999999999999644729 -10.00000000000000177636 1.00000000000000000000 10.00000000000000355271 -10.00000000000000355271 1.00000000000000000000 +AddSurface +Surface 00000002 00646464 8003002d 1 1 +SCtrl 0 0 20.00000000010000178463 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000010000178463 -20.00000000010000178463 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -15.00000000000000000000 -20.00000000010000178463 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000008 1 20.00000000010000178463 15.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 0000000b 1 20.00000000010000178463 -20.00000000010000178463 0.00000000000000000000 20.00000000010000178463 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000002 1 -15.00000000000000000000 -20.00000000010000178463 0.00000000000000000000 20.00000000010000178463 -20.00000000010000178463 0.00000000000000000000 +TrimBy 00000005 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 -20.00000000010000178463 0.00000000000000000000 +TrimBy 000000a0 0 -5.00000000000000177636 10.00000000000000177636 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000009e 0 -10.00000000000000177636 5.00000000000000266454 0.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000009f 0 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -5.00000000000000177636 10.00000000000000177636 0.00000000000000000000 +TrimBy 0000009d 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -10.00000000000000177636 5.00000000000000266454 0.00000000000000000000 +TrimBy 000000a4 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 4.99999999999999822364 5.00000000000000000000 0.00000000000000000000 +TrimBy 000000a2 0 0.00000000000000133227 5.00000000000000000000 0.00000000000000000000 0.00000000000000377476 10.00000000000000000000 0.00000000000000000000 +TrimBy 000000a3 0 0.00000000000000377476 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 000000a1 0 4.99999999999999822364 5.00000000000000000000 0.00000000000000000000 0.00000000000000133227 5.00000000000000000000 0.00000000000000000000 +TrimBy 000000a8 0 14.99999999999999822364 10.00000000000000000000 0.00000000000000000000 15.00000000000000000000 4.99999999999999911182 0.00000000000000000000 +TrimBy 000000a6 0 10.00000000000000000000 5.00000000000000088818 0.00000000000000000000 9.99999999999999822364 10.00000000000000177636 0.00000000000000000000 +TrimBy 000000a7 0 9.99999999999999822364 10.00000000000000177636 0.00000000000000000000 14.99999999999999822364 10.00000000000000000000 0.00000000000000000000 +TrimBy 000000a5 0 15.00000000000000000000 4.99999999999999911182 0.00000000000000000000 10.00000000000000000000 5.00000000000000088818 0.00000000000000000000 +TrimBy 000000ac 0 -5.00000000000000000000 0.00000000000000177636 0.00000000000000000000 -5.00000000000000088818 -4.99999999999999644729 0.00000000000000000000 +TrimBy 000000aa 0 -10.00000000000000000000 -4.99999999999999822364 0.00000000000000000000 -10.00000000000000000000 0.00000000000000088818 0.00000000000000000000 +TrimBy 000000ab 0 -10.00000000000000000000 0.00000000000000088818 0.00000000000000000000 -5.00000000000000000000 0.00000000000000177636 0.00000000000000000000 +TrimBy 000000a9 0 -5.00000000000000088818 -4.99999999999999644729 0.00000000000000000000 -10.00000000000000000000 -4.99999999999999822364 0.00000000000000000000 +TrimBy 000000b0 0 5.00000000000000000000 0.00000000000000266454 0.00000000000000000000 4.99999999999999911182 -4.99999999999999733546 0.00000000000000000000 +TrimBy 000000ae 0 0.00000000000000177636 -4.99999999999999822364 0.00000000000000000000 0.00000000000000266454 0.00000000000000266454 0.00000000000000000000 +TrimBy 000000af 0 0.00000000000000266454 0.00000000000000266454 0.00000000000000000000 5.00000000000000000000 0.00000000000000266454 0.00000000000000000000 +TrimBy 000000ad 0 4.99999999999999911182 -4.99999999999999733546 0.00000000000000000000 0.00000000000000177636 -4.99999999999999822364 0.00000000000000000000 +TrimBy 000000b4 0 15.00000000000000000000 0.00000000000000155431 0.00000000000000000000 15.00000000000000355271 -4.99999999999999911182 0.00000000000000000000 +TrimBy 000000b2 0 10.00000000000000000000 -4.99999999999999911182 0.00000000000000000000 10.00000000000000000000 0.00000000000000266454 0.00000000000000000000 +TrimBy 000000b3 0 10.00000000000000000000 0.00000000000000266454 0.00000000000000000000 15.00000000000000000000 0.00000000000000155431 0.00000000000000000000 +TrimBy 000000b1 0 15.00000000000000355271 -4.99999999999999911182 0.00000000000000000000 10.00000000000000000000 -4.99999999999999911182 0.00000000000000000000 +TrimBy 000000b8 0 -5.00000000000000088818 -10.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -14.99999999999999822364 0.00000000000000000000 +TrimBy 000000b6 0 -10.00000000000000177636 -14.99999999999999644729 0.00000000000000000000 -10.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000b7 0 -10.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 -5.00000000000000088818 -10.00000000000000000000 0.00000000000000000000 +TrimBy 000000b5 0 -5.00000000000000000000 -14.99999999999999822364 0.00000000000000000000 -10.00000000000000177636 -14.99999999999999644729 0.00000000000000000000 +TrimBy 000000bc 0 5.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 5.00000000000000088818 -15.00000000000000000000 0.00000000000000000000 +TrimBy 000000ba 0 0.00000000000000177636 -14.99999999999999644729 0.00000000000000000000 0.00000000000000355271 -10.00000000000000355271 0.00000000000000000000 +TrimBy 000000bb 0 0.00000000000000355271 -10.00000000000000355271 0.00000000000000000000 5.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000b9 0 5.00000000000000088818 -15.00000000000000000000 0.00000000000000000000 0.00000000000000177636 -14.99999999999999644729 0.00000000000000000000 +TrimBy 000000c0 0 15.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 14.99999999999999822364 -14.99999999999999822364 0.00000000000000000000 +TrimBy 000000be 0 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 9.99999999999999822364 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000bf 0 9.99999999999999822364 -10.00000000000000177636 0.00000000000000000000 15.00000000000000000000 -10.00000000000000177636 0.00000000000000000000 +TrimBy 000000bd 0 14.99999999999999822364 -14.99999999999999822364 0.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000003 00646464 80030010 1 1 +SCtrl 0 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000001 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 00000002 0 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +TrimBy 00000003 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 0000000c 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000004 00646464 80030019 1 1 +SCtrl 0 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000004 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 00000005 0 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000006 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000003 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000005 00646464 80030022 1 1 +SCtrl 0 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000007 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000008 0 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +TrimBy 00000009 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 00000006 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000006 00646464 80030007 1 1 +SCtrl 0 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000a 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +TrimBy 0000000b 0 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +TrimBy 0000000c 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +TrimBy 00000009 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000007 00646464 8007000f 1 1 +SCtrl 0 0 -10.00000000000000000000 4.99999999989999999173 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -4.99999999989999999173 4.99999999989999999173 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -4.99999999989999999173 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000008 00646464 80070010 1 1 +SCtrl 0 0 -4.99999999989999999173 4.99999999989999999173 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 4.99999999989999999173 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -4.99999999989999999173 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000009 00646464 8007009f 1 1 +SCtrl 0 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000000d 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000000e 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000000f 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000018 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000a 00646464 800700a8 1 1 +SCtrl 0 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000010 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000011 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000012 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000000f 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000b 00646464 800700b1 1 1 +SCtrl 0 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000013 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000014 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000015 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000012 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000c 00646464 80070097 1 1 +SCtrl 0 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000016 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000017 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000018 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000015 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000000d 00646464 8007001f 1 1 +SCtrl 0 0 0.00000000000000000000 4.99999999989999999173 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000010000000827 4.99999999989999999173 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000010000000827 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000000e 00646464 80070020 1 1 +SCtrl 0 0 5.00000000010000000827 4.99999999989999999173 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 4.99999999989999999173 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000010000000827 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000000f 00646464 800700bc 1 1 +SCtrl 0 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000019 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000001a 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000001b 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000024 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000010 00646464 800700c5 1 1 +SCtrl 0 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000001c 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000001d 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 0000001e 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000001b 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000011 00646464 800700ce 1 1 +SCtrl 0 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000001f 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000020 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000021 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000001e 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000012 00646464 800700b4 1 1 +SCtrl 0 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000022 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000023 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 00000024 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000021 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000013 00646464 8007002f 1 1 +SCtrl 0 0 10.00000000000000000000 4.99999999989999999173 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000010000000827 4.99999999989999999173 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000010000000827 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000014 00646464 80070030 1 1 +SCtrl 0 0 15.00000000010000000827 4.99999999989999999173 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 4.99999999989999999173 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000010000000827 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000015 00646464 800700d9 1 1 +SCtrl 0 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000026 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000025 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000030 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 00000027 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000016 00646464 800700e2 1 1 +SCtrl 0 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000029 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +TrimBy 00000028 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000027 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000002a 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000017 00646464 800700eb 1 1 +SCtrl 0 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000002c 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000002b 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000002a 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 0000002d 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000018 00646464 800700d1 1 1 +SCtrl 0 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000002f 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +TrimBy 0000002e 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +TrimBy 0000002d 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +TrimBy 00000030 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000019 00646464 8007003f 1 1 +SCtrl 0 0 -10.00000000000000000000 -5.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -4.99999999989999999173 -5.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -4.99999999989999999173 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000001a 00646464 80070040 1 1 +SCtrl 0 0 -4.99999999989999999173 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -4.99999999989999999173 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000001b 00646464 800700fc 1 1 +SCtrl 0 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000031 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000032 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000033 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000003c 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001c 00646464 80070105 1 1 +SCtrl 0 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000034 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000035 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000036 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000033 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001d 00646464 8007010e 1 1 +SCtrl 0 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000037 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000038 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000039 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000036 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001e 00646464 800700f4 1 1 +SCtrl 0 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000003a 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000003b 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000003c 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000039 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000001f 00646464 8007004f 1 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000010000000827 -5.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000010000000827 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000020 00646464 80070050 1 1 +SCtrl 0 0 5.00000000010000000827 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000010000000827 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000021 00646464 80070119 1 1 +SCtrl 0 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000003d 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000003e 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000003f 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000048 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000022 00646464 80070122 1 1 +SCtrl 0 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000040 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000041 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000042 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000003f 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000023 00646464 8007012b 1 1 +SCtrl 0 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000043 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000044 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000045 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000042 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000024 00646464 80070111 1 1 +SCtrl 0 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000046 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000047 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000048 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000045 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 00000025 00646464 8007005f 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000010000000827 -5.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000010000000827 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000026 00646464 80070060 1 1 +SCtrl 0 0 15.00000000010000000827 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000010000000827 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000027 00646464 80070136 1 1 +SCtrl 0 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000004a 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 00000049 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000054 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000004b 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000028 00646464 8007013f 1 1 +SCtrl 0 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000004d 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +TrimBy 0000004c 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 0000004b 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 0000004e 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000029 00646464 80070148 1 1 +SCtrl 0 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000050 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 0000004f 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 0000004e 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000051 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002a 00646464 8007012e 1 1 +SCtrl 0 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000053 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +TrimBy 00000052 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +TrimBy 00000051 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +TrimBy 00000054 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002b 00646464 8007006f 1 1 +SCtrl 0 0 -10.00000000000000000000 -15.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -4.99999999989999999173 -15.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -4.99999999989999999173 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000002c 00646464 80070070 1 1 +SCtrl 0 0 -4.99999999989999999173 -15.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -15.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -4.99999999989999999173 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 0000002d 00646464 80070159 1 1 +SCtrl 0 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000056 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000055 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000060 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000057 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002e 00646464 80070162 1 1 +SCtrl 0 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000059 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000058 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000057 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000005a 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 0000002f 00646464 8007016b 1 1 +SCtrl 0 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000005c 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 0000005b 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000005a 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000005d 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000030 00646464 80070151 1 1 +SCtrl 0 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000005f 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 0000005e 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000005d 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000060 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000031 00646464 8007007f 1 1 +SCtrl 0 0 0.00000000000000000000 -15.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000010000000827 -15.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000010000000827 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000032 00646464 80070080 1 1 +SCtrl 0 0 5.00000000010000000827 -15.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -15.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000010000000827 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000033 00646464 80070176 1 1 +SCtrl 0 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000062 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000061 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000006c 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000063 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000034 00646464 8007017f 1 1 +SCtrl 0 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000065 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000064 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000063 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000066 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000035 00646464 80070188 1 1 +SCtrl 0 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000068 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000067 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000066 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000069 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000036 00646464 8007016e 1 1 +SCtrl 0 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000006b 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 0000006a 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000069 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 0000006c 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddSurface +Surface 00000037 00646464 8007008f 1 1 +SCtrl 0 0 10.00000000000000000000 -15.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000010000000827 -15.00000000010000000827 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000010000000827 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000038 00646464 80070090 1 1 +SCtrl 0 0 15.00000000010000000827 -15.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -15.00000000010000000827 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000010000000827 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +AddSurface +Surface 00000039 00646464 80070193 1 1 +SCtrl 0 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 0000006d 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 0000006e 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 0000006f 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000078 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000003a 00646464 8007019c 1 1 +SCtrl 0 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000070 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000071 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000072 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 0000006f 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000003b 00646464 800701a5 1 1 +SCtrl 0 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000073 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +TrimBy 00000074 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000075 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000072 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddSurface +Surface 0000003c 00646464 8007018b 1 1 +SCtrl 0 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 0 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +SCtrl 1 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +TrimBy 00000076 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +TrimBy 00000077 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +TrimBy 00000078 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +TrimBy 00000075 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddSurface +Curve 00000001 1 1 00000001 00000003 +CCtrl 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000002 1 1 00000002 00000003 +CCtrl 0 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000003 1 1 00000003 00000004 +CCtrl 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000004 1 1 00000001 00000004 +CCtrl 0 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000005 1 1 00000002 00000004 +CCtrl 0 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000006 1 1 00000004 00000005 +CCtrl 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000007 1 1 00000001 00000005 +CCtrl 0 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000008 1 1 00000002 00000005 +CCtrl 0 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -15.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000009 1 1 00000005 00000006 +CCtrl 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000a 1 1 00000001 00000006 +CCtrl 0 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000000b 1 1 00000002 00000006 +CCtrl 0 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 15.00000000000000000000 0.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000c 1 1 00000006 00000003 +CCtrl 0 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 1.00000000000000000000 +CurvePt 1 20.00000000000000000000 -20.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000d 1 1 00000007 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000000e 1 1 00000008 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000000f 1 1 00000009 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000010 1 1 00000007 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000011 1 1 00000008 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000012 1 1 0000000a 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000013 1 1 00000007 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000014 1 1 00000008 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000015 1 1 0000000b 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000016 1 1 00000007 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000017 1 1 00000008 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000018 1 1 0000000c 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000019 1 1 0000000d 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000001a 1 1 0000000e 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001b 1 1 0000000f 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001c 1 1 0000000d 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000001d 1 1 0000000e 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001e 1 1 00000010 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000001f 1 1 0000000d 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000020 1 1 0000000e 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000021 1 1 00000011 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000022 1 1 0000000d 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000023 1 1 0000000e 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000024 1 1 00000012 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000025 1 1 00000013 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000026 1 1 00000014 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000027 1 1 00000015 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000028 1 1 00000013 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000029 1 1 00000014 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002a 1 1 00000016 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002b 1 1 00000013 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000002c 1 1 00000014 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002d 1 1 00000017 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000002e 1 1 00000013 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000002f 1 1 00000014 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000030 1 1 00000018 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000031 1 1 00000019 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000032 1 1 0000001a 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000033 1 1 0000001b 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000034 1 1 00000019 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000035 1 1 0000001a 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000036 1 1 0000001c 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000037 1 1 00000019 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000038 1 1 0000001a 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000039 1 1 0000001d 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003a 1 1 00000019 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000003b 1 1 0000001a 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003c 1 1 0000001e 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003d 1 1 0000001f 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000003e 1 1 00000020 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000003f 1 1 00000021 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000040 1 1 0000001f 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000041 1 1 00000020 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000042 1 1 00000022 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000043 1 1 0000001f 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000044 1 1 00000020 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000045 1 1 00000023 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000046 1 1 0000001f 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000047 1 1 00000020 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000048 1 1 00000024 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000049 1 1 00000025 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000004a 1 1 00000026 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004b 1 1 00000027 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004c 1 1 00000025 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000004d 1 1 00000026 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004e 1 1 00000028 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000004f 1 1 00000025 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000050 1 1 00000026 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000051 1 1 00000029 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000052 1 1 00000025 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000053 1 1 00000026 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000054 1 1 0000002a 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000055 1 1 0000002b 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000056 1 1 0000002c 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000057 1 1 0000002d 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000058 1 1 0000002b 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000059 1 1 0000002c 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005a 1 1 0000002e 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005b 1 1 0000002b 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000005c 1 1 0000002c 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005d 1 1 0000002f 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000005e 1 1 0000002b 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000005f 1 1 0000002c 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000060 1 1 00000030 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000061 1 1 00000031 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000062 1 1 00000032 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000063 1 1 00000033 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000064 1 1 00000031 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000065 1 1 00000032 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000066 1 1 00000034 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000067 1 1 00000031 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000068 1 1 00000032 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000069 1 1 00000035 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006a 1 1 00000031 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000006b 1 1 00000032 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006c 1 1 00000036 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006d 1 1 00000037 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000006e 1 1 00000038 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000006f 1 1 00000039 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000070 1 1 00000037 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000071 1 1 00000038 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000072 1 1 0000003a 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000073 1 1 00000037 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000074 1 1 00000038 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000075 1 1 0000003b 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000076 1 1 00000037 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000077 1 1 00000038 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000078 1 1 0000003c 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 00000079 1 1 00000001 00000009 +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007a 1 1 00000001 0000000a +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007b 1 1 00000001 0000000b +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007c 1 1 00000001 0000000c +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007d 1 1 00000001 0000000f +CCtrl 0 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007e 1 1 00000001 00000010 +CCtrl 0 -0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000007f 1 1 00000001 00000011 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000080 1 1 00000001 00000012 +CCtrl 0 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000081 1 1 00000001 00000015 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000082 1 1 00000001 00000016 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000083 1 1 00000001 00000017 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000084 1 1 00000001 00000018 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000085 1 1 00000001 0000001b +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000086 1 1 00000001 0000001c +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000087 1 1 00000001 0000001d +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000088 1 1 00000001 0000001e +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000089 1 1 00000001 00000021 +CCtrl 0 -0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008a 1 1 00000001 00000022 +CCtrl 0 -0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008b 1 1 00000001 00000023 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008c 1 1 00000001 00000024 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008d 1 1 00000001 00000027 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008e 1 1 00000001 00000028 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000008f 1 1 00000001 00000029 +CCtrl 0 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000090 1 1 00000001 0000002a +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000091 1 1 00000001 0000002d +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000092 1 1 00000001 0000002e +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000093 1 1 00000001 0000002f +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000094 1 1 00000001 00000030 +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000095 1 1 00000001 00000033 +CCtrl 0 -0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000096 1 1 00000001 00000034 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000097 1 1 00000001 00000035 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000098 1 1 00000001 00000036 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 00000099 1 1 00000001 00000039 +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009a 1 1 00000001 0000003a +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009b 1 1 00000001 0000003b +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009c 1 1 00000001 0000003c +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 1.00000000000000000000 +AddCurve +Curve 0000009d 1 1 00000002 00000009 +CCtrl 0 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000009e 1 1 00000002 0000000a +CCtrl 0 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 0000009f 1 1 00000002 0000000b +CCtrl 0 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a0 1 1 00000002 0000000c +CCtrl 0 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a1 1 1 00000002 0000000f +CCtrl 0 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a2 1 1 00000002 00000010 +CCtrl 0 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a3 1 1 00000002 00000011 +CCtrl 0 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a4 1 1 00000002 00000012 +CCtrl 0 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a5 1 1 00000002 00000015 +CCtrl 0 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a6 1 1 00000002 00000016 +CCtrl 0 10.00000000000000000000 5.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a7 1 1 00000002 00000017 +CCtrl 0 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a8 1 1 00000002 00000018 +CCtrl 0 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000a9 1 1 00000002 0000001b +CCtrl 0 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000aa 1 1 00000002 0000001c +CCtrl 0 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ab 1 1 00000002 0000001d +CCtrl 0 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ac 1 1 00000002 0000001e +CCtrl 0 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ad 1 1 00000002 00000021 +CCtrl 0 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ae 1 1 00000002 00000022 +CCtrl 0 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000af 1 1 00000002 00000023 +CCtrl 0 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b0 1 1 00000002 00000024 +CCtrl 0 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b1 1 1 00000002 00000027 +CCtrl 0 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b2 1 1 00000002 00000028 +CCtrl 0 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 0.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b3 1 1 00000002 00000029 +CCtrl 0 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b4 1 1 00000002 0000002a +CCtrl 0 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 0.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -5.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b5 1 1 00000002 0000002d +CCtrl 0 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b6 1 1 00000002 0000002e +CCtrl 0 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b7 1 1 00000002 0000002f +CCtrl 0 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b8 1 1 00000002 00000030 +CCtrl 0 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 -5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000b9 1 1 00000002 00000033 +CCtrl 0 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000ba 1 1 00000002 00000034 +CCtrl 0 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000bb 1 1 00000002 00000035 +CCtrl 0 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 0.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000bc 1 1 00000002 00000036 +CCtrl 0 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 5.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 5.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000bd 1 1 00000002 00000039 +CCtrl 0 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000be 1 1 00000002 0000003a +CCtrl 0 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000bf 1 1 00000002 0000003b +CCtrl 0 10.00000000000000000000 -10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -10.00000000000000000000 -0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 10.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +AddCurve +Curve 000000c0 1 1 00000002 0000003c +CCtrl 0 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CCtrl 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 Weight 1.00000000000000000000 +CurvePt 1 15.00000000000000000000 -10.00000000000000000000 0.00000000000000000000 +CurvePt 1 15.00000000000000000000 -15.00000000000000000000 0.00000000000000000000 +AddCurve diff --git a/test/group/translate_nd/test.cpp b/test/group/translate_nd/test.cpp new file mode 100644 index 0000000..0d1b8d6 --- /dev/null +++ b/test/group/translate_nd/test.cpp @@ -0,0 +1,12 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/harness.cpp b/test/harness.cpp new file mode 100644 index 0000000..a41db43 --- /dev/null +++ b/test/harness.cpp @@ -0,0 +1,429 @@ +//----------------------------------------------------------------------------- +// Our harness for running test cases, and reusable checks. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include + +#include "solvespace.h" + +#include "harness.h" + +#if defined(WIN32) +# include +#else +# include +#endif + +namespace SolveSpace { +namespace Platform { + // These are defined in guinone.cpp, and aren't exposed in solvespace.h. + extern std::vector fontFiles; +} +} + + +#ifdef TEST_BUILD_ON_WINDOWS +static const char *VALID_BUILD_PATH_SEPS = "/\\"; +static char BUILD_PATH_SEP = '\\'; +#else +static const char *VALID_BUILD_PATH_SEPS = "/"; +static char BUILD_PATH_SEP = '/'; +#endif + +static std::string BuildRoot() { + static std::string rootDir; + if(!rootDir.empty()) return rootDir; + + rootDir = __FILE__; + rootDir.erase(rootDir.find_last_of(VALID_BUILD_PATH_SEPS) + 1); + return rootDir; +} + +static Platform::Path HostRoot() { + static Platform::Path rootDir; + if(!rootDir.IsEmpty()) return rootDir; + + // No especially good way to do this, so let's assume somewhere up from + // the current directory there's our repository, with CMakeLists.txt, and + // pivot from there. + rootDir = Platform::Path::CurrentDirectory(); + + // We're never more than four levels deep. + for(size_t i = 0; i < 4; i++) { + FILE *f = OpenFile(rootDir.Join("CMakeLists.txt"), "r"); + if(f) { + fclose(f); + rootDir = rootDir.Join("test"); + return rootDir; + } + rootDir = rootDir.Parent(); + } + + ssassert(false, "Couldn't locate repository root"); +} + +enum class Color { + Red, + Green, + DarkGreen +}; + +static std::string Colorize(Color color, std::string input) { +#if !defined(WIN32) + if(isatty(fileno(stdout))) { + switch(color) { + case Color::Red: + return "\e[1;31m" + input + "\e[0m"; + case Color::Green: + return "\e[1;32m" + input + "\e[0m"; + case Color::DarkGreen: + return "\e[36m" + input + "\e[0m"; + } + } +#endif + return input; +} + +// Normalizes a savefile. Different platforms have slightly different floating-point +// behavior, so if we want to compare savefiles byte-by-byte, we need to do something +// to get rid of irrelevant differences in LSB. +static std::string PrepareSavefile(std::string data) { + // Round everything to 2**30 ~ 1e9 + const double precision = pow(2, 30); + + size_t lineBegin = 0; + while(lineBegin < data.length()) { + size_t nextLineBegin = data.find('\n', lineBegin); + if(nextLineBegin == std::string::npos) { + nextLineBegin = data.length(); + } else { + nextLineBegin++; + } + + size_t eqPos = data.find('=', lineBegin); + if(eqPos < nextLineBegin) { + std::string key = data.substr(lineBegin, eqPos - lineBegin), + value = data.substr(eqPos + 1, nextLineBegin - eqPos - 2); + + for(int i = 0; SolveSpaceUI::SAVED[i].type != 0; i++) { + if(SolveSpaceUI::SAVED[i].fmt != 'f') continue; + if(SolveSpaceUI::SAVED[i].desc != key) continue; + double f = strtod(value.c_str(), NULL); + f = round(f * precision) / precision; + std::string newValue = ssprintf("%.20f", f); + ssassert(value.size() == newValue.size(), "Expected no change in value length"); + std::copy(newValue.begin(), newValue.end(), + data.begin() + eqPos + 1); + } + + if(key == "Group.impFile") { + data.erase(lineBegin, nextLineBegin - lineBegin); + nextLineBegin = lineBegin; + } + } + + size_t spPos = data.find(' ', lineBegin); + if(spPos < nextLineBegin) { + std::string cmd = data.substr(lineBegin, spPos - lineBegin); + if(!cmd.empty()) { + if(cmd == "Surface" || cmd == "SCtrl" || cmd == "TrimBy" || + cmd == "Curve" || cmd == "CCtrl" || cmd == "CurvePt") { + data.erase(lineBegin, nextLineBegin - lineBegin); + nextLineBegin = lineBegin; + } + } + } + + lineBegin = nextLineBegin; + } + return data; +} + +bool Test::Helper::RecordCheck(bool success) { + checkCount++; + if(!success) failCount++; + return success; +} + +void Test::Helper::PrintFailure(const char *file, int line, std::string msg) { + std::string shortFile = file; + shortFile.erase(0, BuildRoot().size()); + fprintf(stderr, "test%c%s:%d: FAILED: %s\n", + BUILD_PATH_SEP, shortFile.c_str(), line, msg.c_str()); +} + +Platform::Path Test::Helper::GetAssetPath(std::string testFile, std::string assetName, + std::string mangle) { + if(!mangle.empty()) { + assetName.insert(assetName.rfind('.'), "." + mangle); + } + testFile.erase(0, BuildRoot().size()); + testFile.erase(testFile.find_last_of(VALID_BUILD_PATH_SEPS) + 1); + return HostRoot().Join(Platform::Path::FromPortable(testFile + assetName)); +} + +bool Test::Helper::CheckBool(const char *file, int line, const char *expr, bool value, + bool reference) { + if(!RecordCheck(value == reference)) { + std::string msg = ssprintf("(%s) = %s ≠ %s", expr, + value ? "true" : "false", + reference ? "true" : "false"); + PrintFailure(file, line, msg); + return false; + } else { + return true; + } +} + +bool Test::Helper::CheckEqualString(const char *file, int line, const char *valueExpr, + const std::string &value, const std::string &reference) { + if(!RecordCheck(value == reference)) { + std::string msg = ssprintf("(%s) = \"%s\" ≠ \"%s\"", valueExpr, + value.c_str(), reference.c_str()); + PrintFailure(file, line, msg); + return false; + } else { + return true; + } +} + +bool Test::Helper::CheckEqualEpsilon(const char *file, int line, const char *valueExpr, + double value, double reference) { + bool result = fabs(value - reference) < LENGTH_EPS; + if(!RecordCheck(result)) { + std::string msg = ssprintf("(%s) = %.4g ≉ %.4g", valueExpr, + value, reference); + PrintFailure(file, line, msg); + return false; + } else { + return true; + } +} + +bool Test::Helper::CheckLoad(const char *file, int line, const char *fixture) { + Platform::Path fixturePath = GetAssetPath(file, fixture); + + FILE *f = OpenFile(fixturePath, "rb"); + bool fixtureExists = (f != NULL); + if(f) fclose(f); + + bool result = fixtureExists && SS.LoadFromFile(fixturePath); + if(!RecordCheck(result)) { + PrintFailure(file, line, + ssprintf("loading file '%s'", fixturePath.raw.c_str())); + return false; + } else { + SS.AfterNewFile(); + SS.GW.offset = {}; + SS.GW.scale = 10.0; + return true; + } +} + +bool Test::Helper::CheckSave(const char *file, int line, const char *reference) { + Platform::Path refPath = GetAssetPath(file, reference), + outPath = GetAssetPath(file, reference, "out"); + if(!RecordCheck(SS.SaveToFile(outPath))) { + PrintFailure(file, line, + ssprintf("saving file '%s'", refPath.raw.c_str())); + return false; + } else { + std::string refData, outData; + ReadFile(refPath, &refData); + ReadFile(outPath, &outData); + if(!RecordCheck(PrepareSavefile(refData) == PrepareSavefile(outData))) { + PrintFailure(file, line, "savefile doesn't match reference"); + return false; + } + + RemoveFile(outPath); + return true; + } +} + +bool Test::Helper::CheckRender(const char *file, int line, const char *reference) { + // First, render to a framebuffer. + Camera camera = {}; + camera.pixelRatio = 1; + camera.gridFit = true; + camera.width = 600; + camera.height = 600; + camera.projUp = SS.GW.projUp; + camera.projRight = SS.GW.projRight; + camera.scale = SS.GW.scale; + + CairoPixmapRenderer pixmapCanvas; + pixmapCanvas.SetLighting(SS.GW.GetLighting()); + pixmapCanvas.SetCamera(camera); + pixmapCanvas.Init(); + + pixmapCanvas.StartFrame(); + SS.GW.Draw(&pixmapCanvas); + pixmapCanvas.FlushFrame(); + pixmapCanvas.FinishFrame(); + std::shared_ptr frame = pixmapCanvas.ReadFrame(); + + pixmapCanvas.Clear(); + + // Now, diff framebuffer against reference render. + Platform::Path refPath = GetAssetPath(file, reference), + outPath = GetAssetPath(file, reference, "out"), + diffPath = GetAssetPath(file, reference, "diff"); + + std::shared_ptr refPixmap = Pixmap::ReadPng(refPath, /*flip=*/true); + if(!RecordCheck(refPixmap && refPixmap->Equals(*frame))) { + frame->WritePng(outPath, /*flip=*/true); + + if(!refPixmap) { + PrintFailure(file, line, "reference render not present"); + return false; + } + + ssassert(refPixmap->format == frame->format, "Expected buffer formats to match"); + if(refPixmap->width != frame->width || + refPixmap->height != frame->height) { + PrintFailure(file, line, "render doesn't match reference; dimensions differ"); + } else { + std::shared_ptr diffPixmap = + Pixmap::Create(refPixmap->format, refPixmap->width, refPixmap->height); + + int diffPixelCount = 0; + for(size_t j = 0; j < refPixmap->height; j++) { + for(size_t i = 0; i < refPixmap->width; i++) { + if(!refPixmap->GetPixel(i, j).Equals(frame->GetPixel(i, j))) { + diffPixelCount++; + diffPixmap->SetPixel(i, j, RgbaColor::From(255, 0, 0, 255)); + } + } + } + + diffPixmap->WritePng(diffPath, /*flip=*/true); + std::string message = + ssprintf("render doesn't match reference; %d (%.2f%%) pixels differ", + diffPixelCount, + 100.0 * diffPixelCount / (refPixmap->width * refPixmap->height)); + PrintFailure(file, line, message); + } + return false; + } else { + RemoveFile(outPath); + RemoveFile(diffPath); + return true; + } +} + +bool Test::Helper::CheckRenderXY(const char *file, int line, const char *fixture) { + SS.GW.projRight = Vector::From(1, 0, 0); + SS.GW.projUp = Vector::From(0, 1, 0); + return CheckRender(file, line, fixture); +} + +bool Test::Helper::CheckRenderIso(const char *file, int line, const char *fixture) { + SS.GW.projRight = Vector::From(0.707, 0.000, -0.707); + SS.GW.projUp = Vector::From(-0.408, 0.816, -0.408); + return CheckRender(file, line, fixture); +} + +// Avoid global constructors; using a global static vector instead of a local one +// breaks MinGW for some obscure reason. +static std::vector *testCasesPtr; +int Test::Case::Register(Test::Case testCase) { + static std::vector testCases; + testCases.push_back(testCase); + testCasesPtr = &testCases; + return 0; +} + +int main(int argc, char **argv) { + std::vector args = Platform::InitCli(argc, argv); + + std::string filterPattern = ".*"; + unsigned int seed = std::random_device{}(); + if(args.size() == 1) { + } else if(args.size() == 2) { + filterPattern = args[1]; + } else if(args.size() == 3) { + filterPattern = args[1]; + seed = std::stoul(args[2]); + } else { + fprintf(stderr, "Usage: %s [test filter regex] [shuffle seed]\n", args[0].c_str()); + return 1; + } + + fprintf(stderr, "info: using test filter `%s' and seed %u\n", filterPattern.c_str(), seed); + + Platform::fontFiles.push_back(HostRoot().Join("Gentium-R.ttf")); + + std::mt19937 g(seed); + + // Wreck order dependencies between tests! + std::shuffle(testCasesPtr->begin(), testCasesPtr->end(), g); + + std::regex filter(filterPattern); + + auto testStartTime = std::chrono::steady_clock::now(); + size_t ranTally = 0, skippedTally = 0, checkTally = 0, failTally = 0; + for(Test::Case &testCase : *testCasesPtr) { + std::string testCaseName = testCase.fileName; + testCaseName.erase(0, BuildRoot().size()); + testCaseName.erase(testCaseName.find_last_of(VALID_BUILD_PATH_SEPS)); + testCaseName += BUILD_PATH_SEP + testCase.caseName; + + std::smatch filterMatch; + if(!std::regex_search(testCaseName, filterMatch, filter)) { + skippedTally += 1; + continue; + } + + SS.Init(); + SS.showToolbar = false; + SS.checkClosedContour = false; + + Test::Helper helper = {}; + testCase.fn(&helper); + + SK.Clear(); + SS.Clear(); + + ranTally += 1; + checkTally += helper.checkCount; + failTally += helper.failCount; + if(helper.checkCount == 0) { + fprintf(stderr, " %s test %s (empty)\n", + Colorize(Color::Red, "??").c_str(), + Colorize(Color::DarkGreen, testCaseName).c_str()); + } else if(helper.failCount > 0) { + fprintf(stderr, " %s test %s\n", + Colorize(Color::Red, "NG").c_str(), + Colorize(Color::DarkGreen, testCaseName).c_str()); + } else { + fprintf(stderr, " %s test %s\n", + Colorize(Color::Green, "OK").c_str(), + Colorize(Color::DarkGreen, testCaseName).c_str()); + } + } + + auto testEndTime = std::chrono::steady_clock::now(); + std::chrono::duration testTime = testEndTime - testStartTime; + + if(failTally > 0) { + fprintf(stderr, "Failure! %u checks failed\n", + (unsigned)failTally); + } else { + fprintf(stderr, "Success! %u test cases (%u skipped), %u checks, %.3fs\n", + (unsigned)ranTally, (unsigned)skippedTally, + (unsigned)checkTally, testTime.count()); + } + + // At last, try to reset all caches we or our dependencies have, to make SNR + // of memory checking tools like valgrind higher. + cairo_debug_reset_static_data(); + + return (failTally > 0); +} diff --git a/test/harness.h b/test/harness.h new file mode 100644 index 0000000..91b6d60 --- /dev/null +++ b/test/harness.h @@ -0,0 +1,78 @@ +//----------------------------------------------------------------------------- +// Our harness for running test cases, and reusable checks. +// +// Copyright 2016 whitequark +//----------------------------------------------------------------------------- +#include +#include + +#include "platform/platform.h" + +// Hack... we should rename the ones in ui.h instead. +#undef CHECK_TRUE +#undef CHECK_FALSE + +namespace SolveSpace { +namespace Test { + +class Helper { +public: + size_t checkCount; + size_t failCount; + + bool RecordCheck(bool success); + void PrintFailure(const char *file, int line, std::string msg); + Platform::Path GetAssetPath(std::string testFile, std::string assetName, + std::string mangle = ""); + + bool CheckBool(const char *file, int line, const char *expr, + bool value, bool reference); + bool CheckEqualString(const char *file, int line, const char *valueExpr, + const std::string &value, const std::string &reference); + bool CheckEqualEpsilon(const char *file, int line, const char *valueExpr, + double value, double reference); + bool CheckLoad(const char *file, int line, const char *fixture); + bool CheckSave(const char *file, int line, const char *reference); + bool CheckRender(const char *file, int line, const char *fixture); + bool CheckRenderXY(const char *file, int line, const char *fixture); + bool CheckRenderIso(const char *file, int line, const char *fixture); +}; + +class Case { +public: + std::string fileName; + std::string caseName; + std::function fn; + + static int Register(Case testCase); +}; + +} +} + +using namespace SolveSpace; + +#define TEST_CASE(name) \ + static void Test_##name(Test::Helper *); \ + static Test::Case TestCase_##name = { __FILE__, #name, Test_##name }; \ + static int TestReg_##name = Test::Case::Register(TestCase_##name); \ + static void Test_##name(Test::Helper *helper) // { ... } + +#define CHECK_TRUE(cond) \ + do { if(!helper->CheckBool(__FILE__, __LINE__, #cond, cond, true)) return; } while(0) +#define CHECK_FALSE(cond) \ + do { if(!helper->CheckBool(__FILE__, __LINE__, #cond, cond, false)) return; } while(0) +#define CHECK_EQ_STR(value, reference) \ + do { if(!helper->CheckEqualString(__FILE__, __LINE__, \ + #value, value, reference)) return; } while(0) +#define CHECK_EQ_EPS(value, reference) \ + do { if(!helper->CheckEqualEpsilon(__FILE__, __LINE__, \ + #value, value, reference)) return; } while(0) +#define CHECK_LOAD(fixture) \ + do { if(!helper->CheckLoad(__FILE__, __LINE__, fixture)) return; } while(0) +#define CHECK_SAVE(fixture) \ + do { if(!helper->CheckSave(__FILE__, __LINE__, fixture)) return; } while(0) +#define CHECK_RENDER(reference) \ + do { if(!helper->CheckRenderXY(__FILE__, __LINE__, reference)) return; } while(0) +#define CHECK_RENDER_ISO(reference) \ + do { if(!helper->CheckRenderIso(__FILE__, __LINE__, reference)) return; } while(0) diff --git a/test/request/arc_of_circle/normal.png b/test/request/arc_of_circle/normal.png new file mode 100644 index 0000000..2839007 Binary files /dev/null and b/test/request/arc_of_circle/normal.png differ diff --git a/test/request/arc_of_circle/normal.slvs b/test/request/arc_of_circle/normal.slvs new file mode 100644 index 0000000..aaa6b8f --- /dev/null +++ b/test/request/arc_of_circle/normal.slvs @@ -0,0 +1,306 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/arc_of_circle/normal_v20.slvs b/test/request/arc_of_circle/normal_v20.slvs new file mode 100644 index 0000000..78d983b --- /dev/null +++ b/test/request/arc_of_circle/normal_v20.slvs @@ -0,0 +1,306 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/arc_of_circle/normal_v22.slvs b/test/request/arc_of_circle/normal_v22.slvs new file mode 100644 index 0000000..6f92e0e --- /dev/null +++ b/test/request/arc_of_circle/normal_v22.slvs @@ -0,0 +1,306 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=500 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=14000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/arc_of_circle/test.cpp b/test/request/arc_of_circle/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/request/arc_of_circle/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/request/circle/free_in_3d.png b/test/request/circle/free_in_3d.png new file mode 100644 index 0000000..31e2499 Binary files /dev/null and b/test/request/circle/free_in_3d.png differ diff --git a/test/request/circle/free_in_3d.slvs b/test/request/circle/free_in_3d.slvs new file mode 100644 index 0000000..41287aa --- /dev/null +++ b/test/request/circle/free_in_3d.slvs @@ -0,0 +1,294 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00040021 +AddParam + +Param.h.v.=00040022 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/circle/free_in_3d_dof.png b/test/request/circle/free_in_3d_dof.png new file mode 100644 index 0000000..2b5dff0 Binary files /dev/null and b/test/request/circle/free_in_3d_dof.png differ diff --git a/test/request/circle/free_in_3d_v20.slvs b/test/request/circle/free_in_3d_v20.slvs new file mode 100644 index 0000000..6966f95 --- /dev/null +++ b/test/request/circle/free_in_3d_v20.slvs @@ -0,0 +1,292 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00040021 +AddParam + +Param.h.v.=00040022 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/circle/free_in_3d_v22.slvs b/test/request/circle/free_in_3d_v22.slvs new file mode 100644 index 0000000..ff35698 --- /dev/null +++ b/test/request/circle/free_in_3d_v22.slvs @@ -0,0 +1,294 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00040021 +AddParam + +Param.h.v.=00040022 +AddParam + +Param.h.v.=00040023 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/circle/normal.png b/test/request/circle/normal.png new file mode 100644 index 0000000..31e2499 Binary files /dev/null and b/test/request/circle/normal.png differ diff --git a/test/request/circle/normal.slvs b/test/request/circle/normal.slvs new file mode 100644 index 0000000..1ea104f --- /dev/null +++ b/test/request/circle/normal.slvs @@ -0,0 +1,283 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/circle/normal_dof.png b/test/request/circle/normal_dof.png new file mode 100644 index 0000000..0e62eba Binary files /dev/null and b/test/request/circle/normal_dof.png differ diff --git a/test/request/circle/normal_v20.slvs b/test/request/circle/normal_v20.slvs new file mode 100644 index 0000000..cdd2810 --- /dev/null +++ b/test/request/circle/normal_v20.slvs @@ -0,0 +1,283 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/circle/normal_v22.slvs b/test/request/circle/normal_v22.slvs new file mode 100644 index 0000000..d245f28 --- /dev/null +++ b/test/request/circle/normal_v22.slvs @@ -0,0 +1,283 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040040 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=400 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=13000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.distance.v=00040040 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040040 +Entity.type=4000 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actDistance=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/circle/test.cpp b/test/request/circle/test.cpp new file mode 100644 index 0000000..9a5d536 --- /dev/null +++ b/test/request/circle/test.cpp @@ -0,0 +1,47 @@ +#include "solvespace.h" + +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(free_in_3d_roundtrip) { + CHECK_LOAD("free_in_3d.slvs"); + CHECK_RENDER("free_in_3d.png"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v20) { + CHECK_LOAD("free_in_3d_v20.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(free_in_3d_migrate_from_v22) { + CHECK_LOAD("free_in_3d_v22.slvs"); + CHECK_SAVE("free_in_3d.slvs"); +} + +TEST_CASE(normal_dof) { + CHECK_LOAD("normal.slvs"); + SS.GenerateAll(SolveSpaceUI::Generate::ALL, /*andFindFree=*/true); + CHECK_RENDER("normal_dof.png"); +} + +TEST_CASE(free_in_3d_dof) { + CHECK_LOAD("free_in_3d.slvs"); + SS.GenerateAll(SolveSpaceUI::Generate::ALL, /*andFindFree=*/true); + CHECK_RENDER_ISO("free_in_3d_dof.png"); +} diff --git a/test/request/cubic/normal.png b/test/request/cubic/normal.png new file mode 100644 index 0000000..e7eb94d Binary files /dev/null and b/test/request/cubic/normal.png differ diff --git a/test/request/cubic/normal.slvs b/test/request/cubic/normal.slvs new file mode 100644 index 0000000..7eb93f8 --- /dev/null +++ b/test/request/cubic/normal.slvs @@ -0,0 +1,348 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=0004001c +AddParam + +Param.h.v.=0004001d +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=0004001f +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040020 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.extraPoints=2 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.point[4].v=00040005 +Entity.point[5].v=00040006 +Entity.extraPoints=2 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040005 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040006 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/cubic/normal_v20.slvs b/test/request/cubic/normal_v20.slvs new file mode 100644 index 0000000..9c93a8e --- /dev/null +++ b/test/request/cubic/normal_v20.slvs @@ -0,0 +1,348 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=0004001c +AddParam + +Param.h.v.=0004001d +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=0004001f +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040020 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.extraPoints=2 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.point[4].v=00040005 +Entity.point[5].v=00040006 +Entity.extraPoints=2 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040005 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040006 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/cubic/normal_v22.slvs b/test/request/cubic/normal_v22.slvs new file mode 100644 index 0000000..7630fad --- /dev/null +++ b/test/request/cubic/normal_v22.slvs @@ -0,0 +1,348 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=0004001c +AddParam + +Param.h.v.=0004001d +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=0004001f +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040020 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=300 +Request.extraPoints=2 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.point[4].v=00040005 +Entity.point[5].v=00040006 +Entity.extraPoints=2 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040005 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=-10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040006 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/cubic/test.cpp b/test/request/cubic/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/request/cubic/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/request/cubic_periodic/normal.png b/test/request/cubic_periodic/normal.png new file mode 100644 index 0000000..f98b7c6 Binary files /dev/null and b/test/request/cubic_periodic/normal.png differ diff --git a/test/request/cubic_periodic/normal.slvs b/test/request/cubic_periodic/normal.slvs new file mode 100644 index 0000000..9d3f1ce --- /dev/null +++ b/test/request/cubic_periodic/normal.slvs @@ -0,0 +1,316 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=301 +Request.extraPoints=1 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.extraPoints=1 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/cubic_periodic/normal_v20.slvs b/test/request/cubic_periodic/normal_v20.slvs new file mode 100644 index 0000000..bd8dd4d --- /dev/null +++ b/test/request/cubic_periodic/normal_v20.slvs @@ -0,0 +1,314 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=301 +Request.extraPoints=1 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.extraPoints=1 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/cubic_periodic/normal_v22.slvs b/test/request/cubic_periodic/normal_v22.slvs new file mode 100644 index 0000000..d4f9c72 --- /dev/null +++ b/test/request/cubic_periodic/normal_v22.slvs @@ -0,0 +1,316 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040017 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=-10.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=301 +Request.extraPoints=1 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=12001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.extraPoints=1 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-10.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/cubic_periodic/test.cpp b/test/request/cubic_periodic/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/request/cubic_periodic/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/request/datum_point/normal.png b/test/request/datum_point/normal.png new file mode 100644 index 0000000..6184e0c Binary files /dev/null and b/test/request/datum_point/normal.png differ diff --git a/test/request/datum_point/normal.slvs b/test/request/datum_point/normal.slvs new file mode 100644 index 0000000..867c76b --- /dev/null +++ b/test/request/datum_point/normal.slvs @@ -0,0 +1,252 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/datum_point/normal_v20.slvs b/test/request/datum_point/normal_v20.slvs new file mode 100644 index 0000000..afec571 --- /dev/null +++ b/test/request/datum_point/normal_v20.slvs @@ -0,0 +1,250 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/datum_point/normal_v22.slvs b/test/request/datum_point/normal_v22.slvs new file mode 100644 index 0000000..50f8877 --- /dev/null +++ b/test/request/datum_point/normal_v22.slvs @@ -0,0 +1,252 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=101 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/datum_point/test.cpp b/test/request/datum_point/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/request/datum_point/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/request/image/drawing.png b/test/request/image/drawing.png new file mode 100644 index 0000000..56bedb7 Binary files /dev/null and b/test/request/image/drawing.png differ diff --git a/test/request/image/linked.png b/test/request/image/linked.png new file mode 100644 index 0000000..8667e34 Binary files /dev/null and b/test/request/image/linked.png differ diff --git a/test/request/image/linked.slvs b/test/request/image/linked.slvs new file mode 100644 index 0000000..4819058 --- /dev/null +++ b/test/request/image/linked.slvs @@ -0,0 +1,430 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000003 +Group.type=5300 +Group.order=2 +Group.name=normal +Group.activeWorkplane.v=00010000 +Group.color=00646464 +Group.skipFirst=0 +Group.meshCombine=2 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ + 1 00010000 0 + 2 00010001 0 + 3 00010020 0 + 4 00020000 0 + 5 00020001 0 + 6 00020020 0 + 7 00030000 0 + 8 00030001 0 + 9 00030020 0 + 10 00040000 0 + 11 00040001 0 + 12 00040002 0 + 13 00040003 0 + 14 00040004 0 + 15 00040020 0 + 16 80020000 0 + 17 80020001 0 + 18 80020002 0 +} +Group.impFileRel=normal.slvs +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=40000001 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=80030000 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030001 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=80030002 +AddParam + +Param.h.v.=80030003 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=80030004 +AddParam + +Param.h.v.=80030005 +AddParam + +Param.h.v.=80030006 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=0 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030002 +Entity.type=2011 +Entity.construction=1 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030003 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030005 +Entity.type=2011 +Entity.construction=1 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030006 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030005 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030008 +Entity.type=2011 +Entity.construction=1 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030009 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030008 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000a +Entity.type=16000 +Entity.construction=0 +Entity.file=drawing.png +Entity.point[0].v=8003000b +Entity.point[1].v=8003000c +Entity.point[2].v=8003000d +Entity.point[3].v=8003000e +Entity.normal.v=8003000f +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000b +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000c +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000d +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000e +Entity.type=2011 +Entity.construction=0 +Entity.actPoint.x=20.00000000000000000000 +Entity.actPoint.y=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=8003000f +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=8003000b +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030011 +Entity.type=3011 +Entity.construction=0 +Entity.point[0].v=80030012 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80030012 +Entity.type=2011 +Entity.construction=1 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=110 +Constraint.group.v=00000003 +Constraint.workplane.v=00010000 +Constraint.valP.v=40000001 +Constraint.entityA.v=80030006 +Constraint.entityB.v=00020020 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/request/image/normal.png b/test/request/image/normal.png new file mode 100644 index 0000000..a44f72d Binary files /dev/null and b/test/request/image/normal.png differ diff --git a/test/request/image/normal.slvs b/test/request/image/normal.slvs new file mode 100644 index 0000000..dab1385 --- /dev/null +++ b/test/request/image/normal.slvs @@ -0,0 +1,319 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +Param.val=10.00000000000000000000 +AddParam + +Param.h.v.=00040013 +AddParam + +Param.h.v.=00040014 +AddParam + +Param.h.v.=00040016 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=00040017 +AddParam + +Param.h.v.=00040019 +Param.val=15.00000000000000000000 +AddParam + +Param.h.v.=0004001a +Param.val=10.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=700 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +Request.file=drawing.png +Request.aspectRatio=1.50000000000000000000 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=16000 +Entity.construction=0 +Entity.file=drawing.png +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=15.00000000000000000000 +Entity.actPoint.y=10.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/image/test.cpp b/test/request/image/test.cpp new file mode 100644 index 0000000..a9507be --- /dev/null +++ b/test/request/image/test.cpp @@ -0,0 +1,13 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(linked_roundtrip) { + CHECK_LOAD("linked.slvs"); + CHECK_RENDER("linked.png"); + CHECK_SAVE("linked.slvs"); +} diff --git a/test/request/line_segment/normal.png b/test/request/line_segment/normal.png new file mode 100644 index 0000000..a7b1c34 Binary files /dev/null and b/test/request/line_segment/normal.png differ diff --git a/test/request/line_segment/normal.slvs b/test/request/line_segment/normal.slvs new file mode 100644 index 0000000..4914fef --- /dev/null +++ b/test/request/line_segment/normal.slvs @@ -0,0 +1,278 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/line_segment/normal_v20.slvs b/test/request/line_segment/normal_v20.slvs new file mode 100644 index 0000000..fb26b9f --- /dev/null +++ b/test/request/line_segment/normal_v20.slvs @@ -0,0 +1,278 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/line_segment/normal_v22.slvs b/test/request/line_segment/normal_v22.slvs new file mode 100644 index 0000000..167a2c2 --- /dev/null +++ b/test/request/line_segment/normal_v22.slvs @@ -0,0 +1,278 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=200 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=11000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/line_segment/test.cpp b/test/request/line_segment/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/request/line_segment/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/request/ttf_text/kerning.png b/test/request/ttf_text/kerning.png new file mode 100644 index 0000000..4d6eab0 Binary files /dev/null and b/test/request/ttf_text/kerning.png differ diff --git a/test/request/ttf_text/kerning.slvs b/test/request/ttf_text/kerning.slvs new file mode 100644 index 0000000..c0f8a7f --- /dev/null +++ b/test/request/ttf_text/kerning.slvs @@ -0,0 +1,331 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=23.08769405528209262002 +AddParam + +Param.h.v.=00040017 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=23.08769405528209262002 +AddParam + +Param.h.v.=0004001a +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=600 +Request.extraPoints=1 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +Request.str=Text +Request.font=Gentium-R.ttf +Request.aspectRatio=2.80876940552820908437 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=15000 +Entity.construction=0 +Entity.str=Text +Entity.font=Gentium-R.ttf +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.extraPoints=1 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=23.08769405528209262002 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=23.08769405528209262002 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/ttf_text/normal.png b/test/request/ttf_text/normal.png new file mode 100644 index 0000000..b023b83 Binary files /dev/null and b/test/request/ttf_text/normal.png differ diff --git a/test/request/ttf_text/normal.slvs b/test/request/ttf_text/normal.slvs new file mode 100644 index 0000000..229c63b --- /dev/null +++ b/test/request/ttf_text/normal.slvs @@ -0,0 +1,329 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040016 +Param.val=23.92131768269594616072 +AddParam + +Param.h.v.=00040017 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040019 +Param.val=23.92131768269594616072 +AddParam + +Param.h.v.=0004001a +Param.val=5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=600 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +Request.str=Text +Request.font=Gentium-R.ttf +Request.aspectRatio=2.89213176826959461607 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=15000 +Entity.construction=0 +Entity.str=Text +Entity.font=Gentium-R.ttf +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.point[2].v=00040003 +Entity.point[3].v=00040004 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040003 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=23.92131768269594616072 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040004 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=23.92131768269594616072 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/ttf_text/normal_v20.slvs b/test/request/ttf_text/normal_v20.slvs new file mode 100644 index 0000000..65bc54a --- /dev/null +++ b/test/request/ttf_text/normal_v20.slvs @@ -0,0 +1,290 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=600 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +Request.str=Text +Request.font=Gentium-R.ttf +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=15000 +Entity.construction=0 +Entity.str=Text +Entity.font=GOST.ttf +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/ttf_text/normal_v22.slvs b/test/request/ttf_text/normal_v22.slvs new file mode 100644 index 0000000..3022dcf --- /dev/null +++ b/test/request/ttf_text/normal_v22.slvs @@ -0,0 +1,292 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.activeWorkplane.v=80020000 +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040011 +Param.val=5.00000000000000000000 +AddParam + +Param.h.v.=00040013 +Param.val=-5.00000000000000000000 +AddParam + +Param.h.v.=00040014 +Param.val=-5.00000000000000000000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=600 +Request.workplane.v=80020000 +Request.group.v=00000002 +Request.construction=0 +Request.str=Text +Request.font=Gentium-R.ttf +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=15000 +Entity.construction=0 +Entity.str=Text +Entity.font=Gentium-R.ttf +Entity.point[0].v=00040001 +Entity.point[1].v=00040002 +Entity.normal.v=00040020 +Entity.workplane.v=80020000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040002 +Entity.type=2001 +Entity.construction=0 +Entity.workplane.v=80020000 +Entity.actPoint.x=-5.00000000000000000000 +Entity.actPoint.y=-5.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3001 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.workplane.v=80020000 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + diff --git a/test/request/ttf_text/test.cpp b/test/request/ttf_text/test.cpp new file mode 100644 index 0000000..2937f79 --- /dev/null +++ b/test/request/ttf_text/test.cpp @@ -0,0 +1,23 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(kerning_roundtrip) { + CHECK_LOAD("kerning.slvs"); + CHECK_RENDER("kerning.png"); + CHECK_SAVE("kerning.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/test/request/workplane/normal.png b/test/request/workplane/normal.png new file mode 100644 index 0000000..30862b3 Binary files /dev/null and b/test/request/workplane/normal.png differ diff --git a/test/request/workplane/normal.slvs b/test/request/workplane/normal.slvs new file mode 100644 index 0000000..de433f9 --- /dev/null +++ b/test/request/workplane/normal.slvs @@ -0,0 +1,293 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.88047623921714945894 +AddParam + +Param.h.v.=00040021 +Param.val=-0.27984814233312144127 +AddParam + +Param.h.v.=00040022 +Param.val=-0.36470519963100095362 +AddParam + +Param.h.v.=00040023 +Param.val=-0.11591689595929521861 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=100 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.88047623921714945894 +Entity.actNormal.vx=-0.27984814233312144127 +Entity.actNormal.vy=-0.36470519963100095362 +Entity.actNormal.vz=-0.11591689595929521861 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=1 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/request/workplane/normal_v20.slvs b/test/request/workplane/normal_v20.slvs new file mode 100644 index 0000000..f239329 --- /dev/null +++ b/test/request/workplane/normal_v20.slvs @@ -0,0 +1,291 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allDimsReference=0 +Group.remap={ +} +Group.impFile= +Group.impFileRel= +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.88047623921714946000 +AddParam + +Param.h.v.=00040021 +Param.val=-0.27984814233312144000 +AddParam + +Param.h.v.=00040022 +Param.val=-0.36470519963100095000 +AddParam + +Param.h.v.=00040023 +Param.val=-0.11591689595929522000 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=100 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.88047623921714946000 +Entity.actNormal.vx=-0.27984814233312144000 +Entity.actNormal.vy=-0.36470519963100095000 +Entity.actNormal.vz=-0.11591689595929522000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/request/workplane/normal_v22.slvs b/test/request/workplane/normal_v22.slvs new file mode 100644 index 0000000..d79e899 --- /dev/null +++ b/test/request/workplane/normal_v22.slvs @@ -0,0 +1,293 @@ +±²³SolveSpaceREVa + + +Group.h.v=00000001 +Group.type=5000 +Group.name=#references +Group.color=ff000000 +Group.skipFirst=0 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Group.h.v=00000002 +Group.type=5001 +Group.order=1 +Group.name=sketch-in-plane +Group.color=ff000000 +Group.subtype=6000 +Group.skipFirst=0 +Group.predef.q.w=1.00000000000000000000 +Group.predef.origin.v=00010001 +Group.predef.swapUV=0 +Group.predef.negateU=0 +Group.predef.negateV=0 +Group.visible=1 +Group.suppress=0 +Group.relaxConstraints=0 +Group.allowRedundant=0 +Group.allDimsReference=0 +Group.scale=1.00000000000000000000 +Group.remap={ +} +AddGroup + +Param.h.v.=00010010 +AddParam + +Param.h.v.=00010011 +AddParam + +Param.h.v.=00010012 +AddParam + +Param.h.v.=00010020 +Param.val=1.00000000000000000000 +AddParam + +Param.h.v.=00010021 +AddParam + +Param.h.v.=00010022 +AddParam + +Param.h.v.=00010023 +AddParam + +Param.h.v.=00020010 +AddParam + +Param.h.v.=00020011 +AddParam + +Param.h.v.=00020012 +AddParam + +Param.h.v.=00020020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020021 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020022 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00020023 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030010 +AddParam + +Param.h.v.=00030011 +AddParam + +Param.h.v.=00030012 +AddParam + +Param.h.v.=00030020 +Param.val=0.50000000000000000000 +AddParam + +Param.h.v.=00030021 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030022 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00030023 +Param.val=-0.50000000000000000000 +AddParam + +Param.h.v.=00040010 +AddParam + +Param.h.v.=00040011 +AddParam + +Param.h.v.=00040012 +AddParam + +Param.h.v.=00040020 +Param.val=0.88047623921714945894 +AddParam + +Param.h.v.=00040021 +Param.val=-0.27984814233312144127 +AddParam + +Param.h.v.=00040022 +Param.val=-0.36470519963100095362 +AddParam + +Param.h.v.=00040023 +Param.val=-0.11591689595929521861 +AddParam + +Request.h.v=00000001 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000002 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000003 +Request.type=100 +Request.group.v=00000001 +Request.construction=0 +AddRequest + +Request.h.v=00000004 +Request.type=100 +Request.group.v=00000002 +Request.construction=0 +AddRequest + +Entity.h.v=00010000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.normal.v=00010020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00010020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00010001 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.normal.v=00020020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00020020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00020001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=0.50000000000000000000 +Entity.actNormal.vy=0.50000000000000000000 +Entity.actNormal.vz=0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.normal.v=00030020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00030020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00030001 +Entity.actNormal.w=0.50000000000000000000 +Entity.actNormal.vx=-0.50000000000000000000 +Entity.actNormal.vy=-0.50000000000000000000 +Entity.actNormal.vz=-0.50000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.normal.v=00040020 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040001 +Entity.type=2000 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Entity.h.v=00040020 +Entity.type=3000 +Entity.construction=0 +Entity.point[0].v=00040001 +Entity.actNormal.w=0.88047623921714945894 +Entity.actNormal.vx=-0.27984814233312144127 +Entity.actNormal.vy=-0.36470519963100095362 +Entity.actNormal.vz=-0.11591689595929521861 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020000 +Entity.type=10000 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.normal.v=80020001 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020001 +Entity.type=3010 +Entity.construction=0 +Entity.point[0].v=80020002 +Entity.actNormal.w=1.00000000000000000000 +Entity.actVisible=1 +AddEntity + +Entity.h.v=80020002 +Entity.type=2012 +Entity.construction=0 +Entity.actVisible=1 +AddEntity + +Constraint.h.v=00000001 +Constraint.type=20 +Constraint.group.v=00000002 +Constraint.ptA.v=00010001 +Constraint.ptB.v=00040001 +Constraint.other=0 +Constraint.other2=0 +Constraint.reference=0 +AddConstraint + diff --git a/test/request/workplane/test.cpp b/test/request/workplane/test.cpp new file mode 100644 index 0000000..5e9db1b --- /dev/null +++ b/test/request/workplane/test.cpp @@ -0,0 +1,17 @@ +#include "harness.h" + +TEST_CASE(normal_roundtrip) { + CHECK_LOAD("normal.slvs"); + CHECK_RENDER("normal.png"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v20) { + CHECK_LOAD("normal_v20.slvs"); + CHECK_SAVE("normal.slvs"); +} + +TEST_CASE(normal_migrate_from_v22) { + CHECK_LOAD("normal_v22.slvs"); + CHECK_SAVE("normal.slvs"); +} diff --git a/wishlist.txt b/wishlist.txt new file mode 100644 index 0000000..f9db34a --- /dev/null +++ b/wishlist.txt @@ -0,0 +1,19 @@ +O(n*log(n)) assembly of edges into contours +fix anti-aliased edge bug with filled contours +crude DXF, HPGL import +a request to import a plane thing +make export assemble only contours in same group +rotation of model view works about z of first point under cursor +a way to kill a slow operation + +----- +rounding, as a special group +associative entities from solid model, as a special group +better level of detail +some kind of import +faster triangulation +loop detection +IGES export +incremental regen of entities + +