mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-18 10:31:32 +00:00
added Revit 2020 SDK files
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// the entry point of the sample (to launch the sample dialog and allows further operations)
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
|
||||
class Command : IExternalCommand
|
||||
{
|
||||
#region IExternalCommand Members Implementation
|
||||
/// <summary>
|
||||
/// Implement this method as an external command for Revit.
|
||||
/// </summary>
|
||||
/// <param name="commandData">An object that is passed to the external application
|
||||
/// which contains data related to the command,
|
||||
/// such as the application object and active view.</param>
|
||||
/// <param name="message">A message that can be set by the external application
|
||||
/// which will be displayed if a failure or cancellation is returned by
|
||||
/// the external command.</param>
|
||||
/// <param name="elements">A set of elements to which the external application
|
||||
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
|
||||
/// <returns>Return the status of the external command.
|
||||
/// A result of Succeeded means that the API external method functioned as expected.
|
||||
/// Cancelled can be used to signify that the user cancelled the external operation
|
||||
/// at some point. Failure should be returned if the application is unable to proceed with
|
||||
/// the operation.</returns>
|
||||
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
|
||||
{
|
||||
|
||||
// data verification
|
||||
if (null == commandData.Application.ActiveUIDocument)
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
|
||||
MyDocument mydocument = new MyDocument(commandData);
|
||||
|
||||
|
||||
|
||||
// check whether the mass is kind of parallelepiped
|
||||
CurtainSystem.MassChecker checker = new CurtainSystem.MassChecker(mydocument);
|
||||
bool validMass = checker.CheckSelectedMass();
|
||||
|
||||
if (!validMass)
|
||||
{
|
||||
message = Properties.Resources.MSG_InvalidSelection;
|
||||
return Result.Cancelled;
|
||||
}
|
||||
|
||||
UI.CurtainForm curtainForm = null;
|
||||
TransactionGroup transactionGroup = new TransactionGroup(commandData.Application.ActiveUIDocument.Document);
|
||||
try
|
||||
{
|
||||
transactionGroup.Start("CurtainSystemOperation");
|
||||
curtainForm = new UI.CurtainForm(mydocument);
|
||||
|
||||
if (null != curtainForm && false == curtainForm.IsDisposed)
|
||||
{
|
||||
curtainForm.ShowDialog();
|
||||
}
|
||||
|
||||
transactionGroup.Commit();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
transactionGroup.RollBack();
|
||||
message = ex.Message;
|
||||
return Result.Failed;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != curtainForm && false == curtainForm.IsDisposed)
|
||||
{
|
||||
curtainForm.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RevitAddIns>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>CurtainSystem.dll</Assembly>
|
||||
<ClientId>3ffdcad7-a91a-43f9-8b97-d161c8db860c</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.CurtainSystem.CS.Command</FullClassName>
|
||||
<Text>Curtain System</Text>
|
||||
<Description>Create curtain systems and edit their curtain grids</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
</RevitAddIns>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?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>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{80502467-3D8F-436D-9E47-AF3702D679FD}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Revit.SDK.Samples.CurtainSystem.CS</RootNamespace>
|
||||
<AssemblyName>CurtainSystem</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="CurtainSystem\MassChecker.cs" />
|
||||
<Compile Include="CurtainSystem\SystemData.cs" />
|
||||
<Compile Include="UI\CreateCurtainSystemDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\CreateCurtainSystemDialog.Designer.cs">
|
||||
<DependentUpon>CreateCurtainSystemDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Data\MyDocument.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\CurtainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\CurtainForm.Designer.cs">
|
||||
<DependentUpon>CurtainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\MathTools.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="UI\CreateCurtainSystemDialog.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>CreateCurtainSystemDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\CurtainForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>CurtainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\delete.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\new.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.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>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
|
||||
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,395 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.CurtainSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// check whether the selected element is a mass and whether the mass is kind of parallelepiped
|
||||
/// (only mass of parallelepiped supported in this sample)
|
||||
/// </summary>
|
||||
class MassChecker
|
||||
{
|
||||
// the document containing all the data used in the sample
|
||||
MyDocument m_mydocument;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the document of the sample
|
||||
/// </param>
|
||||
public MassChecker(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check whether the selection is a parallelepiped mass
|
||||
/// </summary>
|
||||
public bool CheckSelectedMass()
|
||||
{
|
||||
// get the selected mass
|
||||
FamilyInstance mass = GetSelectedMass();
|
||||
// start the sample without making a parallelepiped mass selected
|
||||
if (null == mass)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_InvalidSelection;
|
||||
return false;
|
||||
}
|
||||
|
||||
// check whether the mass is parallelepiped
|
||||
bool isMassParallelepiped = IsMassParallelepiped(mass);
|
||||
if (false == isMassParallelepiped)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_InvalidSelection;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check whether the mass is a parallelepiped mass by checking the faces' normals
|
||||
/// (if it's a parallelepiped mass, it will have 3 groups of parallel faces)
|
||||
/// </summary>
|
||||
/// <param name="mass">
|
||||
/// the mass to be checked
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// return true if the mass is parallelepiped; otherwise false
|
||||
/// </returns>
|
||||
private bool IsMassParallelepiped(FamilyInstance mass)
|
||||
{
|
||||
FaceArray faces = GetMassFaceArray(mass);
|
||||
|
||||
// a parallelepiped always has 6 faces
|
||||
if (null == faces ||
|
||||
6 != faces.Size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isFacesParallel = IsFacesParallel(faces);
|
||||
|
||||
// store the face array
|
||||
if (true == isFacesParallel)
|
||||
{
|
||||
m_mydocument.MassFaceArray = faces;
|
||||
}
|
||||
|
||||
return isFacesParallel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check whether the faces of the mass are one-one parallel
|
||||
/// </summary>
|
||||
/// <param name="faces">
|
||||
/// the 6 faces of the mass
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// if the 6 faces are one-one parallel, return true; otherwise false
|
||||
/// </returns>
|
||||
private bool IsFacesParallel(FaceArray faces)
|
||||
{
|
||||
// step1: get the normals of the 6 faces
|
||||
List<Utility.Vector4> normals = new List<Utility.Vector4>();
|
||||
foreach (Face face in faces)
|
||||
{
|
||||
EdgeArrayArray edgeArrayArray = face.EdgeLoops;
|
||||
EdgeArray edges = edgeArrayArray.get_Item(0);
|
||||
|
||||
if (null == edges ||
|
||||
2 > edges.Size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// we use the cross product of 2 non-parallel vectors as the normal
|
||||
for (int i = 0; i < edges.Size - 1; i++)
|
||||
{
|
||||
Edge edgeA = edges.get_Item(i);
|
||||
Edge edgeB = edges.get_Item(i + 1);
|
||||
|
||||
// if edgeA & edgeB are parallel, can't compute the cross product
|
||||
bool isLinesParallel = IsLinesParallel(edgeA, edgeB);
|
||||
|
||||
if (true == isLinesParallel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Utility.Vector4 vec4 = ComputeCrossProduct(edgeA, edgeB);
|
||||
normals.Add(vec4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// step 2: the 6 normals should be one-one parallel pairs
|
||||
if (null == normals ||
|
||||
6 != normals.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool[] matchedList = new bool[6];
|
||||
for (int i = 0; i < matchedList.Length; i++)
|
||||
{
|
||||
matchedList[i] = false;
|
||||
}
|
||||
|
||||
// check whether the normal has another matched parallel normal
|
||||
for (int i = 0; i < matchedList.Length; i++)
|
||||
{
|
||||
if (true == matchedList[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Utility.Vector4 vec4A = normals[i];
|
||||
|
||||
for (int j = 0; j < matchedList.Length; j++)
|
||||
{
|
||||
if (j == i ||
|
||||
true == matchedList[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Utility.Vector4 vec4B = normals[j];
|
||||
|
||||
if (true == IsLinesParallel(vec4A, vec4B))
|
||||
{
|
||||
matchedList[i] = true;
|
||||
matchedList[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// step 3: check each of the 6 normals has matched parallel normal
|
||||
for (int i = 0; i < matchedList.Length; i++)
|
||||
{
|
||||
if (false == matchedList[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// all the normals have matched parallel normals
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check whether 2 edges are parallel
|
||||
/// </summary>
|
||||
/// <param name="edgeA">
|
||||
/// the edge to be checked
|
||||
/// </param>
|
||||
/// <param name="edgeB">
|
||||
/// the edge to be checked
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// if they're parallel, return true; otherwise false
|
||||
/// </returns>
|
||||
private bool IsLinesParallel(Edge edgeA, Edge edgeB)
|
||||
{
|
||||
List<XYZ> pointsA = edgeA.Tessellate() as List<XYZ>;
|
||||
List<XYZ> pointsB = edgeB.Tessellate() as List<XYZ>;
|
||||
Autodesk.Revit.DB.XYZ vectorA = pointsA[1] - pointsA[0];
|
||||
Autodesk.Revit.DB.XYZ vectorB = pointsB[1] - pointsB[0];
|
||||
Utility.Vector4 vec4A = new Utility.Vector4(vectorA);
|
||||
Utility.Vector4 vec4B = new Utility.Vector4(vectorB);
|
||||
return IsLinesParallel(vec4A, vec4B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check whether 2 vectors are parallel
|
||||
/// </summary>
|
||||
/// <param name="vec4A">
|
||||
/// the vector to be checked
|
||||
/// </param>
|
||||
/// <param name="vec4B">
|
||||
/// the vector to be checked
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// if they're parallel, return true; otherwise false
|
||||
/// </returns>
|
||||
private bool IsLinesParallel(Utility.Vector4 vec4A, Utility.Vector4 vec4B)
|
||||
{
|
||||
// if 2 vectors are parallel, they should be like the following formula:
|
||||
// vec4A.X vec4A.Y vec4A.Z
|
||||
// ------- == ------- == -------
|
||||
// vec4B.X vec4B.Y vec4B.Z
|
||||
// change to multiply, it's
|
||||
// vec4A.X * vec4B.Y == vec4A.Y * vec4B.X &&
|
||||
// vec4A.Y * vec4B.Z == vec4A.Z * vec4B.Y
|
||||
double aa = vec4A.X * vec4B.Y;
|
||||
double bb = vec4A.Y * vec4B.X;
|
||||
double cc = vec4A.Y * vec4B.Z;
|
||||
double dd = vec4A.Z * vec4B.Y;
|
||||
double ee = vec4A.X * vec4B.Z;
|
||||
double ff = vec4A.Z * vec4B.X;
|
||||
|
||||
const double tolerance = 0.0001d;
|
||||
|
||||
if (Math.Abs(aa - bb) < tolerance &&
|
||||
Math.Abs(cc - dd) < tolerance &&
|
||||
Math.Abs(ee - ff) < tolerance)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// compute the cross product of 2 edges
|
||||
/// </summary>
|
||||
/// <param name="edgeA">
|
||||
/// the edge for the cross product
|
||||
/// </param>
|
||||
/// <param name="edgeB">
|
||||
/// the edge for the cross product
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// the cross product of 2 edges
|
||||
/// </returns>
|
||||
private Utility.Vector4 ComputeCrossProduct(Edge edgeA, Edge edgeB)
|
||||
{
|
||||
List<XYZ> pointsA = edgeA.Tessellate() as List<XYZ>;
|
||||
List<XYZ> pointsB = edgeB.Tessellate() as List<XYZ>;
|
||||
Autodesk.Revit.DB.XYZ vectorA = pointsA[1] - pointsA[0];
|
||||
Autodesk.Revit.DB.XYZ vectorB = pointsB[1] - pointsB[0];
|
||||
Utility.Vector4 vec4A = new Utility.Vector4(vectorA);
|
||||
Utility.Vector4 vec4B = new Utility.Vector4(vectorB);
|
||||
return Utility.Vector4.CrossProduct(vec4A, vec4B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the faces of the mass
|
||||
/// </summary>
|
||||
/// <param name="mass">
|
||||
/// the source mass
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// the faces of the mass
|
||||
/// </returns>
|
||||
private FaceArray GetMassFaceArray(FamilyInstance mass)
|
||||
{
|
||||
// Obtain the gemotry information of the mass
|
||||
Autodesk.Revit.DB.Options opt = m_mydocument.CommandData.Application.Application.Create.NewGeometryOptions();
|
||||
opt.DetailLevel = ViewDetailLevel.Fine;
|
||||
opt.ComputeReferences = true;
|
||||
Autodesk.Revit.DB.GeometryElement geoElement = null;
|
||||
try
|
||||
{
|
||||
geoElement = mass.get_Geometry(opt);
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (null == geoElement)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//GeometryObjectArray objectarray = geoElement.Objects;
|
||||
//foreach (GeometryObject obj in objectarray)
|
||||
IEnumerator<GeometryObject> Objects = geoElement.GetEnumerator();
|
||||
while (Objects.MoveNext())
|
||||
{
|
||||
GeometryObject obj = Objects.Current;
|
||||
|
||||
Solid solid = obj as Solid;
|
||||
|
||||
if (null != solid &&
|
||||
null != solid.Faces &&
|
||||
0 != solid.Faces.Size)
|
||||
{
|
||||
return solid.Faces;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the selected mass
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// return the selected mass; if it's not a mass, return null
|
||||
/// </returns>
|
||||
private FamilyInstance GetSelectedMass()
|
||||
{
|
||||
FamilyInstance resultMass = null;
|
||||
|
||||
// check whether a mass was selected before launching this sample
|
||||
Selection selection = m_mydocument.UIDocument.Selection;
|
||||
ElementSet elementSet = new ElementSet();
|
||||
foreach (ElementId elementId in selection.GetElementIds())
|
||||
{
|
||||
elementSet.Insert(m_mydocument.UIDocument.Document.GetElement(elementId));
|
||||
}
|
||||
if (null == selection ||
|
||||
null == elementSet ||
|
||||
true == elementSet.IsEmpty ||
|
||||
1 != elementSet.Size)
|
||||
{
|
||||
//m_mydocument.FatalErrorMsg = Properties.Resources.MSG_InvalidSelection;
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (Autodesk.Revit.DB.ElementId selElementId in selection.GetElementIds())
|
||||
{
|
||||
Autodesk.Revit.DB.Element selElement = m_mydocument.UIDocument.Document.GetElement(selElementId);
|
||||
FamilyInstance inst = selElement as FamilyInstance;
|
||||
if (null != inst &&
|
||||
"Mass" == inst.Category.Name)
|
||||
{
|
||||
resultMass = inst;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// nothing selected or the selected element is not a mass
|
||||
if (null == resultMass)
|
||||
{
|
||||
//m_mydocument.FatalErrorMsg = Properties.Resources.MSG_InvalidSelection;
|
||||
return null;
|
||||
}
|
||||
|
||||
return resultMass;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,535 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.CurtainSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// the class to maintain the data and operations of the curtain system
|
||||
/// </summary>
|
||||
public class SystemData
|
||||
{
|
||||
// the data of the sample
|
||||
MyDocument m_mydocument;
|
||||
|
||||
// the count of the created curtain systems
|
||||
static int m_csIndex = -1;
|
||||
|
||||
// all the created curtain systems and their data
|
||||
List<SystemInfo> m_curtainSystemInfos;
|
||||
/// <summary>
|
||||
/// all the created curtain systems and their data
|
||||
/// </summary>
|
||||
public List<SystemInfo> CurtainSystemInfos
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_curtainSystemInfos;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// occurs only when new curtain system added/removed
|
||||
/// the delegate method to handle the curtain system added/removed events
|
||||
/// </summary>
|
||||
public delegate void CurtainSystemChangedHandler();
|
||||
/// <summary>
|
||||
/// the event triggered when curtain system added/removed
|
||||
/// </summary>
|
||||
public event CurtainSystemChangedHandler CurtainSystemChanged;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the document of the sample
|
||||
/// </param>
|
||||
public SystemData(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
m_curtainSystemInfos = new List<SystemInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a new curtain system
|
||||
/// </summary>
|
||||
/// <param name="faceIndices">
|
||||
/// the faces to be covered with new curtain system
|
||||
/// </param>
|
||||
/// <param name="byFaceArray">
|
||||
/// indicates whether the curtain system will be created by face array
|
||||
/// </param>
|
||||
public void CreateCurtainSystem(List<int> faceIndices, bool byFaceArray)
|
||||
{
|
||||
// just refresh the main UI
|
||||
if (null == faceIndices ||
|
||||
0 == faceIndices.Count)
|
||||
{
|
||||
if (null != CurtainSystemChanged)
|
||||
{
|
||||
CurtainSystemChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
SystemInfo resultInfo = new SystemInfo(m_mydocument);
|
||||
resultInfo.ByFaceArray = byFaceArray;
|
||||
resultInfo.GridFacesIndices = faceIndices;
|
||||
resultInfo.Index = ++m_csIndex;
|
||||
|
||||
//
|
||||
// step 1: create the curtain system
|
||||
//
|
||||
// create the curtain system by face array
|
||||
if (true == byFaceArray)
|
||||
{
|
||||
FaceArray faceArray = new FaceArray();
|
||||
foreach (int index in faceIndices)
|
||||
{
|
||||
faceArray.Append(m_mydocument.MassFaceArray.get_Item(index));
|
||||
}
|
||||
|
||||
Autodesk.Revit.DB.CurtainSystem curtainSystem = null;
|
||||
Transaction t = new Transaction(m_mydocument.Document, Guid.NewGuid().GetHashCode().ToString());
|
||||
t.Start();
|
||||
try
|
||||
{
|
||||
curtainSystem = m_mydocument.Document.Create.NewCurtainSystem(faceArray, m_mydocument.CurtainSystemType);
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_CreateCSFailed;
|
||||
t.RollBack();
|
||||
return;
|
||||
}
|
||||
|
||||
t.Commit();
|
||||
|
||||
resultInfo.CurtainForm = curtainSystem;
|
||||
}
|
||||
// create the curtain system by reference array
|
||||
else
|
||||
{
|
||||
ReferenceArray refArray = new ReferenceArray();
|
||||
foreach (int index in faceIndices)
|
||||
{
|
||||
refArray.Append(m_mydocument.MassFaceArray.get_Item(index).Reference);
|
||||
}
|
||||
|
||||
ICollection<ElementId> curtainSystems = null;
|
||||
Transaction t = new Transaction(m_mydocument.Document, Guid.NewGuid().GetHashCode().ToString());
|
||||
t.Start();
|
||||
try
|
||||
{
|
||||
curtainSystems = m_mydocument.Document.Create.NewCurtainSystem2(refArray, m_mydocument.CurtainSystemType);
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_CreateCSFailed;
|
||||
t.RollBack();
|
||||
return;
|
||||
}
|
||||
t.Commit();
|
||||
|
||||
// internal fatal error, quit the sample
|
||||
if (null == curtainSystems ||
|
||||
1 != curtainSystems.Count)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_MoreThan1CSCreated;
|
||||
return;
|
||||
}
|
||||
|
||||
// store the curtain system
|
||||
foreach (ElementId cs in curtainSystems)
|
||||
{
|
||||
resultInfo.CurtainForm = m_mydocument.Document.GetElement(cs) as Autodesk.Revit.DB.CurtainSystem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// step 2: update the curtain system list in the main UI
|
||||
//
|
||||
m_curtainSystemInfos.Add(resultInfo);
|
||||
if (null != CurtainSystemChanged)
|
||||
{
|
||||
CurtainSystemChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delete the curtain systems
|
||||
/// </summary>
|
||||
/// <param name="checkedIndices">
|
||||
/// the curtain systems to be deleted
|
||||
/// </param>
|
||||
public void DeleteCurtainSystem(List<int> checkedIndices)
|
||||
{
|
||||
Transaction t = new Transaction(m_mydocument.Document, Guid.NewGuid().GetHashCode().ToString());
|
||||
t.Start();
|
||||
foreach (int index in checkedIndices)
|
||||
{
|
||||
SystemInfo info = m_curtainSystemInfos[index];
|
||||
if (null != info.CurtainForm)
|
||||
{
|
||||
m_mydocument.Document.Delete(info.CurtainForm.Id);
|
||||
info.CurtainForm = null;
|
||||
}
|
||||
}
|
||||
t.Commit();
|
||||
|
||||
// update the list of created curtain systems
|
||||
// remove the "deleted" curtain systems out
|
||||
List<SystemInfo> infos = m_curtainSystemInfos;
|
||||
m_curtainSystemInfos = new List<SystemInfo>();
|
||||
|
||||
foreach (SystemInfo info in infos)
|
||||
{
|
||||
if (null != info.CurtainForm)
|
||||
{
|
||||
m_curtainSystemInfos.Add(info);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != CurtainSystemChanged)
|
||||
{
|
||||
CurtainSystemChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}// end of class
|
||||
|
||||
/// <summary>
|
||||
/// the information of a curtain system
|
||||
/// </summary>
|
||||
public class SystemInfo
|
||||
{
|
||||
// the data of the sample
|
||||
MyDocument m_mydocument;
|
||||
|
||||
// the curtain system
|
||||
Autodesk.Revit.DB.CurtainSystem m_curtainSystem;
|
||||
/// <summary>
|
||||
/// the curtain system
|
||||
/// </summary>
|
||||
public Autodesk.Revit.DB.CurtainSystem CurtainForm
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_curtainSystem;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_curtainSystem = value;
|
||||
}
|
||||
}
|
||||
|
||||
// indicates which faces the curtain system covers
|
||||
List<int> m_gridFacesIndices;
|
||||
/// <summary>
|
||||
/// indicates which faces the curtain system covers
|
||||
/// </summary>
|
||||
public List<int> GridFacesIndices
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_gridFacesIndices;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_gridFacesIndices = value;
|
||||
|
||||
// the faces which don't be included will be added to the m_uncoverFacesIndices collection
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (false == m_gridFacesIndices.Contains(i))
|
||||
{
|
||||
m_uncoverFacesIndices.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the uncovered faces
|
||||
List<int> m_uncoverFacesIndices;
|
||||
/// <summary>
|
||||
/// the uncovered faces
|
||||
/// </summary>
|
||||
public List<int> UncoverFacesIndices
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_uncoverFacesIndices;
|
||||
}
|
||||
}
|
||||
|
||||
// indicates whether the curtain system is created by face array
|
||||
private bool m_byFaceArray;
|
||||
/// <summary>
|
||||
/// indicates whether the curtain system is created by face array
|
||||
/// </summary>
|
||||
public bool ByFaceArray
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_byFaceArray;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_byFaceArray = value;
|
||||
}
|
||||
}
|
||||
|
||||
// the name of the curtain system, identified by its index
|
||||
private string m_name;
|
||||
/// <summary>
|
||||
/// the name of the curtain system, identified by its index
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
}
|
||||
|
||||
// the index of the curtain systems
|
||||
private int m_index;
|
||||
/// <summary>
|
||||
/// the index of the curtain systems
|
||||
/// </summary>
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_index = value;
|
||||
m_name = "Curtain System " + m_index;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the document of the sample
|
||||
/// </param>
|
||||
public SystemInfo(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
m_gridFacesIndices = new List<int>();
|
||||
m_uncoverFacesIndices = new List<int>();
|
||||
m_byFaceArray = false;
|
||||
m_index = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add some curtain grids to the curtain system
|
||||
/// </summary>
|
||||
/// <param name="faceIndices">
|
||||
/// the faces to be covered
|
||||
/// </param>
|
||||
public void AddCurtainGrids(List<int> faceIndices)
|
||||
{
|
||||
// step 1: find out the faces to be covered
|
||||
List<Reference> refFaces = new List<Reference>();
|
||||
foreach (int index in faceIndices)
|
||||
{
|
||||
refFaces.Add(m_mydocument.MassFaceArray.get_Item(index).Reference);
|
||||
}
|
||||
// step 2: cover the selected faces with curtain grids
|
||||
Transaction t = new Transaction(m_mydocument.Document, Guid.NewGuid().GetHashCode().ToString());
|
||||
t.Start();
|
||||
try
|
||||
{
|
||||
foreach (Reference refFace in refFaces)
|
||||
{
|
||||
m_curtainSystem.AddCurtainGrid(refFace);
|
||||
}
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_AddCGFailed;
|
||||
t.RollBack();
|
||||
return;
|
||||
}
|
||||
t.Commit();
|
||||
|
||||
// step 3: update the uncovered faces and curtain grid faces data
|
||||
foreach (int i in faceIndices)
|
||||
{
|
||||
m_uncoverFacesIndices.Remove(i);
|
||||
m_gridFacesIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove the selected curtain grids
|
||||
/// </summary>
|
||||
/// <param name="faceIndices">
|
||||
/// the curtain grids to be removed
|
||||
/// </param>
|
||||
public void RemoveCurtainGrids(List<int> faceIndices)
|
||||
{
|
||||
// step 1: find out the faces to be covered
|
||||
List<Reference> refFaces = new List<Reference>();
|
||||
foreach (int index in faceIndices)
|
||||
{
|
||||
refFaces.Add(m_mydocument.MassFaceArray.get_Item(index).Reference);
|
||||
}
|
||||
// step 2: remove the selected curtain grids
|
||||
Transaction t = new Transaction(m_mydocument.Document, Guid.NewGuid().GetHashCode().ToString());
|
||||
t.Start();
|
||||
try
|
||||
{
|
||||
foreach (Reference refFace in refFaces)
|
||||
{
|
||||
m_curtainSystem.RemoveCurtainGrid(refFace);
|
||||
}
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
m_mydocument.FatalErrorMsg = Properties.Resources.MSG_RemoveCGFailed;
|
||||
t.RollBack();
|
||||
return;
|
||||
}
|
||||
t.Commit();
|
||||
|
||||
// step 3: update the uncovered faces and curtain grid faces data
|
||||
foreach (int i in faceIndices)
|
||||
{
|
||||
m_gridFacesIndices.Remove(i);
|
||||
m_uncoverFacesIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// override ToString method
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// the string value of the class
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the information for the curtain grid (which face does it lay on)
|
||||
/// </summary>
|
||||
public class GridFaceInfo
|
||||
{
|
||||
// the host face of the curtain grid
|
||||
private int m_faceIndex;
|
||||
/// <summary>
|
||||
/// the host face of the curtain grid
|
||||
/// </summary>
|
||||
public int FaceIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_faceIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_faceIndex = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="index">
|
||||
/// the index of the host face
|
||||
/// </param>
|
||||
public GridFaceInfo(int index)
|
||||
{
|
||||
m_faceIndex = index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the string value for the class
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// the string value for the class
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return "Grid on Face " + m_faceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the information for the faces of the mass
|
||||
/// </summary>
|
||||
public class UncoverFaceInfo
|
||||
{
|
||||
// indicates the index for the face
|
||||
private int m_faceIndex;
|
||||
/// <summary>
|
||||
/// indicates the index for the face
|
||||
/// </summary>
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_faceIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_faceIndex = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="index">
|
||||
/// the index of the face
|
||||
/// </param>
|
||||
public UncoverFaceInfo(int index)
|
||||
{
|
||||
m_faceIndex = index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the string value for the class
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// the string value for the class
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return "Face " + m_faceIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// maintains all the data used in the sample
|
||||
/// </summary>
|
||||
public class MyDocument
|
||||
{
|
||||
// object which contains reference of Revit Applicatio
|
||||
ExternalCommandData m_commandData;
|
||||
/// <summary>
|
||||
/// object which contains reference of Revit Applicatio
|
||||
/// </summary>
|
||||
public ExternalCommandData CommandData
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_commandData;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_commandData = value;
|
||||
}
|
||||
}
|
||||
|
||||
// the active UI document of Revit
|
||||
Autodesk.Revit.UI.UIDocument m_uiDocument;
|
||||
|
||||
/// <summary>
|
||||
/// the active document of Revit
|
||||
/// </summary>
|
||||
public Autodesk.Revit.UI.UIDocument UIDocument
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_uiDocument;
|
||||
}
|
||||
}
|
||||
|
||||
Autodesk.Revit.DB.Document m_document;
|
||||
public Autodesk.Revit.DB.Document Document
|
||||
{
|
||||
get { return m_document; }
|
||||
}
|
||||
|
||||
// the data of the created curtain systems
|
||||
CurtainSystem.SystemData m_systemData;
|
||||
/// <summary>
|
||||
/// the data of the created curtain systems
|
||||
/// </summary>
|
||||
public CurtainSystem.SystemData SystemData
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_systemData;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_systemData = value;
|
||||
}
|
||||
}
|
||||
|
||||
// all the faces of the parallelepiped mass
|
||||
FaceArray m_massFaceArray;
|
||||
/// <summary>
|
||||
/// // all the faces of the parallelepiped mass
|
||||
/// </summary>
|
||||
public FaceArray MassFaceArray
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_massFaceArray;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_massFaceArray = value;
|
||||
}
|
||||
}
|
||||
|
||||
// the curtain system type of the active Revit document, used for curtain system creation
|
||||
CurtainSystemType m_curtainSystemType;
|
||||
/// <summary>
|
||||
/// the curtain system type of the active Revit document, used for curtain system creation
|
||||
/// </summary>
|
||||
public CurtainSystemType CurtainSystemType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_curtainSystemType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_curtainSystemType = value;
|
||||
}
|
||||
}
|
||||
// the message shown when there's a fatal error in the sample
|
||||
string m_fatalErrorMsg = null;
|
||||
/// <summary>
|
||||
/// the message shown when there's a fatal error in the sample
|
||||
/// </summary>
|
||||
public string FatalErrorMsg
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_fatalErrorMsg;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_fatalErrorMsg = value;
|
||||
|
||||
if (false == string.IsNullOrEmpty(m_fatalErrorMsg) &&
|
||||
null != FatalErrorEvent)
|
||||
{
|
||||
FatalErrorEvent(m_fatalErrorMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// occurs only when the message was updated
|
||||
/// the delegate method to handle the message update event
|
||||
/// </summary>
|
||||
public delegate void MessageChangedHandler();
|
||||
/// <summary>
|
||||
/// the event triggered when message updated/changed
|
||||
/// </summary>
|
||||
public event MessageChangedHandler MessageChanged;
|
||||
|
||||
/// <summary>
|
||||
/// occurs only when there's a fatal error
|
||||
/// the delegate method to handle the fatal error event
|
||||
/// </summary>
|
||||
/// <param name="errorMsg"></param>
|
||||
public delegate void FatalErrorHandler(string errorMsg);
|
||||
/// <summary>
|
||||
/// the event triggered when the sample meets a fatal error
|
||||
/// </summary>
|
||||
public event FatalErrorHandler FatalErrorEvent;
|
||||
|
||||
// store the message of the sample
|
||||
private KeyValuePair<string/*msgText*/, bool/*is warningOrError*/> m_message;
|
||||
/// <summary>
|
||||
/// store the message of the sample
|
||||
/// </summary>
|
||||
public KeyValuePair<string/*msgText*/, bool/*is warningOrError*/> Message
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_message = value;
|
||||
if (null != MessageChanged)
|
||||
{
|
||||
MessageChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="commandData">
|
||||
/// object which contains reference of Revit Application
|
||||
/// </param>
|
||||
public MyDocument(ExternalCommandData commandData)
|
||||
{
|
||||
m_commandData = commandData;
|
||||
m_uiDocument = m_commandData.Application.ActiveUIDocument;
|
||||
m_document = m_uiDocument.Document;
|
||||
|
||||
// initialize the curtain system data
|
||||
m_systemData = new CurtainSystem.SystemData(this);
|
||||
|
||||
// get the curtain system type of the active Revit document
|
||||
GetCurtainSystemType();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the curtain system type from the active Revit document
|
||||
/// </summary>
|
||||
private void GetCurtainSystemType()
|
||||
{
|
||||
FilteredElementCollector filteredElementCollector = new FilteredElementCollector(m_document);
|
||||
filteredElementCollector.OfClass(typeof(CurtainSystemType));
|
||||
m_curtainSystemType = filteredElementCollector.FirstElement() as CurtainSystemType;
|
||||
}
|
||||
|
||||
} // end of class
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CurtainSystem")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CurtainSystem")]
|
||||
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ffa0afac-7f23-4bb2-834f-e513beebbce7")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,191 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Revit.SDK.Samples.CurtainSystem.CS.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap _new {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("new", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap delete {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("delete", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No curtain system available. Please create some first..
|
||||
/// </summary>
|
||||
internal static string HINT_CreateCSFirst {
|
||||
get {
|
||||
return ResourceManager.GetString("HINT_CreateCSFirst", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Created by face array, forbidden to add/remove curtain grids..
|
||||
/// </summary>
|
||||
internal static string HINT_CSIsByFaceArray {
|
||||
get {
|
||||
return ResourceManager.GetString("HINT_CSIsByFaceArray", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Curtain system must have at least one curtain grid..
|
||||
/// </summary>
|
||||
internal static string HINT_KeepOneCG {
|
||||
get {
|
||||
return ResourceManager.GetString("HINT_KeepOneCG", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please select some curtain grids and make them checked first..
|
||||
/// </summary>
|
||||
internal static string HINT_SelectCGFirst {
|
||||
get {
|
||||
return ResourceManager.GetString("HINT_SelectCGFirst", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please select some curtain systems and make them checked first..
|
||||
/// </summary>
|
||||
internal static string HINT_SelectCSFirst {
|
||||
get {
|
||||
return ResourceManager.GetString("HINT_SelectCSFirst", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please select some uncovered faces and make them checked first..
|
||||
/// </summary>
|
||||
internal static string HINT_SelectFaceFirst {
|
||||
get {
|
||||
return ResourceManager.GetString("HINT_SelectFaceFirst", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error! Add curtain grid to the mass failed. The application will be terminated..
|
||||
/// </summary>
|
||||
internal static string MSG_AddCGFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("MSG_AddCGFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error! Create curtain system failed. The application will be terminated..
|
||||
/// </summary>
|
||||
internal static string MSG_CreateCSFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("MSG_CreateCSFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error! Please select a parallelepiped mass first. The application will be terminated..
|
||||
/// </summary>
|
||||
internal static string MSG_InvalidSelection {
|
||||
get {
|
||||
return ResourceManager.GetString("MSG_InvalidSelection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Fatal Error! More than 1 curtain system was created. The application will be terminated..
|
||||
/// </summary>
|
||||
internal static string MSG_MoreThan1CSCreated {
|
||||
get {
|
||||
return ResourceManager.GetString("MSG_MoreThan1CSCreated", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error! Remove curtain grid failed. The application will be terminated..
|
||||
/// </summary>
|
||||
internal static string MSG_RemoveCGFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("MSG_RemoveCGFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Curtain System.
|
||||
/// </summary>
|
||||
internal static string TXT_DialogTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("TXT_DialogTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="HINT_KeepOneCG" xml:space="preserve">
|
||||
<value>Curtain system must have at least one curtain grid.</value>
|
||||
</data>
|
||||
<data name="TXT_DialogTitle" xml:space="preserve">
|
||||
<value>Curtain System</value>
|
||||
</data>
|
||||
<data name="HINT_CSIsByFaceArray" xml:space="preserve">
|
||||
<value>Created by face array, forbidden to add/remove curtain grids.</value>
|
||||
</data>
|
||||
<data name="HINT_SelectCGFirst" xml:space="preserve">
|
||||
<value>Please select some curtain grids and make them checked first.</value>
|
||||
</data>
|
||||
<data name="HINT_SelectFaceFirst" xml:space="preserve">
|
||||
<value>Please select some uncovered faces and make them checked first.</value>
|
||||
</data>
|
||||
<data name="MSG_MoreThan1CSCreated" xml:space="preserve">
|
||||
<value>Fatal Error! More than 1 curtain system was created. The application will be terminated.</value>
|
||||
</data>
|
||||
<data name="MSG_InvalidSelection" xml:space="preserve">
|
||||
<value>Error! Please select a parallelepiped mass first. The application will be terminated.</value>
|
||||
</data>
|
||||
<data name="MSG_CreateCSFailed" xml:space="preserve">
|
||||
<value>Error! Create curtain system failed. The application will be terminated.</value>
|
||||
</data>
|
||||
<data name="HINT_CreateCSFirst" xml:space="preserve">
|
||||
<value>No curtain system available. Please create some first.</value>
|
||||
</data>
|
||||
<data name="MSG_RemoveCGFailed" xml:space="preserve">
|
||||
<value>Error! Remove curtain grid failed. The application will be terminated.</value>
|
||||
</data>
|
||||
<data name="MSG_AddCGFailed" xml:space="preserve">
|
||||
<value>Error! Add curtain grid to the mass failed. The application will be terminated.</value>
|
||||
</data>
|
||||
<data name="HINT_SelectCSFirst" xml:space="preserve">
|
||||
<value>Please select some curtain systems and make them checked first.</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\delete.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="new" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\new.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.UI
|
||||
{
|
||||
partial class CreateCurtainSystemDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.byFaceArrayCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.facesLabel = new System.Windows.Forms.Label();
|
||||
this.selectNoneButton = new System.Windows.Forms.Button();
|
||||
this.createCSButton = new System.Windows.Forms.Button();
|
||||
this.selectAllButton = new System.Windows.Forms.Button();
|
||||
this.facesCheckedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.reverseSelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// byFaceArrayCheckBox
|
||||
//
|
||||
this.byFaceArrayCheckBox.AutoSize = true;
|
||||
this.byFaceArrayCheckBox.Location = new System.Drawing.Point(147, 145);
|
||||
this.byFaceArrayCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.byFaceArrayCheckBox.Name = "byFaceArrayCheckBox";
|
||||
this.byFaceArrayCheckBox.Size = new System.Drawing.Size(159, 21);
|
||||
this.byFaceArrayCheckBox.TabIndex = 2;
|
||||
this.byFaceArrayCheckBox.Text = "Create by &face array";
|
||||
this.byFaceArrayCheckBox.UseVisualStyleBackColor = true;
|
||||
this.byFaceArrayCheckBox.CheckedChanged += new System.EventHandler(this.byFaceArrayCheckBox_CheckedChanged);
|
||||
//
|
||||
// facesLabel
|
||||
//
|
||||
this.facesLabel.AutoSize = true;
|
||||
this.facesLabel.Location = new System.Drawing.Point(12, 16);
|
||||
this.facesLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.facesLabel.Name = "facesLabel";
|
||||
this.facesLabel.Size = new System.Drawing.Size(127, 17);
|
||||
this.facesLabel.TabIndex = 21;
|
||||
this.facesLabel.Text = "Faces of the mass:";
|
||||
//
|
||||
// selectNoneButton
|
||||
//
|
||||
this.selectNoneButton.Location = new System.Drawing.Point(147, 75);
|
||||
this.selectNoneButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.selectNoneButton.Name = "selectNoneButton";
|
||||
this.selectNoneButton.Size = new System.Drawing.Size(159, 28);
|
||||
this.selectNoneButton.TabIndex = 4;
|
||||
this.selectNoneButton.Text = "Select &None";
|
||||
this.selectNoneButton.UseVisualStyleBackColor = true;
|
||||
this.selectNoneButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// createCSButton
|
||||
//
|
||||
this.createCSButton.Location = new System.Drawing.Point(122, 197);
|
||||
this.createCSButton.Margin = new System.Windows.Forms.Padding(7, 7, 4, 7);
|
||||
this.createCSButton.Name = "createCSButton";
|
||||
this.createCSButton.Size = new System.Drawing.Size(88, 28);
|
||||
this.createCSButton.TabIndex = 6;
|
||||
this.createCSButton.Text = "OK";
|
||||
this.createCSButton.UseVisualStyleBackColor = true;
|
||||
this.createCSButton.Click += new System.EventHandler(this.createCSButton_Click);
|
||||
//
|
||||
// selectAllButton
|
||||
//
|
||||
this.selectAllButton.Location = new System.Drawing.Point(147, 42);
|
||||
this.selectAllButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.selectAllButton.Name = "selectAllButton";
|
||||
this.selectAllButton.Size = new System.Drawing.Size(158, 28);
|
||||
this.selectAllButton.TabIndex = 3;
|
||||
this.selectAllButton.Text = "&Select All";
|
||||
this.selectAllButton.UseVisualStyleBackColor = true;
|
||||
this.selectAllButton.Click += new System.EventHandler(this.selectAllButton_Click);
|
||||
//
|
||||
// facesCheckedListBox
|
||||
//
|
||||
this.facesCheckedListBox.CheckOnClick = true;
|
||||
this.facesCheckedListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.facesCheckedListBox.FormattingEnabled = true;
|
||||
this.facesCheckedListBox.Items.AddRange(new object[] {
|
||||
"Face 0",
|
||||
"Face 1",
|
||||
"Face 2",
|
||||
"Face 3",
|
||||
"Face 4",
|
||||
"Face 5"});
|
||||
this.facesCheckedListBox.Location = new System.Drawing.Point(16, 42);
|
||||
this.facesCheckedListBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.facesCheckedListBox.Name = "facesCheckedListBox";
|
||||
this.facesCheckedListBox.Size = new System.Drawing.Size(123, 124);
|
||||
this.facesCheckedListBox.TabIndex = 1;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(218, 197);
|
||||
this.cancelButton.Margin = new System.Windows.Forms.Padding(4, 7, 7, 7);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(88, 28);
|
||||
this.cancelButton.TabIndex = 7;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// reverseSelButton
|
||||
//
|
||||
this.reverseSelButton.Location = new System.Drawing.Point(147, 111);
|
||||
this.reverseSelButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.reverseSelButton.Name = "reverseSelButton";
|
||||
this.reverseSelButton.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.reverseSelButton.Size = new System.Drawing.Size(158, 28);
|
||||
this.reverseSelButton.TabIndex = 22;
|
||||
this.reverseSelButton.Text = "&Reverse Selection";
|
||||
this.reverseSelButton.UseVisualStyleBackColor = true;
|
||||
this.reverseSelButton.Click += new System.EventHandler(this.reverseSelButton_Click);
|
||||
//
|
||||
// CreateCurtainSystemDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(318, 241);
|
||||
this.Controls.Add(this.reverseSelButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.byFaceArrayCheckBox);
|
||||
this.Controls.Add(this.facesLabel);
|
||||
this.Controls.Add(this.selectNoneButton);
|
||||
this.Controls.Add(this.createCSButton);
|
||||
this.Controls.Add(this.selectAllButton);
|
||||
this.Controls.Add(this.facesCheckedListBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CreateCurtainSystemDialog";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Create Curtain System";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CreateCurtainSystemDialog_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox byFaceArrayCheckBox;
|
||||
private System.Windows.Forms.Label facesLabel;
|
||||
private System.Windows.Forms.Button selectNoneButton;
|
||||
private System.Windows.Forms.Button createCSButton;
|
||||
private System.Windows.Forms.Button selectAllButton;
|
||||
private System.Windows.Forms.CheckedListBox facesCheckedListBox;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button reverseSelButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// the winForm for user to create a new curtain system
|
||||
/// </summary>
|
||||
public partial class CreateCurtainSystemDialog : System.Windows.Forms.Form
|
||||
{
|
||||
MyDocument m_mydocument;
|
||||
// the flag for curtain system creation, if it's true, the curtain system
|
||||
// will be created by face array (can't add/remove curtain grids on this kind of curtain system)
|
||||
// otherwise be created by reference array
|
||||
bool m_byFaceArray;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the document of the sample
|
||||
/// </param>
|
||||
public CreateCurtainSystemDialog(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
//
|
||||
// initialize data
|
||||
//
|
||||
// by default, create the curtain system by reference array
|
||||
m_byFaceArray = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check/uncheck the "by face array" flag
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void byFaceArrayCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
m_byFaceArray = byFaceArrayCheckBox.Checked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// select all the faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void selectAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
facesCheckedListBox.SetItemChecked(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reverse the selection
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void reverseSelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = facesCheckedListBox.GetItemChecked(i);
|
||||
// toggle the checked status
|
||||
facesCheckedListBox.SetItemChecked(i, !itemChecked);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// clear the selected faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
facesCheckedListBox.SetItemChecked(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a new curtain system by the selected faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void createCSButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// step 1: get the faces for curtain system creation
|
||||
List<int> checkedIndices = new List<int>();
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = facesCheckedListBox.GetItemChecked(i);
|
||||
|
||||
if (true == itemChecked)
|
||||
{
|
||||
checkedIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// step 2: create the new curtain system
|
||||
m_mydocument.SystemData.CreateCurtainSystem(checkedIndices, m_byFaceArray);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void CreateCurtainSystemDialog_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
// just refresh the main UI
|
||||
m_mydocument.SystemData.CreateCurtainSystem(null, m_byFaceArray);
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void reverseSelection_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}// end of class
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.UI
|
||||
{
|
||||
partial class CurtainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.createCSButton = new System.Windows.Forms.Button();
|
||||
this.cgCheckedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.addCGButton = new System.Windows.Forms.Button();
|
||||
this.cgLabel = new System.Windows.Forms.Label();
|
||||
this.removeCGButton = new System.Windows.Forms.Button();
|
||||
this.facesLabel = new System.Windows.Forms.Label();
|
||||
this.facesCheckedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.exitButton = new System.Windows.Forms.Button();
|
||||
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.operationStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.deleteCSButton = new System.Windows.Forms.Button();
|
||||
this.csListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.mainPanel = new System.Windows.Forms.Panel();
|
||||
this.csLabel = new System.Windows.Forms.Label();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.mainPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// createCSButton
|
||||
//
|
||||
this.createCSButton.Image = global::Revit.SDK.Samples.CurtainSystem.CS.Properties.Resources._new;
|
||||
this.createCSButton.Location = new System.Drawing.Point(16, 192);
|
||||
this.createCSButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.createCSButton.Name = "createCSButton";
|
||||
this.createCSButton.Size = new System.Drawing.Size(32, 30);
|
||||
this.createCSButton.TabIndex = 2;
|
||||
this.createCSButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.createCSButton.UseVisualStyleBackColor = true;
|
||||
this.createCSButton.Click += new System.EventHandler(this.createCSButton_Click);
|
||||
//
|
||||
// cgCheckedListBox
|
||||
//
|
||||
this.cgCheckedListBox.CheckOnClick = true;
|
||||
this.cgCheckedListBox.FormattingEnabled = true;
|
||||
this.cgCheckedListBox.Location = new System.Drawing.Point(454, 27);
|
||||
this.cgCheckedListBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 4);
|
||||
this.cgCheckedListBox.Name = "cgCheckedListBox";
|
||||
this.cgCheckedListBox.Size = new System.Drawing.Size(144, 157);
|
||||
this.cgCheckedListBox.TabIndex = 7;
|
||||
this.cgCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.cgCheckedListBox_ItemCheck);
|
||||
//
|
||||
// addCGButton
|
||||
//
|
||||
this.addCGButton.Location = new System.Drawing.Point(348, 67);
|
||||
this.addCGButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.addCGButton.Name = "addCGButton";
|
||||
this.addCGButton.Size = new System.Drawing.Size(98, 32);
|
||||
this.addCGButton.TabIndex = 5;
|
||||
this.addCGButton.Text = "&Add >>";
|
||||
this.addCGButton.UseVisualStyleBackColor = true;
|
||||
this.addCGButton.Click += new System.EventHandler(this.addCGButton_Click);
|
||||
//
|
||||
// cgLabel
|
||||
//
|
||||
this.cgLabel.AutoSize = true;
|
||||
this.cgLabel.Location = new System.Drawing.Point(451, 7);
|
||||
this.cgLabel.Margin = new System.Windows.Forms.Padding(4, 7, 4, 0);
|
||||
this.cgLabel.Name = "cgLabel";
|
||||
this.cgLabel.Size = new System.Drawing.Size(95, 17);
|
||||
this.cgLabel.TabIndex = 8;
|
||||
this.cgLabel.Text = "Curtain Grids:";
|
||||
//
|
||||
// removeCGButton
|
||||
//
|
||||
this.removeCGButton.Location = new System.Drawing.Point(348, 107);
|
||||
this.removeCGButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.removeCGButton.Name = "removeCGButton";
|
||||
this.removeCGButton.Size = new System.Drawing.Size(98, 32);
|
||||
this.removeCGButton.TabIndex = 6;
|
||||
this.removeCGButton.Text = "<< &Remove";
|
||||
this.removeCGButton.UseVisualStyleBackColor = true;
|
||||
this.removeCGButton.Click += new System.EventHandler(this.removeCGButton_Click);
|
||||
//
|
||||
// facesLabel
|
||||
//
|
||||
this.facesLabel.AutoSize = true;
|
||||
this.facesLabel.Location = new System.Drawing.Point(193, 7);
|
||||
this.facesLabel.Margin = new System.Windows.Forms.Padding(4, 7, 4, 0);
|
||||
this.facesLabel.Name = "facesLabel";
|
||||
this.facesLabel.Size = new System.Drawing.Size(123, 17);
|
||||
this.facesLabel.TabIndex = 0;
|
||||
this.facesLabel.Text = "Uncovered Faces:";
|
||||
//
|
||||
// facesCheckedListBox
|
||||
//
|
||||
this.facesCheckedListBox.CheckOnClick = true;
|
||||
this.facesCheckedListBox.FormattingEnabled = true;
|
||||
this.facesCheckedListBox.Location = new System.Drawing.Point(196, 27);
|
||||
this.facesCheckedListBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 4);
|
||||
this.facesCheckedListBox.Name = "facesCheckedListBox";
|
||||
this.facesCheckedListBox.Size = new System.Drawing.Size(144, 157);
|
||||
this.facesCheckedListBox.TabIndex = 4;
|
||||
this.facesCheckedListBox.SelectedIndexChanged += new System.EventHandler(this.facesCheckedListBox_SelectedIndexChanged);
|
||||
//
|
||||
// exitButton
|
||||
//
|
||||
this.exitButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.exitButton.Location = new System.Drawing.Point(510, 241);
|
||||
this.exitButton.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.exitButton.Name = "exitButton";
|
||||
this.exitButton.Size = new System.Drawing.Size(88, 28);
|
||||
this.exitButton.TabIndex = 8;
|
||||
this.exitButton.Text = "&Close";
|
||||
this.exitButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// statusStrip
|
||||
//
|
||||
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.operationStatusLabel});
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 276);
|
||||
this.statusStrip.Name = "statusStrip";
|
||||
this.statusStrip.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
|
||||
this.statusStrip.Size = new System.Drawing.Size(614, 22);
|
||||
this.statusStrip.SizingGrip = false;
|
||||
this.statusStrip.Stretch = false;
|
||||
this.statusStrip.TabIndex = 12;
|
||||
//
|
||||
// operationStatusLabel
|
||||
//
|
||||
this.operationStatusLabel.Name = "operationStatusLabel";
|
||||
this.operationStatusLabel.Size = new System.Drawing.Size(0, 17);
|
||||
//
|
||||
// deleteCSButton
|
||||
//
|
||||
this.deleteCSButton.Image = global::Revit.SDK.Samples.CurtainSystem.CS.Properties.Resources.delete;
|
||||
this.deleteCSButton.Location = new System.Drawing.Point(56, 192);
|
||||
this.deleteCSButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.deleteCSButton.Name = "deleteCSButton";
|
||||
this.deleteCSButton.Size = new System.Drawing.Size(32, 30);
|
||||
this.deleteCSButton.TabIndex = 3;
|
||||
this.deleteCSButton.UseVisualStyleBackColor = true;
|
||||
this.deleteCSButton.Click += new System.EventHandler(this.deleteCSButton_Click);
|
||||
//
|
||||
// csListBox
|
||||
//
|
||||
this.csListBox.FormattingEnabled = true;
|
||||
this.csListBox.Location = new System.Drawing.Point(16, 27);
|
||||
this.csListBox.Margin = new System.Windows.Forms.Padding(7, 3, 7, 4);
|
||||
this.csListBox.Name = "csListBox";
|
||||
this.csListBox.Size = new System.Drawing.Size(169, 157);
|
||||
this.csListBox.TabIndex = 1;
|
||||
this.csListBox.SelectedIndexChanged += new System.EventHandler(this.csListBox_SelectedIndexChanged);
|
||||
//
|
||||
// mainPanel
|
||||
//
|
||||
this.mainPanel.Controls.Add(this.csListBox);
|
||||
this.mainPanel.Controls.Add(this.deleteCSButton);
|
||||
this.mainPanel.Controls.Add(this.statusStrip);
|
||||
this.mainPanel.Controls.Add(this.exitButton);
|
||||
this.mainPanel.Controls.Add(this.facesCheckedListBox);
|
||||
this.mainPanel.Controls.Add(this.facesLabel);
|
||||
this.mainPanel.Controls.Add(this.removeCGButton);
|
||||
this.mainPanel.Controls.Add(this.cgLabel);
|
||||
this.mainPanel.Controls.Add(this.addCGButton);
|
||||
this.mainPanel.Controls.Add(this.csLabel);
|
||||
this.mainPanel.Controls.Add(this.cgCheckedListBox);
|
||||
this.mainPanel.Controls.Add(this.createCSButton);
|
||||
this.mainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.mainPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.mainPanel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.mainPanel.Name = "mainPanel";
|
||||
this.mainPanel.Size = new System.Drawing.Size(614, 298);
|
||||
this.mainPanel.TabIndex = 0;
|
||||
this.mainPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.mainPanel_Paint);
|
||||
//
|
||||
// csLabel
|
||||
//
|
||||
this.csLabel.AutoSize = true;
|
||||
this.csLabel.Location = new System.Drawing.Point(13, 7);
|
||||
this.csLabel.Margin = new System.Windows.Forms.Padding(4, 7, 4, 0);
|
||||
this.csLabel.Name = "csLabel";
|
||||
this.csLabel.Size = new System.Drawing.Size(114, 17);
|
||||
this.csLabel.TabIndex = 0;
|
||||
this.csLabel.Text = "Curtain Systems:";
|
||||
this.csLabel.Click += new System.EventHandler(this.csLabel_Click);
|
||||
//
|
||||
// CurtainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.exitButton;
|
||||
this.ClientSize = new System.Drawing.Size(614, 298);
|
||||
this.Controls.Add(this.mainPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CurtainForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Curtain System";
|
||||
this.statusStrip.ResumeLayout(false);
|
||||
this.statusStrip.PerformLayout();
|
||||
this.mainPanel.ResumeLayout(false);
|
||||
this.mainPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button createCSButton;
|
||||
private System.Windows.Forms.CheckedListBox cgCheckedListBox;
|
||||
private System.Windows.Forms.Button addCGButton;
|
||||
private System.Windows.Forms.Label cgLabel;
|
||||
private System.Windows.Forms.Button removeCGButton;
|
||||
private System.Windows.Forms.Label facesLabel;
|
||||
private System.Windows.Forms.CheckedListBox facesCheckedListBox;
|
||||
private System.Windows.Forms.Button exitButton;
|
||||
private System.Windows.Forms.StatusStrip statusStrip;
|
||||
private System.Windows.Forms.ToolStripStatusLabel operationStatusLabel;
|
||||
private System.Windows.Forms.Button deleteCSButton;
|
||||
private System.Windows.Forms.CheckedListBox csListBox;
|
||||
private System.Windows.Forms.Panel mainPanel;
|
||||
private System.Windows.Forms.Label csLabel;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// the main window form for UI operations
|
||||
/// </summary>
|
||||
public partial class CurtainForm : System.Windows.Forms.Form
|
||||
{
|
||||
// the document containing all the data used in the sample
|
||||
MyDocument m_mydocument;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the data used in the sample
|
||||
/// </param>
|
||||
public CurtainForm(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
|
||||
InitializeComponent();
|
||||
// initialize some controls manually
|
||||
InitializeCustomComponent();
|
||||
// register the customized events
|
||||
RegisterEvents();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize some controls manually
|
||||
/// </summary>
|
||||
private void InitializeCustomComponent()
|
||||
{
|
||||
this.deleteCSButton.Enabled = false;
|
||||
this.addCGButton.Enabled = false;
|
||||
this.removeCGButton.Enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// register the customized events
|
||||
/// </summary>
|
||||
private void RegisterEvents()
|
||||
{
|
||||
m_mydocument.FatalErrorEvent += new MyDocument.FatalErrorHandler(m_document_FatalErrorEvent);
|
||||
m_mydocument.SystemData.CurtainSystemChanged += new CurtainSystem.SystemData.CurtainSystemChangedHandler(m_document_SystemData_CurtainSystemChanged);
|
||||
// moniter the sample message change status
|
||||
m_mydocument.MessageChanged += new MyDocument.MessageChangedHandler(m_document_MessageChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fatal error occurs, close the sample dialog directly
|
||||
/// </summary>
|
||||
/// <param name="errorMsg">
|
||||
/// the error hint shown to user
|
||||
/// </param>
|
||||
void m_document_FatalErrorEvent(string errorMsg)
|
||||
{
|
||||
// hang the sample and shown the error hint to users
|
||||
TaskDialogResult result = TaskDialog.Show(Properties.Resources.TXT_DialogTitle, errorMsg, TaskDialogCommonButtons.Ok, TaskDialogResult.Ok);
|
||||
// the user has read the hint and clicked the "OK" button, close the dialog
|
||||
if (TaskDialogResult.Ok == result)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// curtain system changed(added/removed), refresh the lists
|
||||
/// </summary>
|
||||
void m_document_SystemData_CurtainSystemChanged()
|
||||
{
|
||||
// clear the out-of-date values
|
||||
csListBox.Items.Clear();
|
||||
facesCheckedListBox.Items.Clear();
|
||||
cgCheckedListBox.Items.Clear();
|
||||
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// no curtain system available, disable the "Delete Curtain System"
|
||||
// "Add curtain grid" and "remove curtain grid" buttons
|
||||
if (null == csInfos ||
|
||||
0 == csInfos.Count)
|
||||
{
|
||||
this.deleteCSButton.Enabled = false;
|
||||
this.addCGButton.Enabled = false;
|
||||
this.removeCGButton.Enabled = false;
|
||||
this.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (CurtainSystem.SystemInfo info in csInfos)
|
||||
{
|
||||
csListBox.Items.Add(info);
|
||||
}
|
||||
|
||||
// activate the last one
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csInfos.Count - 1];
|
||||
// this will invoke the selectedIndexChanged event, then to update the other 2 list boxes
|
||||
csListBox.SetSelected(csInfos.Count - 1, true);
|
||||
// enable the buttons and show the dialog
|
||||
this.deleteCSButton.Enabled = true;
|
||||
// only curtain system which created by reference array supports curtain grid operations
|
||||
if (false == csInfo.ByFaceArray)
|
||||
{
|
||||
this.addCGButton.Enabled = true;
|
||||
this.removeCGButton.Enabled = true;
|
||||
}
|
||||
this.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update the status hints in the status strip
|
||||
/// </summary>
|
||||
void m_document_MessageChanged()
|
||||
{
|
||||
//if it's an error / warning message, set the color of the text to red
|
||||
KeyValuePair<string, bool> message = m_mydocument.Message;
|
||||
if (true == message.Value)
|
||||
{
|
||||
this.operationStatusLabel.ForeColor = System.Drawing.Color.Red;
|
||||
}
|
||||
// it's a common hint message, set the color to black
|
||||
else
|
||||
{
|
||||
this.operationStatusLabel.ForeColor = System.Drawing.Color.Black;
|
||||
}
|
||||
this.operationStatusLabel.Text = message.Key;
|
||||
this.statusStrip.Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Create curtain system" button clicked, hide the main form,
|
||||
/// pop up the create curtain system dialog to let user add a new curtain system.
|
||||
/// After the curtain system created, close the dialog and show the main form again
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void createCSButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
|
||||
// show the "create curtain system" dialog
|
||||
using (CreateCurtainSystemDialog dlg = new CreateCurtainSystemDialog(m_mydocument))
|
||||
{
|
||||
dlg.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delete the checked curtain systems in the curtain system list box
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void deleteCSButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// no curtain system available, ask sample user to create some curtain systems first
|
||||
if (null == csListBox.Items ||
|
||||
0 == csListBox.Items.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_CreateCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the checked curtain sytems
|
||||
List<int> checkedIndices = new List<int>();
|
||||
for (int i = 0; i < csListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = csListBox.GetItemChecked(i);
|
||||
|
||||
if (true == itemChecked)
|
||||
{
|
||||
checkedIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// no curtain system available or no curtain system selected for deletion
|
||||
// update the status hints
|
||||
if (null == checkedIndices ||
|
||||
0 == checkedIndices.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_SelectCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// delete them
|
||||
m_mydocument.SystemData.DeleteCurtainSystem(checkedIndices);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the selected curtain system changed, update the "Curtain grid" and
|
||||
/// "Uncovered faces" list boxes of the selected curtain system
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void csListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// data verification
|
||||
if (null == csInfos ||
|
||||
0 == csInfos.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// step 1: activate the selected one
|
||||
//
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csListBox.SelectedIndex];
|
||||
// update the curtain grid list box
|
||||
cgCheckedListBox.Items.Clear();
|
||||
foreach (int index in csInfo.GridFacesIndices)
|
||||
{
|
||||
CurtainSystem.GridFaceInfo gridFaceInfo = new CurtainSystem.GridFaceInfo(index);
|
||||
cgCheckedListBox.Items.Add(gridFaceInfo);
|
||||
}
|
||||
// update the uncovered face list box
|
||||
facesCheckedListBox.Items.Clear();
|
||||
foreach (int index in csInfo.UncoverFacesIndices)
|
||||
{
|
||||
CurtainSystem.UncoverFaceInfo uncoverFaceInfo = new CurtainSystem.UncoverFaceInfo(index);
|
||||
facesCheckedListBox.Items.Add(uncoverFaceInfo);
|
||||
}
|
||||
//
|
||||
// step 2: enable/disable some buttons and refresh the status hints
|
||||
//
|
||||
// the selected curtain system is created by face array
|
||||
// it's not allowed to modify its curtain grids data
|
||||
if (true == csInfo.ByFaceArray)
|
||||
{
|
||||
// disable the buttons
|
||||
this.addCGButton.Enabled = false;
|
||||
this.removeCGButton.Enabled = false;
|
||||
this.facesCheckedListBox.Enabled = false;
|
||||
this.cgCheckedListBox.Enabled = false;
|
||||
// update the status hints
|
||||
string hint = Properties.Resources.HINT_CSIsByFaceArray;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, false);
|
||||
}
|
||||
// the selected curtain system is created by references of the faces
|
||||
// it's allowed to modify its curtain grids data
|
||||
else
|
||||
{
|
||||
// enable the buttons
|
||||
if (null == facesCheckedListBox.Items ||
|
||||
0 == facesCheckedListBox.Items.Count)
|
||||
{
|
||||
this.addCGButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addCGButton.Enabled = true;
|
||||
}
|
||||
// at least one curtain grid must be kept
|
||||
if (null == cgCheckedListBox.Items ||
|
||||
2 > cgCheckedListBox.Items.Count)
|
||||
{
|
||||
this.removeCGButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeCGButton.Enabled = true;
|
||||
}
|
||||
this.facesCheckedListBox.Enabled = true;
|
||||
this.cgCheckedListBox.Enabled = true;
|
||||
// update the status hints
|
||||
string hint = "";
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add curtain grids to the checked faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void addCGButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// step 1: get the curtain system
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// no curtain system available, ask sample user to create some curtain systems first
|
||||
if (null == csInfos || 0 == csInfos.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_CreateCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csListBox.SelectedIndex];
|
||||
// if the curtain system is created by face array, it's forbidden to make other operations on it
|
||||
if (true == csInfo.ByFaceArray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// step 2: find out the faces to be covered
|
||||
List<int> faceIndices = new List<int>();
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = facesCheckedListBox.GetItemChecked(i);
|
||||
if (true == itemChecked)
|
||||
{
|
||||
CurtainSystem.UncoverFaceInfo info = facesCheckedListBox.Items[i] as CurtainSystem.UncoverFaceInfo;
|
||||
faceIndices.Add(info.Index);
|
||||
}
|
||||
}
|
||||
|
||||
// no uncovered faces selected, warn the sample user
|
||||
if (null == faceIndices ||
|
||||
0 == faceIndices.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_SelectFaceFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// step 3: cover the selected faces with curtain grids
|
||||
csInfo.AddCurtainGrids(faceIndices);
|
||||
// step 4: update the UI list boxes
|
||||
csListBox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove the checked curtain grids from the curtain system
|
||||
/// Note: curtain system must have at least one curtain grid
|
||||
/// so sample users can't remove all the curtain grids away
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void removeCGButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// step 1: get the curtain system
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// no curtain system available, ask sample user to create some curtain systems first
|
||||
if (null == csInfos || 0 == csInfos.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_CreateCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csListBox.SelectedIndex];
|
||||
// if the curtain system is created by face array, it's forbidden to make other operations on it
|
||||
if (true == csInfo.ByFaceArray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// step 2: find out the curtain grids to be removed
|
||||
List<int> faceIndices = new List<int>();
|
||||
for (int i = 0; i < cgCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = cgCheckedListBox.GetItemChecked(i);
|
||||
if (true == itemChecked)
|
||||
{
|
||||
CurtainSystem.GridFaceInfo info = cgCheckedListBox.Items[i] as CurtainSystem.GridFaceInfo;
|
||||
faceIndices.Add(info.FaceIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// no curtain grids selected, warn the sample user
|
||||
if (null == faceIndices ||
|
||||
0 == faceIndices.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_SelectCGFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// step 3: remove the selected curtain grids
|
||||
csInfo.RemoveCurtainGrids(faceIndices);
|
||||
// step 4: update the UI list boxes
|
||||
csListBox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check the curtain grids to delete them, if user wants to check all the curtain
|
||||
/// grids for deletion, prohibit it (must keep at least one curtain grid)
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void cgCheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||
{
|
||||
List<int> indices = new List<int>();
|
||||
// get all the unchecked curtain grids
|
||||
for (int i = 0; i < cgCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = cgCheckedListBox.GetItemChecked(i);
|
||||
if (false == itemChecked)
|
||||
{
|
||||
indices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// for curtain system, we must keep at least one curtain grid
|
||||
// so it's not allowed to select all the curtain grids to remove
|
||||
if (indices.Count <= 1 &&
|
||||
CheckState.Unchecked == e.CurrentValue)
|
||||
{
|
||||
e.NewValue = CheckState.Unchecked;
|
||||
|
||||
// update the status hints
|
||||
string hint = Properties.Resources.HINT_KeepOneCG;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the status hints
|
||||
string hint = "";
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void facesCheckedListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void mainPanel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void csLabel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // end of class
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// Vector4 is a homogeneous coordinate class used to store vector
|
||||
/// and contain method to handle the vector
|
||||
/// </summary>
|
||||
public class Vector4
|
||||
{
|
||||
#region Class member variables and properties
|
||||
private double m_x;
|
||||
private double m_y;
|
||||
private double m_z;
|
||||
private double m_w = 1.0d;
|
||||
|
||||
/// <summary>
|
||||
/// X property to get/set x value of Vector4
|
||||
/// </summary>
|
||||
public double X
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_x;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_x = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Y property to get/set y value of Vector4
|
||||
/// </summary>
|
||||
public double Y
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_y;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_y = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Z property to get/set z value of Vector4
|
||||
/// </summary>
|
||||
public double Z
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_z;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_z = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// W property to get/set fourth value of Vector4
|
||||
/// </summary>
|
||||
public double W
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_w;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_w = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
public Vector4(double x, double y, double z)
|
||||
{
|
||||
this.X = x; this.Y = y; this.Z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor, transfer Autodesk.Revit.DB.XYZ to vector
|
||||
/// </summary>
|
||||
/// <param name="v">Autodesk.Revit.DB.XYZ structure which needs to be transfered</param>
|
||||
public Vector4(Autodesk.Revit.DB.XYZ v)
|
||||
{
|
||||
this.X = (double)v.X; this.Y = (double)v.Y; this.Z = (double)v.Z;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// get normal vector of plane contains two vectors
|
||||
/// </summary>
|
||||
/// <param name="v">second vector</param>
|
||||
/// <returns> normal vector of two vectors</returns>
|
||||
public Vector4 CrossProduct(Vector4 v)
|
||||
{
|
||||
return new Vector4(this.Y * v.Z - this.Z * v.Y, this.Z * v.X
|
||||
- this.X * v.Z, this.X * v.Y - this.Y * v.X);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get normal vector of two vectors
|
||||
/// </summary>
|
||||
/// <param name="va">first vector</param>
|
||||
/// <param name="vb">second vector</param>
|
||||
/// <returns> normal vector of two vectors </returns>
|
||||
public static Vector4 CrossProduct(Vector4 va, Vector4 vb)
|
||||
{
|
||||
return new Vector4(va.Y * vb.Z - va.Z * vb.Y, va.Z * vb.X
|
||||
- va.X * vb.Z, va.X * vb.Y - va.Y * vb.X);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user