Skip to content

Commit

Permalink
Add R18 compatibility project
Browse files Browse the repository at this point in the history
  • Loading branch information
luanshixia committed May 16, 2019
1 parent c73ac1b commit 884e137
Show file tree
Hide file tree
Showing 21 changed files with 40,188 additions and 58 deletions.
13 changes: 12 additions & 1 deletion AutoCADCommands.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
# Visual Studio 15
VisualStudioVersion = 15.0.28307.572
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoCADCommands", "AutoCADCommands\AutoCADCommands.csproj", "{C5F6C326-952B-43E8-9830-311F190BAB11}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoCADCommands.R18", "AutoCADCommands\AutoCADCommands.R18.csproj", "{EDA1D1A6-3204-4B82-8D5F-4F59815F072E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -13,8 +17,15 @@ Global
{C5F6C326-952B-43E8-9830-311F190BAB11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5F6C326-952B-43E8-9830-311F190BAB11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5F6C326-952B-43E8-9830-311F190BAB11}.Release|Any CPU.Build.0 = Release|Any CPU
{EDA1D1A6-3204-4B82-8D5F-4F59815F072E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDA1D1A6-3204-4B82-8D5F-4F59815F072E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDA1D1A6-3204-4B82-8D5F-4F59815F072E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDA1D1A6-3204-4B82-8D5F-4F59815F072E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9516FD57-86E1-498D-BC03-D6EFC30A7DE6}
EndGlobalSection
EndGlobal
58 changes: 43 additions & 15 deletions AutoCADCommands/Algorithms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,18 @@ public static Curve GetSubCurve(this Curve curve, Interv interval) // todo: Remo
return curve.GetSubCurveByParams(new Interv(start, end));
}

/// <summary>
/// Gets subcurve from curve by distance interval.
/// </summary>
/// <param name="curve">The curve.</param>
/// <param name="interval">The subcurve interval in distance.</param>
/// <returns>The subcurve.</returns>
public static Curve GetSubCurve(this Curve curve, Tuple<double, double> interval)
{
return Algorithms.GetSubCurve(curve, new Interv(interval.Item1, interval.Item2));
}

#if R23
/// <summary>
/// Gets subcurve from curve by distance interval.
/// </summary>
Expand All @@ -313,6 +325,7 @@ public static Curve GetSubCurve(this Curve curve, (double, double) interval)
{
return Algorithms.GetSubCurve(curve, new Interv(interval));
}
#endif

/// <summary>
/// Gets subcurve from curve by parameter interval.
Expand Down Expand Up @@ -391,6 +404,18 @@ public static Curve GetSubCurveByParams(this Curve curve, Interv interval)
}
}

/// <summary>
/// Gets subcurve from curve by parameter interval.
/// </summary>
/// <param name="curve">The curve.</param>
/// <param name="interval">The subcurve interval in parameter.</param>
/// <returns>The subcurve.</returns>
public static Curve GetSubCurveByParams(this Curve curve, Tuple<double, double> interval)
{
return Algorithms.GetSubCurveByParams(curve, new Interv(interval.Item1, interval.Item2));
}

