Files
create/src/Mod/Assembly/CMakeLists.txt
forbes 4f658b13f9
Some checks failed
Build and Test / build (pull_request) Has been cancelled
fix(assembly): classify datum planes from all class hierarchies in Distance joints
The datum plane detection in getDistanceType() only checked for
App::Plane (origin planes). This missed two other class hierarchies:

  - PartDesign::Plane (inherits Part::Datum, NOT App::Plane)
  - Part::Plane primitive referenced bare (no Face element)

Both produce empty element types (sub-name ends with ".") but failed
the isDerivedFrom<App::Plane>() check, falling through to
DistanceType::Other and the Planar fallback. This caused incorrect
constraint geometry, leading to conflicting/unsatisfiable constraints
and solver failures.

Add shape-based isDatumPlane/Line/Point helpers that cover all three
hierarchies by inspecting the actual OCCT geometry rather than relying
on class identity alone. Extend getDistanceType() to use these helpers
for all datum-vs-datum and datum-vs-element combinations.

Adds TestDatumClassification.py with tests for PartDesign::Plane,
Part::Plane (bare ref), and cross-hierarchy datum combinations.
2026-02-22 21:06:39 -06:00

103 lines
2.1 KiB
CMake

# SPDX-License-Identifier: LGPL-2.1-or-later
if (NOT FREECAD_USE_EXTERNAL_ONDSELSOLVER)
include_directories(
${CMAKE_SOURCE_DIR}/src/3rdParty/OndselSolver
)
else ()
check_include_file_cxx(OndselSolver/enum.h HAVE_ONDSELSOLVER_H)
if (NOT HAVE_ONDSELSOLVER_H)
message(FATAL_ERROR "FREECAD_USE_EXTERNAL_ONDSELSOLVER is set but the required system includes are not available")
endif ()
endif ()
add_subdirectory(Solver)
add_subdirectory(App)
if(BUILD_GUI)
add_subdirectory(Gui)
endif(BUILD_GUI)
set(Assembly_Scripts
Init.py
CommandCreateAssembly.py
CommandCreateBom.py
CommandInsertLink.py
CommandInsertNewPart.py
CommandSolveAssembly.py
CommandCreateJoint.py
CommandCreateView.py
CommandCreateSimulation.py
CommandExportASMT.py
TestAssemblyWorkbench.py
JointObject.py
Preferences.py
AssemblyImport.py
SoSwitchMarker.py
UtilsAssembly.py
)
if(BUILD_GUI)
list (APPEND Assembly_Scripts InitGui.py)
endif(BUILD_GUI)
INSTALL(
FILES
${Assembly_Scripts}
DESTINATION
Mod/Assembly
)
SET(AssemblyScripts_SRCS
Assembly/__init__.py
)
SET(AssemblyTests_SRCS
AssemblyTests/__init__.py
AssemblyTests/TestCore.py
AssemblyTests/TestCommandInsertLink.py
AssemblyTests/TestSolverIntegration.py
AssemblyTests/TestKindredSolverIntegration.py
AssemblyTests/TestKCSolvePy.py
AssemblyTests/TestAssemblyOriginPlanes.py
AssemblyTests/TestDatumClassification.py
AssemblyTests/mocks/__init__.py
AssemblyTests/mocks/MockGui.py
)
SET(all_files
${AssemblyTests_SRCS}
${AssemblyScripts_SRCS}
)
ADD_CUSTOM_TARGET(AssemblyScripts ALL
SOURCES ${all_files}
)
SET(test_files
${Assembly_Scripts}
${AssemblyTests_SRCS}
)
ADD_CUSTOM_TARGET(AssemblyTests ALL
SOURCES ${test_files}
)
fc_copy_sources(AssemblyScripts "${CMAKE_BINARY_DIR}/Mod/Assembly" ${all_files})
fc_copy_sources(AssemblyTests "${CMAKE_BINARY_DIR}/Mod/Assembly" ${test_files})
INSTALL(
FILES
${AssemblyTests_SRCS}
DESTINATION
Mod/Assembly/AssemblyTests
)
INSTALL(
FILES
${AssemblyScripts_SRCS}
DESTINATION
Mod/Assembly/Assembly
)