Skip to content

Commit

Permalink
Allow debug configuration; removed precompiled headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dariomangoni committed Feb 28, 2024
1 parent b281247 commit 3b20b88
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 69 deletions.
4 changes: 2 additions & 2 deletions ChronoSolidworks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Global
{E615EBB3-8A0B-4A1D-A8DA-585BAFA8A8C8}.Release|x64.Build.0 = Release|x64
{E615EBB3-8A0B-4A1D-A8DA-585BAFA8A8C8}.Release|x86.ActiveCfg = Release|Any CPU
{E615EBB3-8A0B-4A1D-A8DA-585BAFA8A8C8}.Release|x86.Build.0 = Release|Any CPU
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|Any CPU.Build.0 = Debug|Win32
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|Any CPU.ActiveCfg = Debug|x64
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|Any CPU.Build.0 = Debug|x64
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|x64.ActiveCfg = Debug|x64
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|x64.Build.0 = Debug|x64
{C457BA60-8F07-4664-90E1-A4E2040AD640}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
4 changes: 2 additions & 2 deletions ChronoSolidworksAddIn/ChModelExporterCSharp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ public override void TraverseFeaturesForCollisionShapes(Component2 swComp, long
newbody.AddCollisionModel(new ChCollisionModel());

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swCompBase.FindAttribute(m_swIntegration.defattr_chbody, 0);
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swCompBase.FindAttribute(m_swIntegration.defattr_collisionParams, 0);

if (myattr != null)
{
Expand Down Expand Up @@ -885,7 +885,7 @@ public override void TraverseComponentForBodies(Component2 swComp, long nLevel,
}

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swComp.FindAttribute(m_swIntegration.defattr_chbody, 0);
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swComp.FindAttribute(m_swIntegration.defattr_collisionParams, 0);

MathTransform chbodytransform = swComp.GetTotalTransform(true);
double[] amatr;
Expand Down
7 changes: 3 additions & 4 deletions ChronoSolidworksAddIn/ChModelExporterCpp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,6 @@ public override void TraverseFeaturesForCollisionShapes(Component2 swComp, long
{
found_collisionshapes = true;

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swCompBase.FindAttribute(m_swIntegration.defattr_chbody, 0);

m_asciiTextCpp += "\n// Collision Model";
m_asciiTextCpp += String.Format(bz, "\n{0}->AddCollisionModel(chrono_types::make_shared<chrono::ChCollisionModel>());\n", bodyname);

Expand All @@ -663,6 +660,8 @@ public override void TraverseFeaturesForCollisionShapes(Component2 swComp, long
m_asciiTextCpp += "\n// Collision shape\n";
m_asciiTextCpp += String.Format(bz, "std::shared_ptr<chrono::ChCollisionShape> {0};\n", collshapename);

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swCompBase.FindAttribute(m_swIntegration.defattr_collisionParams, 0);

if (myattr != null)
{
Expand Down Expand Up @@ -899,7 +898,7 @@ public override void TraverseComponentForBodies(Component2 swComp, long nLevel,
}

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swComp.FindAttribute(m_swIntegration.defattr_chbody, 0);
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swComp.FindAttribute(m_swIntegration.defattr_collisionParams, 0);

MathTransform chbodytransform = swComp.GetTotalTransform(true);
double[] amatr;
Expand Down
4 changes: 2 additions & 2 deletions ChronoSolidworksAddIn/ChModelExporterPython.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public override void TraverseFeaturesForCollisionShapes(Component2 swComp, long
found_collisionshapes = true;

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swCompBase.FindAttribute(m_swIntegration.defattr_chbody, 0);
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swCompBase.FindAttribute(m_swIntegration.defattr_collisionParams, 0);

m_asciiText += "\n# Collision Model\n";
m_asciiText += String.Format(bz, "\n{0}.AddCollisionModel(chrono.ChCollisionModel())\n", bodyname);
Expand Down Expand Up @@ -780,7 +780,7 @@ public override void TraverseComponentForBodies(Component2 swComp, long nLevel,
}

// fetch SW attribute with Chrono parameters
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swComp.FindAttribute(m_swIntegration.defattr_chbody, 0);
SolidWorks.Interop.sldworks.Attribute myattr = (SolidWorks.Interop.sldworks.Attribute)swComp.FindAttribute(m_swIntegration.defattr_collisionParams, 0);

MathTransform chbodytransform = swComp.GetTotalTransform(true);
double[] amatr;
Expand Down
22 changes: 11 additions & 11 deletions ChronoSolidworksAddIn/ChronoEngine_SwAddin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class SWIntegration : ISwAddin
private TaskpaneView m_TaskpaneView;
private int mSWCookie;

public AttributeDef defattr_chbody = default(AttributeDef);
public AttributeDef defattr_collisionParams = default(AttributeDef);
//public AttributeDef defattr_chconveyor = default(AttributeDef);
public AttributeDef defattr_test = default(AttributeDef);
public AttributeDef defattr_chmotor = default(AttributeDef);
Expand All @@ -45,16 +45,16 @@ public bool ConnectToSW(object ThisSW, int Cookie)
bool result = m_swApplication.SetAddinCallbackInfo(0, this, Cookie);

// Register ChBody collision attributes
defattr_chbody = (AttributeDef)m_swApplication.DefineAttribute("chrono_ChBody");
defattr_chbody.AddParameter("friction", (int)swParamType_e.swParamTypeDouble, 0.6, 0);
defattr_chbody.AddParameter("rolling_friction", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_chbody.AddParameter("spinning_friction", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_chbody.AddParameter("restitution", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_chbody.AddParameter("collision_on", (int)swParamType_e.swParamTypeDouble, 1, 0);
defattr_chbody.AddParameter("collision_margin", (int)swParamType_e.swParamTypeDouble, 0.01, 0);
defattr_chbody.AddParameter("collision_envelope", (int)swParamType_e.swParamTypeDouble, 0.03, 0);
defattr_chbody.AddParameter("collision_family", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_chbody.Register();
defattr_collisionParams = (AttributeDef)m_swApplication.DefineAttribute("chrono_collisionParams");
defattr_collisionParams.AddParameter("friction", (int)swParamType_e.swParamTypeDouble, 0.6, 0);
defattr_collisionParams.AddParameter("rolling_friction", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_collisionParams.AddParameter("spinning_friction", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_collisionParams.AddParameter("restitution", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_collisionParams.AddParameter("collision_on", (int)swParamType_e.swParamTypeDouble, 1, 0);
defattr_collisionParams.AddParameter("collision_margin", (int)swParamType_e.swParamTypeDouble, 0.01, 0);
defattr_collisionParams.AddParameter("collision_envelope", (int)swParamType_e.swParamTypeDouble, 0.03, 0);
defattr_collisionParams.AddParameter("collision_family", (int)swParamType_e.swParamTypeDouble, 0, 0);
defattr_collisionParams.Register();

// Register ChMotor attributes
defattr_chmotor = (AttributeDef)m_swApplication.DefineAttribute("chrono_ChMotor");
Expand Down
4 changes: 2 additions & 2 deletions ChronoSolidworksAddIn/ChronoSolidworksAddIn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\chrono-solidworks_install\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<OutputPath>..\..\chrono-solidworks_install\</OutputPath>
<DefineConstants>TRACE;DEBUG;HAS_CHRONO_CSHARP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>true</RegisterForComInterop>
Expand Down
8 changes: 8 additions & 0 deletions ChronoSolidworksAddIn/ChronoSolidworksAddIn.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
<PropertyGroup>
<ReferencePath>C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\</ReferencePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\SLDWORKS.exe</StartProgram>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion ChronoSolidworksAddIn/SidePanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions ChronoSolidworksAddIn/SidePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
using System.Security.Cryptography;
//using static ChronoEngine_SwAddin.ConvertMates;


Expand Down Expand Up @@ -158,21 +160,22 @@ private double[] getGravityAcceleration()
}
}

private void button_setcollshape_Click(object sender, EventArgs e)

private void button_setPrimitiveCollShape_Click(object sender, EventArgs e)
{
ModelDoc2 swModel;
swModel = (ModelDoc2)this.mSWApplication.ActiveDoc;
if (swModel == null)
{
System.Windows.Forms.MessageBox.Show("Please open a part and select a solid body!");
System.Windows.Forms.MessageBox.Show("Please open a part and select a solid body.");
return;
}

SelectionMgr swSelMgr = (SelectionMgr)swModel.SelectionManager;

if (swSelMgr.GetSelectedObjectCount2(-1) == 0)
{
System.Windows.Forms.MessageBox.Show("Please select one or more solid bodies!");
System.Windows.Forms.MessageBox.Show("Please select one or more solid bodies.");
return;
}

Expand Down Expand Up @@ -201,13 +204,14 @@ private void button_setcollshape_Click(object sender, EventArgs e)
{
if ((swSelectType_e)swSelMgr.GetSelectedObjectType3(isel, -1) != swSelectType_e.swSelSOLIDBODIES)
{
System.Windows.Forms.MessageBox.Show("This function can be applied only to solid bodies! Select one or more bodies before using it.");
System.Windows.Forms.MessageBox.Show("This function can be applied only to solid bodies. Select one or more bodies before using it.");
return;
}

bool rbody_converted = false;
Body2 swBody = (Body2)swSelMgr.GetSelectedObject6(isel, -1);


// ----- Try to see if this is a sphere

if (ConvertToCollisionShapes.SWbodyToSphere(swBody))
Expand Down Expand Up @@ -349,6 +353,7 @@ private void button_convexdecomp_Click(object sender, EventArgs e)
//bool rbody_converted = false;
Body2 swBodyIn = (Body2)swSelMgr.GetSelectedObject6(isel, -1);


// ----- tesselate
Face2 swFace = null;
Tessellation swTessellation = null;
Expand Down Expand Up @@ -577,13 +582,13 @@ private void button_chrono_property_Click(object sender, EventArgs e)
EditCollisionParameters myCustomerDialog = new EditCollisionParameters();

// Update dialog properties properties from the selected part(s) (i.e. ChBody in C::E)
if (myCustomerDialog.UpdateFromSelection(swSelMgr, ref this.mSWintegration.defattr_chbody))
if (myCustomerDialog.UpdateFromSelection(swSelMgr, ref this.mSWintegration.defattr_collisionParams))
{
// Show the modal dialog
if (myCustomerDialog.ShowDialog() == DialogResult.OK)
{
// If user pressed OK, apply settings to all selected parts (i.e. ChBody in C::E):
myCustomerDialog.StoreToSelection(swSelMgr, ref this.mSWintegration.defattr_chbody);//ref this.mSWintegration.defattr_chconveyor);
myCustomerDialog.StoreToSelection(swSelMgr, ref this.mSWintegration.defattr_collisionParams);//ref this.mSWintegration.defattr_chconveyor);
}
}

Expand All @@ -609,6 +614,8 @@ private void button_settrimeshcoll_Click(object sender, EventArgs e)

SelectionMgr swSelMgr = (SelectionMgr)swModel.SelectionManager;



if (swSelMgr.GetSelectedObjectCount2(-1) == 0)
{
System.Windows.Forms.MessageBox.Show("Please select one or more solid bodies!");
Expand Down Expand Up @@ -674,11 +681,6 @@ private void butt_chronoMotors_Click(object sender, EventArgs e)
myCustomerDialog.Show();
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}



// ============================================================================================================
Expand Down
1 change: 0 additions & 1 deletion decomposition_hacd_CLI/AssemblyInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "stdafx.h"

using namespace System;
using namespace System::Reflection;
Expand Down
5 changes: 0 additions & 5 deletions decomposition_hacd_CLI/Stdafx.cpp

This file was deleted.

7 changes: 0 additions & 7 deletions decomposition_hacd_CLI/Stdafx.h

This file was deleted.

1 change: 0 additions & 1 deletion decomposition_hacd_CLI/hacd/src/hacdHACD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

//#define THREAD_DIST_POINTS 1

//#define HACD_DEBUG
namespace HACD
{

Expand Down
2 changes: 0 additions & 2 deletions decomposition_hacd_CLI/hacd_CLI.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// This is the main DLL file.

#include "stdafx.h"

#include "hacd_CLI.h"

17 changes: 7 additions & 10 deletions decomposition_hacd_CLI/hacd_CLI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\decomposition_hacd_CLI\hacd\inc;$(SolutionDir)\decomposition_hacd_CLI\vhacd\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;HACD_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
Expand Down Expand Up @@ -138,7 +138,7 @@
<AdditionalIncludeDirectories>$(SolutionDir)\decomposition_hacd_CLI\hacd\inc;$(SolutionDir)\decomposition_hacd_CLI\vhacd\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
Expand Down Expand Up @@ -185,12 +185,6 @@
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="hacd_CLI.cpp" />
<ClCompile Include="Stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="vhacd_CLI.cpp" />
<ClCompile Include="hacd\src\hacdGraph.cpp" />
<ClCompile Include="hacd\src\hacdHACD.cpp" />
Expand All @@ -210,10 +204,14 @@
<ClCompile Include="vhacd\src\kdtree.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
</ClCompile>
<ClCompile Include="vhacd\src\triangle.c">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
</ClCompile>
<ClCompile Include="vhacd\src\vhacdGraph.cpp" />
<ClCompile Include="vhacd\src\vhacdHACD.cpp" />
Expand All @@ -223,7 +221,6 @@
<ItemGroup>
<ClInclude Include="hacd_CLI.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Stdafx.h" />
<ClInclude Include="hacd\inc\hacdCircularList.h" />
<ClInclude Include="hacd\inc\hacdGraph.h" />
<ClInclude Include="hacd\inc\hacdHACD.h" />
Expand Down
6 changes: 0 additions & 6 deletions decomposition_hacd_CLI/hacd_CLI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
<ClCompile Include="hacd_CLI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="vhacd_CLI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -92,9 +89,6 @@
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="hacd\inc\hacdCircularList.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
2 changes: 0 additions & 2 deletions decomposition_hacd_CLI/vhacd_CLI.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// This is the main DLL file.

#include "stdafx.h"

#include "vhacd_CLI.h"

0 comments on commit 3b20b88

Please sign in to comment.