Skip to content

Commit

Permalink
Updated to Chrono af41f83
Browse files Browse the repository at this point in the history
  • Loading branch information
dariomangoni committed May 6, 2024
1 parent 1f3db4b commit 948aa57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
17 changes: 12 additions & 5 deletions to_put_in_app_dir/ChronoSolidworksImportTemplate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.18)
cmake_policy(SET CMP0091 NEW)


project(ChronoSolidworksImport)
Expand Down Expand Up @@ -61,6 +62,8 @@ endif()

# ------------ CPP ---------------
if (EXISTS ${SOLIDWORKS_EXPORTED_FILE_CPP})
message(STATUS "Run exported C++ model from C++.")

get_filename_component(SLW_EXPORT_DIR ${SOLIDWORKS_EXPORTED_FILE_CPP} DIRECTORY)
get_filename_component(SLW_EXPORT_FILENAME_NOEXT ${SOLIDWORKS_EXPORTED_FILE_CPP} NAME_WLE)

Expand All @@ -81,13 +84,15 @@ if (EXISTS ${SOLIDWORKS_EXPORTED_FILE_CPP})
set(SLW_EXPORT_FILENAME_NOEXT_CPP ${SLW_EXPORT_FILENAME_NOEXT})

else()
message(WARNING "File not found. Skipping CPP import for file: \"${SOLIDWORKS_EXPORTED_FILE_CPP}\".")
message(WARNING "C++ export file not found. Skipping CPP import for file: \"${SOLIDWORKS_EXPORTED_FILE_CPP}\".")

endif()

# ------------ JSON ---------------

if (EXISTS ${SOLIDWORKS_EXPORTED_FILE_JSON})
message(STATUS "Run exported JSON model from C++.")

get_filename_component(SLW_EXPORT_DIR ${SOLIDWORKS_EXPORTED_FILE_JSON} DIRECTORY)
get_filename_component(SLW_EXPORT_FILENAME_NOEXT ${SOLIDWORKS_EXPORTED_FILE_JSON} NAME_WLE)

Expand All @@ -107,13 +112,13 @@ if (EXISTS ${SOLIDWORKS_EXPORTED_FILE_JSON})
set(SLW_EXPORT_FILENAME_NOEXT_JSON ${SLW_EXPORT_FILENAME_NOEXT})

else()
message(WARNING "File not found. Skipping JSON import for file: \"${SOLIDWORKS_EXPORTED_FILE_JSON}\".")
message(WARNING "JSON export file not found. Skipping JSON import for file: \"${SOLIDWORKS_EXPORTED_FILE_JSON}\".")
endif()

# ------------ PYTHON ---------------

if (EXISTS ${SOLIDWORKS_EXPORTED_FILE_PY})
message(STATUS "Run .")
message(STATUS "Run exported Python model from C++.")

get_filename_component(SLW_EXPORT_DIR ${SOLIDWORKS_EXPORTED_FILE_PY} DIRECTORY)
get_filename_component(SLW_EXPORT_FILENAME_NOEXT ${SOLIDWORKS_EXPORTED_FILE_PY} NAME_WLE)
Expand Down Expand Up @@ -151,8 +156,10 @@ if (EXISTS ${SOLIDWORKS_EXPORTED_FILE_PY})

endif()



else()
message(WARNING "File not found. Skipping PyChrono and Python Parsing for file: \"${SOLIDWORKS_EXPORTED_FILE_PY}\".")
message(WARNING "Python export file not found. Skipping PyChrono and Python Parsing for file: \"${SOLIDWORKS_EXPORTED_FILE_PY}\".")

endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) {
my_python.ImportSolidWorksSystem(SOLIDWORKS_EXPORTED_PY,
sys); // note, don't type the .py suffix in filename..

} catch (const ChException& myerror) {
} catch (std::exception myerror) {
std::cout << myerror.what();
}

Expand All @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) {
//

sys.SetSolverType(ChSolver::Type::BARZILAIBORWEIN);
sys.SetSolverMaxIterations(400);
sys.GetSolver()->AsIterative()->SetMaxIterations(400);

// Create the Irrlicht visualization system
auto vis = chrono_types::make_shared<ChVisualSystemIrrlicht>();
Expand All @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
vis->AddLogo();
vis->AddSkyBox();
vis->AddTypicalLights();
vis->AddCamera(ChVector<>(1, 1, 6), ChVector<>(0, 0, 0));
vis->AddCamera(ChVector3d(1, 1, 6), ChVector3d(0, 0, 0));
vis->AttachSystem(&sys);

vis->EnableCollisionShapeDrawing(true);
Expand Down

0 comments on commit 948aa57

Please sign in to comment.