replaced Revit 2020 SDK by Revit 2021 SDK

This commit is contained in:
Jeremy Tammik
2020-05-11 14:07:56 +02:00
parent 06ba6e0541
commit 64f8b0ed3e
250 changed files with 1225 additions and 1496 deletions
@@ -64,13 +64,18 @@ namespace Revit.SDK.Samples.ImportExport.CS
t.Start();
// Step 1: Create an ImageType
//ImageTypeOptions specify the source of the image
// If the source is a PDF file then ImageTypeOptions can be used to:
// - Select a specific page from the PDF
// - Select a Resolution (in dots-per-inch) at which to rasterize the PDF
// For other image types the page number should be 1, and the resolution is only used to determine the size of the image
//ImageTypeOptions specifies the source of the image, and how to create the ImageType.
// It can be used to specify:
// - The image file. Either as a local file path, or as an ExternalResourceRef
// - Whether to store the local file path as an absolute path or a relative path.
// - Whether to create an Import or a Link image.
// In addition, if the source is a PDF file, then ImageTypeOptions can be used to specify:
// - which page from the PDF to use
// - the resolution (in dots-per-inch) at which to rasterize the PDF
// For other image types the page number should be 1 (the default),
// and the resolution is only used to determine the size of the image.
ImageTypeOptions typeOptions = new ImageTypeOptions(m_importFileFullName);
ImageTypeOptions typeOptions = new ImageTypeOptions(m_importFileFullName, true, ImageTypeSource.Import);
ImageType imageType = ImageType.Create(m_activeDoc, typeOptions);
// Step 2: Create an ImageInstance, but only if the active view is able to contain images.
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Revit.SDK.Samples.ImportExport.CS</RootNamespace>
<AssemblyName>ImportExport</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+18 -21
View File
@@ -37,46 +37,43 @@ namespace Revit.SDK.Samples.ImportExport.CS
{
#region Methods
/// <summary>
/// Convert the value get from RevitAPI to the value indicated by DisplayUnitType
/// Convert the value get from RevitAPI to the value indicated by ForgeTypeId
/// </summary>
/// <param name="to">DisplayUnitType indicates unit of target value</param>
/// <param name="to">ForgeTypeId indicates unit of target value</param>
/// <param name="value">value get from RevitAPI</param>
/// <returns>Target value</returns>
public static double CovertFromAPI(DisplayUnitType to, double value)
public static double CovertFromAPI(ForgeTypeId to, double value)
{
return value *= ImperialDutRatio(to);
}
/// <summary>
/// Convert a value indicated by DisplayUnitType to the value used by RevitAPI
/// Convert a value indicated by ForgeTypeId to the value used by RevitAPI
/// </summary>
/// <param name="value">Value to be converted</param>
/// <param name="from">DisplayUnitType indicates the unit of the value to be converted</param>
/// <param name="from">ForgeTypeId indicates the unit of the value to be converted</param>
/// <returns>Target value</returns>
public static double CovertToAPI(double value, DisplayUnitType from )
public static double CovertToAPI(double value, ForgeTypeId from )
{
return value /= ImperialDutRatio(from);
}
/// <summary>
/// Get ratio between value in RevitAPI and value to display indicated by DisplayUnitType
/// Get ratio between value in RevitAPI and value to display indicated by ForgeTypeId
/// </summary>
/// <param name="dut">DisplayUnitType indicates display unit type</param>
/// <param name="unit">ForgeTypeId indicates display unit type</param>
/// <returns>Ratio </returns>
private static double ImperialDutRatio(DisplayUnitType dut)
private static double ImperialDutRatio(ForgeTypeId unit)
{
switch (dut)
{
case DisplayUnitType.DUT_DECIMAL_FEET: return 1;
case DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES: return 1;
case DisplayUnitType.DUT_DECIMAL_INCHES: return 12;
case DisplayUnitType.DUT_FRACTIONAL_INCHES: return 12;
case DisplayUnitType.DUT_METERS: return 0.3048;
case DisplayUnitType.DUT_CENTIMETERS: return 30.48;
case DisplayUnitType.DUT_MILLIMETERS: return 304.8;
case DisplayUnitType.DUT_METERS_CENTIMETERS: return 0.3048;
default: return 1;
}
if (unit == UnitTypeId.Feet) return 1;
if (unit == UnitTypeId.FeetFractionalInches) return 1;
if (unit == UnitTypeId.Inches) return 12;
if (unit == UnitTypeId.FractionalInches) return 12;
if (unit == UnitTypeId.Meters) return 0.3048;
if (unit == UnitTypeId.Centimeters) return 30.48;
if (unit == UnitTypeId.Millimeters) return 304.8;
if (unit == UnitTypeId.MetersCentimeters) return 0.3048;
return 1;
}
#endregion
}