#if R23
/// <summary>
/// Gets subcurve from curve by parameter interval.
/// </summary>
Expand All @@ -401,6 +426,7 @@ public static Curve GetSubCurveByParams(this Curve curve, (double, double) inter
{
return Algorithms.GetSubCurveByParams(curve, new Interv(interval));
}
#endif

/// <summary>
/// Gets all points on curve whose parameters are an arithmetic sequence starting from 0.
Expand Down Expand Up @@ -505,7 +531,7 @@ public static IEnumerable<Curve> GetSegments(this Curve cv, double paramDelta =
{
for (var param = 0d; param < cv.EndParam; param += paramDelta)
{
yield return cv.GetSubCurveByParams((param, param + paramDelta));
yield return cv.GetSubCurveByParams(Tuple.Create(param, param + paramDelta));
}
}

Expand All @@ -519,7 +545,7 @@ public static IEnumerable<Curve> GetSegmentsByDist(this Curve cv, double distDel
{
for (var dist = 0d; dist < cv.GetDistAtParam(cv.EndParam); dist += distDelta)
{
yield return cv.GetSubCurve((dist, dist + distDelta)); // TODO: unify patterns of using "Param" and "Dist".
yield return cv.GetSubCurve(Tuple.Create(dist, dist + distDelta)); // TODO: unify patterns of using "Param" and "Dist".
}
}

Expand All @@ -538,9 +564,9 @@ public static double GetDistOfTwoCurve(Curve cv1, Curve cv2, int divs = 100)
return pts1.Min(p1 => pts2.Min(p2 => p1.DistanceTo(p2)));
}

#endregion
#endregion

#region Range algorithms
#region Range algorithms

/// <summary>
/// Gets entity extents.
Expand Down Expand Up @@ -794,9 +820,9 @@ public static double GetArea(this Extents2d extents) // newly 20130514
return (extents.MaxPoint.X - extents.MinPoint.X) * (extents.MaxPoint.Y - extents.MinPoint.Y);
}

#endregion
#endregion

#region Point algorithms
#region Point algorithms

/// <summary>
/// Gets an empty Point3d
Expand Down Expand Up @@ -878,9 +904,9 @@ private static bool IsTurnRight(Point3d px, Point3d py, Point3d pz)
return (num < 0f);
}

#endregion
#endregion

#region Vector algorithms
#region Vector algorithms

/// <summary>
/// Converts Vector2d to Vector3d.
Expand Down Expand Up @@ -970,9 +996,9 @@ public static double MinusPiToPiAngleTo(this Vector2d v0, Vector2d v1)
return angleDelta;
}

#endregion
#endregion

#region Polyline algorithms
#region Polyline algorithms

/// <summary>
/// Gets all vertices of a polyline.
Expand Down Expand Up @@ -1576,9 +1602,9 @@ public static Point3d Centroid(this Polyline poly) // newly 20130801
}
}

#endregion
#endregion

#region Miscellaneous algorithms
#region Miscellaneous algorithms

/// <summary>
/// Gets the transformation matrix of world coordinates to viewport coordinates
Expand Down Expand Up @@ -1744,7 +1770,7 @@ public static List<Polyline> HatchToPline(Hatch hatch) // newly 20130729
return plines;
}

#endregion
#endregion
}

/// <summary>
Expand Down Expand Up @@ -1820,7 +1846,7 @@ public static Polyline[] GetLoops(this Region region)
}
}

#region Private...
#region Private...

// Gets a loop from lines.
private static Polyline GetLoop(DBObjectCollection lines)
Expand Down Expand Up @@ -1918,7 +1944,7 @@ private static DBObjectCollection IncludingRing(DBObjectCollection lines, Curve
return ring;
}

#endregion
#endregion
}

/// <summary>
Expand Down Expand Up @@ -1952,6 +1978,7 @@ public Interv(double start, double end)
this.End = end;
}

#if R23
/// <summary>
/// Creates an interval from a C# 7.0 tuple.
/// </summary>
Expand All @@ -1960,6 +1987,7 @@ public Interv((double, double) tuple)
: this(tuple.Item1, tuple.Item2)
{
}
#endif

