mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
1 Commits
integratio
...
CR33141a
Author | SHA1 | Date | |
---|---|---|---|
|
b2c892d216 |
@@ -3,7 +3,7 @@
|
||||
# See the cotire manual for usage hints.
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright 2012-2018 Sascha Kratky
|
||||
# Copyright 2012-2016 Sascha Kratky
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
@@ -32,18 +32,16 @@ if(__COTIRE_INCLUDED)
|
||||
endif()
|
||||
set(__COTIRE_INCLUDED TRUE)
|
||||
|
||||
# call cmake_minimum_required, but prevent modification of the CMake policy stack in include mode
|
||||
# cmake_minimum_required also sets the policy version as a side effect, which we have to avoid
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(PUSH)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.8.1")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
|
||||
|
||||
# activate select policies
|
||||
if (POLICY CMP0025)
|
||||
@@ -106,11 +104,6 @@ if (POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0055)
|
||||
# strict checking for break() command
|
||||
cmake_policy(SET CMP0055 NEW)
|
||||
endif()
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(ProcessorCount)
|
||||
|
||||
@@ -239,13 +232,7 @@ function (cotire_filter_language_source_files _language _target _sourceFilesVar
|
||||
# add to excluded sources, if file has custom compile flags
|
||||
list (APPEND _excludedSourceFiles "${_sourceFile}")
|
||||
else()
|
||||
get_source_file_property(_sourceCompileOptions "${_sourceFile}" COMPILE_OPTIONS)
|
||||
if (_sourceCompileOptions)
|
||||
# add to excluded sources, if file has list of custom compile options
|
||||
list (APPEND _excludedSourceFiles "${_sourceFile}")
|
||||
else()
|
||||
list (APPEND _sourceFiles "${_sourceFile}")
|
||||
endif()
|
||||
list (APPEND _sourceFiles "${_sourceFile}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -304,7 +291,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
|
||||
set (${_valuesVar} ${_values} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (cotire_resolve_config_properties _configurations _propertiesVar)
|
||||
function (cotire_resolve_config_properites _configurations _propertiesVar)
|
||||
set (_properties "")
|
||||
foreach (_property ${ARGN})
|
||||
if ("${_property}" MATCHES "<CONFIG>")
|
||||
@@ -320,8 +307,8 @@ function (cotire_resolve_config_properties _configurations _propertiesVar)
|
||||
set (${_propertiesVar} ${_properties} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (cotire_copy_set_properties _configurations _type _source _target)
|
||||
cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
|
||||
function (cotire_copy_set_properites _configurations _type _source _target)
|
||||
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN})
|
||||
foreach (_property ${_properties})
|
||||
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
|
||||
if (_isSet)
|
||||
@@ -331,18 +318,13 @@ function (cotire_copy_set_properties _configurations _type _source _target)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
|
||||
function (cotire_get_target_usage_requirements _target _targetRequirementsVar)
|
||||
set (_targetRequirements "")
|
||||
get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES)
|
||||
while (_librariesToProcess)
|
||||
# remove from head
|
||||
list (GET _librariesToProcess 0 _library)
|
||||
list (REMOVE_AT _librariesToProcess 0)
|
||||
if (_library MATCHES "^\\$<\\$<CONFIG:${_config}>:([A-Za-z0-9_:-]+)>$")
|
||||
set (_library "${CMAKE_MATCH_1}")
|
||||
elseif (_config STREQUAL "None" AND _library MATCHES "^\\$<\\$<CONFIG:>:([A-Za-z0-9_:-]+)>$")
|
||||
set (_library "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if (TARGET ${_library})
|
||||
list (FIND _targetRequirements ${_library} _index)
|
||||
if (_index LESS 0)
|
||||
@@ -457,7 +439,7 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
|
||||
# interface compile options from linked library targets
|
||||
if (_target)
|
||||
set (_linkedTargets "")
|
||||
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
|
||||
if (_targetOptions)
|
||||
@@ -589,7 +571,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
|
||||
# interface include directories from linked library targets
|
||||
if (_target)
|
||||
set (_linkedTargets "")
|
||||
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_linkedTargetType ${_linkedTarget} TYPE)
|
||||
if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND
|
||||
@@ -643,7 +625,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
|
||||
if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES)
|
||||
list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES})
|
||||
endif()
|
||||
if (WIN32 AND NOT MINGW)
|
||||
if (WIN32)
|
||||
# convert Windows paths in include directories to CMake paths
|
||||
if (_includeDirs)
|
||||
set (_paths "")
|
||||
@@ -719,7 +701,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
|
||||
endif()
|
||||
# interface compile definitions from linked library targets
|
||||
set (_linkedTargets "")
|
||||
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
|
||||
cotire_get_target_usage_requirements(${_target} _linkedTargets)
|
||||
foreach (_linkedTarget ${_linkedTargets})
|
||||
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
|
||||
if (_definitions)
|
||||
@@ -727,7 +709,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
|
||||
endif()
|
||||
endforeach()
|
||||
# parse additional compile definitions from target compile flags
|
||||
# and do not look at directory compile definitions, which we already handled
|
||||
# and don't look at directory compile definitions, which we already handled
|
||||
set (_targetFlags "")
|
||||
cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags)
|
||||
cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags})
|
||||
@@ -875,9 +857,6 @@ macro (cotire_set_cmd_to_prologue _cmdVar)
|
||||
list (APPEND ${_cmdVar} "--warn-uninitialized")
|
||||
endif()
|
||||
list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>")
|
||||
if (XCODE)
|
||||
list (APPEND ${_cmdVar} "-DXCODE:BOOL=TRUE")
|
||||
endif()
|
||||
if (COTIRE_VERBOSE)
|
||||
list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles")
|
||||
@@ -895,9 +874,6 @@ function (cotire_init_compile_cmd _cmdVar _language _compilerLauncher _compilerE
|
||||
if (NOT _compilerArg1)
|
||||
set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1})
|
||||
endif()
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_compilerExe}" _compilerExe)
|
||||
endif()
|
||||
string (STRIP "${_compilerArg1}" _compilerArg1)
|
||||
if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
||||
# compiler launcher is only supported for Makefile and Ninja
|
||||
@@ -924,16 +900,16 @@ function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemInclu
|
||||
foreach (_include ${_includeDirs})
|
||||
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
file (TO_NATIVE_PATH "${_include}" _include)
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
|
||||
else()
|
||||
set (_index -1)
|
||||
if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+")
|
||||
list (FIND ${_systemIncludesVar} "${_include}" _index)
|
||||
endif()
|
||||
if (_index GREATER -1)
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}")
|
||||
else()
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
|
||||
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -1068,10 +1044,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar)
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
elseif (IS_DIRECTORY "${_headerFile}")
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed")
|
||||
# heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path
|
||||
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$")
|
||||
# heuristic: ignore C headers with embedded parent directory references or "-fixed" or "_fixed" in path
|
||||
# these often stem from using GCC #include_next tricks, which may break the precompiled header compilation
|
||||
# with the error message "error: no include path in which to search for header"
|
||||
# with the error message "error: no include path in which to search for header.h"
|
||||
set (${_headerIsIgnoredVar} TRUE)
|
||||
else()
|
||||
set (${_headerIsIgnoredVar} FALSE)
|
||||
@@ -1092,11 +1068,12 @@ endmacro()
|
||||
|
||||
macro (cotire_parse_line _line _headerFileVar _headerDepthVar)
|
||||
if (MSVC)
|
||||
# cl.exe /showIncludes produces different output, depending on the language pack used, e.g.:
|
||||
# cl.exe /showIncludes output looks different depending on the language pack used, e.g.:
|
||||
# English: "Note: including file: C:\directory\file"
|
||||
# German: "Hinweis: Einlesen der Datei: C:\directory\file"
|
||||
# We use a very general regular expression, relying on the presence of the : characters
|
||||
if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$")
|
||||
# Visual Studio compiler output
|
||||
string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar})
|
||||
get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE)
|
||||
else()
|
||||
@@ -1254,19 +1231,11 @@ function (cotire_scan_includes _includesVar)
|
||||
set (${_includesVar} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
# add source files to be scanned
|
||||
if (WIN32)
|
||||
foreach (_sourceFile ${_existingSourceFiles})
|
||||
file (TO_NATIVE_PATH "${_sourceFile}" _sourceFileNative)
|
||||
list (APPEND _cmd "${_sourceFileNative}")
|
||||
endforeach()
|
||||
else()
|
||||
list (APPEND _cmd ${_existingSourceFiles})
|
||||
endif()
|
||||
list (APPEND _cmd ${_existingSourceFiles})
|
||||
if (COTIRE_VERBOSE)
|
||||
message (STATUS "execute_process: ${_cmd}")
|
||||
endif()
|
||||
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
|
||||
if (_option_COMPILER_ID MATCHES "MSVC")
|
||||
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
|
||||
unset (ENV{VS_UNICODE_OUTPUT})
|
||||
endif()
|
||||
@@ -1502,16 +1471,11 @@ function (cotire_generate_prefix_header _prefixFile)
|
||||
if (_unparsedLines)
|
||||
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
|
||||
list (LENGTH _unparsedLines _skippedLineCount)
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_unparsedLinesFile}" _unparsedLinesLogPath)
|
||||
else()
|
||||
set (_unparsedLinesLogPath "${_unparsedLinesFile}")
|
||||
endif()
|
||||
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesLogPath}")
|
||||
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}")
|
||||
endif()
|
||||
string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}")
|
||||
endif()
|
||||
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}\n")
|
||||
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}")
|
||||
endfunction()
|
||||
|
||||
function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar)
|
||||
@@ -1541,7 +1505,7 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
|
||||
# append to list
|
||||
list (APPEND _flags -H -E)
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0")
|
||||
list (APPEND _flags -fdirectives-only)
|
||||
list (APPEND _flags "-fdirectives-only")
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
@@ -1551,36 +1515,16 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
if (UNIX)
|
||||
# Clang options used
|
||||
# -H print the name of each header file used
|
||||
# -E invoke preprocessor
|
||||
# -fno-color-diagnostics do not print diagnostics in color
|
||||
# -Eonly just run preprocessor, no output
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -H -E -fno-color-diagnostics -Xclang -Eonly)
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-H -E -fno-color-diagnostics -Xclang -Eonly")
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
# Clang-cl.exe options used
|
||||
# /TC treat all files named on the command line as C source files
|
||||
# /TP treat all files named on the command line as C++ source files
|
||||
# /EP preprocess to stdout without #line directives
|
||||
# -H print the name of each header file used
|
||||
# -fno-color-diagnostics do not print diagnostics in color
|
||||
# -Eonly just run preprocessor, no output
|
||||
set (_sourceFileTypeC "/TC")
|
||||
set (_sourceFileTypeCXX "/TP")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "${_sourceFileType${_language}}" /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly)
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "${_sourceFileType${_language}} /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly")
|
||||
endif()
|
||||
# Clang options used
|
||||
# -H print the name of each header file used
|
||||
# -E invoke preprocessor
|
||||
# -fno-color-diagnostics don't prints diagnostics in color
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -H -E -fno-color-diagnostics)
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-H -E -fno-color-diagnostics")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
@@ -1654,8 +1598,8 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
|
||||
set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}")
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "GNU")
|
||||
# GCC options used
|
||||
elseif (_compilerID MATCHES "GNU|Clang")
|
||||
# GCC / Clang options used
|
||||
# -x specify the source language
|
||||
# -c compile but do not link
|
||||
# -o place output in file
|
||||
@@ -1665,55 +1609,11 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
|
||||
set (_xLanguage_CXX "c++-header")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
|
||||
list (APPEND _flags "-x" "${_xLanguage_${_language}}" "-c" "${_prefixFile}" -o "${_pchFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
if (UNIX)
|
||||
# Clang options used
|
||||
# -x specify the source language
|
||||
# -c compile but do not link
|
||||
# -o place output in file
|
||||
# -fno-pch-timestamp disable inclusion of timestamp in precompiled headers (clang 4.0.0+)
|
||||
set (_xLanguage_C "c-header")
|
||||
set (_xLanguage_CXX "c++-header")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
|
||||
list (APPEND _flags -Xclang -fno-pch-timestamp)
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
|
||||
set (_flags "${_flags} -Xclang -fno-pch-timestamp")
|
||||
endif()
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
|
||||
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
|
||||
file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative)
|
||||
# Clang-cl.exe options used
|
||||
# /Yc creates a precompiled header file
|
||||
# /Fp specifies precompiled header binary file name
|
||||
# /FI forces inclusion of file
|
||||
# /Zs syntax check only
|
||||
# /TC treat all files named on the command line as C source files
|
||||
# /TP treat all files named on the command line as C++ source files
|
||||
set (_sourceFileTypeC "/TC")
|
||||
set (_sourceFileTypeCXX "/TP")
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "${_sourceFileType${_language}}"
|
||||
"/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
|
||||
endif()
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
|
||||
@@ -1755,28 +1655,20 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
|
||||
get_filename_component(_pchName "${_pchFile}" NAME)
|
||||
set (_xLanguage_C "c-header")
|
||||
set (_xLanguage_CXX "c++-header")
|
||||
set (_pchSuppressMessages FALSE)
|
||||
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
|
||||
set(_pchSuppressMessages TRUE)
|
||||
endif()
|
||||
if (_flags)
|
||||
# append to list
|
||||
if ("${_language}" STREQUAL "CXX")
|
||||
list (APPEND _flags -Kc++)
|
||||
endif()
|
||||
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-create "${_pchName}" -fsyntax-only "${_hostFile}")
|
||||
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
if (NOT _pchSuppressMessages)
|
||||
list (APPEND _flags -Wpch-messages)
|
||||
endif()
|
||||
list (APPEND _flags "-Wpch-messages")
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
if (NOT _pchSuppressMessages)
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -1827,48 +1719,23 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
|
||||
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -Winvalid-pch -include "${_prefixFile}")
|
||||
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Clang")
|
||||
if (UNIX)
|
||||
# Clang options used
|
||||
# -include process include file as the first line of the primary source file
|
||||
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -include "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\"")
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
|
||||
# Clang-cl.exe options used
|
||||
# /Yu uses a precompiled header file during build
|
||||
# /Fp specifies precompiled header binary file name
|
||||
# /FI forces inclusion of file
|
||||
if (_pchFile)
|
||||
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
|
||||
endif()
|
||||
else()
|
||||
# no precompiled header, force inclusion of prefix header
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "/FI${_prefixFileNative}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "/FI\"${_prefixFileNative}\"")
|
||||
endif()
|
||||
endif()
|
||||
# Clang options used
|
||||
# -include process include file as the first line of the primary source file
|
||||
# -include-pch include precompiled header file
|
||||
# -Qunused-arguments don't emit warning for unused driver arguments
|
||||
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"")
|
||||
endif()
|
||||
elseif (_compilerID MATCHES "Intel")
|
||||
if (WIN32)
|
||||
@@ -1912,32 +1779,24 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
|
||||
if (_pchFile)
|
||||
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
|
||||
get_filename_component(_pchName "${_pchFile}" NAME)
|
||||
set (_pchSuppressMessages FALSE)
|
||||
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
|
||||
set(_pchSuppressMessages TRUE)
|
||||
endif()
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-use "${_pchName}")
|
||||
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
if (NOT _pchSuppressMessages)
|
||||
list (APPEND _flags -Wpch-messages)
|
||||
endif()
|
||||
list (APPEND _flags "-Wpch-messages")
|
||||
endif()
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"")
|
||||
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
|
||||
if (NOT _pchSuppressMessages)
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
set (_flags "${_flags} -Wpch-messages")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# no precompiled header, force inclusion of prefix header
|
||||
if (_flags)
|
||||
# append to list
|
||||
list (APPEND _flags -include "${_prefixFile}")
|
||||
list (APPEND _flags "-include" "${_prefixFile}")
|
||||
else()
|
||||
# return as a flag string
|
||||
set (_flags "-include \"${_prefixFile}\"")
|
||||
@@ -1975,17 +1834,9 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
|
||||
if (COTIRE_VERBOSE)
|
||||
message (STATUS "execute_process: ${_cmd}")
|
||||
endif()
|
||||
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
|
||||
if (_option_COMPILER_ID MATCHES "MSVC")
|
||||
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
|
||||
unset (ENV{VS_UNICODE_OUTPUT})
|
||||
elseif (_option_COMPILER_ID MATCHES "Clang" AND _option_COMPILER_VERSION VERSION_LESS "4.0.0")
|
||||
if (_option_COMPILER_LAUNCHER MATCHES "ccache" OR
|
||||
_option_COMPILER_EXECUTABLE MATCHES "ccache")
|
||||
# Newer versions of Clang embed a compilation timestamp into the precompiled header binary,
|
||||
# which results in "file has been modified since the precompiled header was built" errors if ccache is used.
|
||||
# We work around the problem by disabling ccache upon pre-compiling the prefix header.
|
||||
set (ENV{CCACHE_DISABLE} "true")
|
||||
endif()
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${_cmd}
|
||||
@@ -2000,7 +1851,7 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
set (_unsupportedCompiler
|
||||
"Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}")
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC")
|
||||
# PCH supported since Visual Studio C++ 6.0
|
||||
# supported since Visual Studio C++ 6.0
|
||||
# and CMake does not support an earlier version
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU")
|
||||
@@ -2011,16 +1862,8 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
endif()
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
|
||||
if (UNIX)
|
||||
# all Unix Clang versions have PCH support
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
elseif (WIN32)
|
||||
# only clang-cl is supported under Windows
|
||||
get_filename_component(_compilerName "${CMAKE_${_language}_COMPILER}" NAME_WE)
|
||||
if (NOT _compilerName MATCHES "cl$")
|
||||
set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}. Use clang-cl instead." PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
# all Clang versions have PCH support
|
||||
set (${_msgVar} "" PARENT_SCOPE)
|
||||
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel")
|
||||
# Intel PCH support requires version >= 8.0.0
|
||||
if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0")
|
||||
@@ -2031,38 +1874,29 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
|
||||
else()
|
||||
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
|
||||
endif()
|
||||
# check if ccache is used as a compiler launcher
|
||||
get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER)
|
||||
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" REALPATH)
|
||||
if (_realCompilerExe MATCHES "ccache" OR _launcher MATCHES "ccache")
|
||||
# verify that ccache configuration is compatible with precompiled headers
|
||||
# always check environment variable CCACHE_SLOPPINESS, because earlier versions of ccache
|
||||
# do not report the "sloppiness" setting correctly upon printing ccache configuration
|
||||
if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache")
|
||||
if (DEFINED ENV{CCACHE_SLOPPINESS})
|
||||
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR
|
||||
NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
|
||||
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
|
||||
set (${_msgVar}
|
||||
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"."
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
if (_realCompilerExe MATCHES "ccache")
|
||||
set (_ccacheExe "${_realCompilerExe}")
|
||||
if (_launcher MATCHES "ccache")
|
||||
get_filename_component(_ccacheExe "${_launcher}" REALPATH)
|
||||
else()
|
||||
set (_ccacheExe "${_launcher}")
|
||||
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH)
|
||||
endif()
|
||||
# ccache 3.7.0 replaced --print-config with --show-config
|
||||
# use -p instead, which seems to work for all version for now, sigh
|
||||
execute_process(
|
||||
COMMAND "${_ccacheExe}" "-p"
|
||||
COMMAND "${_ccacheExe}" "--print-config"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE _result
|
||||
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
if (_result)
|
||||
set (${_msgVar} "ccache configuration cannot be determined." PARENT_SCOPE)
|
||||
elseif (NOT _ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR
|
||||
NOT _ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
|
||||
if (_result OR NOT
|
||||
_ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT
|
||||
_ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
|
||||
set (${_msgVar}
|
||||
"ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"."
|
||||
PARENT_SCOPE)
|
||||
@@ -2355,7 +2189,7 @@ function (cotire_generate_target_script _language _configurations _target _targe
|
||||
XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES
|
||||
CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION
|
||||
CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1
|
||||
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_SEP_${_language}
|
||||
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP
|
||||
CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
|
||||
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
|
||||
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
|
||||
@@ -2388,9 +2222,8 @@ endfunction()
|
||||
|
||||
function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile)
|
||||
set (_sourceFiles ${ARGN})
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# for MSVC, Intel and Clang-cl, we attach the precompiled header compilation to the host file
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# for Visual Studio and Intel, we attach the precompiled header compilation to the host file
|
||||
# the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion
|
||||
if (_sourceFiles)
|
||||
set (_flags "")
|
||||
@@ -2398,9 +2231,6 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags)
|
||||
set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_hostFile} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}")
|
||||
# make object file generated from host file depend on prefix header
|
||||
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
|
||||
@@ -2438,9 +2268,8 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
|
||||
endfunction()
|
||||
|
||||
function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile)
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# for MSVC, Intel and clang-cl, we include the precompiled header in all but the host file
|
||||
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# for Visual Studio and Intel, we include the precompiled header in all but the host file
|
||||
# the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation
|
||||
set (_sourceFiles ${ARGN})
|
||||
list (LENGTH _sourceFiles _numberOfSourceFiles)
|
||||
@@ -2452,9 +2281,6 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _flags)
|
||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
# make object files generated from source files depend on precompiled header
|
||||
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}")
|
||||
endif()
|
||||
@@ -2468,9 +2294,6 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _flags)
|
||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
# mark sources as cotired to prevent them from being used in another cotired target
|
||||
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
|
||||
endif()
|
||||
@@ -2488,9 +2311,6 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _flags)
|
||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
|
||||
endif()
|
||||
# mark sources as cotired to prevent them from being used in another cotired target
|
||||
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
|
||||
# make object files generated from source files depend on prefix header
|
||||
@@ -2580,7 +2400,7 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
|
||||
message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}")
|
||||
endif()
|
||||
# because CMake PRE_BUILD command does not support dependencies,
|
||||
# we check dependencies explicity in cotire script mode when the pre-build action is run
|
||||
# we check dependencies explicitly in cotire script mode when the pre-build action is run
|
||||
add_custom_command(
|
||||
TARGET "${_target}"
|
||||
PRE_BUILD ${_cmds}
|
||||
@@ -2595,10 +2415,9 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
|
||||
# if this is a single-language target without any excluded files
|
||||
if (_wholeTarget)
|
||||
set (_language "${_languages}")
|
||||
# for MSVC, Intel and clang-cl, precompiled header inclusion is always done on the source file level
|
||||
# for Visual Studio and Intel, precompiled header inclusion is always done on the source file level
|
||||
# see cotire_setup_pch_file_inclusion
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
|
||||
if (_prefixFile)
|
||||
get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER)
|
||||
@@ -2607,9 +2426,6 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
|
||||
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
|
||||
"${_prefixFile}" "${_pchFile}" _options)
|
||||
set_property(TARGET ${_target} APPEND PROPERTY ${_options})
|
||||
if (COTIRE_DEBUG)
|
||||
message (STATUS "set_property: TARGET ${_target} APPEND PROPERTY ${_options}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -2636,8 +2452,7 @@ function (cotire_setup_unity_generation_commands _language _target _targetScript
|
||||
set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths})
|
||||
endif()
|
||||
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# unity file compilation results in potentially huge object file,
|
||||
# thus use /bigobj by default unter cl.exe and Windows Intel
|
||||
# unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel
|
||||
set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj")
|
||||
endif()
|
||||
cotire_set_cmd_to_prologue(_unityCmd)
|
||||
@@ -2843,9 +2658,6 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa
|
||||
else()
|
||||
set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.")
|
||||
endif()
|
||||
if (_disableMsg)
|
||||
set (_targetMsg "${_targetMsg} ${_disableMsg}")
|
||||
endif()
|
||||
else()
|
||||
if (_excludedStr)
|
||||
set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.")
|
||||
@@ -2935,20 +2747,6 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge
|
||||
set (_targetUsePCH FALSE)
|
||||
endif()
|
||||
endif()
|
||||
if (_targetAddSCU)
|
||||
# disable unity builds if automatic Qt processing is used
|
||||
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
|
||||
get_target_property(_targetAutoUic ${_target} AUTOUIC)
|
||||
get_target_property(_targetAutoRcc ${_target} AUTORCC)
|
||||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
|
||||
if (_disableMsg)
|
||||
set (_disableMsg "${_disableMsg} Target uses automatic CMake Qt processing.")
|
||||
else()
|
||||
set (_disableMsg "Target uses automatic CMake Qt processing.")
|
||||
endif()
|
||||
set (_targetAddSCU FALSE)
|
||||
endif()
|
||||
endif()
|
||||
set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH})
|
||||
set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU})
|
||||
cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles})
|
||||
@@ -2976,11 +2774,7 @@ function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar)
|
||||
set (_sourceFiles ${ARGN})
|
||||
get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES)
|
||||
if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)")
|
||||
if (DEFINED CMAKE_MATCH_2)
|
||||
set (_numberOfThreads "${CMAKE_MATCH_2}")
|
||||
else()
|
||||
set (_numberOfThreads "")
|
||||
endif()
|
||||
set (_numberOfThreads "${CMAKE_MATCH_2}")
|
||||
if (NOT _numberOfThreads)
|
||||
# use all available cores
|
||||
ProcessorCount(_numberOfThreads)
|
||||
@@ -3093,9 +2887,8 @@ function (cotire_setup_pch_target _languages _configurations _target)
|
||||
set (_dependsFiles "")
|
||||
foreach (_language ${_languages})
|
||||
set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE)
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
|
||||
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
|
||||
# MSVC, Intel and clang-cl only create precompiled header as a side effect
|
||||
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
# Visual Studio and Intel only create precompiled header as a side effect
|
||||
list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER)
|
||||
endif()
|
||||
cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props})
|
||||
@@ -3143,7 +2936,6 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou
|
||||
list (APPEND _unityTargetSources ${_unityFiles})
|
||||
endif()
|
||||
endforeach()
|
||||
# handle object libraries which are part of the target's sources
|
||||
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)
|
||||
if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$")
|
||||
cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles})
|
||||
@@ -3188,6 +2980,21 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
# determine unity target sources
|
||||
set (_unityTargetSources "")
|
||||
cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources)
|
||||
# handle automatic Qt processing
|
||||
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
|
||||
get_target_property(_targetAutoUic ${_target} AUTOUIC)
|
||||
get_target_property(_targetAutoRcc ${_target} AUTORCC)
|
||||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
|
||||
# if the original target sources are subject to CMake's automatic Qt processing,
|
||||
# also include implicitly generated <targetname>_automoc.cpp file
|
||||
if (CMAKE_VERSION VERSION_LESS "3.8.0")
|
||||
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
|
||||
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
|
||||
else()
|
||||
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
|
||||
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
|
||||
endif()
|
||||
endif()
|
||||
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created
|
||||
set (CMAKE_AUTOMOC OFF)
|
||||
set (CMAKE_AUTOUIC OFF)
|
||||
@@ -3201,6 +3008,21 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
else()
|
||||
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources})
|
||||
endif()
|
||||
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||
# depend on original target's automoc target, if it exists
|
||||
if (TARGET ${_target}_automoc)
|
||||
add_dependencies(${_unityTargetName} ${_target}_automoc)
|
||||
endif()
|
||||
else()
|
||||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
|
||||
# depend on the original target's implicitly generated <targetname>_automoc target
|
||||
if (CMAKE_VERSION VERSION_LESS "3.8.0")
|
||||
add_dependencies(${_unityTargetName} ${_target}_automoc)
|
||||
else()
|
||||
add_dependencies(${_unityTargetName} ${_target}_autogen)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
# copy output location properties
|
||||
set (_outputDirProperties
|
||||
ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>
|
||||
@@ -3212,8 +3034,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}")
|
||||
else()
|
||||
# append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
|
||||
cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
|
||||
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties})
|
||||
foreach (_property ${_properties})
|
||||
get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
|
||||
if (_outputDir)
|
||||
@@ -3233,11 +3055,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
|
||||
endif()
|
||||
else()
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
${_outputDirProperties})
|
||||
endif()
|
||||
# copy output name
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
|
||||
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
|
||||
OUTPUT_NAME OUTPUT_NAME_<CONFIG>
|
||||
@@ -3245,7 +3067,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
PREFIX <CONFIG>_POSTFIX SUFFIX
|
||||
IMPORT_PREFIX IMPORT_SUFFIX)
|
||||
# copy compile stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
|
||||
COMPILE_FLAGS COMPILE_OPTIONS
|
||||
Fortran_FORMAT Fortran_MODULE_DIRECTORY
|
||||
@@ -3257,12 +3079,12 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN
|
||||
C_CLANG_TIDY CXX_CLANG_TIDY)
|
||||
# copy compile features
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED
|
||||
CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED
|
||||
COMPILE_FEATURES)
|
||||
# copy interface stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN
|
||||
COMPATIBLE_INTERFACE_STRING
|
||||
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS
|
||||
@@ -3270,9 +3092,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
|
||||
INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED)
|
||||
# copy link stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUILD_WITH_INSTALL_RPATH BUILD_WITH_INSTALL_NAME_DIR
|
||||
INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
|
||||
LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED
|
||||
LINK_FLAGS LINK_FLAGS_<CONFIG>
|
||||
LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_<CONFIG>
|
||||
@@ -3280,18 +3101,18 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC
|
||||
STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG>
|
||||
NO_SONAME SOVERSION VERSION
|
||||
LINK_WHAT_YOU_USE BUILD_RPATH)
|
||||
LINK_WHAT_YOU_USE)
|
||||
# copy cmake stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
|
||||
# copy Apple platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR
|
||||
MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH
|
||||
OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST
|
||||
IOS_INSTALL_COMBINED XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
|
||||
IOS_INSTALL_COMBINED)
|
||||
# copy Windows platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
GNUtoMS
|
||||
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
|
||||
@@ -3305,19 +3126,15 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES
|
||||
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS
|
||||
DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE
|
||||
VS_SDK_REFERENCES VS_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
|
||||
VS_SDK_REFERENCES)
|
||||
# copy Android platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
ANDROID_API ANDROID_API_MIN ANDROID_GUI
|
||||
ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES
|
||||
ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR
|
||||
ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES
|
||||
ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH
|
||||
ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE)
|
||||
# copy CUDA platform specific stuff
|
||||
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
|
||||
CUDA_PTX_COMPILATION CUDA_SEPARABLE_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS
|
||||
CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED)
|
||||
# use output name from original target
|
||||
get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME)
|
||||
if (NOT _targetOutputName)
|
||||
@@ -3331,13 +3148,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
|
||||
set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE)
|
||||
endif()
|
||||
endif()
|
||||
# enable parallel compilation for MSVC
|
||||
if (MSVC AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||
list (LENGTH _unityTargetSources _numberOfUnityTargetSources)
|
||||
if (_numberOfUnityTargetSources GREATER 1)
|
||||
set_property(TARGET ${_unityTargetName} APPEND PROPERTY COMPILE_OPTIONS "/MP")
|
||||
endif()
|
||||
endif()
|
||||
cotire_init_target(${_unityTargetName})
|
||||
cotire_add_to_unity_all_target(${_unityTargetName})
|
||||
set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}")
|
||||
@@ -3496,13 +3306,6 @@ function (cotire_target_link_libraries _target)
|
||||
message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}")
|
||||
endif()
|
||||
endif()
|
||||
get_target_property(_manualDependencies ${_target} MANUALLY_ADDED_DEPENDENCIES)
|
||||
if (_manualDependencies)
|
||||
cotire_map_libraries("${_linkLibrariesStrategy}" _unityManualDependencies ${_manualDependencies})
|
||||
if (_unityManualDependencies)
|
||||
add_dependencies("${_unityTargetName}" ${_unityManualDependencies})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction(cotire_target_link_libraries)
|
||||
@@ -3535,9 +3338,9 @@ function (cotire_init_target _targetName)
|
||||
set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}")
|
||||
endif()
|
||||
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
# if (MSVC_IDE)
|
||||
# set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
# endif()
|
||||
if (MSVC_IDE)
|
||||
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function (cotire_add_to_pch_all_target _pchTargetName)
|
||||
@@ -3799,7 +3602,7 @@ else()
|
||||
set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
|
||||
"Ignore sources with the listed file extensions from the generated unity source.")
|
||||
|
||||
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "2" CACHE STRING
|
||||
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING
|
||||
"Minimum number of sources in target required to enable use of precompiled header.")
|
||||
|
||||
if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT)
|
||||
@@ -3898,7 +3701,7 @@ else()
|
||||
FULL_DOCS
|
||||
"The variable can be set to an integer > 0."
|
||||
"If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target."
|
||||
"If not defined, defaults to 2."
|
||||
"If not defined, defaults to 3."
|
||||
)
|
||||
|
||||
define_property(
|
||||
|
@@ -110,19 +110,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
|
||||
endif()
|
||||
|
||||
unset (FREETYPE_LIBRARY_RELEASE)
|
||||
find_package(Freetype)
|
||||
|
||||
# Only for UNIX (not APPLE)
|
||||
if ((NOT WIN32) AND (NOT APPLE))
|
||||
# To avoid linker error on Ubuntu 18.04 and others linux distributives we should
|
||||
# link with freetype library, compiled as Position Independent Code (PIC),
|
||||
# for example, with shared object.
|
||||
if ((DEFINED FREETYPE_LIBRARY_RELEASE) AND (NOT "${FREETYPE_LIBRARY_RELEASE}" STREQUAL "") AND (EXISTS "${FREETYPE_LIBRARY_RELEASE}"))
|
||||
string (REPLACE "\.a" "\.so" FREETYPE_LIBRARY_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# restore ENV{FREETYPE_DIR}
|
||||
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
|
||||
set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
|
||||
@@ -133,7 +122,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY_RELEASE FILEPATH "freetype library")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -152,8 +141,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
if (FREETYPE_LIBRARY_RELEASE AND EXISTS "${FREETYPE_LIBRARY_RELEASE}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY_RELEASE}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
|
||||
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -231,7 +220,7 @@ endif()
|
||||
# freetype library
|
||||
#if (BUILD_SHARED_LIBS)
|
||||
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
|
||||
set (FREETYPE_PATH_SUFFIXES lib)
|
||||
if (ANDROID)
|
||||
@@ -253,16 +242,6 @@ endif()
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
# Only for UNIX (not APPLE)
|
||||
if ((NOT WIN32) AND (NOT APPLE))
|
||||
# To avoid linker error on Ubuntu 18.04 and some others linux distributives we should
|
||||
# link with freetype library, compiled as Position Independent Code (PIC),
|
||||
# for example, with shared object.
|
||||
if ((DEFINED 3RDPARTY_FREETYPE_LIBRARY) AND (NOT "${3RDPARTY_FREETYPE_LIBRARY}" STREQUAL "") AND (EXISTS "${3RDPARTY_FREETYPE_LIBRARY}"))
|
||||
string (REPLACE "\.a" "\.so" 3RDPARTY_FREETYPE_LIBRARY "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
|
||||
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
|
||||
@@ -371,7 +350,7 @@ endif()
|
||||
# unset all redundant variables
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY_RELEASE)
|
||||
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
|
||||
|
@@ -160,8 +160,6 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
|
||||
if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
|
||||
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
|
||||
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
|
||||
elseif ("${lower_PRODUCT_NAME}" STREQUAL "tbb")
|
||||
list (APPEND SEARCH_TEMPLATES "^.*${lower_PRODUCT_NAME}.*")
|
||||
else()
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
|
||||
|
@@ -245,18 +245,6 @@ endif (USE_QT)
|
||||
if (EXECUTABLE_PROJECT)
|
||||
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
else()
|
||||
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
|
||||
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
|
||||
# So, we just exclude PROJECT_NAME from cotire list.
|
||||
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
|
||||
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
install (TARGETS ${PROJECT_NAME}
|
||||
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||
|
||||
@@ -266,18 +254,6 @@ if (EXECUTABLE_PROJECT)
|
||||
else()
|
||||
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||
|
||||
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
else()
|
||||
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
|
||||
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
|
||||
# So, we just exclude PROJECT_NAME from cotire list.
|
||||
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
|
||||
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (BUILD_FORCE_RelWithDebInfo)
|
||||
set (aReleasePdbConf "Release")
|
||||
|
@@ -1,240 +1,294 @@
|
||||
# tbb
|
||||
|
||||
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
||||
endif()
|
||||
|
||||
# tbb directory
|
||||
if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
||||
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
||||
endif()
|
||||
|
||||
if (MSVC AND BUILD_SHARED_LIBS)
|
||||
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
|
||||
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
|
||||
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
||||
endif()
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
# Initialize tbb directory.
|
||||
if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
||||
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
||||
endif()
|
||||
# specify TBB folder in connectin with 3RDPARTY_DIR
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
#CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_TBB_DIR PATH "The directory containing tbb")
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_DIR)
|
||||
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
|
||||
endif()
|
||||
if ("${3RDPARTY_DIR}" STREQUAL "")
|
||||
message (FATAL_ERROR "3RDPARTY_DIR is empty string.")
|
||||
endif()
|
||||
if (NOT EXISTS "${3RDPARTY_DIR}")
|
||||
message (FATAL_ERROR "3RDPARTY_DIR is not exist.")
|
||||
endif()
|
||||
|
||||
# Below, we have correct 3RDPARTY_DIR.
|
||||
|
||||
# Initialize TBB folder in connectin with 3RDPARTY_DIR.
|
||||
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
|
||||
if (NOT 3RDPARTY_TBB_DIR OR NOT EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
|
||||
if (TBB_DIR_NAME)
|
||||
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
#set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing TBB" FORCE)
|
||||
endif()
|
||||
|
||||
# Here we have full path name to installation directory of TBB.
|
||||
# Employ it.
|
||||
if (EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
|
||||
# Achive include directory
|
||||
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
# check 3RDPARTY_TBB_INCLUDE_DIR for consictency with specified 3RDPARTY_TBB_DIR
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_TBB_INCLUDE_DIR PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
|
||||
# tbb.h
|
||||
if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
|
||||
set (HEADER_NAMES tbb.h tbb/tbb.h)
|
||||
|
||||
# set 3RDPARTY_TBB_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_TBB_INCLUDE_DIR
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to tbb.h" FORCE)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATHS ${3RDPARTY_TBB_DIR}
|
||||
PATH_SUFFIXES include
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
||||
PATH_SUFFIXES include
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
|
||||
endif()
|
||||
|
||||
# common steps for tbb and tbbmalloc
|
||||
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
|
||||
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
|
||||
|
||||
# define required tbb/tbbmalloc variables
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
endif()
|
||||
if (EXISTS "${TBB_INCLUDE_DIR}")
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
endif()
|
||||
|
||||
# check 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
|
||||
endif()
|
||||
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
string(TOLOWER "${LIB}" LIB_LOWER)
|
||||
string(TOUPPER "${LIB}" LIB_UPPER)
|
||||
if (WIN32)
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
|
||||
# Achive *.lib files and directory containing it.
|
||||
get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_RELEASE)
|
||||
# Reserve cache variable for *.lib.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.lib)")
|
||||
endif()
|
||||
# Reserve cache variable for directory containing *.lib file.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.lib)")
|
||||
endif()
|
||||
if (EXISTS "${TBB_LIB_FILE}")
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY
|
||||
"${TBB_LIB_FILE}"
|
||||
CACHE FILEPATH
|
||||
"${LIB_UPPER} library (*.lib)"
|
||||
FORCE)
|
||||
get_filename_component (TBB_LIB_FILE_DIRECTORY "${TBB_LIB_FILE}" DIRECTORY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
|
||||
"${TBB_LIB_FILE_DIRECTORY}"
|
||||
CACHE PATH
|
||||
"The directory containing ${LIB_UPPER} library (*.lib)"
|
||||
FORCE)
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
# Achive *.dll files and directory containing it.
|
||||
get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
|
||||
# Reserve cache variable for *.dll.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL)
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL "" CACHE FILEPATH "${LIB_UPPER} library (*.dll)")
|
||||
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
|
||||
endif()
|
||||
# Reserve cache variable for directory containing *.dll file.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL_DIR)
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.dll)")
|
||||
endif()
|
||||
if (EXISTS "${TBB_DLL_FILE}")
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL
|
||||
"${TBB_DLL_FILE}"
|
||||
CACHE FILEPATH
|
||||
"${LIB_UPPER} library (*.dll)"
|
||||
FORCE)
|
||||
get_filename_component (TBB_DLL_FILE_DIRECTORY "${TBB_DLL_FILE}" DIRECTORY)
|
||||
set (3RDPARTY_${LIB_UPPER}_DLL_DIR
|
||||
"${TBB_DLL_FILE_DIRECTORY}"
|
||||
CACHE PATH
|
||||
"The directory containing ${LIB_UPPER} library (*.dll)"
|
||||
FORCE)
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${LIB_UPPER}_DLL_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
OCCT_MAKE_COMPILER_BITNESS()
|
||||
|
||||
if (${COMPILER_BITNESS} EQUAL 32)
|
||||
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME ia32)
|
||||
else()
|
||||
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
|
||||
endif()
|
||||
|
||||
# tbb/tbbmalloc library
|
||||
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME})
|
||||
|
||||
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
|
||||
if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
|
||||
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
|
||||
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
|
||||
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
|
||||
if (THE_MOST_FRESH_COMPILER_VERSION)
|
||||
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_UPPER}_DLL_DIR)
|
||||
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
|
||||
endif()
|
||||
|
||||
# install *.dll (tbb & tbbmalloc)
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
|
||||
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
|
||||
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
|
||||
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# tbb/tbbmalloc shared library
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
set (PRODUCT_PATH_SUFFIXES bin)
|
||||
|
||||
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
|
||||
if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
|
||||
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
|
||||
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
|
||||
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
|
||||
if (THE_MOST_FRESH_COMPILER_VERSION)
|
||||
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
|
||||
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
|
||||
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME}
|
||||
PATHS "${3RDPARTY_TBB_DIR}"
|
||||
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
else()
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
|
||||
endforeach()
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
# the *.dll/*.so* directory for using by the executable
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
endif()
|
||||
else()
|
||||
message (FATAL_ERROR "Installation directory with TBB is not exist.")
|
||||
|
||||
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
|
||||
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
|
||||
endif()
|
||||
endif()
|
||||
else ()
|
||||
# NOT WIN32 branch
|
||||
if ((DEFINED 3RDPARTY_DIR) AND (NOT "${3RDPARTY_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_DIR}"))
|
||||
# Here, we have correct 3RDPARTY_DIR.
|
||||
# Trying to specify TBB folder in connection with 3RDPARTY_DIR
|
||||
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
|
||||
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
|
||||
if (TBB_DIR_NAME)
|
||||
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
|
||||
|
||||
# install tbb/tbbmalloc
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
if (WIN32)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_BIN}")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_BIN}i")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_BIN}d")
|
||||
endif()
|
||||
endif()
|
||||
if ((NOT "${3RDPARTY_TBB_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_TBB_DIR}"))
|
||||
# Find TBB 2021.5 in existing directory.
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
else()
|
||||
# Find TBB 2021.5 in system directory.
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
endif()
|
||||
else()
|
||||
# Find TBB 2021.5 in system directory.
|
||||
find_package (
|
||||
TBB 2021.5
|
||||
REQUIRED
|
||||
CONFIG)
|
||||
endif()
|
||||
# TBB has been configured (in other case FATAL_ERROR occures).
|
||||
|
||||
# Achive include directory.
|
||||
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
||||
endif()
|
||||
if (EXISTS "${TBB_INCLUDE_DIR}")
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
string(TOLOWER "${LIB}" LIB_LOWER)
|
||||
string(TOUPPER "${LIB}" LIB_UPPER)
|
||||
|
||||
# Achive *.so files and directory containing it.
|
||||
get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
|
||||
# Reserve cache variable for *.so.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.so)")
|
||||
endif()
|
||||
# Reserve cache variable for directory containing *.so file.
|
||||
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.so)")
|
||||
endif()
|
||||
if (EXISTS "${TBB_SO_FILE}")
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY
|
||||
"${TBB_SO_FILE}"
|
||||
CACHE FILEPATH
|
||||
"${LIB_UPPER} library (*.so)"
|
||||
FORCE)
|
||||
get_filename_component (TBB_SO_FILE_DIRECTORY "${TBB_SO_FILE}" DIRECTORY)
|
||||
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
|
||||
"${TBB_SO_FILE_DIRECTORY}"
|
||||
CACHE PATH
|
||||
"The directory containing ${LIB_UPPER} library (*.so)"
|
||||
FORCE)
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
# install *.so* (tbb & tbbmalloc)
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
|
||||
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
DESTINATION "${INSTALL_DIR_LIB}"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
else()
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d"
|
||||
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
|
||||
endmacro()
|
||||
|
||||
#if (BUILD_SHARED_LIBS)
|
||||
separate_arguments (CSF_TBB)
|
||||
foreach (LIB IN LISTS CSF_TBB)
|
||||
TBB_PRODUCT_SEARCH (${LIB})
|
||||
endforeach()
|
||||
|
||||
if (INSTALL_TBB)
|
||||
set (USED_3RDPARTY_TBB_DIR "")
|
||||
else()
|
||||
# the *.so* directory for using by the executable
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
#endif()
|
||||
|
@@ -780,14 +780,14 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
||||
}
|
||||
}
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
|
||||
if { "$aTbbDllPath" == "" } {
|
||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
if { "$aTbbDllPath" != "" } {
|
||||
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
|
||||
} else {
|
||||
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
|
||||
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
|
||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||
}
|
||||
}
|
||||
|
177
adm/genproj.tcl
177
adm/genproj.tcl
@@ -1233,11 +1233,28 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
|
||||
lappend aProjectsInModule($aModule) $aToolKit
|
||||
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
|
||||
}
|
||||
# executables
|
||||
# executables, assume one project per cxx file...
|
||||
foreach aUnit [OS:executable ${aModule}] {
|
||||
lappend aProjects $aUnit
|
||||
lappend aProjectsInModule($aModule) $aUnit
|
||||
lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
|
||||
set aUnitLoc $aUnit
|
||||
set src_files [_get_used_files $aUnit $theSrcDir false]
|
||||
set aSrcFiles {}
|
||||
foreach s $src_files {
|
||||
regexp {source ([^\s]+)} $s dummy name
|
||||
lappend aSrcFiles $name
|
||||
}
|
||||
foreach aSrcFile $aSrcFiles {
|
||||
set aFileExtension [file extension $aSrcFile]
|
||||
if { $aFileExtension == ".cxx" } {
|
||||
set aPrjName [file rootname $aSrcFile]
|
||||
lappend aProjects $aPrjName
|
||||
lappend aProjectsInModule($aModule) $aPrjName
|
||||
if {[file isdirectory $path/$theSrcDir/$aUnitLoc]} {
|
||||
lappend aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] $theSrcDir $theSourceDirOther]
|
||||
} else {
|
||||
lappend aDependencies {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2093,106 +2110,98 @@ proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension
|
||||
# Generate Visual Studio project file for executable
|
||||
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
|
||||
set aVcFiles {}
|
||||
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
|
||||
|
||||
set aProjName $theToolKit
|
||||
set l_compilable [osutils:compilable wnt]
|
||||
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
|
||||
set aProjName [file rootname [file tail $f]]
|
||||
set l_compilable [osutils:compilable wnt]
|
||||
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
|
||||
|
||||
upvar $theGuidsMap aGuidsMap
|
||||
if { ! [info exists aGuidsMap($aProjName)] } {
|
||||
set aGuidsMap($aProjName) [OS:genGUID]
|
||||
}
|
||||
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
|
||||
upvar $theGuidsMap aGuidsMap
|
||||
if { ! [info exists aGuidsMap($aProjName)] } {
|
||||
set aGuidsMap($aProjName) [OS:genGUID]
|
||||
}
|
||||
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
|
||||
|
||||
set aUsedLibs [list]
|
||||
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
|
||||
lappend aUsedLibs "${tkx}.lib"
|
||||
}
|
||||
set aUsedLibs [list]
|
||||
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
|
||||
lappend aUsedLibs "${tkx}.lib"
|
||||
}
|
||||
|
||||
set anOsReleaseLibs {}
|
||||
set anOsDebugLibs {}
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
|
||||
set anOsReleaseLibs {}
|
||||
set anOsDebugLibs {}
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
|
||||
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
|
||||
|
||||
set aVCRTVer [string range $theVcVer 0 3]
|
||||
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
|
||||
set aVCRTVer [string range $theVcVer 0 3]
|
||||
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
|
||||
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
|
||||
|
||||
set aFilesSection ""
|
||||
set aVcFilesCxx(units) ""
|
||||
set aVcFilesHxx(units) ""
|
||||
set aFilesSection ""
|
||||
set aVcFilesCxx(units) ""
|
||||
set aVcFilesHxx(units) ""
|
||||
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
|
||||
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
|
||||
lappend aVcFilesCxx($theToolKit) $f
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
append aFilesSection "\t\t\t<Filter\n"
|
||||
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
|
||||
append aFilesSection "\t\t\t\t>\n"
|
||||
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
|
||||
if { ![info exists written([file tail $f])] } {
|
||||
set written([file tail $f]) 1
|
||||
append aFilesSection "\t\t\t<Filter\n"
|
||||
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
|
||||
append aFilesSection "\t\t\t\t>\n"
|
||||
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
append aFilesSection "\t\t\t</Filter>"
|
||||
}
|
||||
} else {
|
||||
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
|
||||
}
|
||||
append aFilesSection "\t\t\t</Filter>"
|
||||
}
|
||||
#puts "$aProjTmpl $aFilesSection"
|
||||
set anIncPaths "..\\..\\..\\inc"
|
||||
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
|
||||
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
|
||||
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
|
||||
|
||||
#puts "$aProjTmpl $aFilesSection"
|
||||
set anIncPaths "..\\..\\..\\inc"
|
||||
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
|
||||
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
|
||||
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
|
||||
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
|
||||
|
||||
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aProjTmpl
|
||||
close $aFile
|
||||
|
||||
set aCommonSettingsFile "$aVcFilePath.user"
|
||||
lappend aVcFiles $aVcFilePath
|
||||
|
||||
# write filters file for vc10
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
|
||||
}
|
||||
|
||||
# write resource file
|
||||
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
|
||||
|
||||
set aCommonSettingsFileTmpl ""
|
||||
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
|
||||
# nothing
|
||||
} elseif { "$theVcVer" == "vc9" } {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
|
||||
} else {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
|
||||
}
|
||||
if { "$aCommonSettingsFileTmpl" != "" } {
|
||||
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
|
||||
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aCommonSettingsFileTmpl
|
||||
puts $aFile $aProjTmpl
|
||||
close $aFile
|
||||
|
||||
lappend aVcFiles "$aCommonSettingsFile"
|
||||
}
|
||||
set aCommonSettingsFile "$aVcFilePath.user"
|
||||
lappend aVcFiles $aVcFilePath
|
||||
|
||||
# write filters file for vc10
|
||||
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
|
||||
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
|
||||
}
|
||||
|
||||
# write resource file
|
||||
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
|
||||
|
||||
set aCommonSettingsFileTmpl ""
|
||||
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
|
||||
# nothing
|
||||
} elseif { "$theVcVer" == "vc9" } {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
|
||||
} else {
|
||||
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
|
||||
}
|
||||
if { "$aCommonSettingsFileTmpl" != "" } {
|
||||
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
|
||||
|
||||
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
|
||||
fconfigure $aFile -translation crlf
|
||||
puts $aFile $aCommonSettingsFileTmpl
|
||||
close $aFile
|
||||
|
||||
lappend aVcFiles "$aCommonSettingsFile"
|
||||
}
|
||||
}
|
||||
return $aVcFiles
|
||||
}
|
||||
|
||||
|
17
dox/build/build_3rdparty/building_3rdparty.md
vendored
17
dox/build/build_3rdparty/building_3rdparty.md
vendored
@@ -128,9 +128,8 @@ You can download its sources from https://freetype.org/
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform.
|
||||
|
||||
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
|
||||
|
||||
@@ -305,9 +304,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
|
||||
|
||||
@@ -478,9 +477,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
|
||||
|
||||
|
@@ -360,7 +360,7 @@ https://dev.opencascade.org/resources/download/3rd-party-components
|
||||
| Component | Where to find | Used for | Purpose |
|
||||
| --------- | ------------- | -------- | -------------------- |
|
||||
| CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
|
||||
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
|
||||
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
|
||||
@@ -572,7 +572,8 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
|
||||
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
|
||||
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
|
||||
abstracts platform details and threading mechanisms for scalability and performance.
|
||||
Intel oneTBB 2021.5.0 is available under Apache 2.0 license (https://www.threadingbuildingblocks.org).
|
||||
TBB version 2017 is available under Apache 2.0 license, while older versions
|
||||
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
|
||||
|
||||
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
|
||||
implementation of 3D viewer. OpenGL specification is developed by the
|
||||
|
@@ -2338,8 +2338,3 @@ or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hx
|
||||
|
||||
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
|
||||
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
|
||||
|
||||
@subsection upgrade_occt770_shapeproximity BRepExtrema_ShapeProximity
|
||||
|
||||
A new way of using the `BRepExtrema_ShapeProximity` class was provided for computing a proximity value between two shapes.
|
||||
If at initialization of the `BRepExtrema_ShapeProximity` class the *theTolerance* parameter is not defined (Precision::Infinite() by default), the proximity value will be computed.
|
||||
|
@@ -1331,7 +1331,7 @@ Therefore if the user of *NCollection* does not specify any allocator as a param
|
||||
Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm.
|
||||
|
||||
As one possible choice, the class *NCollection_IncAllocator* is included.
|
||||
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 12kB) and the allocator keeps track of the amount of occupied memory.
|
||||
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory.
|
||||
The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value.
|
||||
Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty.
|
||||
If used properly, this Allocator can greatly improve the performance of specific algorithms.
|
||||
|
29
get.sh
29
get.sh
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
problem_file=upgrade.bat
|
||||
|
||||
list="master integration"
|
||||
echo "Getting commit hash"
|
||||
for name in $list ; do
|
||||
echo $name
|
||||
export shorthash_$name=$(git rev-parse --short $name)
|
||||
echo shorthash_$name=$(eval echo "\$shorthash_${name}")
|
||||
done
|
||||
|
||||
echo "Getting list of commits between master and integration"
|
||||
list=$(git rev-list --ancestry-path ${shorthash_master}..${shorthash_integration})
|
||||
|
||||
echo "Getting commit whose hash matches the hash of commit with problematic file"
|
||||
for hash in $list ; do
|
||||
list_changed_files=$(git diff-tree --no-commit-id --name-only -r $hash | sed 's/\// /g' | awk '{ print $NF }')
|
||||
for changed_file in $list_changed_files; do
|
||||
if [ "$problem_file" == "$changed_file" ] ; then
|
||||
echo Reverting:
|
||||
echo $(git log -1 --format=oneline $hash)
|
||||
# git revert $hash
|
||||
hash=$(echo $hash | head -c 10)
|
||||
echo $hash
|
||||
git rebase --onto $hash^ $hash
|
||||
fi
|
||||
done
|
||||
done
|
@@ -221,7 +221,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importModel( const int format, cons
|
||||
shapes = importSTEP( file );
|
||||
break;
|
||||
}
|
||||
} catch ( const Standard_Failure& ) {
|
||||
} catch ( Standard_Failure ) {
|
||||
shapes.Nullify();
|
||||
}
|
||||
return shapes;
|
||||
@@ -256,7 +256,7 @@ bool Translate::exportModel( const int format, const QString& file, const Handle
|
||||
case FormatSTL: return exportSTL ( file, shapes );
|
||||
case FormatVRML: return exportVRML( file, shapes );
|
||||
}
|
||||
} catch ( const Standard_Failure& ) {
|
||||
} catch ( Standard_Failure ) {
|
||||
//
|
||||
}
|
||||
return false;
|
||||
@@ -528,26 +528,26 @@ bool Translate::exportSTL( const QString& file, const Handle(TopTools_HSequenceO
|
||||
if ( shapes.IsNull() || shapes->IsEmpty() )
|
||||
return false;
|
||||
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
|
||||
StlAPI_Writer writer;
|
||||
StlAPI_Writer writer;
|
||||
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -557,26 +557,26 @@ bool Translate::exportVRML( const QString& file, const Handle(TopTools_HSequence
|
||||
if ( shapes.IsNull() || shapes->IsEmpty() )
|
||||
return false;
|
||||
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
TopoDS_Compound res;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound( res );
|
||||
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
for ( int i = 1; i <= shapes->Length(); i++ )
|
||||
{
|
||||
TopoDS_Shape shape = shapes->Value( i );
|
||||
if ( shape.IsNull() )
|
||||
{
|
||||
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
|
||||
return false;
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
builder.Add( res, shape );
|
||||
}
|
||||
|
||||
VrmlAPI_Writer writer;
|
||||
VrmlAPI_Writer writer;
|
||||
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
|
||||
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
writer.Write( res, anUtf8Path.ToCString() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -251,9 +251,7 @@ void AIS_Animation::Stop()
|
||||
myState = AnimationState_Stopped;
|
||||
if (!myTimer.IsNull())
|
||||
{
|
||||
const Standard_Real anElapsedTime = ElapsedTime();
|
||||
myTimer->Stop();
|
||||
myTimer->Seek (Min (Duration(), anElapsedTime));
|
||||
}
|
||||
|
||||
for (NCollection_Sequence<Handle(AIS_Animation)>::Iterator anIter (myAnimations); anIter.More(); anIter.Next())
|
||||
|
@@ -13,7 +13,7 @@
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
// branch2
|
||||
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
|
@@ -1,460 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepExtrema_ProximityDistTool.hxx>
|
||||
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <Standard_NullValue.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityDistTool
|
||||
//purpose : Creates new unitialized tool
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool()
|
||||
: myMinDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myProxDist (-1.),
|
||||
myPntStatus1 (ProxPnt_Status_UNKNOWN),
|
||||
myPntStatus2 (ProxPnt_Status_UNKNOWN),
|
||||
myNbSamples1 (0),
|
||||
myProxVtxIdx1 (-1)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityDistTool
|
||||
//purpose : Creates new tool for the given element sets
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
: myMinDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myProxDist (-1.),
|
||||
myPntStatus1 (ProxPnt_Status_UNKNOWN),
|
||||
myPntStatus2 (ProxPnt_Status_UNKNOWN),
|
||||
myNbSamples1 (theNbSamples1),
|
||||
myProxVtxIdx1 (-1)
|
||||
{
|
||||
LoadTriangleSets (theSet1, theSet2);
|
||||
LoadShapeLists (theShapeList1, theShapeList2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given element sets into the tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2)
|
||||
{
|
||||
mySet1 = theSet1;
|
||||
mySet2 = theSet2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given list of subshapes into the proximity tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
{
|
||||
myShapeList1 = theShapeList1;
|
||||
myShapeList2 = theShapeList2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Performs searching of the proximity distance
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::Perform()
|
||||
{
|
||||
SetBVHSet (mySet2.get());
|
||||
|
||||
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
|
||||
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
|
||||
Standard_Integer aVtxStep = Max (myNbSamples1 <= 0 ? 1 : aVtxSize / myNbSamples1, 1);
|
||||
for (Standard_Integer aVtxIdx = 0; aVtxIdx < aVtxSize; aVtxIdx += aVtxStep)
|
||||
{
|
||||
myDistance = std::numeric_limits<Standard_Real>::max();
|
||||
myMinDistance = std::numeric_limits<Standard_Real>::max();
|
||||
myIsDone = Standard_False;
|
||||
SetObject (aVertices1[aVtxIdx]);
|
||||
|
||||
ComputeDistance();
|
||||
|
||||
if (!IsDone() && myProxDist < 0.) return;
|
||||
|
||||
if (IsDone() && myDistance > myProxDist)
|
||||
{
|
||||
myPnt1 = aVertices1[aVtxIdx];
|
||||
myPnt2 = myExtremaPoint;
|
||||
myProxDist = myDistance;
|
||||
myProxVtxIdx1 = aVtxIdx;
|
||||
myProxPrjState = myExtPrjState;
|
||||
}
|
||||
}
|
||||
|
||||
myIsDone = myProxDist > -1.;
|
||||
|
||||
if (myIsDone)
|
||||
{
|
||||
DefineStatusProxPnt();
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Real pointBoxSquareMaxDistance (const BVH_Vec3d& thePoint,
|
||||
const BVH_Vec3d& theCMin,
|
||||
const BVH_Vec3d& theCMax)
|
||||
{
|
||||
Standard_Real aDist = 0;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (thePoint[i] <= 0.5 * (theCMax[i] + theCMin[i])) { Standard_Real d = theCMax[i] - thePoint[i]; d *= d; aDist += d; }
|
||||
else { Standard_Real d = thePoint[i] - theCMin[i]; d *= d; aDist += d; }
|
||||
}
|
||||
return aDist;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Branch rejection
|
||||
//purpose : Defines the rules for node rejection by bounding box
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityDistTool::RejectNode (const BVH_Vec3d& theCornerMin,
|
||||
const BVH_Vec3d& theCornerMax,
|
||||
Standard_Real& theMetric) const
|
||||
{
|
||||
theMetric = sqrt (BVH_Tools<Standard_Real, 3>::PointBoxSquareDistance (myObject,
|
||||
theCornerMin,
|
||||
theCornerMax));
|
||||
|
||||
Standard_Real aMaxMetric = sqrt (pointBoxSquareMaxDistance (myObject,
|
||||
theCornerMin,
|
||||
theCornerMax));
|
||||
|
||||
return theMetric > myDistance || aMaxMetric < myProxDist;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Leaf acceptance
|
||||
//purpose : Defines the rules for leaf acceptance
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ProximityDistTool::Accept (const Standard_Integer theTrgIdx,
|
||||
const Standard_Real&)
|
||||
{
|
||||
BVH_Vec3d aTrgVert1;
|
||||
BVH_Vec3d aTrgVert2;
|
||||
BVH_Vec3d aTrgVert3;
|
||||
|
||||
BVH_PrjState aBVH_PrjState;
|
||||
Standard_Integer aNumberOfFirstNode = -1;
|
||||
Standard_Integer aNumberOfLastNode = -1;
|
||||
|
||||
mySet2->GetVertices (theTrgIdx, aTrgVert1, aTrgVert2, aTrgVert3);
|
||||
|
||||
BVH_Vec3d aNearestPnt = BVH_Tools<Standard_Real, 3>::PointTriangleProjection (myObject,
|
||||
aTrgVert1, aTrgVert2, aTrgVert3,
|
||||
&aBVH_PrjState,
|
||||
&aNumberOfFirstNode, &aNumberOfLastNode);
|
||||
|
||||
PrjState aPrjState (theTrgIdx, aBVH_PrjState, aNumberOfFirstNode, aNumberOfLastNode);
|
||||
BVH_Vec3d aDirect = myObject - aNearestPnt;
|
||||
Standard_Real aSqDistance = aDirect.Dot(aDirect);
|
||||
|
||||
if (aSqDistance > Precision::SquareConfusion()) // point belongs to triangle
|
||||
{
|
||||
const BVH_Vec3d aAB = aTrgVert2 - aTrgVert1;
|
||||
|
||||
BVH_Vec3d aNorm;
|
||||
if (aTrgVert2.IsEqual (aTrgVert3)) // is this degenerate triangle (= segment)
|
||||
{
|
||||
const BVH_Vec3d aAP = myObject - aTrgVert1;
|
||||
aNorm = BVH_Vec3d::Cross (BVH_Vec3d::Cross (aAP, aAB), aAB);
|
||||
}
|
||||
else
|
||||
{
|
||||
const BVH_Vec3d aAC = aTrgVert3 - aTrgVert1;
|
||||
aNorm = BVH_Vec3d::Cross (aAB, aAC);
|
||||
}
|
||||
|
||||
Standard_Real aNormSqLen = aNorm.Dot (aNorm);
|
||||
|
||||
// check if the distance is under perpendicular
|
||||
const BVH_Vec3d aCrossCross = BVH_Vec3d::Cross (aDirect, aNorm);
|
||||
Standard_Real aCrossCrossSqLen = aCrossCross.Dot (aCrossCross);
|
||||
if (aCrossCrossSqLen > Precision::SquareConfusion() * aSqDistance * aNormSqLen)
|
||||
{
|
||||
// the distance is not under perpendicular
|
||||
if (myMinDistance - sqrt (aSqDistance) > Precision::Confusion())
|
||||
{
|
||||
myMinDistance = sqrt (aSqDistance);
|
||||
myMinDistPoint = aNearestPnt;
|
||||
myMinPrjState = aPrjState;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
// the distance is under perpendicular
|
||||
if (myDistance - sqrt (aSqDistance) > Precision::Confusion())
|
||||
{
|
||||
myDistance = sqrt (aSqDistance);
|
||||
myExtremaPoint = aNearestPnt;
|
||||
myExtPrjState = aPrjState;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeDistance
|
||||
//purpose : Computes the distance between object and BVH tree
|
||||
//=======================================================================
|
||||
Standard_Real BRepExtrema_ProximityDistTool::ComputeDistance()
|
||||
{
|
||||
myIsDone = this->Select() > 0;
|
||||
|
||||
if (!myIsDone)
|
||||
{
|
||||
if (myMinDistance < std::numeric_limits<Standard_Real>::max())
|
||||
{
|
||||
myExtremaPoint = myMinDistPoint;
|
||||
myExtPrjState = myMinPrjState;
|
||||
myIsDone = true;
|
||||
}
|
||||
|
||||
myDistance = myMinDistance;
|
||||
}
|
||||
|
||||
return myDistance;
|
||||
}
|
||||
|
||||
static Standard_Boolean isNodeOnBorder (const Standard_Integer theNodeIdx, const Handle (Poly_Triangulation)& theTr)
|
||||
{
|
||||
Poly_Connect aPolyConnect (theTr);
|
||||
|
||||
Standard_Integer aContTrg; //index of triangle containing exploring node
|
||||
for (aPolyConnect.Initialize (theNodeIdx); aPolyConnect.More(); aPolyConnect.Next())
|
||||
{
|
||||
aContTrg = aPolyConnect.Value();
|
||||
|
||||
Standard_Integer aContTrgNodes[3];
|
||||
theTr->Triangle (aContTrg).Get (aContTrgNodes[0], aContTrgNodes[1], aContTrgNodes[2]); //indices of nodes of the triangle
|
||||
|
||||
Standard_Integer aAdjTrg[3];
|
||||
aPolyConnect.Triangles (aContTrg, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
|
||||
|
||||
for (Standard_Integer j = 0; j < 3; j++)
|
||||
{
|
||||
Standard_Integer k = (j + 1) % 3;
|
||||
if (aAdjTrg[j] == 0) //free segment of triangle
|
||||
{
|
||||
//aContTrgNodes[j], aContTrgNodes[k] are ends of free segment and it is a part of border
|
||||
if (aContTrgNodes[j] == theNodeIdx || aContTrgNodes[k] == theNodeIdx)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : defineStatusProxPnt1
|
||||
//purpose : Defines the status of proximity point from 1st BVH
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
|
||||
{
|
||||
Standard_Integer aFaceID1 = mySet1->GetShapeIDOfVtx (myProxVtxIdx1);
|
||||
|
||||
if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
|
||||
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
|
||||
Standard_Integer aLastIdx = aVtxSize - 1;
|
||||
|
||||
if ((aVertices1[0] - aVertices1[aLastIdx]).Modulus() < Precision::Confusion()) // if closed
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_MIDDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (myProxVtxIdx1 == 0 || myProxVtxIdx1 == aLastIdx)
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
else if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
Standard_Integer aNodeIdx = mySet1->GetVtxIdxInShape (myProxVtxIdx1) + 1;
|
||||
|
||||
TopLoc_Location aLocation;
|
||||
const TopoDS_Face& aF = TopoDS::Face (myShapeList1 (aFaceID1));
|
||||
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
|
||||
|
||||
if (isNodeOnBorder (aNodeIdx, aTr))
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus1 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : defineStatusProxPnt2
|
||||
//purpose : Defines the status of proximity point from 2nd BVH
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
|
||||
{
|
||||
Standard_Integer aTrgIdx = myProxPrjState.GetTrgIdx();
|
||||
Standard_Integer aFaceID2 = mySet2->GetFaceID (aTrgIdx);
|
||||
|
||||
if (myShapeList2 (aFaceID2).ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_INNER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
const BVH_Array3d& aVertices2 = mySet2->GetVertices();
|
||||
Standard_Integer aVtxSize = (Standard_Integer)aVertices2.size();
|
||||
Standard_Integer aLastIdx = aVtxSize - 1;
|
||||
|
||||
if ((aVertices2[0] - aVertices2[aLastIdx]).Modulus() < Precision::Confusion()) // if closed
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
|
||||
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
|
||||
|
||||
Standard_Integer aFirstNodeNum = myProxPrjState.GetNumberOfFirstNode();
|
||||
Standard_Integer aFirstVtxIdx = aVtxIndicesOfTrg[aFirstNodeNum];
|
||||
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_VERTEX)
|
||||
{
|
||||
if (aFirstVtxIdx == 0 || aFirstVtxIdx == aLastIdx)
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
|
||||
{
|
||||
Standard_Integer aLastNodeNum = myProxPrjState.GetNumberOfLastNode();
|
||||
Standard_Integer aLastVtxIdx = aVtxIndicesOfTrg[aLastNodeNum];
|
||||
|
||||
// it could be border only in case projection is on a degenerated edge
|
||||
if (aFirstVtxIdx == aLastVtxIdx && (aFirstVtxIdx == 0 || aFirstVtxIdx == aLastIdx))
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (myShapeList2 (aFaceID2).ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_INNER)
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
const TopoDS_Face& aF = TopoDS::Face (myShapeList2 (aFaceID2));
|
||||
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
|
||||
|
||||
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
|
||||
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
|
||||
|
||||
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_VERTEX)
|
||||
{
|
||||
Standard_Integer aNodeNum = myProxPrjState.GetNumberOfFirstNode();
|
||||
Standard_Integer aNodeIdx = mySet2->GetVtxIdxInShape (aVtxIndicesOfTrg[aNodeNum]) + 1;
|
||||
|
||||
if (isNodeOnBorder (aNodeIdx, aTr))
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
}
|
||||
else
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
}
|
||||
}
|
||||
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_MIDDLE;
|
||||
|
||||
Poly_Connect aPolyConnect (aTr);
|
||||
Standard_Integer aTrgIdxInShape = mySet2->GetTrgIdxInShape (aTrgIdx) + 1;
|
||||
|
||||
Standard_Integer aAdjTrg[3];
|
||||
aPolyConnect.Triangles (aTrgIdxInShape, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
|
||||
|
||||
for (Standard_Integer j = 0; j < 3; j++)
|
||||
{
|
||||
Standard_Integer k = (j + 1) % 3;
|
||||
if (aAdjTrg[j] == 0) //free segment of triangle
|
||||
{
|
||||
//aVtxIndicesOfTrg[j] and aVtxIndicesOfTrg[k] are ends of free segment and it is a part of border
|
||||
if (j == myProxPrjState.GetNumberOfFirstNode() &&
|
||||
k == myProxPrjState.GetNumberOfLastNode())
|
||||
{
|
||||
myPntStatus2 = ProxPnt_Status_BORDER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
|
||||
}
|
||||
} //else if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_FACE)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefineStatusProxPnt
|
||||
//purpose : Defines the status of proximity points
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityDistTool::DefineStatusProxPnt()
|
||||
{
|
||||
// define the status of proximity point from 1st BVH
|
||||
defineStatusProxPnt1();
|
||||
|
||||
// define the status of proximity point from 2nd BVH
|
||||
defineStatusProxPnt2();
|
||||
}
|
@@ -1,200 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepExtrema_ProximityDistTool_HeaderFile
|
||||
#define _BRepExtrema_ProximityDistTool_HeaderFile
|
||||
|
||||
#include <BRepExtrema_ElementFilter.hxx>
|
||||
#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
#include <BVH_Distance.hxx>
|
||||
#include <BVH_Tools.hxx>
|
||||
|
||||
//! Tool class for computation the proximity distance from first
|
||||
//! primitive set to second one that is the maximal from minimum
|
||||
//! perpendicular distances. If no perpendicular distance is found, the
|
||||
//! minimum distance will be returned.
|
||||
//! This tool is not intended to be used independently, and is integrated
|
||||
//! in other classes, implementing algorithms based on shape tessellation
|
||||
//! (BRepExtrema_ProximityValueTool).
|
||||
//!
|
||||
//! Please note that algorithm results are approximate and depend greatly
|
||||
//! on the quality of input tessellation(s).
|
||||
class BRepExtrema_ProximityDistTool : public BVH_Distance <Standard_Real, 3, BVH_Vec3d,
|
||||
BRepExtrema_TriangleSet>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename BVH_Tools<Standard_Real, 3>::BVH_PrjStateInTriangle BVH_PrjState;
|
||||
|
||||
enum ProxPnt_Status
|
||||
{
|
||||
ProxPnt_Status_BORDER,
|
||||
ProxPnt_Status_MIDDLE,
|
||||
ProxPnt_Status_UNKNOWN
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Struct with information about projection point state from 2nd BVH,
|
||||
//! providing proximity point of 2nd shape
|
||||
struct PrjState
|
||||
{
|
||||
PrjState()
|
||||
: myTrgIdx (0),
|
||||
myPrjState (BVH_PrjState::BVH_PrjStateInTriangle_INNER),
|
||||
myNumberOfFirstNode (0),
|
||||
myNumberOfLastNode (0)
|
||||
{}
|
||||
|
||||
PrjState (const Standard_Integer theTrgIdx,
|
||||
const BVH_PrjState thePrjState,
|
||||
const Standard_Integer theNumberOfFirstNode,
|
||||
const Standard_Integer theNumberOfLastNode)
|
||||
: myTrgIdx (theTrgIdx),
|
||||
myPrjState (thePrjState),
|
||||
myNumberOfFirstNode (theNumberOfFirstNode),
|
||||
myNumberOfLastNode (theNumberOfLastNode)
|
||||
{}
|
||||
|
||||
Standard_Integer GetTrgIdx() const { return myTrgIdx; }
|
||||
|
||||
BVH_PrjState GetPrjState() const { return myPrjState; }
|
||||
|
||||
Standard_Integer GetNumberOfFirstNode() const { return myNumberOfFirstNode; }
|
||||
|
||||
Standard_Integer GetNumberOfLastNode() const { return myNumberOfLastNode; }
|
||||
|
||||
private:
|
||||
|
||||
Standard_Integer myTrgIdx; //!< Index of triangle on which the projection is located
|
||||
BVH_PrjState myPrjState; //!< Position of a projection on the triangle (vertex, edge, inner)
|
||||
Standard_Integer myNumberOfFirstNode; //!< The 1st vtx of the triangle edge on which the projection is located
|
||||
Standard_Integer myNumberOfLastNode; //!< The 2nd vtx of the triangle edge on which the projection is located
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//! Creates new unitialized tool.
|
||||
Standard_EXPORT BRepExtrema_ProximityDistTool();
|
||||
|
||||
//! Creates new tool for the given element sets.
|
||||
Standard_EXPORT BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
public:
|
||||
|
||||
//! Loads the given element sets into the tool.
|
||||
Standard_EXPORT void LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2);
|
||||
|
||||
//! Loads the given list of subshapes into the tool.
|
||||
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
//! Performs searching of the proximity distance.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
public: //! @name Reject/Accept implementations
|
||||
|
||||
//! Defines the rules for node rejection by bounding box.
|
||||
Standard_EXPORT virtual Standard_Boolean RejectNode (const BVH_Vec3d& theCornerMin,
|
||||
const BVH_Vec3d& theCornerMax,
|
||||
Standard_Real& theMetric) const Standard_OVERRIDE;
|
||||
|
||||
//! Defines the rules for leaf acceptance.
|
||||
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theSgmIdx,
|
||||
const Standard_Real&) Standard_OVERRIDE;
|
||||
|
||||
//! Returns points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPoints (BVH_Vec3d& thePoint1, BVH_Vec3d& thePoint2) const
|
||||
{
|
||||
thePoint1 = myPnt1;
|
||||
thePoint2 = myPnt2;
|
||||
}
|
||||
|
||||
//! Returns status of points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
|
||||
{
|
||||
thePointStatus1 = myPntStatus1;
|
||||
thePointStatus2 = myPntStatus2;
|
||||
}
|
||||
|
||||
//! Returns the computed distance
|
||||
Standard_Real ProximityDistance() const { return myProxDist; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Computes the distance between object and BVH tree.
|
||||
Standard_EXPORT Standard_Real ComputeDistance();
|
||||
|
||||
//! Defines the status of proximity points.
|
||||
Standard_EXPORT void DefineStatusProxPnt();
|
||||
|
||||
private:
|
||||
|
||||
//! Defines the status of proximity point from 1st BVH.
|
||||
void defineStatusProxPnt1();
|
||||
|
||||
//! Defines the status of proximity point from 2nd BVH.
|
||||
void defineStatusProxPnt2();
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Real myMinDistance; //!< Minimal distance from point to BVH, could be not equal to myDistance
|
||||
BVH_Vec3d myMinDistPoint; //!< Point on BVH providing the minimal distance
|
||||
|
||||
BVH_Vec3d myExtremaPoint; //!< Point on BVH providing the extrema
|
||||
|
||||
Standard_Real myProxDist; //!< Proximity distance
|
||||
|
||||
//! Proximity points
|
||||
BVH_Vec3d myPnt1, myPnt2;
|
||||
|
||||
//! Proximity points' status
|
||||
ProxPnt_Status myPntStatus1, myPntStatus2;
|
||||
|
||||
private:
|
||||
|
||||
//! Set of all mesh elements (triangles) of the 1st shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet1;
|
||||
//! Set of all mesh elements (triangles) of the 2nd shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet2;
|
||||
|
||||
//! List of subshapes of the 1st shape.
|
||||
BRepExtrema_ShapeList myShapeList1;
|
||||
//! List of subshapes of the 2nd shape.
|
||||
BRepExtrema_ShapeList myShapeList2;
|
||||
|
||||
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
|
||||
|
||||
//! Vertex index from 1st BVH corresponding to proximity point of 1st shape
|
||||
Standard_Integer myProxVtxIdx1;
|
||||
|
||||
//! Information of projection point state from 2nd BVH providing proximity point of 2nd shape
|
||||
PrjState myProxPrjState;
|
||||
|
||||
//! Information of projection point state from 2nd BVH providing the extrema
|
||||
PrjState myExtPrjState;
|
||||
|
||||
//! Information of projection point state from 2nd BVH providing the minimal distance
|
||||
PrjState myMinPrjState;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_ProximityDistTool_HeaderFile
|
@@ -1,161 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepExtrema_ProximityValueTool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityValueTool
|
||||
//purpose : Creates new unitialized proximity tool
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool()
|
||||
: myDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myIsDone (Standard_False),
|
||||
myNbSamples1(0),
|
||||
myNbSamples2(0)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ProximityValueTool
|
||||
//purpose : Creates new proximity tool for the given element sets
|
||||
//=======================================================================
|
||||
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
: myDistance (std::numeric_limits<Standard_Real>::max()),
|
||||
myIsDone (Standard_False),
|
||||
myNbSamples1(0),
|
||||
myNbSamples2(0)
|
||||
{
|
||||
LoadTriangleSets (theSet1, theSet2);
|
||||
LoadShapeLists (theShapeList1, theShapeList2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given element sets into the proximity tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2)
|
||||
{
|
||||
mySet1 = theSet1;
|
||||
mySet2 = theSet2;
|
||||
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LoadTriangleSets
|
||||
//purpose : Loads the given list of subshapes into the proximity tool
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2)
|
||||
{
|
||||
myShapeList1 = theShapeList1;
|
||||
myShapeList2 = theShapeList2;
|
||||
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetNbSamplePoints
|
||||
//purpose : Sets number of sample points used for proximity calculation for each shape
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer theSamples1,
|
||||
const Standard_Integer theSamples2)
|
||||
{
|
||||
myNbSamples1 = theSamples1;
|
||||
myNbSamples2 = theSamples2;
|
||||
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeProximityValue
|
||||
//purpose : Returns the computed proximity value from first BVH to another one
|
||||
//=======================================================================
|
||||
Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2,
|
||||
BVH_Vec3d& thePoint1,
|
||||
BVH_Vec3d& thePoint2,
|
||||
ProxPnt_Status& thePointStatus1,
|
||||
ProxPnt_Status& thePointStatus2) const
|
||||
{
|
||||
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theSet2, theShapeList1, theShapeList2);
|
||||
aProxDistTool.Perform();
|
||||
|
||||
if (!aProxDistTool.IsDone())
|
||||
return -1.;
|
||||
|
||||
aProxDistTool.ProximityPoints (thePoint1, thePoint2);
|
||||
aProxDistTool.ProximityPointsStatus (thePointStatus1, thePointStatus2);
|
||||
|
||||
return aProxDistTool.ProximityDistance();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Performs the computation of the proximity value
|
||||
//=======================================================================
|
||||
void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
|
||||
// max(min) dist from the 1st shape to the 2nd one
|
||||
BVH_Vec3d aP1_1, aP1_2;
|
||||
ProxPnt_Status aPointStatus1_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
ProxPnt_Status aPointStatus1_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
|
||||
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, mySet2, myShapeList1, myShapeList2,
|
||||
aP1_1, aP1_2, aPointStatus1_1, aPointStatus1_2);
|
||||
|
||||
if (aProximityDist1 < 0.)
|
||||
return;
|
||||
|
||||
// max(min) dist from the 2nd shape to t he 1st one
|
||||
BVH_Vec3d aP2_1, aP2_2;
|
||||
ProxPnt_Status aPointStatus2_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
ProxPnt_Status aPointStatus2_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
|
||||
|
||||
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, mySet1, myShapeList2, myShapeList1,
|
||||
aP2_2, aP2_1, aPointStatus2_2, aPointStatus2_1);
|
||||
|
||||
if (aProximityDist2 < 0.)
|
||||
return;
|
||||
|
||||
// min dist of the two max(min) dists
|
||||
if (aProximityDist1 < aProximityDist2)
|
||||
{
|
||||
myDistance = aProximityDist1;
|
||||
myPnt1.SetCoord(aP1_1.x(), aP1_1.y(), aP1_1.z());
|
||||
myPnt2.SetCoord(aP1_2.x(), aP1_2.y(), aP1_2.z());
|
||||
myPntStatus1 = aPointStatus1_1;
|
||||
myPntStatus2 = aPointStatus1_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
myDistance = aProximityDist2;
|
||||
myPnt1.SetCoord(aP2_1.x(), aP2_1.y(), aP2_1.z());
|
||||
myPnt2.SetCoord(aP2_2.x(), aP2_2.y(), aP2_2.z());
|
||||
myPntStatus1 = aPointStatus2_1;
|
||||
myPntStatus2 = aPointStatus2_2;
|
||||
}
|
||||
|
||||
myIsDone = Standard_True;
|
||||
theTolerance = myDistance;
|
||||
}
|
@@ -1,126 +0,0 @@
|
||||
// Created on: 2022-08-08
|
||||
// Created by: Kseniya NOSULKO
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepExtrema_ProximityValueTool_HeaderFile
|
||||
#define _BRepExtrema_ProximityValueTool_HeaderFile
|
||||
|
||||
#include <BRepExtrema_ProximityDistTool.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
|
||||
//! Tool class for computation of the proximity value from one BVH
|
||||
//! primitive set to another, solving max(min) problem.
|
||||
//! This tool is not intended to be used independently, and is integrated
|
||||
//! in other classes, implementing algorithms based on shape tessellation
|
||||
//! (BRepExtrema_ShapeProximity and BRepExtrema_SelfIntersection).
|
||||
//!
|
||||
//! Please note that algorithm results are approximate and depend greatly
|
||||
//! on the quality of input tessellation(s).
|
||||
class BRepExtrema_ProximityValueTool
|
||||
{
|
||||
public:
|
||||
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
|
||||
|
||||
public:
|
||||
|
||||
//! Creates new unitialized proximity tool.
|
||||
Standard_EXPORT BRepExtrema_ProximityValueTool();
|
||||
|
||||
//! Creates new proximity tool for the given element sets.
|
||||
Standard_EXPORT BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
public:
|
||||
|
||||
//! Loads the given element sets into the proximity tool.
|
||||
Standard_EXPORT void LoadTriangleSets (const Handle (BRepExtrema_TriangleSet)& theSet1,
|
||||
const Handle (BRepExtrema_TriangleSet)& theSet2);
|
||||
|
||||
//! Loads the given list of subshapes into the proximity tool.
|
||||
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2);
|
||||
|
||||
//! Sets number of sample points used for proximity calculation for each shape.
|
||||
//! If number is less or equal zero, all triangulation nodes are used.
|
||||
Standard_EXPORT void SetNbSamplePoints (const Standard_Integer theSamples1 = 0,
|
||||
const Standard_Integer theSamples2 = 0);
|
||||
|
||||
//! Performs the computation of the proximity value.
|
||||
Standard_EXPORT void Perform (Standard_Real& theTolerance);
|
||||
|
||||
//! Is proximity test completed?
|
||||
Standard_Boolean IsDone() const { return myIsDone; }
|
||||
|
||||
//! Marks test results as outdated.
|
||||
void MarkDirty() { myIsDone = Standard_False; }
|
||||
|
||||
//! Returns the computed distance.
|
||||
Standard_Real Distance() const { return myDistance; }
|
||||
|
||||
//! Returns points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2) const
|
||||
{
|
||||
thePoint1 = myPnt1;
|
||||
thePoint2 = myPnt2;
|
||||
}
|
||||
|
||||
//! Returns status of points on triangles sets, which provide the proximity distance.
|
||||
void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
|
||||
{
|
||||
thePointStatus1 = myPntStatus1;
|
||||
thePointStatus2 = myPntStatus2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Returns the computed proximity value from first BVH to another one.
|
||||
Standard_Real computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
|
||||
const Standard_Integer theNbSamples1,
|
||||
const Handle(BRepExtrema_TriangleSet)& theSet2,
|
||||
const BRepExtrema_ShapeList& theShapeList1,
|
||||
const BRepExtrema_ShapeList& theShapeList2,
|
||||
BVH_Vec3d& thePoint1,
|
||||
BVH_Vec3d& thePoint2,
|
||||
ProxPnt_Status& thePointStatus1,
|
||||
ProxPnt_Status& thePointStatus2) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Set of all mesh primitives of the 1st shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet1;
|
||||
//! Set of all mesh primitives of the 2nd shape.
|
||||
Handle(BRepExtrema_TriangleSet) mySet2;
|
||||
|
||||
//! List of subshapes of the 1st shape.
|
||||
BRepExtrema_ShapeList myShapeList1;
|
||||
//! List of subshapes of the 2nd shape.
|
||||
BRepExtrema_ShapeList myShapeList2;
|
||||
|
||||
Standard_Real myDistance; //!< Distance
|
||||
Standard_Boolean myIsDone; //!< State of the algorithm
|
||||
|
||||
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
|
||||
Standard_Integer myNbSamples2; //!< Number of samples points on the second shape
|
||||
|
||||
//! Proximity points
|
||||
gp_Pnt myPnt1, myPnt2;
|
||||
|
||||
//! Proximity points' status
|
||||
ProxPnt_Status myPntStatus1, myPntStatus2;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_ProximityValueTool_HeaderFile
|
@@ -18,8 +18,6 @@
|
||||
|
||||
#include <BRepExtrema_OverlapTool.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
//! Tool class for detection of self-sections in the given shape.
|
||||
//! This class is based on BRepExtrema_OverlapTool and thus uses
|
||||
//! shape tessellation to detect incorrect mesh fragments (pairs
|
||||
@@ -78,7 +76,7 @@ public:
|
||||
//! Returns sub-shape from the shape for the given index (started from 0).
|
||||
const TopoDS_Face& GetSubShape (const Standard_Integer theID) const
|
||||
{
|
||||
return TopoDS::Face(myFaceList.Value(theID));
|
||||
return myFaceList.Value (theID);
|
||||
}
|
||||
|
||||
//! Returns set of all the face triangles of the shape.
|
||||
|
@@ -18,28 +18,6 @@
|
||||
#include <Precision.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
// Assign a map of sub-shapes (edges/faces) of a given shape
|
||||
static Standard_Boolean initSubShapes(const TopoDS_Shape& theShape,
|
||||
BRepExtrema_ShapeList& theSubshapesList,
|
||||
Handle(BRepExtrema_TriangleSet)& theTriangleSet)
|
||||
{
|
||||
theSubshapesList.Clear();
|
||||
|
||||
for (TopExp_Explorer anIter(theShape, TopAbs_FACE); anIter.More(); anIter.Next())
|
||||
{
|
||||
theSubshapesList.Append(anIter.Current());
|
||||
}
|
||||
|
||||
for (TopExp_Explorer anIter(theShape, TopAbs_EDGE); anIter.More(); anIter.Next())
|
||||
{
|
||||
theSubshapesList.Append(anIter.Current());
|
||||
}
|
||||
|
||||
if (theTriangleSet.IsNull())
|
||||
theTriangleSet = new BRepExtrema_TriangleSet;
|
||||
return theTriangleSet->Init(theSubshapesList);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepExtrema_ShapeProximity
|
||||
//purpose : Creates uninitialized proximity tool
|
||||
@@ -47,9 +25,7 @@ static Standard_Boolean initSubShapes(const TopoDS_Shape& theShape,
|
||||
BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const Standard_Real theTolerance)
|
||||
: myTolerance (theTolerance),
|
||||
myElementSet1 (new BRepExtrema_TriangleSet),
|
||||
myElementSet2 (new BRepExtrema_TriangleSet),
|
||||
myNbSamples1 (0),
|
||||
myNbSamples2 (0)
|
||||
myElementSet2 (new BRepExtrema_TriangleSet)
|
||||
{
|
||||
// Should be initialized later
|
||||
myIsInitS1 = myIsInitS2 = Standard_False;
|
||||
@@ -64,9 +40,7 @@ BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const TopoDS_Shape& theS
|
||||
const Standard_Real theTolerance)
|
||||
: myTolerance (theTolerance),
|
||||
myElementSet1 (new BRepExtrema_TriangleSet),
|
||||
myElementSet2 (new BRepExtrema_TriangleSet),
|
||||
myNbSamples1 (0),
|
||||
myNbSamples2 (0)
|
||||
myElementSet2 (new BRepExtrema_TriangleSet)
|
||||
{
|
||||
LoadShape1 (theShape1);
|
||||
LoadShape2 (theShape2);
|
||||
@@ -78,18 +52,16 @@ BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const TopoDS_Shape& theS
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ShapeProximity::LoadShape1 (const TopoDS_Shape& theShape1)
|
||||
{
|
||||
myIsInitS1 = initSubShapes(theShape1, myShapeList1, myElementSet1);
|
||||
myFaceList1.Clear();
|
||||
|
||||
if (myTolerance == Precision::Infinite())
|
||||
for (TopExp_Explorer anIter (theShape1, TopAbs_FACE); anIter.More(); anIter.Next())
|
||||
{
|
||||
myProxValTool.MarkDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTool.MarkDirty();
|
||||
myFaceList1.Append (static_cast<const TopoDS_Face&> (anIter.Current()));
|
||||
}
|
||||
|
||||
return myIsInitS1;
|
||||
myOverlapTool.MarkDirty();
|
||||
|
||||
return myIsInitS1 = myElementSet1->Init (myFaceList1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -98,18 +70,16 @@ Standard_Boolean BRepExtrema_ShapeProximity::LoadShape1 (const TopoDS_Shape& the
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_ShapeProximity::LoadShape2 (const TopoDS_Shape& theShape2)
|
||||
{
|
||||
myIsInitS2 = initSubShapes(theShape2, myShapeList2, myElementSet2);
|
||||
myFaceList2.Clear();
|
||||
|
||||
if (myTolerance == Precision::Infinite())
|
||||
for (TopExp_Explorer anIter (theShape2, TopAbs_FACE); anIter.More(); anIter.Next())
|
||||
{
|
||||
myProxValTool.MarkDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
myOverlapTool.MarkDirty();
|
||||
myFaceList2.Append (static_cast<const TopoDS_Face&> (anIter.Current()));
|
||||
}
|
||||
|
||||
return myIsInitS2;
|
||||
myOverlapTool.MarkDirty();
|
||||
|
||||
return myIsInitS2 = myElementSet2->Init (myFaceList2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -118,32 +88,13 @@ Standard_Boolean BRepExtrema_ShapeProximity::LoadShape2 (const TopoDS_Shape& the
|
||||
//=======================================================================
|
||||
void BRepExtrema_ShapeProximity::Perform()
|
||||
{
|
||||
if (myTolerance == Precision::Infinite())
|
||||
if (!myIsInitS1 || !myIsInitS2 || myOverlapTool.IsDone())
|
||||
{
|
||||
if (!myIsInitS1 || !myIsInitS2 || myProxValTool.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myProxValTool.LoadTriangleSets (myElementSet1,
|
||||
myElementSet2);
|
||||
myProxValTool.LoadShapeLists (myShapeList1,
|
||||
myShapeList2);
|
||||
|
||||
myProxValTool.Perform (myTolerance);
|
||||
myProxValTool.ProximityPoints(myProxPoint1, myProxPoint2);
|
||||
myProxValTool.ProximityPointsStatus (myProxPntStatus1, myProxPntStatus2);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!myIsInitS1 || !myIsInitS2 || myOverlapTool.IsDone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myOverlapTool.LoadTriangleSets (myElementSet1,
|
||||
myElementSet2);
|
||||
myOverlapTool.LoadTriangleSets (myElementSet1,
|
||||
myElementSet2);
|
||||
|
||||
myOverlapTool.Perform (myTolerance);
|
||||
}
|
||||
myOverlapTool.Perform (myTolerance);
|
||||
}
|
||||
|
@@ -16,48 +16,31 @@
|
||||
#ifndef _BRepExtrema_ShapeProximity_HeaderFile
|
||||
#define _BRepExtrema_ShapeProximity_HeaderFile
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
|
||||
#include <BRepExtrema_ProximityValueTool.hxx>
|
||||
#include <BRepExtrema_TriangleSet.hxx>
|
||||
#include <BRepExtrema_OverlapTool.hxx>
|
||||
|
||||
//! @brief Tool class for shape proximity detection.
|
||||
//!
|
||||
//! First approach:
|
||||
//! Tool class for shape proximity detection.
|
||||
//! For two given shapes and given tolerance (offset from the mesh) the algorithm allows
|
||||
//! to determine whether or not they are overlapped. The algorithm input consists of any
|
||||
//! shapes which can be decomposed into individual faces (used as basic shape elements).
|
||||
//! High performance is achieved through the use of existing triangulation of faces. So
|
||||
//! poly triangulation (with the desired deflection) should already be built. Note that
|
||||
//! solution is approximate (and corresponds to the deflection used for triangulation).
|
||||
//!
|
||||
//! The algorithm can be run in two modes. If tolerance is set to zero, the algorithm
|
||||
//! will detect only intersecting faces (containing triangles with common points). If
|
||||
//! tolerance is set to positive value, the algorithm will also detect faces located
|
||||
//! on distance less than the given tolerance from each other.
|
||||
//!
|
||||
//! Second approach:
|
||||
//! Compute the proximity value between two shapes if the tolerance is not defined (Precision::Infinite()).
|
||||
//! In this case the proximity value is a minimal thickness of a layer containing both shapes.
|
||||
//!
|
||||
//! For the both approaches the high performance is achieved through the use of existing
|
||||
//! triangulation of faces. So, poly triangulation (with the desired deflection) should already
|
||||
//! be built. Note that solution is approximate (and corresponds to the deflection used for
|
||||
//! triangulation).
|
||||
class BRepExtrema_ShapeProximity
|
||||
{
|
||||
public:
|
||||
typedef typename BRepExtrema_ProximityValueTool::ProxPnt_Status ProxPnt_Status;
|
||||
|
||||
public:
|
||||
|
||||
//! Creates empty proximity tool.
|
||||
Standard_EXPORT BRepExtrema_ShapeProximity (const Standard_Real theTolerance = Precision::Infinite());
|
||||
Standard_EXPORT BRepExtrema_ShapeProximity (const Standard_Real theTolerance = 0.0);
|
||||
|
||||
//! Creates proximity tool for the given two shapes.
|
||||
Standard_EXPORT BRepExtrema_ShapeProximity (const TopoDS_Shape& theShape1,
|
||||
const TopoDS_Shape& theShape2,
|
||||
const Standard_Real theTolerance = Precision::Infinite());
|
||||
const Standard_Real theTolerance = 0.0);
|
||||
|
||||
public:
|
||||
|
||||
@@ -73,33 +56,19 @@ public:
|
||||
myTolerance = theTolerance;
|
||||
}
|
||||
|
||||
//! Returns proximity value calculated for the whole input shapes.
|
||||
Standard_Real Proximity() const
|
||||
{
|
||||
return Tolerance();
|
||||
}
|
||||
|
||||
//! Loads 1st shape into proximity tool.
|
||||
Standard_EXPORT Standard_Boolean LoadShape1 (const TopoDS_Shape& theShape1);
|
||||
|
||||
//! Loads 2nd shape into proximity tool.
|
||||
Standard_EXPORT Standard_Boolean LoadShape2 (const TopoDS_Shape& theShape2);
|
||||
|
||||
//! Set number of sample points on the 1st shape used to compute the proximity value.
|
||||
//! In case of 0, all triangulation nodes will be used.
|
||||
void SetNbSamples1(const Standard_Integer theNbSamples) { myNbSamples1 = theNbSamples; }
|
||||
|
||||
//! Set number of sample points on the 2nd shape used to compute the proximity value.
|
||||
//! In case of 0, all triangulation nodes will be used.
|
||||
void SetNbSamples2(const Standard_Integer theNbSamples) { myNbSamples2 = theNbSamples; }
|
||||
|
||||
//! Performs search of overlapped faces.
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
//! True if the search is completed.
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myOverlapTool.IsDone() || myProxValTool.IsDone();
|
||||
return myOverlapTool.IsDone();
|
||||
}
|
||||
|
||||
//! Returns set of IDs of overlapped faces of 1st shape (started from 0).
|
||||
@@ -115,15 +84,15 @@ public:
|
||||
}
|
||||
|
||||
//! Returns sub-shape from 1st shape with the given index (started from 0).
|
||||
const TopoDS_Shape& GetSubShape1 (const Standard_Integer theID) const
|
||||
const TopoDS_Face& GetSubShape1 (const Standard_Integer theID) const
|
||||
{
|
||||
return myShapeList1.Value (theID);
|
||||
return myFaceList1.Value (theID);
|
||||
}
|
||||
|
||||
//! Returns sub-shape from 1st shape with the given index (started from 0).
|
||||
const TopoDS_Shape& GetSubShape2 (const Standard_Integer theID) const
|
||||
const TopoDS_Face& GetSubShape2 (const Standard_Integer theID) const
|
||||
{
|
||||
return myShapeList2.Value (theID);
|
||||
return myFaceList2.Value (theID);
|
||||
}
|
||||
|
||||
//! Returns set of all the face triangles of the 1st shape.
|
||||
@@ -138,34 +107,6 @@ public:
|
||||
return myElementSet2;
|
||||
}
|
||||
|
||||
//! Returns the point on the 1st shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const gp_Pnt& ProximityPoint1() const
|
||||
{
|
||||
return myProxPoint1;
|
||||
}
|
||||
|
||||
//! Returns the point on the 2nd shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const gp_Pnt& ProximityPoint2() const
|
||||
{
|
||||
return myProxPoint2;
|
||||
}
|
||||
|
||||
//! Returns the status of point on the 1st shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const ProxPnt_Status& ProxPntStatus1() const
|
||||
{
|
||||
return myProxPntStatus1;
|
||||
}
|
||||
|
||||
//! Returns the status of point on the 2nd shape, which could be used as a reference point
|
||||
//! for the value of the proximity.
|
||||
const ProxPnt_Status& ProxPntStatus2() const
|
||||
{
|
||||
return myProxPntStatus2;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Maximum overlapping distance.
|
||||
@@ -176,39 +117,19 @@ private:
|
||||
//! Is the 2nd shape initialized?
|
||||
Standard_Boolean myIsInitS2;
|
||||
|
||||
//! List of subshapes of the 1st shape.
|
||||
BRepExtrema_ShapeList myShapeList1;
|
||||
//! List of subshapes of the 2nd shape.
|
||||
BRepExtrema_ShapeList myShapeList2;
|
||||
//! List of faces of the 1st shape.
|
||||
BRepExtrema_ShapeList myFaceList1;
|
||||
//! List of faces of the 2nd shape.
|
||||
BRepExtrema_ShapeList myFaceList2;
|
||||
|
||||
//! Set of all the face triangles of the 1st shape.
|
||||
Handle(BRepExtrema_TriangleSet) myElementSet1;
|
||||
//! Set of all the face triangles of the 2nd shape.
|
||||
Handle(BRepExtrema_TriangleSet) myElementSet2;
|
||||
|
||||
//! Number of sample points on the 1st shape used to compute the proximity value
|
||||
//! (if zero (default), all triangulation nodes will be used).
|
||||
Standard_Integer myNbSamples1;
|
||||
//! Number of sample points on the 2nd shape used to compute the proximity value
|
||||
//! (if zero (default), all triangulation nodes will be used).
|
||||
Standard_Integer myNbSamples2;
|
||||
|
||||
//! Reference point of the proximity value on the 1st shape.
|
||||
gp_Pnt myProxPoint1;
|
||||
//! Reference point of the proximity value on the 2st shape.
|
||||
gp_Pnt myProxPoint2;
|
||||
|
||||
//! Status of reference points of the proximity value.
|
||||
ProxPnt_Status myProxPntStatus1, myProxPntStatus2;
|
||||
|
||||
//! Overlap tool used for intersection/overlap test.
|
||||
BRepExtrema_OverlapTool myOverlapTool;
|
||||
|
||||
//! Shape-shape proximity tool used for computation of
|
||||
//! the minimal diameter of a tube containing both edges or
|
||||
//! the minimal thickness of a shell containing both faces.
|
||||
BRepExtrema_ProximityValueTool myProxValTool;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepExtrema_ShapeProximity_HeaderFile
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BVH_LinearBuilder.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
|
||||
|
||||
@@ -115,65 +114,17 @@ void BRepExtrema_TriangleSet::Swap (const Standard_Integer theIndex1, const Stan
|
||||
{
|
||||
std::swap (myTriangles[theIndex1],
|
||||
myTriangles[theIndex2]);
|
||||
|
||||
std::swap (myTrgIdxMap (theIndex1),
|
||||
myTrgIdxMap (theIndex2));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceID
|
||||
//purpose : Returns face ID of the given vertex
|
||||
//purpose : Returns face ID of the given triangle
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetFaceID (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myTriangles[theIndex].w();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShapeIDOfVtx
|
||||
//purpose : Returns shape ID of the given vertex index
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetShapeIDOfVtx (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myShapeIdxOfVtxVec.Value (theIndex);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVtxIdxInShape
|
||||
//purpose : Returns vertex index in tringulation of the shape, which vertex belongs,
|
||||
// with the given vtx ID in whole set
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetVtxIdxInShape (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer aShID = myShapeIdxOfVtxVec.Value (theIndex);
|
||||
Standard_Integer aNumVertices = 0;
|
||||
|
||||
for (Standard_Integer aSIdx = 0; aSIdx < aShID; aSIdx++)
|
||||
{
|
||||
aNumVertices += myNumVtxInShapeVec.Value (aSIdx);
|
||||
}
|
||||
|
||||
return theIndex - aNumVertices;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTrgIdxInShape
|
||||
//purpose : Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs,
|
||||
// with the given trg ID in whole set (after swapping)
|
||||
//=======================================================================
|
||||
Standard_Integer BRepExtrema_TriangleSet::GetTrgIdxInShape (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer aShID = GetFaceID (theIndex);
|
||||
Standard_Integer aNumTriangles = 0;
|
||||
|
||||
for (Standard_Integer aSIdx = 0; aSIdx < aShID; aSIdx++)
|
||||
{
|
||||
aNumTriangles += myNumTrgInShapeVec.Value (aSIdx);
|
||||
}
|
||||
|
||||
return myTrgIdxMap (theIndex) - aNumTriangles;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVertices
|
||||
//purpose : Returns vertices of the given triangle
|
||||
@@ -190,21 +141,6 @@ void BRepExtrema_TriangleSet::GetVertices (const Standard_Integer theIndex,
|
||||
theVertex3 = myVertexArray[aTriangle.z()];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVertices
|
||||
//purpose : Returns vertices of the given triangle
|
||||
//=======================================================================
|
||||
void BRepExtrema_TriangleSet::GetVtxIndices (const Standard_Integer theIndex,
|
||||
NCollection_Array1<Standard_Integer>& theVtxIndices) const
|
||||
{
|
||||
BVH_Vec4i aTriangle = myTriangles[theIndex];
|
||||
|
||||
theVtxIndices = NCollection_Array1<Standard_Integer> (0, 2);
|
||||
theVtxIndices.SetValue (0, aTriangle.x());
|
||||
theVtxIndices.SetValue (1, aTriangle.y());
|
||||
theVtxIndices.SetValue (2, aTriangle.z());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose : Clears triangle set data
|
||||
@@ -222,26 +158,41 @@ void BRepExtrema_TriangleSet::Clear()
|
||||
//function : Init
|
||||
//purpose : Initializes triangle set
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& theShapes)
|
||||
Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& theFaces)
|
||||
{
|
||||
Clear();
|
||||
|
||||
Standard_Boolean isOK = Standard_True;
|
||||
for (Standard_Integer aShapeIdx = 0; aShapeIdx < theShapes.Size() && isOK; ++aShapeIdx)
|
||||
for (Standard_Integer aFaceIdx = 0; aFaceIdx < theFaces.Size(); ++aFaceIdx)
|
||||
{
|
||||
if (theShapes (aShapeIdx).ShapeType() == TopAbs_FACE)
|
||||
isOK = initFace (TopoDS::Face (theShapes(aShapeIdx)), aShapeIdx);
|
||||
else if (theShapes (aShapeIdx).ShapeType() == TopAbs_EDGE)
|
||||
isOK = initEdge (TopoDS::Edge (theShapes(aShapeIdx)), aShapeIdx);
|
||||
}
|
||||
TopLoc_Location aLocation;
|
||||
|
||||
Standard_Integer aNumTrg = static_cast<Standard_Integer> (myTriangles.size());
|
||||
myTrgIdxMap.Clear();
|
||||
myTrgIdxMap.ReSize (aNumTrg);
|
||||
Handle(Poly_Triangulation) aTriangulation =
|
||||
BRep_Tool::Triangulation (theFaces (aFaceIdx), aLocation);
|
||||
|
||||
for (Standard_Integer aTrgIdx = 0; aTrgIdx < aNumTrg; ++aTrgIdx)
|
||||
{
|
||||
myTrgIdxMap.Bind (aTrgIdx, aTrgIdx);
|
||||
if (aTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aVertOffset =
|
||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
||||
|
||||
for (Standard_Integer aVertIdx = 1; aVertIdx <= aTriangulation->NbNodes(); ++aVertIdx)
|
||||
{
|
||||
gp_Pnt aVertex = aTriangulation->Node (aVertIdx);
|
||||
aVertex.Transform (aLocation.Transformation());
|
||||
myVertexArray.push_back (BVH_Vec3d (aVertex.X(), aVertex.Y(), aVertex.Z()));
|
||||
}
|
||||
|
||||
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
|
||||
{
|
||||
Standard_Integer aVertex1, aVertex2, aVertex3;
|
||||
aTriangulation->Triangle (aTriIdx).Get (aVertex1, aVertex2, aVertex3);
|
||||
myTriangles.push_back (BVH_Vec4i (aVertex1 + aVertOffset,
|
||||
aVertex2 + aVertOffset,
|
||||
aVertex3 + aVertOffset,
|
||||
aFaceIdx));
|
||||
}
|
||||
}
|
||||
|
||||
MarkDirty(); // needs BVH rebuilding
|
||||
@@ -252,95 +203,3 @@ Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& the
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initFace
|
||||
//purpose : Initializes triangle set
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_TriangleSet::initFace (const TopoDS_Face& theFace, const Standard_Integer theIndex)
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (theFace, aLocation);
|
||||
if (aTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aVertOffset =
|
||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
||||
|
||||
initNodes (aTriangulation->MapNodeArray()->ChangeArray1(), aLocation.Transformation(), theIndex);
|
||||
|
||||
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
|
||||
{
|
||||
Standard_Integer aVertex1;
|
||||
Standard_Integer aVertex2;
|
||||
Standard_Integer aVertex3;
|
||||
|
||||
aTriangulation->Triangle (aTriIdx).Get (aVertex1,
|
||||
aVertex2,
|
||||
aVertex3);
|
||||
|
||||
myTriangles.push_back (BVH_Vec4i (aVertex1 + aVertOffset,
|
||||
aVertex2 + aVertOffset,
|
||||
aVertex3 + aVertOffset,
|
||||
theIndex));
|
||||
}
|
||||
|
||||
myNumTrgInShapeVec.SetValue (theIndex, aTriangulation->NbTriangles());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initEdge
|
||||
//purpose : Initializes triangle set
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepExtrema_TriangleSet::initEdge (const TopoDS_Edge& theEdge, const Standard_Integer theIndex)
|
||||
{
|
||||
TopLoc_Location aLocation;
|
||||
|
||||
Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (theEdge, aLocation);
|
||||
if (aPolygon.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aVertOffset =
|
||||
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
|
||||
|
||||
initNodes (aPolygon->Nodes(), aLocation.Transformation(), theIndex);
|
||||
|
||||
for (Standard_Integer aVertIdx = 1; aVertIdx < aPolygon->NbNodes(); ++aVertIdx)
|
||||
{
|
||||
// segment as degenerate triangle
|
||||
myTriangles.push_back (BVH_Vec4i (aVertIdx + aVertOffset,
|
||||
aVertIdx + aVertOffset + 1,
|
||||
aVertIdx + aVertOffset + 1,
|
||||
theIndex));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initNodes
|
||||
//purpose : Initializes nodes
|
||||
//=======================================================================
|
||||
void BRepExtrema_TriangleSet::initNodes (const TColgp_Array1OfPnt& theNodes,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Integer theIndex)
|
||||
{
|
||||
for (Standard_Integer aVertIdx = 1; aVertIdx <= theNodes.Size(); ++aVertIdx)
|
||||
{
|
||||
gp_Pnt aVertex = theNodes.Value (aVertIdx);
|
||||
|
||||
aVertex.Transform (theTrsf);
|
||||
|
||||
myVertexArray.push_back (BVH_Vec3d (aVertex.X(),
|
||||
aVertex.Y(),
|
||||
aVertex.Z()));
|
||||
myShapeIdxOfVtxVec.Append (theIndex);
|
||||
}
|
||||
|
||||
myNumVtxInShapeVec.SetValue (theIndex, theNodes.Size());
|
||||
}
|
||||
|
@@ -16,14 +16,11 @@
|
||||
#ifndef _BRepExtrema_TriangleSet_HeaderFile
|
||||
#define _BRepExtrema_TriangleSet_HeaderFile
|
||||
|
||||
#include <BVH_PrimitiveSet3d.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_DataMapOfIntegerInteger.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <BVH_PrimitiveSet3d.hxx>
|
||||
|
||||
//! List of shapes and their IDs for collision detection.
|
||||
typedef NCollection_Vector<TopoDS_Shape> BRepExtrema_ShapeList;
|
||||
typedef NCollection_Vector<TopoDS_Face> BRepExtrema_ShapeList;
|
||||
|
||||
//! Triangle set corresponding to specific face.
|
||||
class BRepExtrema_TriangleSet : public BVH_PrimitiveSet3d
|
||||
@@ -62,10 +59,7 @@ public:
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
//! Initializes triangle set.
|
||||
Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theShapes);
|
||||
|
||||
//! Returns all vertices.
|
||||
Standard_EXPORT const BVH_Array3d& GetVertices() const { return myVertexArray; }
|
||||
Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theFaces);
|
||||
|
||||
//! Returns vertices of the given triangle.
|
||||
Standard_EXPORT void GetVertices (const Standard_Integer theIndex,
|
||||
@@ -73,37 +67,9 @@ public:
|
||||
BVH_Vec3d& theVertex2,
|
||||
BVH_Vec3d& theVertex3) const;
|
||||
|
||||
//! Returns vertex indices of the given triangle.
|
||||
Standard_EXPORT void GetVtxIndices (const Standard_Integer theIndex,
|
||||
NCollection_Array1<Standard_Integer>& theVtxIndices) const;
|
||||
|
||||
//! Returns face ID of the given triangle.
|
||||
Standard_EXPORT Standard_Integer GetFaceID (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns shape ID of the given vertex index.
|
||||
Standard_EXPORT Standard_Integer GetShapeIDOfVtx (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns vertex index in tringulation of the shape, which vertex belongs,
|
||||
//! with the given vtx ID in whole set.
|
||||
Standard_EXPORT Standard_Integer GetVtxIdxInShape (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs,
|
||||
//! with the given trg ID in whole set (after swapping).
|
||||
Standard_EXPORT Standard_Integer GetTrgIdxInShape (const Standard_Integer theIndex) const;
|
||||
|
||||
private:
|
||||
|
||||
//! Initializes triangle set from the face
|
||||
Standard_Boolean initFace (const TopoDS_Face& theFace, const Standard_Integer theIndex);
|
||||
|
||||
//! Initializes polygon from the edge
|
||||
Standard_Boolean initEdge (const TopoDS_Edge& theEdge, const Standard_Integer theIndex);
|
||||
|
||||
//! Initializes nodes
|
||||
void initNodes (const TColgp_Array1OfPnt& theNodes,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Integer theIndex);
|
||||
|
||||
protected:
|
||||
|
||||
//! Array of vertex indices.
|
||||
@@ -112,19 +78,6 @@ protected:
|
||||
//! Array of vertex coordinates.
|
||||
BVH_Array3d myVertexArray;
|
||||
|
||||
//! Vector of shapes' indices where index of item corresponds to index of vertex,
|
||||
//! belonging to this shape.
|
||||
NCollection_Vector<Standard_Integer> myShapeIdxOfVtxVec;
|
||||
|
||||
//! Vector of vertexes' number belonging to shape which index corresponds item's index.
|
||||
NCollection_Vector<Standard_Integer> myNumVtxInShapeVec;
|
||||
|
||||
//! Vector of triangles' number belonging to shape which index corresponds item's index.
|
||||
NCollection_Vector<Standard_Integer> myNumTrgInShapeVec;
|
||||
|
||||
//! Map of triangles' indices after (key) and before (value) swapping.
|
||||
TColStd_DataMapOfIntegerInteger myTrgIdxMap;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
|
||||
|
@@ -18,10 +18,6 @@ BRepExtrema_OverlapTool.cxx
|
||||
BRepExtrema_OverlapTool.hxx
|
||||
BRepExtrema_Poly.cxx
|
||||
BRepExtrema_Poly.hxx
|
||||
BRepExtrema_ProximityValueTool.cxx
|
||||
BRepExtrema_ProximityValueTool.hxx
|
||||
BRepExtrema_ProximityDistTool.cxx
|
||||
BRepExtrema_ProximityDistTool.hxx
|
||||
BRepExtrema_SelfIntersection.cxx
|
||||
BRepExtrema_SelfIntersection.hxx
|
||||
BRepExtrema_SeqOfSolution.hxx
|
||||
|
@@ -3002,7 +3002,7 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
|
||||
}
|
||||
}
|
||||
|
||||
if ((NbTrous > 0) ? (aNbFaces < NbLaw) : (aNbFaces == 0))
|
||||
if (aNbFaces == 0)
|
||||
{
|
||||
isDone = Standard_False;
|
||||
return;
|
||||
|
@@ -35,13 +35,11 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellato
|
||||
//=======================================================================
|
||||
BRepMesh_CurveTessellator::BRepMesh_CurveTessellator(
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
: myDEdge(theEdge),
|
||||
myParameters(theParameters),
|
||||
myEdge(theEdge->GetEdge()),
|
||||
myCurve(myEdge),
|
||||
myMinPointsNb (theMinPointsNb)
|
||||
myCurve(myEdge)
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -54,13 +52,11 @@ BRepMesh_CurveTessellator::BRepMesh_CurveTessellator (
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
: myDEdge(theEdge),
|
||||
myParameters(theParameters),
|
||||
myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))),
|
||||
myCurve(myEdge, theFace->GetFace()),
|
||||
myMinPointsNb (theMinPointsNb)
|
||||
myCurve(myEdge, theFace->GetFace())
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -101,8 +97,7 @@ void BRepMesh_CurveTessellator::init()
|
||||
myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
|
||||
myEdgeSqTol *= myEdgeSqTol;
|
||||
|
||||
const Standard_Integer aMinPntNb = Max(myMinPointsNb,
|
||||
(myCurve.GetType() == GeomAbs_Circle) ? 4 : 2); //OCC287
|
||||
const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287
|
||||
|
||||
myDiscretTool.Initialize (myCurve,
|
||||
myCurve.FirstParameter(), myCurve.LastParameter(),
|
||||
|
@@ -34,16 +34,14 @@ public:
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_CurveTessellator(
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_CurveTessellator (
|
||||
const IMeshData::IEdgeHandle& theEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_CurveTessellator ();
|
||||
@@ -98,7 +96,6 @@ private:
|
||||
const IMeshTools_Parameters& myParameters;
|
||||
TopoDS_Edge myEdge;
|
||||
BRepAdaptor_Curve myCurve;
|
||||
Standard_Integer myMinPointsNb;
|
||||
GCPnts_TangentialDeflection myDiscretTool;
|
||||
TopoDS_Vertex myFirstVertex;
|
||||
TopoDS_Vertex myLastVertex;
|
||||
|
@@ -49,10 +49,9 @@ BRepMesh_EdgeDiscret::~BRepMesh_EdgeDiscret ()
|
||||
//=======================================================================
|
||||
Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
return new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb);
|
||||
return new BRepMesh_CurveTessellator(theDEdge, theParameters);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -63,12 +62,11 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
return theDEdge->GetSameParam() ?
|
||||
new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb) :
|
||||
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb);
|
||||
new BRepMesh_CurveTessellator(theDEdge, theParameters) :
|
||||
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -38,16 +38,14 @@ public:
|
||||
//! Creates instance of free edge tessellator.
|
||||
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Creates instance of edge tessellator.
|
||||
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const TopAbs_Orientation theOrientation,
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Standard_Integer theMinPointsNb = 2);
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Creates instance of tessellation extractor.
|
||||
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor(
|
||||
|
@@ -1,45 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_ExtrusionRangeSplitter.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedIntervalNb
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_ExtrusionRangeSplitter::getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean /*isU*/,
|
||||
const GeomAbs_Shape theContinuity) const
|
||||
{
|
||||
// Here we need just a regular grid along dimension with no
|
||||
// geometrical data regarding intervals like extrusion surface.
|
||||
const Handle(Adaptor3d_Curve) aCurve = theSurface->BasisCurve();
|
||||
Standard_Integer aIntervalsNb = aCurve->NbIntervals(theContinuity);
|
||||
if (aIntervalsNb == 1)
|
||||
{
|
||||
const GeomAbs_CurveType aCurveType = aCurve->GetType();
|
||||
const Standard_Boolean isBSplineCurve =
|
||||
aCurveType == GeomAbs_BezierCurve ||
|
||||
aCurveType == GeomAbs_BSplineCurve;
|
||||
|
||||
if (isBSplineCurve)
|
||||
{
|
||||
aIntervalsNb = aCurve->NbPoles() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return aIntervalsNb;
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepMesh_ExtrusionRangeSplitter_HeaderFile
|
||||
#define _BRepMesh_ExtrusionRangeSplitter_HeaderFile
|
||||
|
||||
#include <BRepMesh_NURBSRangeSplitter.hxx>
|
||||
|
||||
//! Auxiliary class analysing extrusion surface in order to generate internal nodes.
|
||||
class BRepMesh_ExtrusionRangeSplitter : public BRepMesh_NURBSRangeSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_ExtrusionRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~BRepMesh_ExtrusionRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Returns number of intervals computed using available geometrical parameters.
|
||||
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity) const Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
@@ -21,8 +21,6 @@
|
||||
#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
|
||||
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
|
||||
#include <BRepMesh_ExtrusionRangeSplitter.hxx>
|
||||
#include <BRepMesh_UndefinedRangeSplitter.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
|
||||
@@ -73,55 +71,34 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo(
|
||||
switch (theSurfaceType)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
(theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type);
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_SphereRangeSplitter>::Type :
|
||||
new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
|
||||
return new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
(theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type);
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_ConeRangeSplitter>::Type :
|
||||
new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
|
||||
return new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Torus:
|
||||
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
|
||||
new DeflectionControlMeshAlgo<BRepMesh_TorusRangeSplitter>::Type :
|
||||
new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
|
||||
return new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_SurfaceOfRevolution:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_SurfaceOfExtrusion:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_ExtrusionRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_BezierSurface:
|
||||
case GeomAbs_BSplineSurface:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_OffsetSurface:
|
||||
case GeomAbs_OtherSurface:
|
||||
default:
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_UndefinedRangeSplitter>::Type;
|
||||
return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
|
||||
}
|
||||
}
|
||||
|
@@ -50,32 +50,14 @@ namespace
|
||||
void operator()(const IMeshData::IEdgePtr& theDEdge) const
|
||||
{
|
||||
const IMeshData::IEdgeHandle aDEdge = theDEdge;
|
||||
|
||||
Standard_Integer aPointsNb = aDEdge->GetCurve()->ParametersNb();
|
||||
|
||||
aDEdge->Clear(Standard_True);
|
||||
aDEdge->SetDeflection(Max(aDEdge->GetDeflection() / 3., Precision::Confusion()));
|
||||
|
||||
for (Standard_Integer aPCurveIt = 0; aPCurveIt < aDEdge->PCurvesNb(); ++aPCurveIt)
|
||||
{
|
||||
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(aPCurveIt);
|
||||
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
|
||||
|
||||
// Check that outer wire contains 2 edges or less and add an additional point.
|
||||
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(0);
|
||||
if (aDWire->EdgesNb() <= 2)
|
||||
{
|
||||
++aPointsNb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0);
|
||||
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
|
||||
Handle(IMeshTools_CurveTessellator) aTessellator =
|
||||
BRepMesh_EdgeDiscret::CreateEdgeTessellator(
|
||||
aDEdge, aPCurve->GetOrientation(), aDFace,
|
||||
myParameters, aPointsNb);
|
||||
aDEdge, aPCurve->GetOrientation(), aDFace, myParameters);
|
||||
|
||||
BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False);
|
||||
BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False);
|
||||
|
@@ -392,73 +392,27 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_NURBSRangeSplitter::GenerateSurfaceNodes
|
||||
return aNodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedIntervalNb
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_NURBSRangeSplitter::getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape /*theContinuity*/) const
|
||||
{
|
||||
return (isU ? theSurface->NbUPoles() : theSurface->NbVPoles()) - 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedInterval
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_NURBSRangeSplitter::getUndefinedInterval(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
TColStd_Array1OfReal& theIntervals) const
|
||||
{
|
||||
Standard_Integer aIntervalsNb = isU ?
|
||||
theSurface->NbUIntervals(theContinuity) :
|
||||
theSurface->NbVIntervals(theContinuity);
|
||||
|
||||
if (aIntervalsNb == 1)
|
||||
{
|
||||
aIntervalsNb = getUndefinedIntervalNb(theSurface, isU, theContinuity);
|
||||
if (aIntervalsNb > 1)
|
||||
{
|
||||
theIntervals = TColStd_Array1OfReal(1, aIntervalsNb - 1);
|
||||
const Standard_Real aDiff = (theRange.second - theRange.first) / aIntervalsNb;
|
||||
for (Standard_Integer i = theIntervals.Lower(); i <= theIntervals.Upper(); ++i)
|
||||
{
|
||||
theIntervals.SetValue(i, theRange.first + i * aDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (theIntervals.IsEmpty())
|
||||
{
|
||||
theIntervals = TColStd_Array1OfReal(1, aIntervalsNb + 1);
|
||||
if (isU)
|
||||
{
|
||||
theSurface->UIntervals(theIntervals, theContinuity);
|
||||
}
|
||||
else
|
||||
{
|
||||
theSurface->VIntervals(theIntervals, theContinuity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: initParameters
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_NURBSRangeSplitter::initParameters() const
|
||||
{
|
||||
const GeomAbs_Shape aContinuity = GeomAbs_CN;
|
||||
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
|
||||
|
||||
TColStd_Array1OfReal aIntervals[2];
|
||||
getUndefinedInterval(aSurface, Standard_True, aContinuity, GetRangeU(), aIntervals[0]);
|
||||
getUndefinedInterval(aSurface, Standard_False, aContinuity, GetRangeV(), aIntervals[1]);
|
||||
const GeomAbs_Shape aContinuity = GeomAbs_CN;
|
||||
const std::pair<Standard_Integer, Standard_Integer> aIntervalsNb(
|
||||
aSurface->NbUIntervals(aContinuity),
|
||||
aSurface->NbVIntervals(aContinuity)
|
||||
);
|
||||
|
||||
TColStd_Array1OfReal aIntervals[2] = {
|
||||
TColStd_Array1OfReal(1, aIntervalsNb.first + 1),
|
||||
TColStd_Array1OfReal(1, aIntervalsNb.second + 1)
|
||||
};
|
||||
|
||||
aSurface->UIntervals(aIntervals[0], aContinuity);
|
||||
aSurface->VIntervals(aIntervals[1], aContinuity);
|
||||
|
||||
const Standard_Boolean isSplitIntervals = toSplitIntervals (aSurface->Surface().Surface(), aIntervals);
|
||||
|
||||
@@ -553,17 +507,12 @@ Handle(IMeshData::SequenceOfReal) BRepMesh_NURBSRangeSplitter::computeGrainAndFi
|
||||
aMinDiff /= theDelta;
|
||||
}
|
||||
|
||||
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
|
||||
const Standard_Real aMinSize2d = Max(
|
||||
aSurface->UResolution(theParameters.MinSize),
|
||||
aSurface->VResolution(theParameters.MinSize));
|
||||
|
||||
aMinDiff = Max(aMinSize2d, aMinDiff);
|
||||
aMinDiff = Max(theParameters.MinSize, aMinDiff);
|
||||
|
||||
const Standard_Real aDiffMaxLim = 0.1 * theRangeDiff;
|
||||
const Standard_Real aDiffMinLim = Max(0.005 * theRangeDiff,
|
||||
2. * theTol2d);
|
||||
const Standard_Real aDiff = Max(aMinSize2d,
|
||||
const Standard_Real aDiff = Max(theParameters.MinSize,
|
||||
Min(aDiffMaxLim, aDiffMinLim));
|
||||
return filterParameters(theSourceParams, aMinDiff, aDiff, theAllocator);
|
||||
}
|
||||
|
@@ -49,21 +49,7 @@ protected:
|
||||
//! Initializes U and V parameters lists using CN continuity intervals.
|
||||
Standard_EXPORT virtual Standard_Boolean initParameters() const;
|
||||
|
||||
//! Returns number of intervals computed using available geometrical parameters.
|
||||
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity) const;
|
||||
|
||||
private:
|
||||
//! Tries to compute intervals even for cases with no intervals
|
||||
//! at all using available geometrical parameters.
|
||||
void getUndefinedInterval(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
TColStd_Array1OfReal& theIntervals) const;
|
||||
|
||||
//! Computes parameters of filter and applies it to the source parameters.
|
||||
Handle(IMeshData::SequenceOfReal) computeGrainAndFilterParameters(
|
||||
|
@@ -1,28 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_UndefinedRangeSplitter.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Function: getUndefinedIntervalNb
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer BRepMesh_UndefinedRangeSplitter::getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& /*theSurface*/,
|
||||
const Standard_Boolean /*isU*/,
|
||||
const GeomAbs_Shape /*theContinuity*/) const
|
||||
{
|
||||
return 1;
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
// Created on: 2022-09-07
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepMesh_UndefinedRangeSplitter_HeaderFile
|
||||
#define _BRepMesh_UndefinedRangeSplitter_HeaderFile
|
||||
|
||||
#include <BRepMesh_NURBSRangeSplitter.hxx>
|
||||
|
||||
//! Auxiliary class provides safe value for surfaces that looks like NURBS
|
||||
//! but has no poles or other characteristics.
|
||||
class BRepMesh_UndefinedRangeSplitter : public BRepMesh_NURBSRangeSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_UndefinedRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~BRepMesh_UndefinedRangeSplitter()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Returns number of intervals computed using available geometrical parameters.
|
||||
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
|
||||
const Handle(Adaptor3d_Surface)& theSurface,
|
||||
const Standard_Boolean isU,
|
||||
const GeomAbs_Shape theContinuity) const Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
@@ -40,8 +40,6 @@ BRepMesh_EdgeDiscret.hxx
|
||||
BRepMesh_EdgeParameterProvider.hxx
|
||||
BRepMesh_EdgeTessellationExtractor.cxx
|
||||
BRepMesh_EdgeTessellationExtractor.hxx
|
||||
BRepMesh_ExtrusionRangeSplitter.cxx
|
||||
BRepMesh_ExtrusionRangeSplitter.hxx
|
||||
BRepMesh_FaceChecker.cxx
|
||||
BRepMesh_FaceChecker.hxx
|
||||
BRepMesh_FaceDiscret.cxx
|
||||
@@ -82,8 +80,6 @@ BRepMesh_SphereRangeSplitter.hxx
|
||||
BRepMesh_TorusRangeSplitter.cxx
|
||||
BRepMesh_TorusRangeSplitter.hxx
|
||||
BRepMesh_Triangle.hxx
|
||||
BRepMesh_UndefinedRangeSplitter.cxx
|
||||
BRepMesh_UndefinedRangeSplitter.hxx
|
||||
BRepMesh_UVParamRangeSplitter.hxx
|
||||
BRepMesh_Vertex.hxx
|
||||
BRepMesh_VertexInspector.hxx
|
||||
|
@@ -60,8 +60,8 @@ static Standard_Boolean NeedsConvertion (const TopoDS_Wire& theWire)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopoDS_Face BRepOffsetAPI_MakeOffset::ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance)
|
||||
static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance)
|
||||
{
|
||||
TopAbs_Orientation anOr = theFace.Orientation();
|
||||
TopoDS_Face aFace = theFace;
|
||||
@@ -76,7 +76,6 @@ TopoDS_Face BRepOffsetAPI_MakeOffset::ConvertFace (const TopoDS_Face& theFace,
|
||||
if (NeedsConvertion (aWire))
|
||||
{
|
||||
TopAbs_Orientation anOrOfWire = aWire.Orientation();
|
||||
aWire.Orientation (TopAbs_FORWARD);
|
||||
aWire = BRepAlgo::ConvertWire (aWire, theAngleTolerance, aFace);
|
||||
BRepLib::BuildCurves3d (aWire);
|
||||
aWire.Orientation (anOrOfWire);
|
||||
@@ -353,7 +352,7 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
|
||||
{
|
||||
if (myIsToApprox)
|
||||
{
|
||||
Standard_Real aTol = 0.1;
|
||||
Standard_Real aTol = 0.01;
|
||||
if (myFace.IsNull())
|
||||
{
|
||||
TopoDS_Face aFace;
|
||||
|
@@ -84,10 +84,7 @@ public:
|
||||
//! from the shape <S>.
|
||||
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
|
||||
|
||||
//! Converts each wire of the face into contour consisting only of
|
||||
//! arcs and segments. New 3D curves are built too.
|
||||
Standard_EXPORT static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
|
||||
const Standard_Real theAngleTolerance);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -173,7 +173,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
{
|
||||
if (theNbArgs < 3 || theNbArgs > 6)
|
||||
{
|
||||
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value> | -value] [-profile]";
|
||||
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value>] [-profile]";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -186,11 +186,9 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepExtrema_ShapeProximity aTool(0.0);
|
||||
BRepExtrema_ShapeProximity aTool;
|
||||
|
||||
Standard_Boolean aProfile = Standard_False;
|
||||
Standard_Boolean isTolerance = Standard_False;
|
||||
Standard_Boolean isValue = Standard_False;
|
||||
|
||||
for (Standard_Integer anArgIdx = 3; anArgIdx < theNbArgs; ++anArgIdx)
|
||||
{
|
||||
@@ -199,7 +197,6 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
|
||||
if (aFlag == "-tol")
|
||||
{
|
||||
isTolerance = Standard_True;
|
||||
if (++anArgIdx >= theNbArgs)
|
||||
{
|
||||
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
|
||||
@@ -217,23 +214,13 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
aTool.SetTolerance (aTolerance);
|
||||
}
|
||||
}
|
||||
else if (aFlag == "-value")
|
||||
{
|
||||
isValue = Standard_True;
|
||||
aTool.SetTolerance(Precision::Infinite());
|
||||
}
|
||||
else if (aFlag == "-profile")
|
||||
|
||||
if (aFlag == "-profile")
|
||||
{
|
||||
aProfile = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (isTolerance && isValue)
|
||||
{
|
||||
Message::SendFail() << "Error: Proximity value could not be computed if the tolerance is set";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Real aInitTime = 0.0;
|
||||
Standard_Real aWorkTime = 0.0;
|
||||
|
||||
@@ -277,74 +264,39 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
|
||||
theDI << "Executing proximity test: " << aWorkTime << "\n";
|
||||
}
|
||||
|
||||
if (isValue)
|
||||
TopoDS_Builder aCompBuilder;
|
||||
|
||||
TopoDS_Compound aFaceCompound1;
|
||||
aCompBuilder.MakeCompound (aFaceCompound1);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1 (aTool.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
|
||||
{
|
||||
theDI << "Proximity value: " << aTool.Proximity() << "\n";
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString (theArgs[1]) + "_" + (anIt1.Key() + 1);
|
||||
|
||||
// proximity points
|
||||
TopoDS_Vertex aProxVtx1 = BRepLib_MakeVertex (aTool.ProximityPoint1());
|
||||
TopoDS_Vertex aProxVtx2 = BRepLib_MakeVertex (aTool.ProximityPoint2());
|
||||
const TopoDS_Face& aFace = aTool.GetSubShape1 (anIt1.Key());
|
||||
aCompBuilder.Add (aFaceCompound1, aFace);
|
||||
DBRep::Set (aStr.ToCString(), aFace);
|
||||
|
||||
DBRep::Set ("ProxPnt1", aProxVtx1);
|
||||
DBRep::Set ("ProxPnt2", aProxVtx2);
|
||||
|
||||
// proximity points' status
|
||||
TCollection_AsciiString ProxPntStatus1;
|
||||
TCollection_AsciiString ProxPntStatus2;
|
||||
|
||||
switch (aTool.ProxPntStatus1())
|
||||
{
|
||||
case 0: ProxPntStatus1 = "Border"; break;
|
||||
case 1: ProxPntStatus1 = "Middle"; break;
|
||||
default: ProxPntStatus1 = "Unknown";
|
||||
}
|
||||
|
||||
switch (aTool.ProxPntStatus2())
|
||||
{
|
||||
case 0: ProxPntStatus2 = "Border"; break;
|
||||
case 1: ProxPntStatus2 = "Middle"; break;
|
||||
default: ProxPntStatus2 = "Unknown";
|
||||
}
|
||||
|
||||
theDI << " Status of ProxPnt1 on " << theArgs[1] << " : " << ProxPntStatus1 << "\n";
|
||||
theDI << " Status of ProxPnt2 on " << theArgs[2] << " : " << ProxPntStatus2 << "\n";
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
else
|
||||
|
||||
TopoDS_Compound aFaceCompound2;
|
||||
aCompBuilder.MakeCompound (aFaceCompound2);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2 (aTool.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
|
||||
{
|
||||
TopoDS_Builder aCompBuilder;
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString (theArgs[2]) + "_" + (anIt2.Key() + 1);
|
||||
|
||||
TopoDS_Compound aFaceCompound1;
|
||||
aCompBuilder.MakeCompound(aFaceCompound1);
|
||||
const TopoDS_Face& aFace = aTool.GetSubShape2 (anIt2.Key());
|
||||
aCompBuilder.Add (aFaceCompound2, aFace);
|
||||
DBRep::Set (aStr.ToCString(), aFace);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1(aTool.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
|
||||
{
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString(theArgs[1]) + "_" + (anIt1.Key() + 1);
|
||||
|
||||
const TopoDS_Shape& aShape = aTool.GetSubShape1(anIt1.Key());
|
||||
aCompBuilder.Add(aFaceCompound1, aShape);
|
||||
DBRep::Set(aStr.ToCString(), aShape);
|
||||
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
|
||||
TopoDS_Compound aFaceCompound2;
|
||||
aCompBuilder.MakeCompound(aFaceCompound2);
|
||||
|
||||
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2(aTool.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
|
||||
{
|
||||
TCollection_AsciiString aStr = TCollection_AsciiString(theArgs[2]) + "_" + (anIt2.Key() + 1);
|
||||
|
||||
const TopoDS_Shape& aShape = aTool.GetSubShape2(anIt2.Key());
|
||||
aCompBuilder.Add(aFaceCompound2, aShape);
|
||||
DBRep::Set(aStr.ToCString(), aShape);
|
||||
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
|
||||
DBRep::Set((TCollection_AsciiString(theArgs[1]) + "_" + "overlapped").ToCString(), aFaceCompound1);
|
||||
DBRep::Set((TCollection_AsciiString(theArgs[2]) + "_" + "overlapped").ToCString(), aFaceCompound2);
|
||||
theDI << aStr << " \n";
|
||||
}
|
||||
|
||||
DBRep::Set ((TCollection_AsciiString (theArgs[1]) + "_" + "overlapped").ToCString(), aFaceCompound1);
|
||||
DBRep::Set ((TCollection_AsciiString (theArgs[2]) + "_" + "overlapped").ToCString(), aFaceCompound2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -493,14 +445,12 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands)
|
||||
aGroup);
|
||||
|
||||
theCommands.Add ("proximity",
|
||||
"proximity Shape1 Shape2 [-tol <value> | -value] [-profile]"
|
||||
"proximity Shape1 Shape2 [-tol <value>] [-profile]"
|
||||
"\n\t\t: Searches for pairs of overlapping faces of the given shapes."
|
||||
"\n\t\t: The options are:"
|
||||
"\n\t\t: -tol : non-negative tolerance value used for overlapping"
|
||||
"\n\t\t: test (for zero tolerance, the strict intersection"
|
||||
"\n\t\t: test will be performed)"
|
||||
"\n\t\t: -value : compute the proximity value (minimal value which"
|
||||
"\n\t\t: shows both shapes fully overlapped)"
|
||||
"\n\t\t: -profile : outputs execution time for main algorithm stages",
|
||||
__FILE__,
|
||||
ShapeProximity,
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include <Bisector_BisecAna.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <BRepOffsetAPI_MakeOffset.hxx>
|
||||
#include <BRepMAT2d_Explorer.hxx>
|
||||
#include <BRepMAT2d_BisectingLocus.hxx>
|
||||
#include <BRepMAT2d_LinkTopoBilo.hxx>
|
||||
@@ -45,7 +44,6 @@
|
||||
|
||||
#include <DBRep.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#ifdef _WIN32
|
||||
Standard_IMPORT Draw_Viewer dout;
|
||||
@@ -72,16 +70,7 @@ static Standard_Integer topoload (Draw_Interpretor& , Standard_Integer argc, con
|
||||
|
||||
if (C1.IsNull()) return 1;
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face(C1);
|
||||
|
||||
if (argc >= 3 &&
|
||||
(strcmp(argv[2], "-approx") == 0))
|
||||
{
|
||||
Standard_Real aTol = 0.1;
|
||||
aFace = BRepOffsetAPI_MakeOffset::ConvertFace (aFace, aTol);
|
||||
}
|
||||
|
||||
anExplo.Perform (aFace);
|
||||
anExplo.Perform (TopoDS::Face(C1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -278,7 +267,7 @@ void DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
|
||||
void BRepTest::MatCommands (Draw_Interpretor& theCommands)
|
||||
{
|
||||
theCommands.Add("topoload","load face: topoload face [-approx]",__FILE__,topoload);
|
||||
theCommands.Add("topoload","load face",__FILE__,topoload);
|
||||
theCommands.Add("drawcont","display current contour",__FILE__,drawcont);
|
||||
theCommands.Add("mat","computes the mat: mat [a/i [o]]",__FILE__,mat);
|
||||
theCommands.Add("side","side left/right",__FILE__,side);
|
||||
|
@@ -30,15 +30,6 @@ public: //! @name public types
|
||||
|
||||
typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
|
||||
|
||||
public:
|
||||
|
||||
enum BVH_PrjStateInTriangle
|
||||
{
|
||||
BVH_PrjStateInTriangle_VERTEX,
|
||||
BVH_PrjStateInTriangle_EDGE,
|
||||
BVH_PrjStateInTriangle_INNER
|
||||
};
|
||||
|
||||
public: //! @name Box-Box Square distance
|
||||
|
||||
//! Computes Square distance between Axis aligned bounding boxes
|
||||
@@ -122,14 +113,11 @@ public: //! @name Point-Box projection
|
||||
|
||||
public: //! @name Point-Triangle Square distance
|
||||
|
||||
//! Find nearest point on a triangle for the given point
|
||||
static BVH_VecNt PointTriangleProjection (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theNode0,
|
||||
const BVH_VecNt& theNode1,
|
||||
const BVH_VecNt& theNode2,
|
||||
BVH_PrjStateInTriangle* thePrjState = nullptr,
|
||||
Standard_Integer* theNumberOfFirstNode = nullptr,
|
||||
Standard_Integer* theNumberOfLastNode = nullptr)
|
||||
//! Computes square distance between point and triangle
|
||||
static T PointTriangleSquareDistance (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theNode0,
|
||||
const BVH_VecNt& theNode1,
|
||||
const BVH_VecNt& theNode2)
|
||||
{
|
||||
const BVH_VecNt aAB = theNode1 - theNode0;
|
||||
const BVH_VecNt aAC = theNode2 - theNode0;
|
||||
@@ -140,110 +128,68 @@ public: //! @name Point-Triangle Square distance
|
||||
|
||||
if (aABdotAP <= 0. && aACdotAP <= 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
|
||||
*theNumberOfFirstNode = 0;
|
||||
*theNumberOfLastNode = 0;
|
||||
}
|
||||
return theNode0;
|
||||
return aAP.Dot(aAP);
|
||||
}
|
||||
|
||||
const BVH_VecNt aBC = theNode2 - theNode1;
|
||||
const BVH_VecNt aBP = thePoint - theNode1;
|
||||
|
||||
T aBAdotBP = -(aAB.Dot (aBP));
|
||||
T aBCdotBP = (aBC.Dot (aBP));
|
||||
T aBAdotBP = -(aAB.Dot(aBP));
|
||||
T aBCdotBP = (aBC.Dot(aBP));
|
||||
|
||||
if (aBAdotBP <= 0. && aBCdotBP <= 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
|
||||
*theNumberOfFirstNode = 1;
|
||||
*theNumberOfLastNode = 1;
|
||||
}
|
||||
return theNode1;
|
||||
return (aBP.Dot(aBP));
|
||||
}
|
||||
|
||||
const BVH_VecNt aCP = thePoint - theNode2;
|
||||
|
||||
T aCBdotCP = -(aBC.Dot (aCP));
|
||||
T aCAdotCP = -(aAC.Dot (aCP));
|
||||
T aCBdotCP = -(aBC.Dot(aCP));
|
||||
T aCAdotCP = -(aAC.Dot(aCP));
|
||||
|
||||
if (aCAdotCP <= 0. && aCBdotCP <= 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
|
||||
*theNumberOfFirstNode = 2;
|
||||
*theNumberOfLastNode = 2;
|
||||
}
|
||||
return theNode2;
|
||||
return (aCP.Dot(aCP));
|
||||
}
|
||||
|
||||
T aACdotBP = (aAC.Dot (aBP));
|
||||
T aACdotBP = (aAC.Dot(aBP));
|
||||
|
||||
T aVC = aABdotAP * aACdotBP + aBAdotBP * aACdotAP;
|
||||
|
||||
if (aVC <= 0. && aABdotAP > 0. && aBAdotBP > 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_EDGE;
|
||||
*theNumberOfFirstNode = 0;
|
||||
*theNumberOfLastNode = 1;
|
||||
}
|
||||
return theNode0 + aAB * (aABdotAP / (aABdotAP + aBAdotBP));
|
||||
const BVH_VecNt aDirect = aAP - aAB * (aABdotAP / (aABdotAP + aBAdotBP));
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
T aABdotCP = (aAB.Dot (aCP));
|
||||
T aABdotCP = (aAB.Dot(aCP));
|
||||
|
||||
T aVA = aBAdotBP * aCAdotCP - aABdotCP * aACdotBP;
|
||||
|
||||
if (aVA <= 0. && aBCdotBP > 0. && aCBdotCP > 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_EDGE;
|
||||
*theNumberOfFirstNode = 1;
|
||||
*theNumberOfLastNode = 2;
|
||||
}
|
||||
return theNode1 + aBC * (aBCdotBP / (aBCdotBP + aCBdotCP));
|
||||
const BVH_VecNt aDirect = aBP - aBC * (aBCdotBP / (aBCdotBP + aCBdotCP));
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
T aVB = aABdotCP * aACdotAP + aABdotAP * aCAdotCP;
|
||||
|
||||
if (aVB <= 0. && aACdotAP > 0. && aCAdotCP > 0.)
|
||||
{
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_EDGE;
|
||||
*theNumberOfFirstNode = 2;
|
||||
*theNumberOfLastNode = 0;
|
||||
}
|
||||
return theNode0 + aAC * (aACdotAP / (aACdotAP + aCAdotCP));
|
||||
const BVH_VecNt aDirect = aAP - aAC * (aACdotAP / (aACdotAP + aCAdotCP));
|
||||
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
T aNorm = aVA + aVB + aVC;
|
||||
|
||||
if (thePrjState != nullptr)
|
||||
{
|
||||
*thePrjState = BVH_PrjStateInTriangle_INNER;
|
||||
}
|
||||
const BVH_VecNt& aDirect = thePoint - (theNode0 * aVA +
|
||||
theNode1 * aVB +
|
||||
theNode2 * aVC) / aNorm;
|
||||
|
||||
return (theNode0 * aVA + theNode1 * aVB + theNode2 * aVC) / aNorm;
|
||||
}
|
||||
|
||||
//! Computes square distance between point and triangle
|
||||
static T PointTriangleSquareDistance (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theNode0,
|
||||
const BVH_VecNt& theNode1,
|
||||
const BVH_VecNt& theNode2)
|
||||
{
|
||||
const BVH_VecNt aProj = PointTriangleProjection(thePoint, theNode0, theNode1, theNode2);
|
||||
const BVH_VecNt aPP = aProj - thePoint;
|
||||
return aPP.Dot(aPP);
|
||||
return (aDirect.Dot(aDirect));
|
||||
}
|
||||
|
||||
public: //! @name Ray-Box Intersection
|
||||
|
@@ -1221,105 +1221,6 @@ static void ComputeSphere (const gp_Sphere& Sphere,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeDegeneratedTorus
|
||||
//purpose : compute bounding box for degenerated torus
|
||||
//=======================================================================
|
||||
|
||||
static void computeDegeneratedTorus (const gp_Torus& theTorus,
|
||||
const Standard_Real theUMin, const Standard_Real theUMax,
|
||||
const Standard_Real theVMin, const Standard_Real theVMax,
|
||||
Bnd_Box& theB)
|
||||
{
|
||||
gp_Pnt aP = theTorus.Location();
|
||||
Standard_Real aRa = theTorus.MajorRadius();
|
||||
Standard_Real aRi = theTorus.MinorRadius();
|
||||
Standard_Real aXmin,anYmin,aZmin,aXmax,anYmax,aZmax;
|
||||
aXmin = aP.X() - aRa - aRi;
|
||||
aXmax = aP.X() + aRa + aRi;
|
||||
anYmin = aP.Y() - aRa - aRi;
|
||||
anYmax = aP.Y() + aRa + aRi;
|
||||
aZmin = aP.Z() - aRi;
|
||||
aZmax = aP.Z() + aRi;
|
||||
|
||||
Standard_Real aPhi = ACos (-aRa / aRi);
|
||||
|
||||
Standard_Real anUper = 2. * M_PI - Precision::PConfusion();
|
||||
Standard_Real aVper = 2. * aPhi - Precision::PConfusion();
|
||||
if (theUMax - theUMin >= anUper && theVMax - theVMin >= aVper)
|
||||
{
|
||||
// a whole torus
|
||||
theB.Update(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real anU,aV;
|
||||
Standard_Real anUmax = theUMin + 2. * M_PI;
|
||||
const gp_Ax3& aPos = theTorus.Position();
|
||||
gp_Pnt aPExt = aP;
|
||||
aPExt.SetX(aXmin);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
aPExt.SetX(aXmax);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
aPExt.SetX(aP.X());
|
||||
//
|
||||
aPExt.SetY(anYmin);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
aPExt.SetY(anYmax);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
aPExt.SetY(aP.Y());
|
||||
//
|
||||
aPExt.SetZ(aZmin);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
aPExt.SetZ(aZmax);
|
||||
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
|
||||
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
|
||||
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
|
||||
{
|
||||
theB.Add(aPExt);
|
||||
}
|
||||
//
|
||||
// Add boundaries of patch
|
||||
// UMin, UMax
|
||||
gp_Circ aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMin);
|
||||
BndLib::Add(aC,theVMin,theVMax,0.,theB);
|
||||
aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMax);
|
||||
BndLib::Add(aC,theVMin,theVMax,0.,theB);
|
||||
// VMin, VMax
|
||||
aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMin);
|
||||
BndLib::Add(aC,theUMin,theUMax,0.,theB);
|
||||
aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMax);
|
||||
BndLib::Add(aC,theUMin,theUMax,0.,theB);
|
||||
}
|
||||
|
||||
void BndLib::Add(const gp_Sphere& S,const Standard_Real UMin,
|
||||
const Standard_Real UMax,const Standard_Real VMin,
|
||||
const Standard_Real VMax,const Standard_Real Tol, Bnd_Box& B)
|
||||
@@ -1364,13 +1265,6 @@ void BndLib::Add(const gp_Torus& S,const Standard_Real UMin,
|
||||
|
||||
if (Fi2<Fi1) return;
|
||||
|
||||
if (Ra<Ri)
|
||||
{
|
||||
computeDegeneratedTorus(S,UMin,UMax,VMin,VMax,B);
|
||||
B.Enlarge(Tol);
|
||||
return;
|
||||
}
|
||||
|
||||
#define SC 0.71
|
||||
#define addP0 (Compute(UMin,UMax,Ra+Ri,Ra+Ri,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),S.Location(),B))
|
||||
#define addP1 (Compute(UMin,UMax,Ra+Ri*SC,Ra+Ri*SC,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),gp_Pnt(S.Location().XYZ()+(Ri*SC)*S.Axis().Direction().XYZ()),B))
|
||||
|
@@ -502,7 +502,16 @@ GeomAbs_SurfaceType GeomAdaptor_SurfaceOfRevolution::GetType() const
|
||||
MajorRadius = aLin.Distance(aLC);
|
||||
if(MajorRadius > aR)
|
||||
{
|
||||
return GeomAbs_Torus;
|
||||
Standard_Real aT = 0., aDx, dX;
|
||||
gp_Pnt aPx;
|
||||
|
||||
aPx = ElCLib::Value(aT, C);
|
||||
aDx = aLin.Distance(aPx);
|
||||
dX = aDx - MajorRadius - aR;
|
||||
if (dX < 0.)
|
||||
dX = -dX;
|
||||
if (dX < TolConf)
|
||||
return GeomAbs_Torus;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -839,38 +839,14 @@ static IFSelect_ReturnStatus fun27
|
||||
Standard_Integer argc = pilot->NbWords();
|
||||
Handle(IFSelect_WorkSession) WS = pilot->Session();
|
||||
const Standard_CString arg1 = pilot->Arg(1);
|
||||
Standard_CString arg2 = pilot->Arg(2);
|
||||
const Standard_CString anEmptyStr = "";
|
||||
if (arg2 && strlen(arg2) == 2 && arg2[0] == '"' && arg2[1] == '"')
|
||||
{
|
||||
arg2 = anEmptyStr;
|
||||
}
|
||||
const Standard_CString arg2 = pilot->Arg(2);
|
||||
// **** Param(Value) ****
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
if (argc < 2 || (argc == 3 && strcmp (arg1, "-p") == 0)) {
|
||||
if (argc < 2) {
|
||||
Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
|
||||
Standard_Integer i,nb = li->Length(), aPatternNb = 0;
|
||||
size_t aPatternLen = strlen(arg2);
|
||||
if (argc == 3)
|
||||
{
|
||||
for (i = 1; i <= nb; i ++)
|
||||
{
|
||||
if (strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) == 0)
|
||||
{
|
||||
aPatternNb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aPatternNb = nb;
|
||||
}
|
||||
sout << " List of parameters : " << aPatternNb << " items : " << std::endl;
|
||||
Standard_Integer i,nb = li->Length();
|
||||
sout<<" List of parameters : "<<nb<<" items : "<<std::endl;
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (argc == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sout<<li->Value(i)->String();
|
||||
sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<std::endl;
|
||||
}
|
||||
@@ -888,14 +864,7 @@ static IFSelect_ReturnStatus fun27
|
||||
|
||||
if (argc == 2) sout<<"To modify, param name_param new_val"<<std::endl;
|
||||
else {
|
||||
if (strlen(arg2) != 0)
|
||||
{
|
||||
sout<<" New demanded value : "<<arg2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sout<<" New demanded value : not valued";
|
||||
}
|
||||
sout<<" New demanded value : "<<arg2;
|
||||
if (Interface_Static::SetCVal (arg1,arg2))
|
||||
{ sout<<" OK"<<std::endl; return IFSelect_RetDone; }
|
||||
else { sout <<" , refused"<<std::endl; return IFSelect_RetError; }
|
||||
@@ -2468,9 +2437,7 @@ void IFSelect_Functions::Init()
|
||||
IFSelect_Act::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
|
||||
IFSelect_Act::AddFunc("xsave","filename:string : sauve items-session",fun25);
|
||||
IFSelect_Act::AddFunc("xrestore","filename:string : restaure items-session",fun26);
|
||||
IFSelect_Act::AddFunc("param","[-p Pattern] - displays all parameters or filtered by pattern;\n"
|
||||
"par_name - displays parameter;\n"
|
||||
"par_name par_value - changes parameter's value", fun27);
|
||||
IFSelect_Act::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
|
||||
|
||||
IFSelect_Act::AddFunc("sentfiles","Lists files sent from last Load",fun29);
|
||||
IFSelect_Act::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);
|
||||
|
@@ -90,64 +90,10 @@ static Handle(IGESData_DefaultSpecific) speci;
|
||||
Interface_Static::SetIVal ("write.convertsurface.mode",0);
|
||||
|
||||
// abv 15.11.00: ShapeProcessing
|
||||
Interface_Static::Init ("XSTEP", "write.iges.resource.name", 't', "IGES");
|
||||
Interface_Static::Init ("XSTEP", "read.iges.resource.name", 't', "IGES");
|
||||
Interface_Static::Init ("XSTEP", "write.iges.sequence", 't', "ToIGES");
|
||||
Interface_Static::Init ("XSTEP", "read.iges.sequence", 't', "FromIGES");
|
||||
Interface_Static::Init ("XSTEP", "ToIGES.exec.op", 't', "DirectFaces");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.exec.op", 't', "FixShape");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.Tolerance3d", 't', "&Runtime.Tolerance");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTolerance3d", 't', "&Runtime.MaxTolerance");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MinTolerance3d", 't', "1.e-7");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeShellMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeWireMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSameParameterMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSolidMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShellOrientationMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.CreateOpenSolidMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShellMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFaceOrientationMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixWireMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixOrientationMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddNaturalBoundMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixMissingSeamMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSmallAreaWireMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.RemoveSmallAreaFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixIntersectingWiresMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixLoopWiresMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSplitFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.AutoCorrectPrecisionMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ModifyTopologyMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ModifyGeometryMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ClosedWireMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.PreferencePCurveMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixReorderMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSmallMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixConnectedMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixEdgeCurvesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixDegeneratedMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixLackingMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSelfIntersectionMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.RemoveLoopMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixReversed2dMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixRemovePCurveMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixRemoveCurve3dMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddPCurveMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddCurve3dMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSeamMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShiftedMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixEdgeSameParameterMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixNotchedEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixTailMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTailAngle", 't', "0.0");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTailWidth", 't', "-1.0");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSelfIntersectingEdgeMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixIntersectingEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixVertexPositionMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixVertexToleranceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP","write.iges.resource.name",'t',"IGES");
|
||||
Interface_Static::Init ("XSTEP","read.iges.resource.name",'t',"IGES");
|
||||
Interface_Static::Init ("XSTEP","write.iges.sequence",'t',"ToIGES");
|
||||
Interface_Static::Init ("XSTEP","read.iges.sequence",'t',"FromIGES");
|
||||
|
||||
// sln 11.06.2002 OCC448 : Initialize "read.onlyvisible" parameter to control transferring
|
||||
// invisible sub entities which logically depend on the grouping entities
|
||||
|
@@ -28,7 +28,7 @@ enum IMeshData_Status
|
||||
IMeshData_TooFewPoints = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
|
||||
IMeshData_Outdated = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
|
||||
IMeshData_Reused = 0x80, //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
|
||||
IMeshData_UserBreak = 0x100 //!< User break
|
||||
IMeshData_UserBreak = 0x160 //!< User break
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -35,7 +35,6 @@ struct IMeshTools_Parameters {
|
||||
Relative (Standard_False),
|
||||
InternalVerticesMode (Standard_True),
|
||||
ControlSurfaceDeflection (Standard_True),
|
||||
EnableControlSurfaceDeflectionAllSurfaces(Standard_False),
|
||||
CleanModel (Standard_True),
|
||||
AdjustMinSize (Standard_False),
|
||||
ForceFaceDeflection (Standard_False),
|
||||
@@ -86,10 +85,6 @@ struct IMeshTools_Parameters {
|
||||
//! the face
|
||||
Standard_Boolean ControlSurfaceDeflection;
|
||||
|
||||
// Enables/disables check triggered by ControlSurfaceDeflection flag
|
||||
// for all types of surfaces including analytical.
|
||||
Standard_Boolean EnableControlSurfaceDeflectionAllSurfaces;
|
||||
|
||||
//! Cleans temporary data model when algorithm is finished.
|
||||
Standard_Boolean CleanModel;
|
||||
|
||||
|
@@ -714,8 +714,7 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
}
|
||||
|
||||
IntPatch_Point aVtx = theALine->Vertex(aVertexNumber);
|
||||
Standard_Real aNewVertexParam = aLinOn2S->NbPoints() + 1;
|
||||
Standard_Integer aNbPointsPrev = aLinOn2S->NbPoints();
|
||||
const Standard_Real aNewVertexParam = aLinOn2S->NbPoints() + 1;
|
||||
|
||||
//ATTENTION!!!
|
||||
// IsPoleOrSeam inserts new point in aLinOn2S if aVtx respects
|
||||
@@ -749,7 +748,6 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
|
||||
aPrePointExist = IsPoleOrSeam(myS1, myS2, aPrefIso, aLinOn2S, aVtx,
|
||||
anArrPeriods, aTol, aSingularSurfaceID);
|
||||
|
||||
if (aPrePointExist == IntPatch_SPntPole ||
|
||||
aPrePointExist == IntPatch_SPntPoleSeamU)
|
||||
{
|
||||
@@ -763,11 +761,6 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
const Standard_Real aCurVertParam = aVtx.ParameterOnLine();
|
||||
if(aPrePointExist != IntPatch_SPntNone)
|
||||
{
|
||||
if (aNbPointsPrev == aLinOn2S->NbPoints())
|
||||
{
|
||||
//Vertex coinsides any point of line and was not added into line
|
||||
aNewVertexParam = aNbPointsPrev;
|
||||
}
|
||||
aPrevParam = aParameter = aCurVertParam;
|
||||
}
|
||||
else
|
||||
|
@@ -354,7 +354,6 @@ void BoundedArc (const TheArc& A,
|
||||
{
|
||||
const IntSurf_Quadric& aQuadric = Func.Quadric();
|
||||
GeomAbs_SurfaceType TypeQuad = aQuadric.TypeQuadric();
|
||||
GeomAbs_CurveType TypeConS = GeomAbs_OtherCurve;
|
||||
|
||||
IntCurveSurface_HInter IntCS;
|
||||
Standard_Boolean IsIntCSdone = Standard_False;
|
||||
@@ -388,7 +387,7 @@ void BoundedArc (const TheArc& A,
|
||||
//Exact solution
|
||||
Handle(Adaptor3d_Surface) aSurf = Func.Surface();
|
||||
Adaptor3d_CurveOnSurface ConS(A, aSurf);
|
||||
TypeConS = ConS.GetType();
|
||||
GeomAbs_CurveType TypeConS = ConS.GetType();
|
||||
#ifdef OCCT_DEBUG
|
||||
Handle(Geom_Curve) CurveConS;
|
||||
switch(TypeConS)
|
||||
@@ -609,27 +608,13 @@ void BoundedArc (const TheArc& A,
|
||||
para = aSI(i).Value();
|
||||
|
||||
Standard_Real param=(para+parap1)*0.5;
|
||||
Standard_Real yf = 0.0;
|
||||
Standard_Real ym = 0.0;
|
||||
Standard_Real yl = 0.0;
|
||||
if(Func.Value(param,ym) && Abs(ym) < maxdist) {
|
||||
Standard_Real sm = Sign(1., ym);
|
||||
Standard_Boolean aTang = Func.Value(para,yf) && Func.Value(parap1,yl);
|
||||
if (aTang) {
|
||||
//Line can be tangent surface if all distances less then maxdist
|
||||
aTang = aTang && Abs(yf) < maxdist && Abs(yl) < maxdist;
|
||||
}
|
||||
if (aTang && IsIntCSdone && TypeConS == GeomAbs_Line) {
|
||||
//Interval is got by exact intersection
|
||||
//Line can be tangent if all points are on the same side of surface
|
||||
//it means that signs of all distances are the same
|
||||
Standard_Real sf = Sign(1., yf), sl = Sign(1., yl);
|
||||
aTang = aTang && (sm == sf) && (sm == sl);
|
||||
}
|
||||
if(aTang) {
|
||||
Standard_Real ym;
|
||||
if(Func.Value(param,ym)) {
|
||||
if(Abs(ym)<maxdist) {
|
||||
// Modified by skv - Tue Aug 31 12:13:51 2004 OCC569 Begin
|
||||
// Consider this interval as tangent one. Treat it to find
|
||||
// parameter with the lowest function value.
|
||||
|
||||
// Compute the number of nodes.
|
||||
Standard_Real aTol = TolBoundary*1000.0;
|
||||
if(aTol > 0.001)
|
||||
@@ -642,7 +627,6 @@ void BoundedArc (const TheArc& A,
|
||||
Standard_Integer aNbNodes = RealToInt(Ceiling((parap1 - para)/aTol));
|
||||
|
||||
Standard_Real aVal = RealLast();
|
||||
Standard_Real aValMax = 0.;
|
||||
//Standard_Integer aNbNodes = 23;
|
||||
Standard_Real aDelta = (parap1 - para)/(aNbNodes + 1.);
|
||||
Standard_Integer ii;
|
||||
@@ -653,29 +637,17 @@ void BoundedArc (const TheArc& A,
|
||||
aCurPar = (ii < aNbNodes + 1) ? para + ii*aDelta : parap1;
|
||||
|
||||
if (Func.Value(aCurPar, aCurVal)) {
|
||||
Standard_Real anAbsVal = Abs(aCurVal);
|
||||
if (anAbsVal < aVal) {
|
||||
aVal = anAbsVal;
|
||||
//if (aCurVal < aVal) {
|
||||
if (Abs(aCurVal) < aVal) {
|
||||
//aVal = aCurVal;
|
||||
aVal = Abs(aCurVal);
|
||||
param = aCurPar;
|
||||
}
|
||||
if (anAbsVal > aValMax)
|
||||
{
|
||||
aValMax = anAbsVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
// At last, interval got by exact intersection can be considered as tangent if
|
||||
// minimal distance is inside interval and
|
||||
// minimal and maximal values are almost the same
|
||||
if (IsIntCSdone && aNbNodes > 1) {
|
||||
aTang = Abs(param - para) > EpsX && Abs(parap1 - param) > EpsX &&
|
||||
0.01*aValMax <= aVal;
|
||||
}
|
||||
if (aTang)
|
||||
{
|
||||
aSI(i).ChangeValue() = Pdeb - 1;
|
||||
aSI(i + 1).ChangeValue() = param;
|
||||
}
|
||||
// Modified by skv - Tue Aug 31 12:13:51 2004 OCC569 End
|
||||
aSI(i).ChangeValue() = Pdeb - 1;
|
||||
aSI(i + 1).ChangeValue() = param;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1694,20 +1694,6 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
|
||||
Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsoparametric theChoixIso,
|
||||
const Standard_Boolean theDirectionFlag)
|
||||
{
|
||||
// Caro1 and Caro2
|
||||
const Handle(Adaptor3d_Surface)& Caro1 = myIntersectionOn2S.Function().AuxillarSurface1();
|
||||
const Handle(Adaptor3d_Surface)& Caro2 = myIntersectionOn2S.Function().AuxillarSurface2();
|
||||
//
|
||||
const Standard_Real UFirst1 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro1);
|
||||
const Standard_Real VFirst1 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro1);
|
||||
const Standard_Real ULast1 = Adaptor3d_HSurfaceTool::LastUParameter(Caro1);
|
||||
const Standard_Real VLast1 = Adaptor3d_HSurfaceTool::LastVParameter(Caro1);
|
||||
|
||||
const Standard_Real UFirst2 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro2);
|
||||
const Standard_Real VFirst2 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro2);
|
||||
const Standard_Real ULast2 = Adaptor3d_HSurfaceTool::LastUParameter(Caro2);
|
||||
const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter(Caro2);
|
||||
|
||||
Standard_Boolean bOutOfTangentZone = Standard_False;
|
||||
Standard_Boolean bStop = !myIntersectionOn2S.IsTangent();
|
||||
Standard_Integer dIncKey = 1;
|
||||
@@ -1719,42 +1705,6 @@ Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsop
|
||||
Standard_Integer uvit = 0;
|
||||
IntSurf_SequenceOfPntOn2S aSeqOfNewPoint;
|
||||
|
||||
previousPoint.Parameters(Param(1), Param(2), Param(3), Param(4));
|
||||
|
||||
if (Param(1) - UFirst1 < ResoU1)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
else if (Param(2) - VFirst1 < ResoV1)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
else if (Param(3) - UFirst2 < ResoU2)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
else if (Param(4) - VFirst2 < ResoV2)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
|
||||
if (Param(1) - ULast1 > -ResoU1)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
else if (Param(2) - VLast1 > -ResoV1)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
else if (Param(3) - ULast2 > -ResoU2)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
else if (Param(4) - VLast2 > -ResoV2)
|
||||
{
|
||||
return bOutOfTangentZone;
|
||||
}
|
||||
|
||||
while (!bStop) {
|
||||
nbIterWithoutAppend++;
|
||||
|
||||
|
@@ -407,29 +407,3 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_Static::Items
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : FillMap
|
||||
// purpose : Fills given string-to-string map with all static data
|
||||
//=======================================================================
|
||||
void Interface_Static::FillMap (NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString, TCollection_AsciiString>& theMap)
|
||||
{
|
||||
theMap.Clear();
|
||||
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& aMap = MoniTool_TypedValue::Stats();
|
||||
|
||||
for (NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator anIt(aMap); anIt.More(); anIt.Next())
|
||||
{
|
||||
Handle(Interface_Static) aValue = Handle(Interface_Static)::DownCast(anIt.Value());
|
||||
if (aValue.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aValue->HStringValue().IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
theMap.Bind (anIt.Key(), aValue->HStringValue()->String());
|
||||
}
|
||||
}
|
||||
|
@@ -245,8 +245,8 @@ public:
|
||||
//! must be defined around it
|
||||
Standard_EXPORT static void Standards();
|
||||
|
||||
//! Fills given string-to-string map with all static data
|
||||
Standard_EXPORT static void FillMap(NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString, TCollection_AsciiString>& theMap);
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Interface_Static,Interface_TypedValue)
|
||||
|
||||
|
@@ -27,8 +27,10 @@
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DrawTrSurf_Curve2d.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
#include <Bisector_Bisec.hxx>
|
||||
#include <Bisector_BisecAna.hxx>
|
||||
#include <Bisector_BisecCC.hxx>
|
||||
@@ -227,22 +229,10 @@ Standard_Integer MAT2d_Tool2d::TangentBefore(const Standard_Integer anitem,
|
||||
type = theCircuit->Value(anitem)->DynamicType();
|
||||
if ( type != STANDARD_TYPE(Geom2d_CartesianPoint)){
|
||||
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(anitem));
|
||||
#ifdef DRAW
|
||||
char *name = new char[100];
|
||||
sprintf(name, "c%d", anitem);
|
||||
DrawTrSurf::Set(name, curve);
|
||||
delete [] name;
|
||||
#endif
|
||||
theGeomVecs.Bind(theNumberOfVecs,curve->DN(curve->LastParameter(),1));
|
||||
}
|
||||
else {
|
||||
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(item));
|
||||
#ifdef DRAW
|
||||
char *name = new char[100];
|
||||
sprintf(name, "c%d", item);
|
||||
DrawTrSurf::Set(name, curve);
|
||||
delete [] name;
|
||||
#endif
|
||||
Standard_Real param = (IsOpenResult && anitem == theCircuit->NumberOfItems())?
|
||||
curve->LastParameter() : curve->FirstParameter();
|
||||
theGeomVecs.Bind(theNumberOfVecs,curve->DN(param,1));
|
||||
@@ -275,12 +265,6 @@ Standard_Integer MAT2d_Tool2d::TangentAfter(const Standard_Integer anitem,
|
||||
type = theCircuit->Value(anitem)->DynamicType();
|
||||
if ( type != STANDARD_TYPE(Geom2d_CartesianPoint)){
|
||||
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(anitem));
|
||||
#ifdef DRAW
|
||||
char *name = new char[100];
|
||||
sprintf(name, "c%d", anitem);
|
||||
DrawTrSurf::Set(name, curve);
|
||||
delete [] name;
|
||||
#endif
|
||||
thevector = curve->DN(curve->FirstParameter(),1);
|
||||
}
|
||||
else {
|
||||
@@ -288,14 +272,7 @@ Standard_Integer MAT2d_Tool2d::TangentAfter(const Standard_Integer anitem,
|
||||
item = (anitem == 1) ? theCircuit->NumberOfItems() : (anitem - 1);
|
||||
else
|
||||
item = (anitem == 1) ? 2 : (anitem - 1);
|
||||
|
||||
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(item));
|
||||
#ifdef DRAW
|
||||
char *name = new char[100];
|
||||
sprintf(name, "c%d", item);
|
||||
DrawTrSurf::Set(name, curve);
|
||||
delete [] name;
|
||||
#endif
|
||||
Standard_Real param = (IsOpenResult && anitem == 1)?
|
||||
curve->FirstParameter() : curve->LastParameter();
|
||||
thevector = curve->DN(param,1);
|
||||
@@ -420,14 +397,6 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector)
|
||||
abisector->BisectorNumber(theNumberOfBisectors);
|
||||
abisector->Sense(1);
|
||||
|
||||
#ifdef DRAW
|
||||
char *name = new char[100];
|
||||
sprintf(name, "b%d", theNumberOfBisectors);
|
||||
DrawTrSurf::Set(name, bisector.Value());
|
||||
Dump(abisector->BisectorNumber(),1);
|
||||
delete [] name;
|
||||
#endif
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
Standard_Boolean AffichDraw = Standard_False;
|
||||
if (AffichDraw) Dump(abisector->BisectorNumber(),1);
|
||||
|
@@ -116,10 +116,6 @@ static Standard_Integer incrementalmesh (Draw_Interpretor& theDI,
|
||||
{
|
||||
aMeshParams.ControlSurfaceDeflection = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
|
||||
}
|
||||
else if (aNameCase == "-surf_def_all")
|
||||
{
|
||||
aMeshParams.EnableControlSurfaceDeflectionAllSurfaces = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
|
||||
}
|
||||
else if (aNameCase == "-adjust_min")
|
||||
{
|
||||
aMeshParams.AdjustMinSize = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
|
||||
@@ -1624,8 +1620,6 @@ void MeshTest::Commands(Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -ai angular deflection inside of faces in deg (~57.29 deg = 1 rad by default);"
|
||||
"\n\t\t: -int_vert_off disables insertion of internal vertices into mesh (enabled by default);"
|
||||
"\n\t\t: -surf_def_off disables control of deflection of mesh from real surface (enabled by default);"
|
||||
"\n\t\t: -surf_def_all enables control of deflection of mesh from real surface for all types of surfaces"
|
||||
"\n\t\t: (FALSE by default);"
|
||||
"\n\t\t: -adjust_min enables local adjustment of min size depending on edge size (FALSE by default);"
|
||||
"\n\t\t: -force_face_def disables usage of shape tolerances for computing face deflection (FALSE by default);"
|
||||
"\n\t\t: -decrease enforces the meshing of the shape even if current mesh satisfies the new criteria"
|
||||
|
@@ -33,12 +33,7 @@ class Standard_Mutex;
|
||||
* type "aligned_t". To modify the size of memory blocks requested from the
|
||||
* OS, use the parameter of the constructor (measured in bytes); if this
|
||||
* parameter is smaller than 25 bytes on 32bit or 49 bytes on 64bit, the
|
||||
* block size will be the default 12 kbytes.
|
||||
*
|
||||
* It is not recommended to use memory blocks larger than 16KB on Windows
|
||||
* platform for the repeated operations because Low Fragmentation Heap is
|
||||
* not going to be used for these allocations which may lead to memory
|
||||
* fragmentation and the general performance slow down.
|
||||
* block size will be the default 24 kbytes
|
||||
*
|
||||
* Note that this allocator is most suitable for single-threaded algorithms
|
||||
* (consider creating dedicated allocators per working thread),
|
||||
@@ -55,12 +50,6 @@ class NCollection_IncAllocator : public NCollection_BaseAllocator
|
||||
//! Constructor.
|
||||
//! Note that this constructor does NOT setup mutex for using allocator concurrently from different threads,
|
||||
//! see SetThreadSafe() method.
|
||||
//!
|
||||
//! The default size of the memory blocks is 12KB.
|
||||
//! It is not recommended to use memory blocks larger than 16KB on Windows
|
||||
//! platform for the repeated operations (and thus multiple allocations)
|
||||
//! because Low Fragmentation Heap is not going to be used for these allocations,
|
||||
//! leading to memory fragmentation and eventual performance slow down.
|
||||
Standard_EXPORT NCollection_IncAllocator (size_t theBlockSize = DefaultBlockSize);
|
||||
|
||||
//! Setup mutex for thread-safe allocations.
|
||||
@@ -94,8 +83,7 @@ class NCollection_IncAllocator : public NCollection_BaseAllocator
|
||||
Standard_EXPORT void Reset (const Standard_Boolean
|
||||
doReleaseMem=Standard_True);
|
||||
|
||||
//! Default size for the memory blocks - 12KB
|
||||
static const size_t DefaultBlockSize = 12300;
|
||||
static const size_t DefaultBlockSize = 24600;
|
||||
|
||||
protected:
|
||||
struct IBlock;
|
||||
|
@@ -125,10 +125,10 @@ protected:
|
||||
|
||||
// Since C++20 inheritance from std::iterator is deprecated, so define predefined types manually:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = IteratorInterface*;
|
||||
using value_type = UniversalIterator;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = value_type;
|
||||
using reference = value_type;
|
||||
using pointer = UniversalIterator*;
|
||||
using reference = UniversalIterator&;
|
||||
|
||||
UniversalIterator() {}
|
||||
|
||||
@@ -171,8 +171,18 @@ protected:
|
||||
return aValue;
|
||||
}
|
||||
|
||||
reference operator* () const { return myPtr.get(); }
|
||||
reference operator* () { return myPtr.get(); }
|
||||
const UniversalIterator& operator* () const { return *this; }
|
||||
UniversalIterator& operator* () { return *this; }
|
||||
|
||||
const UniversalIterator* operator->() const { return this; }
|
||||
UniversalIterator* operator->() { return this; }
|
||||
|
||||
// type cast to actual iterator
|
||||
template <typename Iterator>
|
||||
const Iterator& DownCast () const
|
||||
{
|
||||
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(myPtr.get())->Value();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<IteratorInterface> myPtr;
|
||||
@@ -186,14 +196,7 @@ protected:
|
||||
public:
|
||||
virtual ~FunctorInterface() {}
|
||||
|
||||
virtual void operator () (IteratorInterface* theIterator) const = 0;
|
||||
|
||||
// type cast to actual iterator
|
||||
template <typename Iterator>
|
||||
static const Iterator& DownCast(IteratorInterface* theIterator)
|
||||
{
|
||||
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(theIterator)->Value();
|
||||
}
|
||||
virtual void operator () (UniversalIterator& theIterator) const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -208,9 +211,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
|
||||
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
|
||||
{
|
||||
const Iterator& anIt = DownCast<Iterator>(theIterator);
|
||||
const Iterator& anIt = theIterator.DownCast<Iterator>();
|
||||
myFunctor(*anIt);
|
||||
}
|
||||
|
||||
@@ -230,9 +233,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
|
||||
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
|
||||
{
|
||||
Standard_Integer anIndex = DownCast<Standard_Integer>(theIterator);
|
||||
Standard_Integer anIndex = theIterator.DownCast<Standard_Integer>();
|
||||
myFunctor(anIndex);
|
||||
}
|
||||
|
||||
|
@@ -100,7 +100,7 @@ namespace
|
||||
{
|
||||
for (OSD_Parallel::UniversalIterator anIter = myRange.It(); anIter != myRange.End(); anIter = myRange.It())
|
||||
{
|
||||
myPerformer (*anIter);
|
||||
myPerformer (anIter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -128,16 +128,6 @@ Resource_Manager::Resource_Manager(const Standard_CString aName,
|
||||
std::cout << "Resource Manager Warning: Environment variable \"CSF_" << aName << "UserDefaults\" not set." << std::endl;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Resource_Manager
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Resource_Manager::Resource_Manager()
|
||||
: myName(""), myVerbose(Standard_False)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Load
|
||||
// purpose :
|
||||
@@ -548,12 +538,3 @@ void Resource_Manager::GetResourcePath (TCollection_AsciiString& aPath, const St
|
||||
|
||||
anOSDPath.SystemName(aPath);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GetMap
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Resource_DataMapOfAsciiStringAsciiString& Resource_Manager::GetMap(Standard_Boolean theRefMap)
|
||||
{
|
||||
return theRefMap ? myRefMap : myUserMap;
|
||||
}
|
||||
|
@@ -54,9 +54,6 @@ public:
|
||||
//! syntax of an individual resource line is:
|
||||
Standard_EXPORT Resource_Manager(const Standard_CString aName, const Standard_Boolean Verbose = Standard_False);
|
||||
|
||||
//! Create an empty Resource manager
|
||||
Standard_EXPORT Resource_Manager();
|
||||
|
||||
//! Create a Resource manager.
|
||||
//! @param theName [in] description file name
|
||||
//! @param theDefaultsDirectory [in] default folder for looking description file
|
||||
@@ -115,9 +112,6 @@ public:
|
||||
//! or file doesn't exist returns empty string.
|
||||
Standard_EXPORT static void GetResourcePath (TCollection_AsciiString& aPath, const Standard_CString aName, const Standard_Boolean isUserDefaults);
|
||||
|
||||
//! Returns internal Ref or User map with parameters
|
||||
Standard_EXPORT Resource_DataMapOfAsciiStringAsciiString& GetMap(Standard_Boolean theRefMap = Standard_True);
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT void Load (const TCollection_AsciiString& thePath,
|
||||
|
@@ -338,20 +338,12 @@ TCollection_ExtendedString STEPCAFControl_Reader::convertName (const TCollection
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile (const Standard_CString theFileName)
|
||||
|
||||
IFSelect_ReturnStatus STEPCAFControl_Reader::ReadFile(const Standard_CString filename)
|
||||
{
|
||||
return myReader.ReadFile (theFileName);
|
||||
return myReader.ReadFile(filename);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStream
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPCAFControl_Reader::ReadStream (const Standard_CString theName,
|
||||
std::istream& theIStream)
|
||||
{
|
||||
return myReader.ReadStream (theName, theIStream);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbRootsForTransfer
|
||||
|
@@ -75,17 +75,8 @@ public:
|
||||
Standard_EXPORT void Init (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
|
||||
|
||||
//! Loads a file and returns the read status
|
||||
//! Provided for use like single-file reader.
|
||||
//! @param theFileName [in] file to open
|
||||
//! @return read status
|
||||
Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString theFileName);
|
||||
|
||||
//! Loads a file from stream and returns the read status.
|
||||
//! @param theName [in] auxiliary stream name
|
||||
//! @param theIStream [in] stream to read from
|
||||
//! @return read status
|
||||
Standard_EXPORT IFSelect_ReturnStatus ReadStream (const Standard_CString theName,
|
||||
std::istream& theIStream);
|
||||
//! Provided for use like single-file reader
|
||||
Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename);
|
||||
|
||||
//! Returns number of roots recognized for transfer
|
||||
//! Shortcut for Reader().NbRootsForTransfer()
|
||||
|
@@ -302,51 +302,34 @@ void STEPCAFControl_Writer::Init (const Handle(XSControl_WorkSession)& WS,
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString theFileName)
|
||||
|
||||
IFSelect_ReturnStatus STEPCAFControl_Writer::Write (const Standard_CString filename)
|
||||
{
|
||||
IFSelect_ReturnStatus aStatus = myWriter.Write (theFileName);
|
||||
if (aStatus != IFSelect_RetDone)
|
||||
{
|
||||
return aStatus;
|
||||
}
|
||||
IFSelect_ReturnStatus status = myWriter.Write ( filename );
|
||||
|
||||
// get directory name of the main file
|
||||
TCollection_AsciiString aDirPath;
|
||||
{
|
||||
OSD_Path aMainFile (theFileName);
|
||||
aMainFile.SetName ("");
|
||||
aMainFile.SetExtension ("");
|
||||
aMainFile.SystemName (aDirPath);
|
||||
}
|
||||
OSD_Path mainfile ( filename );
|
||||
mainfile.SetName ( "" );
|
||||
mainfile.SetExtension ( "" );
|
||||
TCollection_AsciiString dpath;
|
||||
mainfile.SystemName ( dpath );
|
||||
|
||||
for (NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator anExtFileIter (myFiles);
|
||||
anExtFileIter.More(); anExtFileIter.Next())
|
||||
{
|
||||
Handle(STEPCAFControl_ExternFile) anExtFile = anExtFileIter.Value();
|
||||
if (anExtFile->GetWriteStatus() != IFSelect_RetVoid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)>::Iterator it(myFiles);
|
||||
for ( ; it.More(); it.Next() ) {
|
||||
Handle(STEPCAFControl_ExternFile) EF = it.Value();
|
||||
if ( EF->GetWriteStatus() != IFSelect_RetVoid ) continue;
|
||||
|
||||
// construct extern file name
|
||||
TCollection_AsciiString aFileName = OSD_Path::AbsolutePath (aDirPath, anExtFile->GetName()->String());
|
||||
if (aFileName.Length() <= 0)
|
||||
{
|
||||
aFileName = anExtFile->GetName()->String();
|
||||
}
|
||||
TCollection_AsciiString fname = OSD_Path::AbsolutePath ( dpath, EF->GetName()->String() );
|
||||
if ( fname.Length() <= 0 ) fname = EF->GetName()->String();
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "Writing external file: " << aFileName << std::endl;
|
||||
std::cout << "Writing external file: " << fname.ToCString() << std::endl;
|
||||
#endif
|
||||
|
||||
const IFSelect_ReturnStatus anExtStatus = anExtFile->GetWS()->SendAll (aFileName.ToCString());
|
||||
anExtFile->SetWriteStatus (anExtStatus);
|
||||
if (anExtStatus != IFSelect_RetDone)
|
||||
{
|
||||
aStatus = anExtStatus;
|
||||
}
|
||||
EF->SetWriteStatus ( EF->GetWS()->SendAll ( fname.ToCString() ) );
|
||||
}
|
||||
|
||||
return aStatus;
|
||||
return status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -369,21 +352,6 @@ void STEPCAFControl_Writer::prepareUnit(const TDF_Label& theLabel,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStream
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPCAFControl_Writer::WriteStream (std::ostream& theStream)
|
||||
{
|
||||
if (!myFiles.IsEmpty())
|
||||
{
|
||||
// writing external files is unsupported via stream interface
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
|
||||
return myWriter.WriteStream (theStream);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transfer
|
||||
//purpose :
|
||||
|
@@ -70,11 +70,7 @@ public:
|
||||
//! filename will be a name of root file, all other files
|
||||
//! have names of corresponding parts
|
||||
//! Provided for use like single-file writer
|
||||
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
|
||||
|
||||
//! Writes all the produced models into the stream.
|
||||
//! Provided for use like single-file writer
|
||||
Standard_EXPORT IFSelect_ReturnStatus WriteStream (std::ostream& theStream);
|
||||
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
|
||||
|
||||
//! Transfers a document (or single label) to a STEP model
|
||||
//! The mode of translation of shape is AsIs
|
||||
|
@@ -1595,10 +1595,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
|
||||
// SINON, la shape est prise et transferee telle quelle
|
||||
TopoDS_Shape sh0 = shape;
|
||||
gp_Trsf aLoc;
|
||||
Standard_Boolean isShapeLocated = Standard_False;
|
||||
if ( GroupMode() >0) {
|
||||
TopLoc_Location shloc = shape.Location();
|
||||
isShapeLocated = !shloc.IsIdentity();
|
||||
aLoc = shloc.Transformation();
|
||||
TopLoc_Location shident;
|
||||
sh0.Location (shident);
|
||||
@@ -1678,7 +1676,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
|
||||
myContext.NextIndex();
|
||||
|
||||
// abv 16.10.00: bind CDSR (et al) to located shape in order to be able to track instances
|
||||
if (mapper != start && isShapeLocated) {
|
||||
if (mapper != start && aLoc.Form() != gp_Identity) {
|
||||
Handle(Transfer_Binder) bnd = FP->Find ( start );
|
||||
for ( Standard_Integer j=1; j <= roots->Length(); j++ )
|
||||
if ( bnd.IsNull() ) bnd = TransientResult ( roots->Value(j) );
|
||||
|
@@ -181,64 +181,10 @@ STEPControl_Controller::STEPControl_Controller ()
|
||||
Interface_Static::SetIVal("write.step.vertex.mode",0);
|
||||
|
||||
// abv 15.11.00: ShapeProcessing
|
||||
Interface_Static::Init ("XSTEP", "write.step.resource.name", 't', "STEP");
|
||||
Interface_Static::Init ("XSTEP", "read.step.resource.name", 't', "STEP");
|
||||
Interface_Static::Init ("XSTEP", "write.step.sequence", 't', "ToSTEP");
|
||||
Interface_Static::Init ("XSTEP", "read.step.sequence", 't', "FromSTEP");
|
||||
Interface_Static::Init ("XSTEP", "ToSTEP.exec.op", 't', "SplitCommonVertex,DirectFaces");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.exec.op", 't', "FixShape");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.Tolerance3d", 't', "&Runtime.Tolerance");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTolerance3d", 't', "&Runtime.MaxTolerance");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MinTolerance3d", 't', "1.e-7");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeShellMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFreeWireMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSameParameterMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSolidMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShellOrientationMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.CreateOpenSolidMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShellMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFaceOrientationMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixWireMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixOrientationMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddNaturalBoundMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixMissingSeamMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSmallAreaWireMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.RemoveSmallAreaFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixIntersectingWiresMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixLoopWiresMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSplitFaceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.AutoCorrectPrecisionMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ModifyTopologyMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ModifyGeometryMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.ClosedWireMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.PreferencePCurveMode", 't', "1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixReorderMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSmallMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixConnectedMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixEdgeCurvesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixDegeneratedMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixLackingMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSelfIntersectionMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.RemoveLoopMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixReversed2dMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixRemovePCurveMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixRemoveCurve3dMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddPCurveMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixAddCurve3dMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSeamMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixShiftedMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixEdgeSameParameterMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNotchedEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixTailMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTailAngle", 't', "0.0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.MaxTailWidth", 't', "-1.0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixSelfIntersectingEdgeMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixIntersectingEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexPositionMode", 't', "0");
|
||||
Interface_Static::Init ("XSTEP", "FromSTEP.FixShape.FixVertexToleranceMode", 't', "-1");
|
||||
Interface_Static::Init ("XSTEP","write.step.resource.name",'t',"STEP");
|
||||
Interface_Static::Init ("XSTEP","read.step.resource.name",'t',"STEP");
|
||||
Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
|
||||
Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
|
||||
|
||||
// ika 28.07.16: Parameter to read all top level solids and shells,
|
||||
// should be used only in case of invalid shape_representation without links to shapes.
|
||||
|
@@ -18,9 +18,6 @@
|
||||
#include <STEPControl_ActorWrite.hxx>
|
||||
#include <STEPControl_Controller.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <StepData_Protocol.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <XSAlgo.hxx>
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
@@ -152,35 +149,12 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString theFileName)
|
||||
|
||||
IFSelect_ReturnStatus STEPControl_Writer::Write (const Standard_CString filename)
|
||||
{
|
||||
return thesession->SendAll (theFileName);
|
||||
return thesession->SendAll(filename);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteStream
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPControl_Writer::WriteStream (std::ostream& theOStream)
|
||||
{
|
||||
Handle(StepData_StepModel) aModel = Model();
|
||||
if (aModel.IsNull())
|
||||
{
|
||||
return IFSelect_RetFail;
|
||||
}
|
||||
|
||||
Handle(StepData_Protocol) aProtocol = Handle(StepData_Protocol)::DownCast (aModel->Protocol());
|
||||
if (aProtocol.IsNull())
|
||||
{
|
||||
return IFSelect_RetFail;
|
||||
}
|
||||
|
||||
StepData_StepWriter aWriter (aModel);
|
||||
aWriter.SendModel (aProtocol);
|
||||
return aWriter.Print (theOStream)
|
||||
? IFSelect_RetDone
|
||||
: IFSelect_RetFail;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintStatsTransfer
|
||||
|
@@ -90,10 +90,7 @@ public:
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a STEP model in the file identified by filename.
|
||||
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
|
||||
|
||||
//! Writes a STEP model in the std::ostream.
|
||||
Standard_EXPORT IFSelect_ReturnStatus WriteStream (std::ostream& theOStream);
|
||||
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
|
||||
|
||||
//! Displays the statistics for the
|
||||
//! last translation. what defines the kind of statistics that are displayed:
|
||||
|
@@ -229,31 +229,36 @@ Standard_Boolean ShapeAnalysis::IsOuterBound(const TopoDS_Face& face)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OuterWire
|
||||
//purpose : Returns positively oriented wire in the face.
|
||||
// If there is no one - returns the last wire of the face.
|
||||
//function : OuterBound
|
||||
//purpose : replacement of bad BRepTools::OuterBound(), to be merged
|
||||
// - skips internal vertices in face, if any, without exception
|
||||
// - returns positively oriented wire rather than greater one
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& theFace)
|
||||
TopoDS_Wire ShapeAnalysis::OuterWire(const TopoDS_Face& face)
|
||||
{
|
||||
TopoDS_Face aF = theFace;
|
||||
aF.Orientation (TopAbs_FORWARD);
|
||||
TopoDS_Face F = face;
|
||||
F.Orientation(TopAbs_FORWARD);
|
||||
|
||||
TopExp_Explorer anIt (aF, TopAbs_WIRE);
|
||||
BRep_Builder B;
|
||||
TopoDS_Iterator anIt (F, Standard_False);
|
||||
while (anIt.More())
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire (anIt.Value());
|
||||
TopoDS_Shape aWire = anIt.Value();
|
||||
anIt.Next();
|
||||
|
||||
// if current wire is the last one, return it without analysis
|
||||
if (!anIt.More())
|
||||
return aWire;
|
||||
// skip possible internal vertices in face
|
||||
if (aWire.ShapeType() != TopAbs_WIRE)
|
||||
continue;
|
||||
|
||||
// Check if the wire has positive area
|
||||
Handle(ShapeExtend_WireData) aSEWD = new ShapeExtend_WireData (aWire);
|
||||
Standard_Real anArea2d = ShapeAnalysis::TotCross2D (aSEWD, aF);
|
||||
if (anArea2d >= 0.)
|
||||
return aWire;
|
||||
// if current wire is the last one, return it without analysis
|
||||
if (! anIt.More())
|
||||
return TopoDS::Wire (aWire);
|
||||
|
||||
TopoDS_Shape aTestFace = F.EmptyCopied();
|
||||
B.Add (aTestFace, aWire);
|
||||
if (ShapeAnalysis::IsOuterBound (TopoDS::Face (aTestFace)))
|
||||
return TopoDS::Wire (aWire);
|
||||
}
|
||||
return TopoDS_Wire();
|
||||
}
|
||||
|
@@ -51,9 +51,12 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Returns positively oriented wire in the face.
|
||||
//! If there is no such wire - returns the last wire of the face.
|
||||
Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& theFace);
|
||||
//! Returns the outer wire on the face <Face>.
|
||||
//! This is replacement of the method BRepTools::OuterWire
|
||||
//! until it works badly.
|
||||
//! Returns the first wire oriented as outer according to
|
||||
//! FClass2d_Classifier. If none, last wire is returned.
|
||||
Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& face);
|
||||
|
||||
//! Returns a total area of 2d wire
|
||||
Standard_EXPORT static Standard_Real TotCross2D (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& aFace);
|
||||
|
@@ -48,7 +48,6 @@
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_SphericalSurface.hxx>
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
@@ -647,10 +646,11 @@ Standard_Boolean ShapeFix_Face::Perform()
|
||||
|
||||
// fix natural bounds
|
||||
Standard_Boolean NeedSplit = Standard_True;
|
||||
if (FixAddNaturalBound())
|
||||
{
|
||||
NeedSplit = Standard_False;
|
||||
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE5 );
|
||||
if ( NeedFix ( myFixAddNaturalBoundMode ) ) {
|
||||
if ( FixAddNaturalBound() ) {
|
||||
NeedSplit = Standard_False;
|
||||
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE5 );
|
||||
}
|
||||
}
|
||||
|
||||
// split face
|
||||
@@ -839,11 +839,9 @@ Standard_Boolean ShapeFix_Face::FixAddNaturalBound()
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// check if surface doesn't need natural bounds
|
||||
if (!isNeedAddNaturalBound(ws))
|
||||
{
|
||||
// check if surface is double-closed and fix is needed
|
||||
if ( !IsSurfaceUVPeriodic (mySurf->Adaptor3d()) || ShapeAnalysis::IsOuterBound (myFace) )
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Collect information on free intervals in U and V
|
||||
TColgp_SequenceOfPnt2d intU, intV, centers;
|
||||
@@ -1003,50 +1001,6 @@ Standard_Boolean ShapeFix_Face::FixOrientation()
|
||||
return FixOrientation(MapWires);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : isNeedAddNaturalBound
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeFix_Face::isNeedAddNaturalBound(const TopTools_SequenceOfShape& theOrientedWires)
|
||||
{
|
||||
// if fix is not needed
|
||||
if (!NeedFix (myFixAddNaturalBoundMode))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
// if surface is not double-closed
|
||||
if (!IsSurfaceUVPeriodic (mySurf->Adaptor3d()))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
// if face has an OUTER bound
|
||||
if (ShapeAnalysis::IsOuterBound (myFace))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
// check that not any wire has a seam edge and not any edge is degenerated.
|
||||
// because the presence of a seam or degenerated edge indicates that this wire should be an external one,
|
||||
// and in case of its incorrect orientation, this will be corrected.
|
||||
Standard_Integer aNbOriented = theOrientedWires.Length();
|
||||
for (Standard_Integer i = 1; i <= aNbOriented; i++)
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire(theOrientedWires.Value(i));
|
||||
for (TopoDS_Iterator anEdgeIt(aWire); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(anEdgeIt.Value());
|
||||
if (BRep_Tool::Degenerated(anEdge))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (BRep_Tool::IsClosed(anEdge, myFace))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FixOrientation
|
||||
@@ -1116,8 +1070,9 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
|
||||
|
||||
// if no wires, just do nothing
|
||||
if ( nb <= 0) return Standard_False;
|
||||
Standard_Integer nbInternal=0;
|
||||
|
||||
Standard_Boolean isAddNaturalBounds = isNeedAddNaturalBound(ws);
|
||||
Standard_Boolean isAddNaturalBounds = (NeedFix (myFixAddNaturalBoundMode) && IsSurfaceUVPeriodic(mySurf->Adaptor3d()));
|
||||
TColStd_SequenceOfInteger aSeqReversed;
|
||||
// if wire is only one, check its orientation
|
||||
if ( nb == 1 ) {
|
||||
@@ -1128,7 +1083,9 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
|
||||
af.Orientation ( TopAbs_FORWARD );
|
||||
B.Add (af,ws.Value(1));
|
||||
|
||||
if (!isAddNaturalBounds && !ShapeAnalysis::IsOuterBound(af))
|
||||
if ((myFixAddNaturalBoundMode != 1 ||
|
||||
!IsSurfaceUVPeriodic(mySurf->Adaptor3d())) &&
|
||||
!ShapeAnalysis::IsOuterBound(af))
|
||||
{
|
||||
Handle(ShapeExtend_WireData) sbdw =
|
||||
new ShapeExtend_WireData(TopoDS::Wire(ws.Value(1)));
|
||||
@@ -1286,7 +1243,7 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
|
||||
if(!(stb==ste)) {
|
||||
sta = TopAbs_UNKNOWN;
|
||||
SI.Bind(aw,0);
|
||||
j=nbAll;
|
||||
j=nb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1405,9 +1362,11 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
|
||||
|
||||
}
|
||||
|
||||
//done = (done && (nb ==1 || (isAddNaturalBounds || (!isAddNaturalBounds && nbInternal <nb))));
|
||||
if(isAddNaturalBounds && nb == aSeqReversed.Length())
|
||||
done = Standard_False;
|
||||
|
||||
else
|
||||
done = (done && (nb ==1 || (isAddNaturalBounds || (!isAddNaturalBounds && nbInternal <nb))));
|
||||
// Faut-il reconstruire ? si myRebil est mis
|
||||
if ( done ) {
|
||||
TopoDS_Shape S = myFace.EmptyCopied();
|
||||
@@ -1626,9 +1585,6 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
|
||||
}
|
||||
|
||||
BRep_Builder B;
|
||||
Handle(Geom_ToroidalSurface) aTorSurf = Handle(Geom_ToroidalSurface)::DownCast(mySurf->Surface());
|
||||
Standard_Boolean anIsDegeneratedTor = ( aTorSurf.IsNull() ? Standard_False : aTorSurf->MajorRadius() < aTorSurf->MinorRadius() );
|
||||
|
||||
if ( w1.IsNull() ) return Standard_False;
|
||||
else if ( w2.IsNull()) {
|
||||
// For spheres and BSpline cone-like surfaces(bug 24055):
|
||||
@@ -1639,18 +1595,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
|
||||
gp_Dir2d d;
|
||||
Standard_Real aRange;
|
||||
|
||||
if( ismodeu && anIsDegeneratedTor )
|
||||
{
|
||||
Standard_Real aRa = aTorSurf->MajorRadius();
|
||||
Standard_Real aRi = aTorSurf->MinorRadius();
|
||||
Standard_Real aPhi = ACos (-aRa / aRi);
|
||||
p.SetCoord (0.0, ( ismodeu > 0 ? M_PI + aPhi : aPhi ));
|
||||
|
||||
Standard_Real aXCoord = -ismodeu;
|
||||
d.SetCoord ( aXCoord, 0.);
|
||||
aRange = 2.*M_PI;
|
||||
}
|
||||
else if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
|
||||
if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
|
||||
p.SetCoord ( ( ismodeu < 0 ? 0. : 2.*M_PI ), ismodeu * 0.5 * M_PI );
|
||||
Standard_Real aXCoord = -ismodeu;
|
||||
d.SetCoord ( aXCoord, 0.);
|
||||
@@ -1718,7 +1663,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
|
||||
// validity of orientation of the open wires in parametric space.
|
||||
// In case of U closed surface wire with minimal V coordinate should be directed in positive direction by U
|
||||
// In case of V closed surface wire with minimal U coordinate should be directed in negative direction by V
|
||||
if (!vclosed || !uclosed || anIsDegeneratedTor)
|
||||
if (!vclosed || !uclosed)
|
||||
{
|
||||
Standard_Real deltaOther = 0.5 * (m2[coord][0] + m2[coord][1]) - 0.5 * (m1[coord][0] + m1[coord][1]);
|
||||
if (deltaOther * isneg < 0)
|
||||
@@ -1766,7 +1711,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
|
||||
// A special kind of FixShifted is necessary for torus-like
|
||||
// surfaces to adjust wires by period ALONG the missing SEAM direction
|
||||
// tr9_r0501-ug.stp #187640
|
||||
if ( uclosed && vclosed && !anIsDegeneratedTor ) {
|
||||
if ( uclosed && vclosed ) {
|
||||
Standard_Real shiftw2 =
|
||||
ShapeAnalysis::AdjustByPeriod ( 0.5 * ( m2[coord][0] + m2[coord][1] ),
|
||||
0.5 * ( m1[coord][0] + m1[coord][1] +
|
||||
|
@@ -261,8 +261,6 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//! Returns True if the face needs to add natural bound and corresponded option of shape healing is ON
|
||||
Standard_Boolean isNeedAddNaturalBound(const TopTools_SequenceOfShape& theOrientedWires);
|
||||
|
||||
Standard_EXPORT Standard_Boolean SplitEdge (const Handle(ShapeExtend_WireData)& sewd, const Standard_Integer num, const Standard_Real param, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes);
|
||||
|
||||
|
@@ -62,14 +62,7 @@ Standard_Boolean ShapeProcess_Context::Init (const Standard_CString file,
|
||||
const Standard_CString scope)
|
||||
{
|
||||
myScope.Nullify();
|
||||
if (file != nullptr && strlen (file) != 0)
|
||||
{
|
||||
myRC = LoadResourceManager ( file );
|
||||
}
|
||||
else
|
||||
{
|
||||
myRC = new Resource_Manager();
|
||||
}
|
||||
myRC = LoadResourceManager ( file );
|
||||
if ( scope && scope[0] ) {
|
||||
SetScope ( scope );
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
// Primary definitions
|
||||
#define OCC_VERSION_MAJOR 7
|
||||
#define OCC_VERSION_MINOR 8
|
||||
#define OCC_VERSION_MINOR 7
|
||||
#define OCC_VERSION_MAINTENANCE 0
|
||||
|
||||
//! This macro must be commented in official release, and set to non-empty
|
||||
@@ -45,9 +45,9 @@
|
||||
#define OCC_VERSION_DEVELOPMENT "dev"
|
||||
|
||||
// Derived (manually): version as real and string (major.minor)
|
||||
#define OCC_VERSION 7.8
|
||||
#define OCC_VERSION_STRING "7.8"
|
||||
#define OCC_VERSION_COMPLETE "7.8.0"
|
||||
#define OCC_VERSION 7.7
|
||||
#define OCC_VERSION_STRING "7.7"
|
||||
#define OCC_VERSION_COMPLETE "7.7.0"
|
||||
|
||||
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
||||
#ifdef OCC_VERSION_DEVELOPMENT
|
||||
|
@@ -5,6 +5,7 @@ TKG3d
|
||||
TKMath
|
||||
TKBRep
|
||||
TKGeomAlgo
|
||||
TKTopAlgo
|
||||
TKShHealing
|
||||
TKMesh
|
||||
TKService
|
||||
|
@@ -1,5 +1,3 @@
|
||||
project(TKOpenGl)
|
||||
|
||||
set (TKOpenGl_DISABLE_COTIRE ON)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
|
@@ -1,6 +1,4 @@
|
||||
project(TKOpenGles)
|
||||
|
||||
set (TKOpenGles_DISABLE_COTIRE ON)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
#add_definitions("-DOCCT_OPENGL")
|
||||
|
@@ -1,5 +1,3 @@
|
||||
project(TKService)
|
||||
|
||||
set (TKService_DISABLE_COTIRE ON)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
|
@@ -9,7 +9,6 @@ TKG2d
|
||||
TKG3d
|
||||
TKMesh
|
||||
TKHLR
|
||||
TKRWMesh
|
||||
TKService
|
||||
TKGeomAlgo
|
||||
TKV3d
|
||||
|
@@ -1,5 +1,3 @@
|
||||
project(TKXCAF)
|
||||
|
||||
set (TKXCAF_DISABLE_COTIRE ON)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
|
@@ -1,5 +1,3 @@
|
||||
project(TKXDEDRAW)
|
||||
|
||||
set (TKXDEDRAW_DISABLE_COTIRE ON)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
|
@@ -7296,10 +7296,9 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
|
||||
Standard_Real aPlaySpeed = 1.0;
|
||||
Standard_Real aPlayStartTime = anAnimation->StartPts();
|
||||
Standard_Real aPlayDuration = anAnimation->Duration();
|
||||
Standard_Boolean isFreeCamera = Standard_False;
|
||||
Standard_Boolean isFreeCamera = Standard_False;
|
||||
Standard_Boolean toPauseOnClick = Standard_True;
|
||||
Standard_Boolean isLockLoop = Standard_False;
|
||||
Standard_Boolean toPrintElapsedTime = Standard_False;
|
||||
Standard_Boolean isLockLoop = Standard_False;
|
||||
|
||||
// video recording parameters
|
||||
TCollection_AsciiString aRecFile;
|
||||
@@ -7353,11 +7352,6 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (anArg == "-elapsedtime"
|
||||
|| anArg == "-elapsed")
|
||||
{
|
||||
toPrintElapsedTime = Standard_True;
|
||||
}
|
||||
else if (anArg == "-resume")
|
||||
{
|
||||
toPlay = Standard_True;
|
||||
@@ -7766,17 +7760,8 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
|
||||
}
|
||||
}
|
||||
|
||||
if (anAnimation.IsNull() || anAnimation->IsStopped())
|
||||
{
|
||||
ViewerTest::CurrentEventManager()->AbortViewAnimation();
|
||||
ViewerTest::CurrentEventManager()->SetObjectsAnimation(Handle(AIS_Animation)());
|
||||
}
|
||||
|
||||
if (toPrintElapsedTime)
|
||||
{
|
||||
theDI << "Elapsed Time: " << anAnimation->ElapsedTime() << " s\n";
|
||||
}
|
||||
|
||||
ViewerTest::CurrentEventManager()->AbortViewAnimation();
|
||||
ViewerTest::CurrentEventManager()->SetObjectsAnimation (Handle(AIS_Animation)());
|
||||
if (!toPlay && aRecFile.IsEmpty())
|
||||
{
|
||||
return 0;
|
||||
@@ -14353,14 +14338,13 @@ List existing animations:
|
||||
vanim
|
||||
|
||||
Animation playback:
|
||||
vanim name {-play|-resume|-pause|-stop} [playFrom [playDuration]] [-speed Coeff]
|
||||
[-freeLook] [-noPauseOnClick] [-lockLoop] [-elapsedTime]
|
||||
vanim name {-play|-resume|-pause|-stop} [playFrom [playDuration]]
|
||||
[-speed Coeff] [-freeLook] [-noPauseOnClick] [-lockLoop]
|
||||
|
||||
-speed playback speed (1.0 is normal speed)
|
||||
-freeLook skip camera animations
|
||||
-speed playback speed (1.0 is normal speed)
|
||||
-freeLook skip camera animations
|
||||
-noPauseOnClick do not pause animation on mouse click
|
||||
-lockLoop disable any interactions
|
||||
-elapsedTime prints elapsed time in seconds"
|
||||
-lockLoop disable any interactions
|
||||
|
||||
Animation definition:
|
||||
vanim Name/sub/name [-clear] [-delete]
|
||||
|
@@ -56,15 +56,6 @@ bool Vrml_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theReso
|
||||
{
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
||||
|
||||
InternalParameters.ReadFileUnit =
|
||||
theResource->RealVal("read.file.unit", InternalParameters.ReadFileUnit, aScope);
|
||||
InternalParameters.ReadFileCoordinateSys = (RWMesh_CoordinateSystem)
|
||||
theResource->IntegerVal("read.file.coordinate.system", InternalParameters.ReadFileCoordinateSys, aScope);
|
||||
InternalParameters.ReadSystemCoordinateSys = (RWMesh_CoordinateSystem)
|
||||
theResource->IntegerVal("read.system.coordinate.system", InternalParameters.ReadSystemCoordinateSys, aScope);
|
||||
InternalParameters.ReadFillIncomplete =
|
||||
theResource->BooleanVal("read.fill.incomplete", InternalParameters.ReadFillIncomplete, aScope);
|
||||
|
||||
InternalParameters.WriterVersion = (WriteMode_WriterVersion)
|
||||
theResource->IntegerVal("writer.version", InternalParameters.WriterVersion, aScope);
|
||||
InternalParameters.WriteRepresentationType = (WriteMode_RepresentationType)
|
||||
@@ -84,47 +75,19 @@ TCollection_AsciiString Vrml_ConfigurationNode::Save() const
|
||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Read parameters:\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Set (override) file length units to convert from while reading the file, defined as scale factor for m (meters).\n";
|
||||
aResult += "!Default value: 1. Available values: positive double\n";
|
||||
aResult += aScope + "read.file.unit :\t " + InternalParameters.ReadFileUnit + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Set (override) file origin coordinate system to perform conversion during read.\n";
|
||||
aResult += "!Default value: Yup (1). { Zup (0) | Yup (1) }\n";
|
||||
aResult += aScope + "read.file.coordinate.system :\t " + InternalParameters.ReadFileCoordinateSys + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Set system origin coordinate system to perform conversion into during read.\n";
|
||||
aResult += "!Default value: Zup (0). Available values: { Zup (0) | Yup (1) }\n";
|
||||
aResult += aScope + "read.system.coordinate.system :\t " + InternalParameters.ReadSystemCoordinateSys + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Set flag allowing partially read file content to be put into the XDE document.\n";
|
||||
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
|
||||
aResult += aScope + "read.fill.incomplete :\t " + InternalParameters.ReadFillIncomplete + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Write parameters:\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Setting up writer version.\n";
|
||||
aResult += "!Setting up writer version\n";
|
||||
aResult += "!Default value: 2. Available values: 1, 2\n";
|
||||
aResult += aScope + "writer.version :\t " + InternalParameters.WriterVersion + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Setting up representation\n";
|
||||
aResult += "!Default value: 1. Available values: 0(shaded), 1(wireframe), 2(both).\n";
|
||||
aResult += "!Default value: 1. Available values: 0(shaded), 1(wireframe), 2(both)\n";
|
||||
aResult += aScope + "write.representation.type :\t " + InternalParameters.WriteRepresentationType + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#define _Vrml_ConfigurationNode_HeaderFile
|
||||
|
||||
#include <DE_ConfigurationNode.hxx>
|
||||
#include <RWMesh_CoordinateSystem.hxx>
|
||||
|
||||
//! The purpose of this class is to configure the transfer process for VRML format
|
||||
//! Stores the necessary settings for Vrml_Provider.
|
||||
@@ -94,12 +93,6 @@ public:
|
||||
|
||||
struct Vrml_InternalSection
|
||||
{
|
||||
// Read
|
||||
double ReadFileUnit = 1.; //<! file length units to convert from while reading the file, defined as scale factor for meters
|
||||
RWMesh_CoordinateSystem ReadFileCoordinateSys = RWMesh_CoordinateSystem_Yup; //<! coordinate system defined by Vrml file
|
||||
RWMesh_CoordinateSystem ReadSystemCoordinateSys = RWMesh_CoordinateSystem_Zup; //<! result coordinate system
|
||||
bool ReadFillIncomplete = true; //<! fill the document with partially retrieved data even if reader has failed with error
|
||||
|
||||
// Write
|
||||
WriteMode_WriterVersion WriterVersion = WriteMode_WriterVersion_2; //!< Setting up writer version (1/2)
|
||||
WriteMode_RepresentationType WriteRepresentationType = WriteMode_RepresentationType_Wireframe; //!< Setting up representation (shaded/wireframe/both)
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <Message.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <VrmlAPI_CafReader.hxx>
|
||||
#include <VrmlAPI_Writer.hxx>
|
||||
#include <VrmlData_Scene.hxx>
|
||||
#include <Vrml_ConfigurationNode.hxx>
|
||||
@@ -88,27 +87,14 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
return false;
|
||||
}
|
||||
Handle(Vrml_ConfigurationNode) aNode = Handle(Vrml_ConfigurationNode)::DownCast(GetNode());
|
||||
|
||||
VrmlAPI_CafReader aVrmlReader;
|
||||
aVrmlReader.SetDocument(theDocument);
|
||||
aVrmlReader.SetFileLengthUnit(aNode->InternalParameters.ReadFileUnit);
|
||||
aVrmlReader.SetSystemLengthUnit(aNode->GlobalParameters.LengthUnit);
|
||||
aVrmlReader.SetFileCoordinateSystem(aNode->InternalParameters.ReadFileCoordinateSys);
|
||||
aVrmlReader.SetSystemCoordinateSystem(aNode->InternalParameters.ReadSystemCoordinateSys);
|
||||
aVrmlReader.SetFillIncompleteDocument(aNode->InternalParameters.ReadFillIncomplete);
|
||||
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->InternalParameters.ReadFileUnit);
|
||||
|
||||
if (!aVrmlReader.Perform(thePath, theProgress))
|
||||
TopoDS_Shape aShape;
|
||||
if(!Read(thePath, aShape, theProgress))
|
||||
{
|
||||
if (aVrmlReader.ExtraStatus() != RWMesh_CafReaderStatusEx_Partial)
|
||||
{
|
||||
Message::SendFail() << "Error in the Vrml_Provider during reading the file '" << thePath << "'";
|
||||
return false;
|
||||
}
|
||||
Message::SendWarning() << "Warning in the Vrml_Provider during reading the file: file has been read paratially " <<
|
||||
"(due to unexpected EOF, syntax error, memory limit) '" << thePath << "'";
|
||||
return false;
|
||||
}
|
||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||
aShTool->AddShape(aShape);
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -131,7 +117,7 @@ bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
|
||||
VrmlAPI_Writer aWriter;
|
||||
aWriter.SetRepresentation(static_cast<VrmlAPI_RepresentationOfShape>(aNode->InternalParameters.WriteRepresentationType));
|
||||
Standard_Real aScaleFactorM = aNode->GlobalParameters.LengthUnit;
|
||||
Standard_Real aScaleFactorM = aNode->GlobalParameters.LengthUnit / 1000;
|
||||
if (!aWriter.WriteDoc(theDocument, thePath.ToCString(), aScaleFactorM))
|
||||
{
|
||||
Message::SendFail() << "Error in the Vrml_Provider during wtiting the file " <<
|
||||
@@ -213,7 +199,8 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
}
|
||||
|
||||
VrmlData_Scene aScene;
|
||||
aScene.SetLinearScale(aNode->GlobalParameters.LengthUnit);
|
||||
Standard_Real anOCCUnitMM = aNode->GlobalParameters.LengthUnit;
|
||||
aScene.SetLinearScale(1000. / anOCCUnitMM);
|
||||
|
||||
aScene.SetVrmlDir(aVrmlDir);
|
||||
aScene << aStream;
|
||||
|
@@ -1,7 +1,5 @@
|
||||
VrmlAPI.cxx
|
||||
VrmlAPI.hxx
|
||||
VrmlAPI_CafReader.cxx
|
||||
VrmlAPI_CafReader.hxx
|
||||
VrmlAPI_RepresentationOfShape.hxx
|
||||
VrmlAPI_Writer.cxx
|
||||
VrmlAPI_Writer.hxx
|
||||
|
@@ -1,137 +0,0 @@
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <VrmlAPI_CafReader.hxx>
|
||||
|
||||
#include <OSD_FileSystem.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Standard_CLocaleSentry.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <VrmlData_Scene.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(VrmlAPI_CafReader, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
//=======================================================================
|
||||
// function : getVrmlErrorName
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
static TCollection_AsciiString getVrmlErrorName(VrmlData_ErrorStatus theStatus)
|
||||
{
|
||||
switch (theStatus)
|
||||
{
|
||||
case VrmlData_StatusOK: return "";
|
||||
case VrmlData_EmptyData: return "EmptyData";
|
||||
case VrmlData_UnrecoverableError: return "UnrecoverableError";
|
||||
case VrmlData_GeneralError: return "GeneralError";
|
||||
case VrmlData_EndOfFile: return "EndOfFile";
|
||||
case VrmlData_NotVrmlFile: return "NotVrmlFile";
|
||||
case VrmlData_CannotOpenFile: return "CannotOpenFile";
|
||||
case VrmlData_VrmlFormatError: return "VrmlFormatError";
|
||||
case VrmlData_NumericInputError: return "NumericInputError";
|
||||
case VrmlData_IrrelevantNumber: return "IrrelevantNumber";
|
||||
case VrmlData_BooleanInputError: return "BooleanInputError";
|
||||
case VrmlData_StringInputError: return "StringInputError";
|
||||
case VrmlData_NodeNameUnknown: return "NodeNameUnknown";
|
||||
case VrmlData_NonPositiveSize: return "NonPositiveSize";
|
||||
case VrmlData_ReadUnknownNode: return "ReadUnknownNode";
|
||||
case VrmlData_NonSupportedFeature: return "NonSupportedFeature";
|
||||
case VrmlData_OutputStreamUndefined: return "OutputStreamUndefined";
|
||||
case VrmlData_NotImplemented: return "NotImplemented";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : performMeshSubshape
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
static void performMeshSubshape(RWMesh_NodeAttributeMap& theAttribMap,
|
||||
const VrmlData_DataMapOfShapeAppearance& theShapeAppMap,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
Handle(VrmlData_Appearance) anAppearance;
|
||||
if (theShapeAppMap.Find(theShape.TShape(), anAppearance))
|
||||
{
|
||||
if (!anAppearance.IsNull()
|
||||
&& !anAppearance->Material().IsNull())
|
||||
{
|
||||
RWMesh_NodeAttributes aFaceAttribs;
|
||||
theAttribMap.Find(theShape, aFaceAttribs);
|
||||
aFaceAttribs.Style.SetColorSurf(anAppearance->Material()->DiffuseColor());
|
||||
theAttribMap.Bind(theShape, aFaceAttribs);
|
||||
}
|
||||
}
|
||||
|
||||
for (TopoDS_Iterator aSubShapeIter(theShape, true, false); aSubShapeIter.More(); aSubShapeIter.Next())
|
||||
{
|
||||
performMeshSubshape(theAttribMap, theShapeAppMap, aSubShapeIter.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : performMesh
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool VrmlAPI_CafReader::performMesh(const TCollection_AsciiString& theFile,
|
||||
const Message_ProgressRange& theProgress,
|
||||
const Standard_Boolean theToProbe)
|
||||
{
|
||||
(void)theProgress;
|
||||
Handle(OSD_FileSystem) aFile = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::istream> aFileStream = aFile->OpenIStream(theFile, std::ios::in | std::ios::binary);
|
||||
if (aFileStream.get() == nullptr || !aFileStream->good())
|
||||
{
|
||||
Message::SendFail() << "Error in VrmlAPI_CafReader: file '" << theFile << "' is not found";
|
||||
return false;
|
||||
}
|
||||
if (theToProbe)
|
||||
{
|
||||
Message::SendFail() << "Error in VrmlAPI_CafReader: theToProbe parameter isn't supported";
|
||||
return false; // unsupported
|
||||
}
|
||||
|
||||
// determine file location to load associated files
|
||||
TCollection_AsciiString aFolder;
|
||||
TCollection_AsciiString aFileName;
|
||||
OSD_Path::FolderAndFileFromPath(theFile, aFolder, aFileName);
|
||||
|
||||
VrmlData_Scene aScene;
|
||||
aScene.SetLinearScale(FileLengthUnit());
|
||||
aScene.SetVrmlDir(aFolder);
|
||||
aScene << *aFileStream;
|
||||
|
||||
VrmlData_DataMapOfShapeAppearance aShapeAppMap;
|
||||
TopoDS_Shape aShape = aScene.GetShape(aShapeAppMap);
|
||||
if (!aShape.IsNull())
|
||||
{
|
||||
performMeshSubshape(myAttribMap, aShapeAppMap, aShape);
|
||||
myRootShapes.Append(aShape);
|
||||
}
|
||||
if (aScene.Status() != VrmlData_StatusOK
|
||||
|| aShape.IsNull())
|
||||
{
|
||||
Message::SendFail() << "Error in VrmlAPI_CafReader: " << getVrmlErrorName(aScene.Status())
|
||||
<< "occurred at line " << aScene.GetLineError()
|
||||
<< "\nwhile reading VRML file '" << theFile << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _VrmlAPI_Reader_HeaderFile
|
||||
#define _VrmlAPI_Reader_HeaderFile
|
||||
|
||||
#include <RWMesh_CafReader.hxx>
|
||||
|
||||
//! The Vrml mesh reader into XDE document.
|
||||
class VrmlAPI_CafReader : public RWMesh_CafReader
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(VrmlAPI_CafReader, RWMesh_CafReader)
|
||||
|
||||
protected:
|
||||
|
||||
//! Read the mesh data from specified file.
|
||||
//! @param theFile file to read
|
||||
//! @param theProgress progress indicator
|
||||
//! @param theToProbe flag for probing file without complete reading. Not supported.
|
||||
//! @return false when theToProbe is set to true or reading has completed with error.
|
||||
Standard_EXPORT virtual Standard_Boolean performMesh(const TCollection_AsciiString& theFile,
|
||||
const Message_ProgressRange& theProgress,
|
||||
const Standard_Boolean theToProbe) Standard_OVERRIDE;
|
||||
|
||||
};
|
||||
|
||||
#endif // _VrmlAPI_Reader_HeaderFile
|
@@ -416,40 +416,6 @@ void XCAFDoc_ShapeTool::MakeReference (const TDF_Label &L,
|
||||
SetLabelNameByLink(L);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : SetLocation
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XCAFDoc_ShapeTool::SetLocation (const TDF_Label& theShapeLabel,
|
||||
const TopLoc_Location& theLoc,
|
||||
TDF_Label& theRefLabel)
|
||||
{
|
||||
if (theLoc.IsIdentity())
|
||||
{
|
||||
theRefLabel = theShapeLabel;
|
||||
return Standard_True;
|
||||
}
|
||||
// if input label is reference -> just change the location attribute
|
||||
if (IsReference (theShapeLabel))
|
||||
{
|
||||
TopLoc_Location anOldLoc;
|
||||
anOldLoc = GetLocation (theShapeLabel);
|
||||
TopLoc_Location aNewLoc (theLoc.Transformation() * anOldLoc.Transformation());
|
||||
XCAFDoc_Location::Set(theShapeLabel, aNewLoc);
|
||||
theRefLabel = theShapeLabel;
|
||||
return Standard_True;
|
||||
}
|
||||
// if input label is shape, and it is free -> create reference to the shape
|
||||
if (IsShape(theShapeLabel) && IsFree(theShapeLabel))
|
||||
{
|
||||
theRefLabel = TDF_TagSource::NewChild (Label());
|
||||
MakeReference (theRefLabel, theShapeLabel, theLoc);
|
||||
return Standard_True;
|
||||
}
|
||||
// other cases of label meaning doesn't need to apply new location
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : addShape
|
||||
//purpose : private
|
||||
|
@@ -402,15 +402,6 @@ public:
|
||||
//! Returns null attribute if no SHUO found
|
||||
Standard_EXPORT static Standard_Boolean FindSHUO (const TDF_LabelSequence& Labels, Handle(XCAFDoc_GraphNode)& theSHUOAttr);
|
||||
|
||||
//! Sets location to the shape label
|
||||
//! If label is reference -> changes location attribute
|
||||
//! If label is free shape -> creates reference with location to it
|
||||
//! @param[in] theShapeLabel the shape label to change location
|
||||
//! @param[in] theLoc location to set
|
||||
//! @param[out] theRefLabel the reference label with new location
|
||||
//! @return TRUE if new location was set
|
||||
Standard_EXPORT Standard_Boolean SetLocation (const TDF_Label& theShapeLabel, const TopLoc_Location& theLoc, TDF_Label& theRefLabel);
|
||||
|
||||
//! Convert Shape (compound/compsolid/shell/wire) to assembly
|
||||
Standard_EXPORT Standard_Boolean Expand (const TDF_Label& Shape);
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <DDocStd.hxx>
|
||||
#include <DDocStd_DrawDocument.hxx>
|
||||
#include <DE_ConfigurationContext.hxx>
|
||||
@@ -26,9 +27,6 @@
|
||||
#include <IGESCAFControl_Writer.hxx>
|
||||
#include <IGESControl_Controller.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <STEPCAFControl_ExternFile.hxx>
|
||||
#include <STEPCAFControl_Reader.hxx>
|
||||
#include <STEPCAFControl_Writer.hxx>
|
||||
#include <STEPControl_Controller.hxx>
|
||||
@@ -41,7 +39,6 @@
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <XSDRAW.hxx>
|
||||
#include <XSDRAW_Vars.hxx>
|
||||
#include <VrmlAPI_CafReader.hxx>
|
||||
#include <VrmlAPI_Writer.hxx>
|
||||
#include <DDF.hxx>
|
||||
|
||||
@@ -52,7 +49,6 @@
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <UnitsAPI.hxx>
|
||||
#include <UnitsMethods.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -62,30 +58,6 @@
|
||||
//============================================================
|
||||
static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedictws;
|
||||
|
||||
//=======================================================================
|
||||
//function : parseCoordinateSystem
|
||||
//purpose : Parse RWMesh_CoordinateSystem enumeration.
|
||||
//=======================================================================
|
||||
static bool parseCoordinateSystem(const char* theArg,
|
||||
RWMesh_CoordinateSystem& theSystem)
|
||||
{
|
||||
TCollection_AsciiString aCSStr(theArg);
|
||||
aCSStr.LowerCase();
|
||||
if (aCSStr == "zup")
|
||||
{
|
||||
theSystem = RWMesh_CoordinateSystem_Zup;
|
||||
}
|
||||
else if (aCSStr == "yup")
|
||||
{
|
||||
theSystem = RWMesh_CoordinateSystem_Yup;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
static Standard_Boolean ClearDicWS()
|
||||
{
|
||||
thedictws.Clear();
|
||||
@@ -378,26 +350,19 @@ static Standard_Integer WriteIges(Draw_Interpretor& di, Standard_Integer argc, c
|
||||
//function : ReadStep
|
||||
//purpose : Read STEP file to DECAF document
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
DeclareAndCast(STEPControl_Controller, ctl, XSDRAW::Controller());
|
||||
if (ctl.IsNull())
|
||||
{
|
||||
XSDRAW::SetNorm ("STEP");
|
||||
}
|
||||
if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
|
||||
|
||||
Standard_CString aDocName = NULL;
|
||||
TCollection_AsciiString aFilePath, aModeStr;
|
||||
bool toTestStream = false;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString anArgCase(argv[anArgIter]);
|
||||
anArgCase.LowerCase();
|
||||
if (anArgCase == "-stream")
|
||||
{
|
||||
toTestStream = true;
|
||||
}
|
||||
else if (aDocName == NULL)
|
||||
if (aDocName == NULL)
|
||||
{
|
||||
aDocName = argv[anArgIter];
|
||||
}
|
||||
@@ -416,26 +381,26 @@ static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString aFileName, anOldVarName;
|
||||
Standard_Boolean isFileMode = XSDRAW::FileAndVar (aFilePath.ToCString(), aDocName, "STEP", aFileName, anOldVarName);
|
||||
if (isFileMode) di << " File STEP to read : " << aFileName << "\n";
|
||||
else di << " Model taken from the session : " << aFileName << "\n";
|
||||
TCollection_AsciiString fnom, rnom;
|
||||
Standard_Boolean modfic = XSDRAW::FileAndVar(aFilePath.ToCString(), aDocName, "STEP", fnom, rnom);
|
||||
if (modfic) di << " File STEP to read : " << fnom.ToCString() << "\n";
|
||||
else di << " Model taken from the session : " << fnom.ToCString() << "\n";
|
||||
// di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
|
||||
|
||||
STEPCAFControl_Reader aReader (XSDRAW::Session(), isFileMode);
|
||||
STEPCAFControl_Reader reader(XSDRAW::Session(), modfic);
|
||||
if (!aModeStr.IsEmpty())
|
||||
{
|
||||
Standard_Boolean aMode = Standard_True;
|
||||
for (Standard_Integer i = 1; aModeStr.Value (i); ++i)
|
||||
Standard_Boolean mode = Standard_True;
|
||||
for (Standard_Integer i = 1; aModeStr.Value(i); ++i)
|
||||
{
|
||||
switch (aModeStr.Value (i))
|
||||
switch (aModeStr.Value(i))
|
||||
{
|
||||
case '-' : aMode = Standard_False; break;
|
||||
case '+' : aMode = Standard_True; break;
|
||||
case 'c' : aReader.SetColorMode (aMode); break;
|
||||
case 'n' : aReader.SetNameMode (aMode); break;
|
||||
case 'l' : aReader.SetLayerMode (aMode); break;
|
||||
case 'v' : aReader.SetPropsMode (aMode); break;
|
||||
case '-': mode = Standard_False; break;
|
||||
case '+': mode = Standard_True; break;
|
||||
case 'c': reader.SetColorMode(mode); break;
|
||||
case 'n': reader.SetNameMode(mode); break;
|
||||
case 'l': reader.SetLayerMode(mode); break;
|
||||
case 'v': reader.SetPropsMode(mode); break;
|
||||
default:
|
||||
{
|
||||
Message::SendFail() << "Syntax error at '" << aModeStr << "'\n";
|
||||
@@ -445,36 +410,25 @@ static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
|
||||
Message_ProgressScope aRootScope (aProgress->Start(), "STEP import", isFileMode ? 2 : 1);
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
||||
Message_ProgressScope aRootScope(aProgress->Start(), "STEP import", modfic ? 2 : 1);
|
||||
|
||||
IFSelect_ReturnStatus aReadStat = IFSelect_RetVoid;
|
||||
if (isFileMode)
|
||||
IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
|
||||
if (modfic)
|
||||
{
|
||||
Message_ProgressScope aReadScope (aRootScope.Next(), "File reading", 1);
|
||||
Message_ProgressScope aReadScope(aRootScope.Next(), "File reading", 1);
|
||||
aReadScope.Show();
|
||||
if (toTestStream)
|
||||
{
|
||||
std::ifstream aStream;
|
||||
OSD_OpenStream (aStream, aFileName.ToCString(), std::ios::in | std::ios::binary);
|
||||
TCollection_AsciiString aFolder, aFileNameShort;
|
||||
OSD_Path::FolderAndFileFromPath (aFileName, aFolder, aFileNameShort);
|
||||
aReadStat = aReader.ReadStream (aFileNameShort.ToCString(), aStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
aReadStat = aReader.ReadFile (aFileName.ToCString());
|
||||
}
|
||||
readstat = reader.ReadFile(fnom.ToCString());
|
||||
}
|
||||
else if (XSDRAW::Session()->NbStartingEntities() > 0)
|
||||
{
|
||||
aReadStat = IFSelect_RetDone;
|
||||
readstat = IFSelect_RetDone;
|
||||
}
|
||||
if (aReadStat != IFSelect_RetDone)
|
||||
if (readstat != IFSelect_RetDone)
|
||||
{
|
||||
if (isFileMode)
|
||||
if (modfic)
|
||||
{
|
||||
di << "Could not read file " << aFileName << " , abandon\n";
|
||||
di << "Could not read file " << fnom << " , abandon\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -483,29 +437,30 @@ static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
if (!DDocStd::GetDocument (aDocName, aDoc, Standard_False))
|
||||
Handle(TDocStd_Document) doc;
|
||||
if (!DDocStd::GetDocument(aDocName, doc, Standard_False))
|
||||
{
|
||||
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
||||
anApp->NewDocument("BinXCAF", aDoc);
|
||||
TDataStd_Name::Set (aDoc->GetData()->Root(), aDocName);
|
||||
Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
|
||||
Draw::Set (aDocName, aDrawDoc);
|
||||
Handle(TDocStd_Application) A = DDocStd::GetApplication();
|
||||
A->NewDocument("BinXCAF", doc);
|
||||
TDataStd_Name::Set(doc->GetData()->Root(), aDocName);
|
||||
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
|
||||
Draw::Set(aDocName, DD);
|
||||
// di << "Document saved with name " << aDocName;
|
||||
}
|
||||
if (!aReader.Transfer (aDoc, aRootScope.Next()))
|
||||
if (!reader.Transfer(doc, aRootScope.Next()))
|
||||
{
|
||||
di << "Cannot read any relevant data from the STEP file\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
|
||||
Draw::Set (aDocName, aDrawDoc);
|
||||
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(doc);
|
||||
Draw::Set(aDocName, DD);
|
||||
di << "Document saved with name " << aDocName;
|
||||
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aReader.ExternFiles();
|
||||
FillDicWS (aDicFile);
|
||||
AddWS (aFileName, XSDRAW::Session());
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> DicFile = reader.ExternFiles();
|
||||
FillDicWS(DicFile);
|
||||
AddWS(fnom, XSDRAW::Session());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -513,183 +468,132 @@ static Standard_Integer ReadStep(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
//function : WriteStep
|
||||
//purpose : Write DECAF document to STEP
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer WriteStep(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
|
||||
if (ctl.IsNull())
|
||||
if (argc < 3)
|
||||
{
|
||||
XSDRAW::SetNorm ("STEP");
|
||||
}
|
||||
STEPCAFControl_Writer aWriter (XSDRAW::Session(), Standard_True);
|
||||
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
TCollection_AsciiString aDocName, aFilePath;
|
||||
STEPControl_StepModelType aMode = STEPControl_AsIs;
|
||||
bool hasModeArg = false, toTestStream = false;
|
||||
TCollection_AsciiString aMultiFilePrefix, aLabelName;
|
||||
TDF_Label aLabel;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString anArgCase (argv[anArgIter]);
|
||||
anArgCase.LowerCase();
|
||||
if (anArgCase == "-stream")
|
||||
{
|
||||
toTestStream = true;
|
||||
}
|
||||
else if (aDocName.IsEmpty())
|
||||
{
|
||||
Standard_CString aDocNameStr = argv[anArgIter];
|
||||
DDocStd::GetDocument (aDocNameStr, aDoc);
|
||||
if (aDoc.IsNull())
|
||||
{
|
||||
di << "Syntax error: '" << argv[anArgIter] << "' is not a document";
|
||||
return 1;
|
||||
}
|
||||
aDocName = aDocNameStr;
|
||||
}
|
||||
else if (aFilePath.IsEmpty())
|
||||
{
|
||||
aFilePath = argv[anArgIter];
|
||||
}
|
||||
else if (!hasModeArg)
|
||||
{
|
||||
hasModeArg = true;
|
||||
switch (anArgCase.Value (1))
|
||||
{
|
||||
case 'a':
|
||||
case '0': aMode = STEPControl_AsIs; break;
|
||||
case 'f':
|
||||
case '1': aMode = STEPControl_FacetedBrep; break;
|
||||
case 's':
|
||||
case '2': aMode = STEPControl_ShellBasedSurfaceModel; break;
|
||||
case 'm':
|
||||
case '3': aMode = STEPControl_ManifoldSolidBrep; break;
|
||||
case 'w':
|
||||
case '4': aMode = STEPControl_GeometricCurveSet; break;
|
||||
default:
|
||||
{
|
||||
di << "Syntax error: mode '" << argv[anArgIter] << "' is incorrect [give fsmw]";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Standard_Boolean wrmode = Standard_True;
|
||||
for (Standard_Integer i = 1; i <= anArgCase.Length(); ++i)
|
||||
{
|
||||
switch (anArgCase.Value (i))
|
||||
{
|
||||
case '-' : wrmode = Standard_False; break;
|
||||
case '+' : wrmode = Standard_True; break;
|
||||
case 'c' : aWriter.SetColorMode (wrmode); break;
|
||||
case 'n' : aWriter.SetNameMode (wrmode); break;
|
||||
case 'l' : aWriter.SetLayerMode (wrmode); break;
|
||||
case 'v' : aWriter.SetPropsMode (wrmode); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aMultiFilePrefix.IsEmpty()
|
||||
&& anArgCase.Search (":") == -1)
|
||||
{
|
||||
aMultiFilePrefix = argv[anArgIter];
|
||||
}
|
||||
else if (aLabel.IsNull())
|
||||
{
|
||||
if (!DDF::FindLabel (aDoc->Main().Data(), argv[anArgIter], aLabel)
|
||||
|| aLabel.IsNull())
|
||||
{
|
||||
di << "Syntax error: No label for entry '" << argv[anArgIter] << "'";
|
||||
return 1;
|
||||
}
|
||||
aLabelName = argv[anArgIter];
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Syntax error: unknown argument '" << argv[anArgIter] << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (aFilePath.IsEmpty())
|
||||
{
|
||||
di << "Syntax error: wrong number of arguments";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aFileName, anOldVarName;
|
||||
const Standard_Boolean isFileMode = XSDRAW::FileAndVar (aFilePath.ToCString(), aDocName.ToCString(), "STEP", aFileName, anOldVarName);
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di);
|
||||
Message_ProgressScope aRootScope (aProgress->Start(), "STEP export", isFileMode ? 2 : 1);
|
||||
if (!aLabel.IsNull())
|
||||
{
|
||||
di << "Translating label " << aLabelName << " of document " << aDocName << " to STEP\n";
|
||||
if (!aWriter.Transfer (aLabel, aMode,
|
||||
!aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
|
||||
aRootScope.Next()))
|
||||
{
|
||||
di << "Error: the label of document cannot be translated or gives no result";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Translating document " << aDocName << " to STEP\n";
|
||||
if (!aWriter.Transfer (aDoc, aMode,
|
||||
!aMultiFilePrefix.IsEmpty() ? aMultiFilePrefix.ToCString() : NULL,
|
||||
aRootScope.Next()))
|
||||
{
|
||||
di << "Error: The document cannot be translated or gives no result\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFileMode)
|
||||
{
|
||||
di << "Document has been translated into the session";
|
||||
di << "Use: " << argv[0] << " Doc filename [mode [multifile_prefix [label]]]: write document to the STEP file\n";
|
||||
di << "mode can be: a or 0 : AsIs (default)\n";
|
||||
di << " f or 1 : FacettedBRep s or 2 : ShellBasedSurfaceModel\n";
|
||||
di << " m or 3 : ManifoldSolidBrep w or 4 : GeometricCurveSet/WireFrame\n";
|
||||
di << "multifile_prefix: triggers writing assembly components as separate files,\n";
|
||||
di << " and defines common prefix for their names\n";
|
||||
di << "label: tag of the sub-assembly label to save only that sub-assembly\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Message_ProgressScope aWriteScope (aRootScope.Next(), "File writing", 1);
|
||||
aWriteScope.Show();
|
||||
di << "Writing STEP file " << aFilePath << "\n";
|
||||
|
||||
IFSelect_ReturnStatus aStat = IFSelect_RetVoid;
|
||||
if (toTestStream)
|
||||
Handle(TDocStd_Document) Doc;
|
||||
DDocStd::GetDocument(argv[1], Doc);
|
||||
if (Doc.IsNull())
|
||||
{
|
||||
std::ofstream aStream;
|
||||
OSD_OpenStream (aStream, aFilePath, std::ios::out | std::ios::binary);
|
||||
aStat = aWriter.WriteStream (aStream);
|
||||
aStream.close();
|
||||
if (!aStream.good()
|
||||
&& aStat == IFSelect_RetDone)
|
||||
di << argv[1] << " is not a document\n";
|
||||
return 1;
|
||||
}
|
||||
Standard_CString multifile = 0;
|
||||
|
||||
Standard_Integer k = 3;
|
||||
DeclareAndCast(STEPControl_Controller, ctl, XSDRAW::Controller());
|
||||
if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
|
||||
STEPCAFControl_Writer writer(XSDRAW::Session(), Standard_True);
|
||||
|
||||
STEPControl_StepModelType mode = STEPControl_AsIs;
|
||||
if (argc > k)
|
||||
{
|
||||
switch (argv[k][0])
|
||||
{
|
||||
aStat = IFSelect_RetFail;
|
||||
case 'a':
|
||||
case '0': mode = STEPControl_AsIs; break;
|
||||
case 'f':
|
||||
case '1': mode = STEPControl_FacetedBrep; break;
|
||||
case 's':
|
||||
case '2': mode = STEPControl_ShellBasedSurfaceModel; break;
|
||||
case 'm':
|
||||
case '3': mode = STEPControl_ManifoldSolidBrep; break;
|
||||
case 'w':
|
||||
case '4': mode = STEPControl_GeometricCurveSet; break;
|
||||
default: di << "3rd arg = mode, incorrect [give fsmw]\n"; return 1;
|
||||
}
|
||||
Standard_Boolean wrmode = Standard_True;
|
||||
for (Standard_Integer i = 0; argv[k][i]; i++)
|
||||
switch (argv[3][i])
|
||||
{
|
||||
case '-': wrmode = Standard_False; break;
|
||||
case '+': wrmode = Standard_True; break;
|
||||
case 'c': writer.SetColorMode(wrmode); break;
|
||||
case 'n': writer.SetNameMode(wrmode); break;
|
||||
case 'l': writer.SetLayerMode(wrmode); break;
|
||||
case 'v': writer.SetPropsMode(wrmode); break;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
TDF_Label label;
|
||||
if (argc > k)
|
||||
{
|
||||
TCollection_AsciiString aStr(argv[k]);
|
||||
if (aStr.Search(":") == -1)
|
||||
multifile = argv[k++];
|
||||
|
||||
}
|
||||
if (argc > k)
|
||||
{
|
||||
|
||||
if (!DDF::FindLabel(Doc->Main().Data(), argv[k], label) || label.IsNull())
|
||||
{
|
||||
di << "No label for entry" << "\n";
|
||||
return 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString fnom, rnom;
|
||||
const Standard_Boolean modfic = XSDRAW::FileAndVar(argv[2], argv[1], "STEP", fnom, rnom);
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di);
|
||||
Message_ProgressScope aRootScope(aProgress->Start(), "STEP export", modfic ? 2 : 1);
|
||||
if (!label.IsNull())
|
||||
{
|
||||
di << "Translating label " << argv[k] << " of document " << argv[1] << " to STEP\n";
|
||||
if (!writer.Transfer(label, mode, multifile, aRootScope.Next()))
|
||||
{
|
||||
di << "The label of document cannot be translated or gives no result\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aStat = aWriter.Write (aFilePath.ToCString());
|
||||
di << "Translating document " << argv[1] << " to STEP\n";
|
||||
if (!writer.Transfer(Doc, mode, multifile, aRootScope.Next()))
|
||||
{
|
||||
di << "The document cannot be translated or gives no result\n";
|
||||
}
|
||||
}
|
||||
|
||||
switch (aStat)
|
||||
if (modfic)
|
||||
{
|
||||
case IFSelect_RetVoid:
|
||||
Message_ProgressScope aWriteScope(aRootScope.Next(), "File writing", 1);
|
||||
aWriteScope.Show();
|
||||
di << "Writing STEP file " << argv[2] << "\n";
|
||||
IFSelect_ReturnStatus stat = writer.Write(argv[2]);
|
||||
switch (stat)
|
||||
{
|
||||
di << "Error: no file written";
|
||||
break;
|
||||
}
|
||||
case IFSelect_RetDone:
|
||||
{
|
||||
di << "File " << aFilePath << " written\n";
|
||||
case IFSelect_RetVoid: di << "No file written\n"; break;
|
||||
case IFSelect_RetDone:
|
||||
{
|
||||
di << "File " << argv[2] << " written\n";
|
||||
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> aDicFile = aWriter.ExternFiles();
|
||||
FillDicWS (aDicFile);
|
||||
AddWS (aFilePath, XSDRAW::Session());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
di << "Error on writing file";
|
||||
break;
|
||||
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> DicFile = writer.ExternFiles();
|
||||
FillDicWS(DicFile);
|
||||
AddWS(argv[2], XSDRAW::Session());
|
||||
break;
|
||||
}
|
||||
default: di << "Error on writing file\n"; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Document has been translated into the session";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -817,142 +721,6 @@ static Standard_Integer Extract(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadVrml
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer ReadVrml(Draw_Interpretor& theDI,
|
||||
Standard_Integer theArgc,
|
||||
const char** theArgv)
|
||||
{
|
||||
if(theArgc < 3)
|
||||
{
|
||||
theDI.PrintHelp(theArgv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
Standard_Real aFileUnitFactor = 1.0;
|
||||
RWMesh_CoordinateSystem aFileCoordSys = RWMesh_CoordinateSystem_Yup, aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
|
||||
Standard_Boolean toUseExistingDoc = Standard_False;
|
||||
Standard_Boolean toFillIncomplete = Standard_True;
|
||||
Standard_CString aDocName = NULL;
|
||||
TCollection_AsciiString aFilePath;
|
||||
|
||||
for(Standard_Integer anArgIt = 1; anArgIt < theArgc; anArgIt++)
|
||||
{
|
||||
TCollection_AsciiString anArg(theArgv[anArgIt]);
|
||||
anArg.LowerCase();
|
||||
if(anArgIt + 1 < theArgc && anArg == "-fileunit")
|
||||
{
|
||||
const TCollection_AsciiString aUnitStr(theArgv[++anArgIt]);
|
||||
aFileUnitFactor = UnitsAPI::AnyToSI(1.0, aUnitStr.ToCString());
|
||||
if (aFileUnitFactor <= 0.0)
|
||||
{
|
||||
Message::SendFail() << "Error: wrong length unit '" << aUnitStr << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (anArgIt + 1 < theArgc && anArg == "-filecoordsys")
|
||||
{
|
||||
if (!parseCoordinateSystem(theArgv[++anArgIt], aFileCoordSys))
|
||||
{
|
||||
Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (anArgIt + 1 < theArgc && anArg == "-systemcoordsys")
|
||||
{
|
||||
if (!parseCoordinateSystem(theArgv[++anArgIt], aSystemCoordSys))
|
||||
{
|
||||
Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (anArg == "-fillincomplete")
|
||||
{
|
||||
toFillIncomplete = true;
|
||||
if (anArgIt + 1 < theArgc && Draw::ParseOnOff(theArgv[anArgIt + 1], toFillIncomplete))
|
||||
{
|
||||
++anArgIt;
|
||||
}
|
||||
}
|
||||
else if (anArg == "-nocreatedoc")
|
||||
{
|
||||
toUseExistingDoc = true;
|
||||
}
|
||||
else if (aDocName == nullptr)
|
||||
{
|
||||
aDocName = theArgv[anArgIt];
|
||||
DDocStd::GetDocument(aDocName, aDoc, Standard_False);
|
||||
}
|
||||
else if(aFilePath.IsEmpty())
|
||||
{
|
||||
aFilePath = theArgv[anArgIt];
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendFail() << "Syntax error at '" << theArgv[anArgIt] << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (aFilePath.IsEmpty() || aDocName == nullptr)
|
||||
{
|
||||
Message::SendFail() << "Syntax error: wrong number of arguments";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (aDoc.IsNull())
|
||||
{
|
||||
if(toUseExistingDoc)
|
||||
{
|
||||
Message::SendFail() << "Error: document with name " << aDocName << " does not exist";
|
||||
return 1;
|
||||
}
|
||||
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
||||
anApp->NewDocument("BinXCAF", aDoc);
|
||||
}
|
||||
else if (!toUseExistingDoc)
|
||||
{
|
||||
Message::SendFail() << "Error: document with name " << aDocName << " already exists\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Real aScaleFactor = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactor))
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
aScaleFactor = UnitsMethods::GetCasCadeLengthUnit();
|
||||
}
|
||||
|
||||
VrmlAPI_CafReader aVrmlReader;
|
||||
aVrmlReader.SetDocument(aDoc);
|
||||
aVrmlReader.SetFileLengthUnit(aFileUnitFactor);
|
||||
aVrmlReader.SetSystemLengthUnit(aScaleFactor);
|
||||
aVrmlReader.SetFileCoordinateSystem(aFileCoordSys);
|
||||
aVrmlReader.SetSystemCoordinateSystem(aSystemCoordSys);
|
||||
aVrmlReader.SetFillIncompleteDocument(toFillIncomplete);
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
|
||||
if (!aVrmlReader.Perform(aFilePath, aProgress->Start()))
|
||||
{
|
||||
if (aVrmlReader.ExtraStatus() != RWMesh_CafReaderStatusEx_Partial)
|
||||
{
|
||||
Message::SendFail() << "Error: file reading failed '" << aFilePath << "'";
|
||||
return 1;
|
||||
}
|
||||
Message::SendWarning() <<
|
||||
"Warning: file has been read paratially (due to unexpected EOF, syntax error, memory limit) " << aFilePath;
|
||||
}
|
||||
|
||||
TDataStd_Name::Set(aDoc->GetData()->Root(), aDocName);
|
||||
Handle(DDocStd_DrawDocument) aDD = new DDocStd_DrawDocument(aDoc);
|
||||
Draw::Set(aDocName, aDD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteVrml
|
||||
//purpose : Write DECAF document to Vrml
|
||||
@@ -1342,21 +1110,10 @@ void XDEDRAW_Common::InitCommands(Draw_Interpretor& di)
|
||||
di.Add("ReadIges", "Doc filename: Read IGES file to DECAF document", __FILE__, ReadIges, g);
|
||||
di.Add("WriteIges", "Doc filename: Write DECAF document to IGES file", __FILE__, WriteIges, g);
|
||||
di.Add("ReadStep",
|
||||
"Doc filename [mode] [-stream]"
|
||||
"\n\t\t: Read STEP file to a document."
|
||||
"\n\t\t: -stream read using istream reading interface (testing)",
|
||||
"Doc filename [mode]"
|
||||
"\n\t\t: Read STEP file to a document.",
|
||||
__FILE__, ReadStep, g);
|
||||
di.Add("WriteStep" ,
|
||||
"Doc filename [mode=a [multifile_prefix] [label]] [-stream]"
|
||||
"\n\t\t: Write DECAF document to STEP file"
|
||||
"\n\t\t: mode can be: a or 0 : AsIs (default)"
|
||||
"\n\t\t: f or 1 : FacettedBRep s or 2 : ShellBasedSurfaceModel"
|
||||
"\n\t\t: m or 3 : ManifoldSolidBrep w or 4 : GeometricCurveSet/WireFrame"
|
||||
"\n\t\t: multifile_prefix: triggers writing assembly components as separate files,"
|
||||
"\n\t\t: and defines common prefix for their names"
|
||||
"\n\t\t: label tag of the sub-assembly label to save only that sub-assembly"
|
||||
"\n\t\t: -stream read using ostream writing interface (testing)",
|
||||
__FILE__, WriteStep, g);
|
||||
di.Add("WriteStep", "Doc filename [mode=a [multifile_prefix] [label]]: Write DECAF document to STEP file", __FILE__, WriteStep, g);
|
||||
|
||||
di.Add("XFileList", "Print list of files that was transferred by the last transfer", __FILE__, GetDicWSList, g);
|
||||
di.Add("XFileCur", ": returns name of file which is set as current", __FILE__, GetCurWS, g);
|
||||
@@ -1369,20 +1126,7 @@ void XDEDRAW_Common::InitCommands(Draw_Interpretor& di)
|
||||
"Extracts given srcLabel1 srcLabel2 ... from srcDoc into given Doc or assembly shape",
|
||||
__FILE__, Extract, g);
|
||||
|
||||
di.Add("ReadVrml",
|
||||
"ReadVrml docName filePath [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
|
||||
"\n\t\t: [-systemCoordSys {Zup|Yup}] [-noCreateDoc] [-fillIncomplete {ON|OFF}]"
|
||||
"\n\t\t: Read Vrml file into XDE document."
|
||||
"\n\t\t: -fileCoordSys coordinate system defined by Vrml file; Yup when not specified."
|
||||
"\n\t\t: -fileUnit length unit of Vrml file content."
|
||||
"\n\t\t: -systemCoordSys result coordinate system; Zup when not specified."
|
||||
"\n\t\t: -noCreateDoc read into existing XDE document."
|
||||
"\n\t\t: -fillIncomplete fill the document with partially retrieved data even if reader has failed with "
|
||||
"error; true when not specified",
|
||||
__FILE__, ReadVrml, g);
|
||||
di.Add("WriteVrml",
|
||||
"WriteVrml Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]",
|
||||
__FILE__, WriteVrml, g);
|
||||
di.Add("WriteVrml", "Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]", __FILE__, WriteVrml, g);
|
||||
|
||||
di.Add("DumpConfiguration",
|
||||
"DumpConfiguration [-path <path>] [-recursive {on|off}] [-format fmt1 fmt2 ...] [-vendor vend1 vend2 ...]\n"
|
||||
|
@@ -18,8 +18,6 @@
|
||||
#include <DBRep.hxx>
|
||||
#include <DDocStd.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
@@ -1115,127 +1113,6 @@ static Standard_Integer XAutoNaming (Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : parseXYZ
|
||||
// purpose : Converts three string arguments, to gp_XYZ with check
|
||||
//=======================================================================
|
||||
static Standard_Boolean parseXYZ (const char** theArgVec, gp_XYZ& thePnt)
|
||||
{
|
||||
const TCollection_AsciiString aXYZ[3] = {theArgVec[0], theArgVec[1], theArgVec[2] };
|
||||
if (!aXYZ[0].IsRealValue (Standard_True)
|
||||
|| !aXYZ[1].IsRealValue (Standard_True)
|
||||
|| !aXYZ[2].IsRealValue (Standard_True))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
thePnt.SetCoord (aXYZ[0].RealValue(), aXYZ[1].RealValue(), aXYZ[2].RealValue());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : setLocation
|
||||
// purpose : Sets location to the shape at the label in XDE document
|
||||
//=======================================================================
|
||||
static Standard_Integer setLocation (Draw_Interpretor& , Standard_Integer theArgNb, const char** theArgVec)
|
||||
{
|
||||
if (theArgNb < 4)
|
||||
{
|
||||
Message::SendFail() << "Error: not enough arguments, see help " << theArgVec[0] << " for details";
|
||||
return 1;
|
||||
}
|
||||
// get and check the document
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
DDocStd::GetDocument (theArgVec[1], aDoc);
|
||||
if (aDoc.IsNull ())
|
||||
{
|
||||
Message::SendFail() << "Error: " << theArgVec[1] << " is not a document";
|
||||
return 1;
|
||||
}
|
||||
// get and check the label
|
||||
TDF_Label aShapeLabel;
|
||||
TDF_Tool::Label (aDoc->GetData(), theArgVec[2], aShapeLabel);
|
||||
if (aShapeLabel.IsNull ())
|
||||
{
|
||||
Message::SendFail() << "Error: no such Label: " << theArgVec[2];
|
||||
return 1;
|
||||
}
|
||||
// get the transformation
|
||||
gp_Trsf aTransformation;
|
||||
for (Standard_Integer anArgIter = 3; anArgIter < theArgNb; ++anArgIter)
|
||||
{
|
||||
gp_Trsf aCurTransformation;
|
||||
gp_XYZ aMoveXYZ, aRotPnt, aRotAxis, aScalePnt;
|
||||
Standard_Real aRotAngle, aScale;
|
||||
TCollection_AsciiString anArg = theArgVec[anArgIter];
|
||||
anArg.LowerCase();
|
||||
|
||||
if (anArg == "-rotate" &&
|
||||
anArgIter + 7 < theArgNb &&
|
||||
parseXYZ (theArgVec + anArgIter + 1, aRotPnt) &&
|
||||
parseXYZ (theArgVec + anArgIter + 4, aRotAxis) &&
|
||||
Draw::ParseReal (theArgVec[anArgIter + 7], aRotAngle))
|
||||
{
|
||||
anArgIter += 7;
|
||||
aCurTransformation.SetRotation (gp_Ax1 (gp_Pnt (aRotPnt), gp_Dir (aRotAxis)), aRotAngle * (M_PI / 180.0));
|
||||
}
|
||||
else if (anArg == "-move" &&
|
||||
anArgIter + 3 < theArgNb &&
|
||||
parseXYZ (theArgVec + anArgIter + 1, aMoveXYZ))
|
||||
{
|
||||
anArgIter += 3;
|
||||
aCurTransformation.SetTranslation (aMoveXYZ);
|
||||
}
|
||||
// first check scale with base point
|
||||
else if (anArg == "-scale" &&
|
||||
anArgIter + 4 < theArgNb &&
|
||||
parseXYZ (theArgVec + anArgIter + 1, aScalePnt) &&
|
||||
Draw::ParseReal (theArgVec[anArgIter + 4], aScale))
|
||||
{
|
||||
anArgIter += 4;
|
||||
aCurTransformation.SetScale (gp_Pnt (aScalePnt), aScale);
|
||||
}
|
||||
// second check for scale with scale factor only
|
||||
else if (anArg == "-scale" &&
|
||||
anArgIter + 1 < theArgNb &&
|
||||
Draw::ParseReal (theArgVec[anArgIter + 1], aScale))
|
||||
{
|
||||
anArgIter += 1;
|
||||
aCurTransformation.SetScaleFactor (aScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendFail() << "Syntax error: unknown options '" << anArg << "', or incorrect option parameters";
|
||||
return 1;
|
||||
}
|
||||
aTransformation.PreMultiply (aCurTransformation);
|
||||
}
|
||||
TopLoc_Location aLoc(aTransformation);
|
||||
|
||||
// Create the ShapeTool and try to set location
|
||||
Handle(XCAFDoc_ShapeTool) anAssembly = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
|
||||
TDF_Label aRefLabel;
|
||||
if (anAssembly->SetLocation (aShapeLabel, aLoc, aRefLabel))
|
||||
{
|
||||
if (aShapeLabel == aRefLabel)
|
||||
{
|
||||
Message::SendInfo() << "New location was set";
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_AsciiString aLabelStr;
|
||||
TDF_Tool::Entry(aRefLabel, aLabelStr);
|
||||
Message::SendInfo() << "Reference to the shape at label " << aLabelStr << " was created and location was set";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendFail() << "Error: an attempt to set the location to a shape to which there is a reference, or to not a shape at all";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitCommands
|
||||
//purpose :
|
||||
@@ -1346,20 +1223,6 @@ void XDEDRAW_Shapes::InitCommands(Draw_Interpretor& di)
|
||||
di.Add ("XSetInstanceSHUO","Doc shape \t: sets the SHUO structure for indicated component",
|
||||
__FILE__, setStyledComponent, g);
|
||||
|
||||
di.Add ("XSetLocation", R"(
|
||||
Doc Label transformation [transformation ... ]
|
||||
Applies given complex transformation to the shape at Label from Document.
|
||||
The label may contain a reference to a shape, an assembly or simple shape.
|
||||
The assembly or simple shape should not be referred by any reference.
|
||||
Transformations:
|
||||
'-move x y z' - move shape
|
||||
'-rotate x y z dx dy dz angle' - rotate shape
|
||||
'-scale [x y z] factor' - scale shape
|
||||
Transformations are applied from left to right.
|
||||
There can be more than one transformation of the same type.
|
||||
At least one transformation must be specified.
|
||||
)", __FILE__, setLocation, g);
|
||||
|
||||
di.Add ("XUpdateAssemblies","Doc \t: updates assembly compounds",
|
||||
__FILE__, updateAssemblies, g);
|
||||
|
||||
|
@@ -100,17 +100,9 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
|
||||
if ( context.IsNull() )
|
||||
{
|
||||
Standard_CString rscfile = Interface_Static::CVal(prscfile);
|
||||
if (rscfile != nullptr && strlen (rscfile) == 0)
|
||||
{
|
||||
context = new ShapeProcess_ShapeContext(shape, nullptr);
|
||||
Interface_Static::FillMap(context->ResourceManager()->GetMap());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!rscfile)
|
||||
rscfile = prscfile;
|
||||
context = new ShapeProcess_ShapeContext(shape, rscfile);
|
||||
}
|
||||
if (!rscfile)
|
||||
rscfile = prscfile;
|
||||
context = new ShapeProcess_ShapeContext(shape, rscfile);
|
||||
context->SetDetalisation(TopAbs_EDGE);
|
||||
}
|
||||
context->SetNonManifold(NonManifold);
|
||||
|
@@ -22,8 +22,6 @@
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <STEPControl_ActorWrite.hxx>
|
||||
#include <STEPControl_Controller.hxx>
|
||||
#include <STEPControl_Reader.hxx>
|
||||
@@ -284,11 +282,8 @@ static Standard_Integer testreadstep (Draw_Interpretor& di, Standard_Integer arg
|
||||
IFSelect_ReturnStatus readstat;
|
||||
if (useStream)
|
||||
{
|
||||
std::ifstream aStream;
|
||||
OSD_OpenStream (aStream, filename, std::ios::in | std::ios::binary);
|
||||
TCollection_AsciiString aFolder, aFileNameShort;
|
||||
OSD_Path::FolderAndFileFromPath (filename, aFolder, aFileNameShort);
|
||||
readstat = Reader.ReadStream (aFileNameShort.ToCString(), aStream);
|
||||
std::ifstream aStream (filename);
|
||||
readstat = Reader.ReadStream(filename, aStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -440,72 +435,22 @@ static Standard_Integer stepwrite (Draw_Interpretor& di, Standard_Integer argc,
|
||||
//=======================================================================
|
||||
static Standard_Integer testwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
TCollection_AsciiString aFilePath;
|
||||
TopoDS_Shape aShape;
|
||||
bool toTestStream = false;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < argc; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString anArgCase (argv[anArgIter]);
|
||||
anArgCase.LowerCase();
|
||||
if (anArgCase == "-stream")
|
||||
if (argc != 3)
|
||||
{
|
||||
toTestStream = true;
|
||||
}
|
||||
else if (aFilePath.IsEmpty())
|
||||
{
|
||||
aFilePath = argv[anArgIter];
|
||||
}
|
||||
else if (aShape.IsNull())
|
||||
{
|
||||
aShape = DBRep::Get (argv[anArgIter]);
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
di << "Syntax error: '" << argv[anArgIter] << "' is not a shape";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Syntax error: unknown argument '" << argv[anArgIter] << "'";
|
||||
di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";
|
||||
di << " Usage : " << argv[0] <<" file_name shape_name \n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
di << "Syntax error: wrong number of arguments";
|
||||
STEPControl_Writer Writer;
|
||||
Standard_CString filename = argv[1];
|
||||
TopoDS_Shape shape = DBRep::Get(argv[2]);
|
||||
IFSelect_ReturnStatus stat = Writer.Transfer(shape,STEPControl_AsIs);
|
||||
stat = Writer.Write(filename);
|
||||
if(stat != IFSelect_RetDone){
|
||||
di<<"Error on writing file\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
STEPControl_Writer aWriter;
|
||||
IFSelect_ReturnStatus aStat = aWriter.Transfer (aShape, STEPControl_AsIs);
|
||||
if (aStat != IFSelect_RetDone)
|
||||
{
|
||||
di << "Error on transferring shape";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (toTestStream)
|
||||
{
|
||||
std::ofstream aStream;
|
||||
OSD_OpenStream (aStream, aFilePath, std::ios::out | std::ios::binary);
|
||||
aStat = aWriter.WriteStream (aStream);
|
||||
aStream.close();
|
||||
if (!aStream.good()
|
||||
&& aStat == IFSelect_RetDone)
|
||||
{
|
||||
aStat = IFSelect_RetFail;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aStat = aWriter.Write (aFilePath.ToCString());
|
||||
}
|
||||
if (aStat != IFSelect_RetDone)
|
||||
{
|
||||
di << "Error on writing file";
|
||||
return 1;
|
||||
}
|
||||
di << "File Is Written";
|
||||
di<<"File Is Written\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -605,8 +550,7 @@ void XSDRAWSTEP::InitCommands (Draw_Interpretor& theCommands)
|
||||
XSDRAWSTEP::Init();
|
||||
XSDRAW::LoadDraw(theCommands);
|
||||
theCommands.Add("stepwrite" , "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, g);
|
||||
theCommands.Add("testwritestep", "testwritestep filename.stp shape [-stream]",
|
||||
__FILE__, testwrite, g);
|
||||
theCommands.Add("testwritestep", "testwritestep filename.stp shape", __FILE__, testwrite, g);
|
||||
theCommands.Add("stepread", "stepread [file] [f or r (type of model full or reduced)]",__FILE__, stepread, g);
|
||||
theCommands.Add("testreadstep", "testreadstep file shape [-stream]",__FILE__, testreadstep, g);
|
||||
theCommands.Add("steptrans", "steptrans shape stepax1 stepax2", __FILE__, steptrans, g);
|
||||
|
0
src/XSTEPResource/FILES
Normal file → Executable file
0
src/XSTEPResource/FILES
Normal file → Executable file
0
src/XSTEPResource/IGES
Normal file → Executable file
0
src/XSTEPResource/IGES
Normal file → Executable file
0
src/XSTEPResource/STEP
Normal file → Executable file
0
src/XSTEPResource/STEP
Normal file → Executable file
@@ -59,47 +59,3 @@ proc checktime {value expected tol_rel message} {
|
||||
puts "Improvement. ${message}, ${value} seconds, is less than expected time - ${expected} seconds"
|
||||
}
|
||||
}
|
||||
|
||||
# Reads resource file, returns options from file as key-value dict
|
||||
proc parse_resource_file {theFileName} {
|
||||
# Creating empty dictionary
|
||||
set aDict [dict create];
|
||||
# Check for resource file
|
||||
if { [info exists theFileName] == 0 } {
|
||||
puts "Error: resource file \"${theFileName}\" isn't found"
|
||||
return $aDict
|
||||
}
|
||||
# Open a resource file
|
||||
set aFD [open "${theFileName}" "rb"]
|
||||
set aLineNo 0
|
||||
# Read line by line
|
||||
while {[gets $aFD aLine] !=-1 } {
|
||||
incr aLineNo
|
||||
# Clear the line from comment
|
||||
if {[regexp {(^[^!]+)} $aLine match aClearLine]} {
|
||||
# remove spaces
|
||||
set aClearLine [string trim $aClearLine]
|
||||
if {[string length $aClearLine] != 0} {
|
||||
if {[regexp {(\S+)\s*:\s*(\S*)} $aClearLine match aKey aValue]} {
|
||||
dict set aDict $aKey $aValue
|
||||
} else {
|
||||
puts "Error: syntax error in resource file at line: ${aLineNo}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close $aFD
|
||||
return $aDict
|
||||
}
|
||||
|
||||
# Creates new resource file with options as key-value dict
|
||||
proc create_resource_file {theFileName theOptions} {
|
||||
# Open a resource file
|
||||
set aFD [open "${theFileName}" "wb"]
|
||||
set aLineNo 0
|
||||
# Write line by line
|
||||
dict for {aKey aValue} $theOptions {
|
||||
puts $aFD "${aKey} : ${aValue}"
|
||||
}
|
||||
close $aFD
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user