added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,113 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Linq;
using System.Text;
using System.IO;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using Autodesk;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
namespace Revit.SDK.Samples.BRepBuilderExample.CS
{
/// <summary>
/// Implements the Revit add-in interface IExternalApplication
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
public class Application : IExternalApplication
{
#region IExternalApplication Members
static String addinAssmeblyPath = typeof(Application).Assembly.Location;
/// <summary>
/// Implements the OnShutdown event
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
/// <summary>
/// Implements the OnStartup event
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnStartup(UIControlledApplication application)
{
createRibbonButtons(application);
return Result.Succeeded;
}
BitmapSource convertFromBitmap(System.Drawing.Bitmap bitmap)
{
return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
bitmap.GetHbitmap(),
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
}
void createRibbonButtons(UIControlledApplication application)
{
application.CreateRibbonTab("Create Geometry");
RibbonPanel rp = application.CreateRibbonPanel("Create Geometry", "Create Geometry using BRepBuilder");
PushButtonData pbd1 = new PushButtonData("CreateCube", "Create Cube",
addinAssmeblyPath,
"Revit.SDK.Samples.BRepBuilderExample.CS.CreateCube");
pbd1.LargeImage = convertFromBitmap(Revit.SDK.Samples.BRepBuilderExample.CS.Properties.Resources.large_shape);
pbd1.Image = convertFromBitmap(Revit.SDK.Samples.BRepBuilderExample.CS.Properties.Resources.small_shape);
PushButton pb1 = rp.AddItem(pbd1) as PushButton;
PushButtonData pbd2 = new PushButtonData("CreateNURBS", "Create NURBS Surface",
addinAssmeblyPath,
"Revit.SDK.Samples.BRepBuilderExample.CS.CreateNURBS");
pbd2.LargeImage = convertFromBitmap(Revit.SDK.Samples.BRepBuilderExample.CS.Properties.Resources.large_shape);
pbd2.Image = convertFromBitmap(Revit.SDK.Samples.BRepBuilderExample.CS.Properties.Resources.small_shape);
PushButton pb2 = rp.AddItem(pbd2) as PushButton;
PushButtonData pbd3 = new PushButtonData("CreatePeriodic", "Create Periodic Surface",
addinAssmeblyPath,
"Revit.SDK.Samples.BRepBuilderExample.CS.CreatePeriodic");
pbd3.LargeImage = convertFromBitmap(Revit.SDK.Samples.BRepBuilderExample.CS.Properties.Resources.large_shape);
pbd3.Image = convertFromBitmap(Revit.SDK.Samples.BRepBuilderExample.CS.Properties.Resources.small_shape);
PushButton pb3 = rp.AddItem(pbd3) as PushButton;
}
#endregion
}
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Application">
<Name>BRepBuilderExample</Name>
<Assembly>BRepBuilderExample.dll</Assembly>
<ClientId>2a66f35e-e1ce-469d-9f92-c33ac995f29d</ClientId>
<FullClassName>Revit.SDK.Samples.BRepBuilderExample.CS.Application</FullClassName>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{64730D77-160D-4DA4-9708-66FDD4CAF8FE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Revit.SDK.Samples.BRepBuilderExample.CS</RootNamespace>
<AssemblyName>BRepBuilderExample</AssemblyName>
<StartupObject>
</StartupObject>
<TargetFrameworkVersion>v4.8</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>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DocumentationFile>bin\Debug\BRepBuilderExample.XML</DocumentationFile>
</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>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="System.Core">
<RequiredTargetFramework>4.5.2</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Application.cs" />
<Compile Include="CreateCube.cs" />
<Compile Include="CreateNURBS.cs" />
<Compile Include="CreatePeriodic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Resources\large_shape.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\small_shape.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</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>
</Project>
@@ -0,0 +1,219 @@
//
// (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.Linq;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.BRepBuilderExample.CS
{
/// <summary>
/// Implement method Execute of this class as an external command for Revit.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class CreateCube : IExternalCommand
{
/// <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 canceled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
_dbdocument = commandData.Application.ActiveUIDocument.Document;
try
{
Solid mySolid = CreateCubeImpl().GetResult();
if(null == mySolid)
return Result.Failed;
using (Autodesk.Revit.DB.Transaction tran = new Autodesk.Revit.DB.Transaction(_dbdocument, "CreateCube"))
{
tran.Start();
DirectShape dsCubed = DirectShape.CreateElement(_dbdocument, new ElementId(BuiltInCategory.OST_Walls));
if (null == dsCubed)
return Result.Failed;
dsCubed.ApplicationId = "TestCreateCube";
dsCubed.ApplicationDataId = "Cube";
List<GeometryObject> shapes = new List<GeometryObject>();
shapes.Add(mySolid);
dsCubed.SetShape(shapes, DirectShapeTargetViewType.Default);
tran.Commit();
}
}
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
}
return Result.Succeeded;
}
private BRepBuilder CreateCubeImpl()
{
// create a BRepBuilder; add faces to build a cube
BRepBuilder brepBuilder = new BRepBuilder(BRepType.Solid);
// a cube 100x100x100, from (0,0,0) to (100, 100, 100)
// 1. Planes.
// naming convention for faces and planes:
// We are looking at this cube in an isometric view. X is down and to the left of us, Y is horizontal and points to the right, Z is up.
// front and back faces are along the X axis, left and right are along the Y axis, top and bottom are along the Z axis.
Plane bottom = Plane.CreateByOriginAndBasis(new XYZ(50, 50, 0), new XYZ(1, 0, 0), new XYZ(0, 1, 0)); // bottom. XY plane, Z = 0, normal pointing inside the cube.
Plane top = Plane.CreateByOriginAndBasis(new XYZ(50, 50, 100), new XYZ(1, 0, 0), new XYZ(0, 1, 0)); // top. XY plane, Z = 100, normal pointing outside the cube.
Plane front = Plane.CreateByOriginAndBasis(new XYZ(100, 50, 50), new XYZ(0, 0, 1), new XYZ(0, 1, 0)); // front side. ZY plane, X = 0, normal pointing inside the cube.
Plane back = Plane.CreateByOriginAndBasis(new XYZ(0, 50, 50), new XYZ(0, 0, 1), new XYZ(0, 1, 0)); // back side. ZY plane, X = 0, normal pointing outside the cube.
Plane left = Plane.CreateByOriginAndBasis(new XYZ(50, 0, 50), new XYZ(0, 0, 1), new XYZ(1, 0, 0)); // left side. ZX plane, Y = 0, normal pointing inside the cube
Plane right = Plane.CreateByOriginAndBasis(new XYZ(50, 100, 50), new XYZ(0, 0, 1), new XYZ(1, 0, 0)); // right side. ZX plane, Y = 100, normal pointing outside the cube
//Note that the alternating of "inside/outside" matches the alternating of "true/false" in the next block that defines faces.
//There must be a correspondence to ensure that all faces are correctly oriented to point out of the solid.
// 2. Faces.
BRepBuilderGeometryId faceId_Bottom = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(bottom, null), true);
BRepBuilderGeometryId faceId_Top = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(top, null), false);
BRepBuilderGeometryId faceId_Front = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(front, null), true);
BRepBuilderGeometryId faceId_Back = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(back, null), false);
BRepBuilderGeometryId faceId_Left = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(left, null), true);
BRepBuilderGeometryId faceId_Right = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(right, null), false);
// 3. Edges.
// 3.a (define edge geometry)
// walk around bottom face
BRepBuilderEdgeGeometry edgeBottomFront = BRepBuilderEdgeGeometry.Create(new XYZ(100, 0, 0), new XYZ(100, 100, 0));
BRepBuilderEdgeGeometry edgeBottomRight = BRepBuilderEdgeGeometry.Create(new XYZ(100, 100, 0), new XYZ(0, 100, 0));
BRepBuilderEdgeGeometry edgeBottomBack = BRepBuilderEdgeGeometry.Create(new XYZ(0, 100, 0), new XYZ(0, 0, 0));
BRepBuilderEdgeGeometry edgeBottomLeft = BRepBuilderEdgeGeometry.Create(new XYZ(0, 0, 0), new XYZ(100, 0, 0));
// now walk around top face
BRepBuilderEdgeGeometry edgeTopFront = BRepBuilderEdgeGeometry.Create(new XYZ(100, 0, 100), new XYZ(100, 100, 100));
BRepBuilderEdgeGeometry edgeTopRight = BRepBuilderEdgeGeometry.Create(new XYZ(100, 100, 100), new XYZ(0, 100, 100));
BRepBuilderEdgeGeometry edgeTopBack = BRepBuilderEdgeGeometry.Create(new XYZ(0, 100, 100), new XYZ(0, 0, 100));
BRepBuilderEdgeGeometry edgeTopLeft = BRepBuilderEdgeGeometry.Create(new XYZ(0, 0, 100), new XYZ(100, 0, 100));
// sides
BRepBuilderEdgeGeometry edgeFrontRight = BRepBuilderEdgeGeometry.Create(new XYZ(100, 100, 0), new XYZ(100, 100, 100));
BRepBuilderEdgeGeometry edgeRightBack = BRepBuilderEdgeGeometry.Create(new XYZ(0, 100, 0), new XYZ(0, 100, 100));
BRepBuilderEdgeGeometry edgeBackLeft = BRepBuilderEdgeGeometry.Create(new XYZ(0, 0, 0), new XYZ(0, 0, 100));
BRepBuilderEdgeGeometry edgeLeftFront = BRepBuilderEdgeGeometry.Create(new XYZ(100, 0, 0), new XYZ(100, 0, 100));
// 3.b (define the edges themselves)
BRepBuilderGeometryId edgeId_BottomFront = brepBuilder.AddEdge(edgeBottomFront);
BRepBuilderGeometryId edgeId_BottomRight = brepBuilder.AddEdge(edgeBottomRight);
BRepBuilderGeometryId edgeId_BottomBack = brepBuilder.AddEdge(edgeBottomBack);
BRepBuilderGeometryId edgeId_BottomLeft = brepBuilder.AddEdge(edgeBottomLeft);
BRepBuilderGeometryId edgeId_TopFront = brepBuilder.AddEdge(edgeTopFront);
BRepBuilderGeometryId edgeId_TopRight = brepBuilder.AddEdge(edgeTopRight);
BRepBuilderGeometryId edgeId_TopBack = brepBuilder.AddEdge(edgeTopBack);
BRepBuilderGeometryId edgeId_TopLeft = brepBuilder.AddEdge(edgeTopLeft);
BRepBuilderGeometryId edgeId_FrontRight = brepBuilder.AddEdge(edgeFrontRight);
BRepBuilderGeometryId edgeId_RightBack = brepBuilder.AddEdge(edgeRightBack);
BRepBuilderGeometryId edgeId_BackLeft = brepBuilder.AddEdge(edgeBackLeft);
BRepBuilderGeometryId edgeId_LeftFront = brepBuilder.AddEdge(edgeLeftFront);
// 4. Loops.
BRepBuilderGeometryId loopId_Bottom = brepBuilder.AddLoop(faceId_Bottom);
BRepBuilderGeometryId loopId_Top = brepBuilder.AddLoop(faceId_Top);
BRepBuilderGeometryId loopId_Front = brepBuilder.AddLoop(faceId_Front);
BRepBuilderGeometryId loopId_Back = brepBuilder.AddLoop(faceId_Back);
BRepBuilderGeometryId loopId_Right = brepBuilder.AddLoop(faceId_Right);
BRepBuilderGeometryId loopId_Left = brepBuilder.AddLoop(faceId_Left);
// 5. Co-edges.
// Bottom face. All edges reversed
brepBuilder.AddCoEdge(loopId_Bottom, edgeId_BottomFront, true); // other direction in front loop
brepBuilder.AddCoEdge(loopId_Bottom, edgeId_BottomLeft, true); // other direction in left loop
brepBuilder.AddCoEdge(loopId_Bottom, edgeId_BottomBack, true); // other direction in back loop
brepBuilder.AddCoEdge(loopId_Bottom, edgeId_BottomRight, true); // other direction in right loop
brepBuilder.FinishLoop(loopId_Bottom);
brepBuilder.FinishFace(faceId_Bottom);
// Top face. All edges NOT reversed.
brepBuilder.AddCoEdge(loopId_Top, edgeId_TopFront, false); // other direction in front loop.
brepBuilder.AddCoEdge(loopId_Top, edgeId_TopRight, false); // other direction in right loop
brepBuilder.AddCoEdge(loopId_Top, edgeId_TopBack, false); // other direction in back loop
brepBuilder.AddCoEdge(loopId_Top, edgeId_TopLeft, false); // other direction in left loop
brepBuilder.FinishLoop(loopId_Top);
brepBuilder.FinishFace(faceId_Top);
// Front face.
brepBuilder.AddCoEdge(loopId_Front, edgeId_BottomFront, false); // other direction in bottom loop
brepBuilder.AddCoEdge(loopId_Front, edgeId_FrontRight, false); // other direction in right loop
brepBuilder.AddCoEdge(loopId_Front, edgeId_TopFront, true); // other direction in top loop.
brepBuilder.AddCoEdge(loopId_Front, edgeId_LeftFront, true); // other direction in left loop.
brepBuilder.FinishLoop(loopId_Front);
brepBuilder.FinishFace(faceId_Front);
// Back face
brepBuilder.AddCoEdge(loopId_Back, edgeId_BottomBack, false); // other direction in bottom loop
brepBuilder.AddCoEdge(loopId_Back, edgeId_BackLeft, false); // other direction in left loop.
brepBuilder.AddCoEdge(loopId_Back, edgeId_TopBack, true); // other direction in top loop
brepBuilder.AddCoEdge(loopId_Back, edgeId_RightBack, true); // other direction in right loop.
brepBuilder.FinishLoop(loopId_Back);
brepBuilder.FinishFace(faceId_Back);
// Right face
brepBuilder.AddCoEdge(loopId_Right, edgeId_BottomRight, false); // other direction in bottom loop
brepBuilder.AddCoEdge(loopId_Right, edgeId_RightBack, false); // other direction in back loop
brepBuilder.AddCoEdge(loopId_Right, edgeId_TopRight, true); // other direction in top loop
brepBuilder.AddCoEdge(loopId_Right, edgeId_FrontRight, true); // other direction in front loop
brepBuilder.FinishLoop(loopId_Right);
brepBuilder.FinishFace(faceId_Right);
// Left face
brepBuilder.AddCoEdge(loopId_Left, edgeId_BottomLeft, false); // other direction in bottom loop
brepBuilder.AddCoEdge(loopId_Left, edgeId_LeftFront, false); // other direction in front loop
brepBuilder.AddCoEdge(loopId_Left, edgeId_TopLeft, true); // other direction in top loop
brepBuilder.AddCoEdge(loopId_Left, edgeId_BackLeft, true); // other direction in back loop
brepBuilder.FinishLoop(loopId_Left);
brepBuilder.FinishFace(faceId_Left);
brepBuilder.Finish();
return brepBuilder;
}
private Document _dbdocument = null;
}
}
@@ -0,0 +1,152 @@
//
// (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.Linq;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.BRepBuilderExample.CS
{
/// <summary>
/// Implement method Execute of this class as an external command for Revit.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class CreateNURBS : IExternalCommand
{
/// <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 canceled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
_dbdocument = commandData.Application.ActiveUIDocument.Document;
try
{
using (Autodesk.Revit.DB.Transaction tr = new Autodesk.Revit.DB.Transaction(_dbdocument, "CreateNURBS"))
{
tr.Start();
DirectShape myDirectShape = DirectShape.CreateElement(_dbdocument, new ElementId(BuiltInCategory.OST_GenericModel));
myDirectShape.ApplicationId = "TestCreateNURBS";
myDirectShape.ApplicationDataId = "NURBS";
if(null != myDirectShape)
myDirectShape.SetShape(CreateNurbsSurface());
tr.Commit();
}
}
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
}
return Result.Succeeded;
}
private BRepBuilder CreateNurbsSurface()
{
//Note that we are not creating a closed solid here. It is an open shell.
BRepBuilder brepBuilder = new BRepBuilder(BRepType.OpenShell);
// Create NURBS surface
IList<double> knotsU = new List<double> { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 };
IList<double> knotsV = new List<double> { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 };
int degreeU = 4;
int degreeV = 4;
IList<XYZ> controlPoints = new List<XYZ>
{
new XYZ(0, 0, 0), new XYZ(0, 20, 0), new XYZ(0, 40, 0), new XYZ(0, 60, 0), new XYZ(0, 80, 0),
new XYZ(20, 0, 100), new XYZ(20, 20, 200), new XYZ(20, 40, 300), new XYZ(20, 60, 200), new XYZ(20, 80, 100),
new XYZ(40, 0, -100), new XYZ(40, 20, -250), new XYZ(40, 40, -300), new XYZ(40, 60, -250), new XYZ(40, 80, -100),
new XYZ(60, 0, 100), new XYZ(60, 20, 200), new XYZ(60, 40, 300), new XYZ(60, 60, 200), new XYZ(60, 80, 100),
new XYZ(80, 0, 0), new XYZ(80, 20, 0), new XYZ(80, 40, 0), new XYZ(80, 60, 0), new XYZ(80, 80, 0)
};
BRepBuilderSurfaceGeometry nurbsSurface = BRepBuilderSurfaceGeometry.CreateNURBSSurface(degreeU, degreeV, knotsU, knotsV, controlPoints, false/*bReverseOrientation*/, null /*pSurfaceEnvelope*/);
// Create 4 NURBS curves defining the boundary of the NURBS surface that has just been created
IList<double> weights = new List<double> { 1, 1, 1, 1, 1 };
IList<XYZ> backEdgeControlPoints = new List<XYZ> { new XYZ(0, 0, 0), new XYZ(0, 20, 0), new XYZ(0, 40, 0), new XYZ(0, 60, 0), new XYZ(0, 80, 0) };
Curve backNurbs = NurbSpline.CreateCurve(4, knotsU, backEdgeControlPoints, weights);
BRepBuilderEdgeGeometry backEdge = BRepBuilderEdgeGeometry.Create(backNurbs);
IList<XYZ> frontEdgeControlPoints = new List<XYZ> { new XYZ(80, 0, 0), new XYZ(80, 20, 0), new XYZ(80, 40, 0), new XYZ(80, 60, 0), new XYZ(80, 80, 0) };
Curve frontNurbs = NurbSpline.CreateCurve(4, knotsU, frontEdgeControlPoints, weights);
BRepBuilderEdgeGeometry frontEdge = BRepBuilderEdgeGeometry.Create(frontNurbs);
IList<XYZ> leftEdgeControlPoints = new List<XYZ> { new XYZ(0, 0, 0), new XYZ(20, 0, 100), new XYZ(40, 0, -100), new XYZ(60, 0, 100), new XYZ(80, 0, 0) };
Curve leftNurbs = NurbSpline.CreateCurve(4, knotsU, leftEdgeControlPoints, weights);
BRepBuilderEdgeGeometry leftEdge = BRepBuilderEdgeGeometry.Create(leftNurbs);
IList<XYZ> rightEdgeControlPoints = new List<XYZ> { new XYZ(0, 80, 0), new XYZ(20, 80, 100), new XYZ(40, 80, -100), new XYZ(60, 80, 100), new XYZ(80, 80, 0) };
Curve rightNurbs = NurbSpline.CreateCurve(4, knotsU, rightEdgeControlPoints, weights);
BRepBuilderEdgeGeometry rightEdge = BRepBuilderEdgeGeometry.Create(rightNurbs);
// Add the geometries to the brepBuilder
BRepBuilderGeometryId nurbSplineFaceId = brepBuilder.AddFace(nurbsSurface, false);
BRepBuilderGeometryId loopId = brepBuilder.AddLoop(nurbSplineFaceId);
BRepBuilderGeometryId backEdgeId = brepBuilder.AddEdge(backEdge);
BRepBuilderGeometryId frontEdgeId = brepBuilder.AddEdge(frontEdge);
BRepBuilderGeometryId leftEdgeId = brepBuilder.AddEdge(leftEdge);
BRepBuilderGeometryId rightEdgeId = brepBuilder.AddEdge(rightEdge);
// Add each edge to the loop
brepBuilder.AddCoEdge(loopId, backEdgeId, true);
brepBuilder.AddCoEdge(loopId, leftEdgeId, false);
brepBuilder.AddCoEdge(loopId, frontEdgeId, false);
brepBuilder.AddCoEdge(loopId, rightEdgeId, true);
brepBuilder.FinishLoop(loopId);
brepBuilder.FinishFace(nurbSplineFaceId);
brepBuilder.Finish();
return brepBuilder;
}
private Document _dbdocument = null;
}
}
@@ -0,0 +1,262 @@
//
// (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.Linq;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.BRepBuilderExample.CS
{
/// <summary>
/// Implement method Execute of this class as an external command for Revit.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class CreatePeriodic : IExternalCommand
{
/// <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 canceled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
_dbdocument = commandData.Application.ActiveUIDocument.Document;
try
{
CreateCylinder();
CreateTruncatedCone();
}
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
}
return Result.Succeeded;
}
/// <summary>
/// Create a DirectShape element from a BRepBuilder object and keep it in the _dbdocument.
/// The main purpose is to display the BRepBuilder objects created.
/// In this function, the BrepBuilder is directly set to a DirectShape.
/// </summary>
/// <param name="myBRepBuilder"> The BRepBuilder object.</param>
/// <param name="name"> Name of the BRepBuilder object, which will be passed on to the DirectShape creation method.</param>
private void createDirectShapeElementFromBrepBuilderObject(BRepBuilder myBRepBuilder, String name)
{
if (!myBRepBuilder.IsResultAvailable())
return;
using (Transaction tr = new Transaction(_dbdocument, "Create a DirectShape"))
{
tr.Start();
DirectShape myDirectShape = DirectShape.CreateElement(_dbdocument, new ElementId(BuiltInCategory.OST_GenericModel));
myDirectShape.ApplicationId = "TestBRepBuilder";
myDirectShape.ApplicationDataId = name;
if(null != myDirectShape)
myDirectShape.SetShape(myBRepBuilder);
tr.Commit();
}
}
private void CreateCylinder()
{
// Naming convention for faces and edges: we assume that x is to the left and pointing down, y is horizontal and pointing to the right, z is up
BRepBuilder brepBuilder = new BRepBuilder(BRepType.Solid);
// The surfaces of the four faces.
Frame basis = new Frame(new XYZ(50, -100, 0), new XYZ(0, 1, 0), new XYZ(-1, 0, 0), new XYZ(0, 0, 1));
// Note that we do not have to create two identical surfaces here. The same surface can be used for multiple faces,
// since BRepBuilderSurfaceGeometry::Create() copies the input surface.
// Thus, potentially we could have only one surface here,
// but we must create at least two faces below to account for periodicity.
CylindricalSurface frontCylSurf = CylindricalSurface.Create(basis, 50);
CylindricalSurface backCylSurf = CylindricalSurface.Create(basis, 50);
Plane top = Plane.CreateByNormalAndOrigin(new XYZ(0, 0, 1), new XYZ(0, 0, 100)); // normal points outside the cylinder
Plane bottom = Plane.CreateByNormalAndOrigin(new XYZ(0, 0, 1), new XYZ(0, 0, 0)); // normal points inside the cylinder
// Note that the alternating of "inside/outside" matches the alternating of "true/false" in the next block that defines faces.
// There must be a correspondence to ensure that all faces are correctly oriented to point out of the solid.
// Add the four faces
BRepBuilderGeometryId frontCylFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(frontCylSurf, null), false);
BRepBuilderGeometryId backCylFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(backCylSurf, null), false);
BRepBuilderGeometryId topFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(top, null), false);
BRepBuilderGeometryId bottomFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(bottom, null), true);
// Geometry for the four semi-circular edges and two vertical linear edges
BRepBuilderEdgeGeometry frontEdgeBottom = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(0, -100, 0), new XYZ(100, -100, 0), new XYZ(50, -50, 0)));
BRepBuilderEdgeGeometry backEdgeBottom = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(100, -100, 0), new XYZ(0, -100, 0), new XYZ(50, -150, 0)));
BRepBuilderEdgeGeometry frontEdgeTop = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(0, -100, 100), new XYZ(100, -100, 100), new XYZ(50, -50, 100)));
BRepBuilderEdgeGeometry backEdgeTop = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(0, -100, 100), new XYZ(100, -100, 100), new XYZ(50, -150, 100)));
BRepBuilderEdgeGeometry linearEdgeFront = BRepBuilderEdgeGeometry.Create(new XYZ(100, -100, 0), new XYZ(100, -100, 100));
BRepBuilderEdgeGeometry linearEdgeBack = BRepBuilderEdgeGeometry.Create(new XYZ(0, -100, 0), new XYZ(0, -100, 100));
// Add the six edges
BRepBuilderGeometryId frontEdgeBottomId = brepBuilder.AddEdge(frontEdgeBottom);
BRepBuilderGeometryId frontEdgeTopId = brepBuilder.AddEdge(frontEdgeTop);
BRepBuilderGeometryId linearEdgeFrontId = brepBuilder.AddEdge(linearEdgeFront);
BRepBuilderGeometryId linearEdgeBackId = brepBuilder.AddEdge(linearEdgeBack);
BRepBuilderGeometryId backEdgeBottomId = brepBuilder.AddEdge(backEdgeBottom);
BRepBuilderGeometryId backEdgeTopId = brepBuilder.AddEdge(backEdgeTop);
// Loops of the four faces
BRepBuilderGeometryId loopId_Top = brepBuilder.AddLoop(topFaceId);
BRepBuilderGeometryId loopId_Bottom = brepBuilder.AddLoop(bottomFaceId);
BRepBuilderGeometryId loopId_Front = brepBuilder.AddLoop(frontCylFaceId);
BRepBuilderGeometryId loopId_Back = brepBuilder.AddLoop(backCylFaceId);
// Add coedges for the loop of the front face
brepBuilder.AddCoEdge(loopId_Front, linearEdgeBackId, false);
brepBuilder.AddCoEdge(loopId_Front, frontEdgeTopId, false);
brepBuilder.AddCoEdge(loopId_Front, linearEdgeFrontId, true);
brepBuilder.AddCoEdge(loopId_Front, frontEdgeBottomId, true);
brepBuilder.FinishLoop(loopId_Front);
brepBuilder.FinishFace(frontCylFaceId);
// Add coedges for the loop of the back face
brepBuilder.AddCoEdge(loopId_Back, linearEdgeBackId, true);
brepBuilder.AddCoEdge(loopId_Back, backEdgeBottomId, true);
brepBuilder.AddCoEdge(loopId_Back, linearEdgeFrontId, false);
brepBuilder.AddCoEdge(loopId_Back, backEdgeTopId, true);
brepBuilder.FinishLoop(loopId_Back);
brepBuilder.FinishFace(backCylFaceId);
// Add coedges for the loop of the top face
brepBuilder.AddCoEdge(loopId_Top, backEdgeTopId, false);
brepBuilder.AddCoEdge(loopId_Top, frontEdgeTopId, true);
brepBuilder.FinishLoop(loopId_Top);
brepBuilder.FinishFace(topFaceId);
// Add coedges for the loop of the bottom face
brepBuilder.AddCoEdge(loopId_Bottom, frontEdgeBottomId, false);
brepBuilder.AddCoEdge(loopId_Bottom, backEdgeBottomId, false);
brepBuilder.FinishLoop(loopId_Bottom);
brepBuilder.FinishFace(bottomFaceId);
brepBuilder.Finish();
createDirectShapeElementFromBrepBuilderObject(brepBuilder, "Full cylinder");
}
private void CreateTruncatedCone()
{
BRepBuilder brepBuilder = new BRepBuilder(BRepType.Solid);
Plane bottom = Plane.CreateByNormalAndOrigin(new XYZ(0, 0, -1), new XYZ(0, 0, 0));
Plane top = Plane.CreateByNormalAndOrigin(new XYZ(0, 0, 1), new XYZ(0, 0, 50));
Frame basis = new Frame(new XYZ(0, 0, 100), new XYZ(0, 1, 0), new XYZ(1, 0, 0), new XYZ(0, 0, -1));
// Note that we do not have to create two identical surfaces here. The same surface can be used for multiple faces,
// since BRepBuilderSurfaceGeometry::Create() copies the input surface.
// Thus, potentially we could have only one surface here,
// but we must create at least two faces below to account for periodicity.
ConicalSurface rightConicalSurface = ConicalSurface.Create(basis, Math.Atan(0.5));
ConicalSurface leftConicalSurface = ConicalSurface.Create(basis, Math.Atan(0.5));
// Create 4 faces of the cone
BRepBuilderGeometryId topFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(top, null), false);
BRepBuilderGeometryId bottomFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(bottom, null), false);
BRepBuilderGeometryId rightSideFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(rightConicalSurface, null), false);
BRepBuilderGeometryId leftSideFaceId = brepBuilder.AddFace(BRepBuilderSurfaceGeometry.Create(leftConicalSurface, null), false);
// Create 2 edges at the bottom of the cone
BRepBuilderEdgeGeometry bottomRightEdgeGeom = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(-50, 0, 0), new XYZ(50, 0, 0), new XYZ(0, 50, 0)));
BRepBuilderEdgeGeometry bottomLeftEdgeGeom = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(50, 0, 0), new XYZ(-50, 0, 0), new XYZ(0, -50, 0)));
// Create 2 edges at the top of the cone
BRepBuilderEdgeGeometry topLeftEdgeGeom = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(-25, 0, 50), new XYZ(25, 0, 50), new XYZ(0, -25, 50)));
BRepBuilderEdgeGeometry topRightEdgeGeom = BRepBuilderEdgeGeometry.Create(Arc.Create(new XYZ(25, 0, 50), new XYZ(-25, 0, 50), new XYZ(0, 25, 50)));
// Create 2 side edges of the cone
BRepBuilderEdgeGeometry sideFrontEdgeGeom = BRepBuilderEdgeGeometry.Create(new XYZ(25, 0, 50), new XYZ(50, 0, 0));
BRepBuilderEdgeGeometry sideBackEdgeGeom = BRepBuilderEdgeGeometry.Create(new XYZ(-25, 0, 50), new XYZ(-50, 0, 0));
BRepBuilderGeometryId bottomRightId = brepBuilder.AddEdge(bottomRightEdgeGeom);
BRepBuilderGeometryId bottomLeftId = brepBuilder.AddEdge(bottomLeftEdgeGeom);
BRepBuilderGeometryId topRightEdgeId = brepBuilder.AddEdge(topRightEdgeGeom);
BRepBuilderGeometryId topLeftEdgeId = brepBuilder.AddEdge(topLeftEdgeGeom);
BRepBuilderGeometryId sideFrontEdgeid = brepBuilder.AddEdge(sideFrontEdgeGeom);
BRepBuilderGeometryId sideBackEdgeId = brepBuilder.AddEdge(sideBackEdgeGeom);
// Create bottom face
BRepBuilderGeometryId bottomLoopId = brepBuilder.AddLoop(bottomFaceId);
brepBuilder.AddCoEdge(bottomLoopId, bottomRightId, false);
brepBuilder.AddCoEdge(bottomLoopId, bottomLeftId, false);
brepBuilder.FinishLoop(bottomLoopId);
brepBuilder.FinishFace(bottomFaceId);
// Create top face
BRepBuilderGeometryId topLoopId = brepBuilder.AddLoop(topFaceId);
brepBuilder.AddCoEdge(topLoopId, topLeftEdgeId, false);
brepBuilder.AddCoEdge(topLoopId, topRightEdgeId, false);
brepBuilder.FinishLoop(topLoopId);
brepBuilder.FinishFace(topFaceId);
// Create right face
BRepBuilderGeometryId rightLoopId = brepBuilder.AddLoop(rightSideFaceId);
brepBuilder.AddCoEdge(rightLoopId, topRightEdgeId, true);
brepBuilder.AddCoEdge(rightLoopId, sideFrontEdgeid, false);
brepBuilder.AddCoEdge(rightLoopId, bottomRightId, true);
brepBuilder.AddCoEdge(rightLoopId, sideBackEdgeId, true);
brepBuilder.FinishLoop(rightLoopId);
brepBuilder.FinishFace(rightSideFaceId);
// Create left face
BRepBuilderGeometryId leftLoopId = brepBuilder.AddLoop(leftSideFaceId);
brepBuilder.AddCoEdge(leftLoopId, topLeftEdgeId, true);
brepBuilder.AddCoEdge(leftLoopId, sideBackEdgeId, false);
brepBuilder.AddCoEdge(leftLoopId, bottomLeftId, true);
brepBuilder.AddCoEdge(leftLoopId, sideFrontEdgeid, true);
brepBuilder.FinishLoop(leftLoopId);
brepBuilder.FinishFace(leftSideFaceId);
brepBuilder.Finish();
createDirectShapeElementFromBrepBuilderObject(brepBuilder, "Cone surface");
}
private Document _dbdocument = null;
}
}
@@ -0,0 +1,55 @@
//
// (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.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("BRepBuilderExample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2016")]
[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("c93ddfa5-52cf-4425-966c-77f509aed4e8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <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.BRepBuilderExample.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.BRepBuilderExample.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 large_shape {
get {
object obj = ResourceManager.GetObject("large_shape", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap small_shape {
get {
object obj = ResourceManager.GetObject("small_shape", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
@@ -0,0 +1,127 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="large_shape" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\large_shape.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="small_shape" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\small_shape.png;System.Drawing.Bitmap, System.Drawing, Version=4.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: 405 B