/// <summary>
/// Adds point to interval.
Expand Down
129 changes: 129 additions & 0 deletions AutoCADCommands/AutoCADCommands.R18.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EDA1D1A6-3204-4B82-8D5F-4F59815F072E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoCADCommands</RootNamespace>
<AssemblyName>AutoCADCommands</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Utf8Output>true</Utf8Output>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\r18\</OutputPath>
<DefineConstants>TRACE;DEBUG;R18</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\r18\AutoCADCommands.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>AutoCADCommands.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\r18\</OutputPath>
<DefineConstants>TRACE;R18</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>AutoCADCommands.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="acdbmgd">
<HintPath>..\Reference\AutoCAD\r18\acdbmgd.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="acmgd">
<HintPath>..\Reference\AutoCAD\r18\acmgd.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="AdWindows">
<HintPath>..\Reference\AutoCAD\r18\AdWindows.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Algorithms.cs" />
<Compile Include="App.cs" />
<Compile Include="Commands.cs" />
<Compile Include="FlexDataStore.cs" />
<Compile Include="Internal\CustomDictionary.cs" />
<Compile Include="DbHelper.cs" />
<Compile Include="GUIs\DictionaryViewer.xaml.cs">
<DependentUpon>DictionaryViewer.xaml</DependentUpon>
</Compile>
<Compile Include="Gui.cs" />
<Compile Include="GUIs\InputBox.xaml.cs">
<DependentUpon>InputBox.xaml</DependentUpon>
</Compile>
<Compile Include="GUIs\TaskProgressWindow.xaml.cs">
<DependentUpon>TaskProgressWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Interaction.cs" />
<Compile Include="Internal\JigDrag.cs" />
<Compile Include="Layouts.cs" />
<Compile Include="GUIs\MultiInputs.xaml.cs">
<DependentUpon>MultiInputs.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QuickSelection.cs" />
<Compile Include="SymbolPack.cs" />
<Compile Include="Test.cs" />
<Compile Include="GUIs\TextReport.xaml.cs">
<DependentUpon>TextReport.xaml</DependentUpon>
</Compile>
<Compile Include="Tuples.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="GUIs\DictionaryViewer.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GUIs\InputBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GUIs\MultiInputs.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GUIs\TaskProgressWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GUIs\TextReport.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="AutoCADCommands.ruleset" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
12 changes: 5 additions & 7 deletions AutoCADCommands/AutoCADCommands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,25 @@
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Utf8Output>true</Utf8Output>
<ExpressionBlendVersion>4.0.20621.0</ExpressionBlendVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE;DEBUG;R18, net20</DefineConstants>
<OutputPath>..\bin\r23\</OutputPath>
<DefineConstants>TRACE;DEBUG;R23</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\AutoCADCommands.xml</DocumentationFile>
<DocumentationFile>..\bin\r23\AutoCADCommands.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>AutoCADCommands.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<OutputPath>..\bin\Release\r23\</OutputPath>
<DefineConstants>TRACE;R23</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
Expand Down
6 changes: 3 additions & 3 deletions AutoCADCommands/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static ObjectId Pline(IEnumerable<Point3d> points, double globalWidth = 0
/// <param name="vertices">The vertices.</param>
/// <param name="globalWidth">The global width. Default is 0.</param>
/// <returns>The object ID.</returns>
public static ObjectId Pline(List<(Point3d, double)> vertices, double globalWidth = 0)
public static ObjectId Pline(List<Tuple<Point3d, double>> vertices, double globalWidth = 0)
{
return NoDraw.Pline(vertices, globalWidth).AddToCurrentSpace();
}
Expand Down Expand Up @@ -1122,7 +1122,7 @@ public static Polyline Pline(params Point3d[] points)
public static Polyline Pline(IEnumerable<Point3d> points, double globalWidth = 0)
{
return NoDraw.Pline(
vertices: points.Select(point => (point, 0d)).ToList(),
vertices: points.Select(point => Tuple.Create(point, 0d)).ToList(),
globalWidth: globalWidth);
}

Expand All @@ -1132,7 +1132,7 @@ public static Polyline Pline(IEnumerable<Point3d> points, double globalWidth = 0
/// <param name="vertices">The vertices.</param>
/// <param name="globalWidth">The global width. Default is 0.</param>
/// <returns>The result.</returns>
public static Polyline Pline(List<(Point3d, double)> vertices, double globalWidth = 0)
public static Polyline Pline(List<Tuple<Point3d, double>> vertices, double globalWidth = 0)
{
var poly = new Polyline();
Enumerable
Expand Down
Loading

0 comments on commit 884e137

Please sign in to comment.