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
+140
View File
@@ -0,0 +1,140 @@
//
// (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 Autodesk.Revit.DB.Structure;
namespace Revit.SDK.Samples.InPlaceMembers.CS
{
/// <summary>
/// This command shows how to get In-place Family instance properties and
/// paint it AnalyticalModel profile on a PictureBox.
/// </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)]
public class Command : IExternalCommand
{
static ExternalCommandData m_commandData;
/// <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)
{
m_commandData = commandData;
Transaction transaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "External Tool");
FamilyInstance inPlace = null;
AnalyticalModel model = null;
try
{
transaction.Start();
if (!PrepareData(ref inPlace, ref model))
{
message = "You should select only one in place member which have analytical model.";
return Autodesk.Revit.UI.Result.Failed;
}
GraphicsData graphicsData = GraphicsDataFactory.CreateGraphicsData(model);
Properties instanceProperties = new Properties(inPlace);
InPlaceMembersForm form = new InPlaceMembersForm(instanceProperties, graphicsData);
if (form.ShowDialog() == System.Windows.Forms.DialogResult.Abort)
{
return Autodesk.Revit.UI.Result.Failed;
}
return Autodesk.Revit.UI.Result.Succeeded;
}
catch (Exception e)
{
message = e.Message;
return Autodesk.Revit.UI.Result.Failed;
}
finally
{
transaction.Commit();
}
}
/// <summary>
/// Search for the In-Place family instance's properties data to be listed
/// and graphics data to be drawn.
/// </summary>
/// <param name="inPlaceMember">properties data to be listed</param>
/// <param name="model">graphics data to be draw</param>
/// <returns>Returns true if retrieved this data</returns>
private bool PrepareData(ref FamilyInstance inPlaceMember, ref AnalyticalModel model)
{
ElementSet selected = new ElementSet();
foreach (ElementId elementId in m_commandData.Application.ActiveUIDocument.Selection.GetElementIds())
{
selected.Insert(m_commandData.Application.ActiveUIDocument.Document.GetElement(elementId));
}
if (selected.Size != 1)
{
return false;
}
foreach (object o in selected)
{
inPlaceMember = o as FamilyInstance;
if (null == inPlaceMember)
{
return false;
}
}
model = inPlaceMember.GetAnalyticalModel();
if (null==model)
{
return false;
}
return true;
}
}
}
@@ -0,0 +1,434 @@
//
// (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 System.Drawing;
using System.Drawing.Drawing2D;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.InPlaceMembers.CS
{
/// <summary>
/// trigger when view data updated
/// </summary>
public delegate void UpdateViewDelegate();
/// <summary>
/// interface as the datasource of view, include nececessary members
/// </summary>
public interface IGraphicsData
{
/// <summary>
/// 2D lines
/// </summary>
/// <returns></returns>
List<PointF[]> PointCurves();
/// <summary>
/// view data update
/// </summary>
event UpdateViewDelegate UpdateViewEvent;
/// <summary>
/// region of 3D view data
/// </summary>
RectangleF Region
{
get;
}
}
/// <summary>
/// abstract class include general members
/// </summary>
public abstract class GraphicsDataBase:IGraphicsData
{
/// <summary>
///3D max point after transfered
/// </summary>
protected Autodesk.Revit.DB.XYZ m_transferedMax;
/// <summary>
///3D min point after transfered
/// </summary>
protected Autodesk.Revit.DB.XYZ m_transferedMin;
/// <summary>
/// origin max define
/// </summary>
protected Autodesk.Revit.DB.XYZ m_originMax = new Autodesk.Revit.DB.XYZ (double.MinValue, double.MinValue, double.MinValue);
/// <summary>
/// origin min define
/// </summary>
protected Autodesk.Revit.DB.XYZ m_originMin = new Autodesk.Revit.DB.XYZ (double.MaxValue, double.MaxValue, double.MaxValue);
/// <summary>
/// origin define
/// </summary>
protected double[,] m_origin = {{ 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0 } };
/// <summary>
///minimum value of the region box's edge
/// </summary>
public const float MINEDGElENGTH = 1.0f;
/// <summary>
/// default angle when rotate around X,Y,Z axis
/// </summary>
public const double ROTATEANGLE = System.Math.PI / 90;
/// <summary>
/// update view event
/// </summary>
public virtual event UpdateViewDelegate UpdateViewEvent;
/// <summary>
/// constructor
/// </summary>
public GraphicsDataBase()
{
Initialize();
}
/// <summary>
/// initialize some member data
/// </summary>
protected virtual void Initialize()
{
double INITANGLE = Math.PI / 4;
RotateX(ref m_origin, INITANGLE);
RotateY(ref m_origin, INITANGLE);
m_transferedMax = new Autodesk.Revit.DB.XYZ (double.MinValue, double.MinValue, double.MinValue);
m_transferedMin = new Autodesk.Revit.DB.XYZ (double.MaxValue, double.MaxValue, double.MaxValue);
}
/// <summary>
/// trigger updata view event
/// </summary>
public virtual void UpdataData()
{
UpdateViewEvent();
}
/// <summary>
/// point curves function
/// </summary>
/// <returns>the points list of curves</returns>
public abstract List<PointF[]> PointCurves();
/// <summary>
/// rectangular region of 3D view data
/// </summary>
public RectangleF Region
{
get
{
float width = (float)(m_transferedMax.X - m_transferedMin.X);
float height = (float)(m_transferedMax.Y - m_transferedMin.Y);
float maxX = (width / 2);
float maxY = (height / 2);
float minX = -(width / 2);
float minY = -(height / 2);
if (width < 1)
{
width = 1;
}
if (height < 1)
{
height = 1;
}
RectangleF rec = new RectangleF(minX, minY, width, height);
return rec;
}
}
/// <summary>
/// rotate around Z axis with default angle
/// </summary>
/// <param name="direction">minus or positive angle</param>
public void RotateZ(bool direction)
{
double angle = ROTATEANGLE;
if (!direction)
{
angle = -ROTATEANGLE;
}
RotateZ(ref m_origin, angle);
UpdataData();
}
/// <summary>
/// rotate 3*3 matrix around Z axis
/// </summary>
/// <param name="origin">matrix to rotate</param>
/// <param name="angle"></param>
private void RotateZ(ref double[,] origin, double angle)
{
double sin = Math.Sin(angle);
double cos = Math.Cos(angle);
double[,] rotate = { { cos, sin, 0.0 }, { -sin, cos, 0.0 }, { 0.0, 0.0, 1.0 } };
origin = MatrixArith.MultiCross(m_origin, rotate);
}
/// <summary>
/// rotate around Y axis with default angle
/// </summary>
/// <param name="direction">minus or positive angle</param>
public void RotateY(bool direction)
{
double angle = ROTATEANGLE;
if (!direction)
{
angle = -ROTATEANGLE;
}
RotateY(ref m_origin, angle);
UpdataData();
}
/// <summary>
/// rotate 3*3 matrix around Y axis
/// </summary>
/// <param name="origin">matrix to rotate</param>
/// <param name="angle"></param>
private void RotateY(ref double[,] origin, double angle)
{
double sin = Math.Sin(angle);
double cos = Math.Cos(angle);
double[,] rotate = { { cos, 0.0, -sin }, { 0.0, 1.0, 0.0 }, { sin, 0.0, cos } };
origin = MatrixArith.MultiCross(m_origin, rotate);
}
/// <summary>
/// rotate around X axis with default angle
/// </summary>
/// <param name="direction">minus or positive angle</param>
public void RotateX(bool direction)
{
double angle = ROTATEANGLE;
if (!direction)
{
angle = -ROTATEANGLE;
}
RotateX(ref m_origin ,angle);
UpdataData();
}
/// <summary>
/// rotate 3*3 matrix around X axis
/// </summary>
/// <param name="origin">matrix to rotate</param>
/// <param name="angle"></param>
private void RotateX(ref double[,] origin, double angle)
{
double sin = Math.Sin(angle);
double cos = Math.Cos(angle);
double[,] rotate = { { 1.0, 0.0, 0.0 }, { 0.0, cos, sin }, { 0.0, -sin, cos } };
origin = MatrixArith.MultiCross(m_origin, rotate);
}
}
/// <summary>
/// datasource that can bind to PictureBox3D
/// </summary>
public class GraphicsData : GraphicsDataBase
{
List<List<XYZ>> m_originCurves;
List<List<XYZ>> m_transferedCurves;
List<PointF[]> m_curves2D;
/// <summary>
/// update view event
/// </summary>
public override event UpdateViewDelegate UpdateViewEvent;
/// <summary>
/// constructor to initialize member data
/// </summary>
public GraphicsData() : base()
{
m_originCurves = new List<List<XYZ>>();
m_transferedCurves = new List<List<XYZ>>();
m_curves2D = new List<PointF[]>();
}
/// <summary>
/// curves array
/// </summary>
/// <returns></returns>
public override List<PointF[]> PointCurves()
{
return m_curves2D;
}
/// <summary>
/// insert curves array into datasource
/// </summary>
/// <param name="points">points compose the curve</param>
public void InsertCurve(List<XYZ> points)
{
m_originCurves.Add(points);
foreach (Autodesk.Revit.DB.XYZ point in points)
{
m_originMin = UpdateMinRange(point);
m_originMax = UpdateMaxRange(point);
}
}
/// <summary>
/// update 3D view data
/// </summary>
public override void UpdataData()
{
m_transferedMin = TransferRotate(m_originMin);
m_transferedMax = TransferRotate(m_originMax);
m_transferedCurves.Clear();
m_curves2D.Clear();
foreach (List<XYZ> points in m_originCurves)
{
SynChroData(points);
}
if (null != UpdateViewEvent)
{
UpdateViewEvent();
}
}
/// <summary>
/// update 3D view curve data with origin data and transfer matrix
/// </summary>
/// <param name="points"></param>
private void SynChroData(List<XYZ> points)
{
int size = points.Count;
PointF[] points2D = new PointF[size];
List<XYZ> transferedPoints = new List<XYZ>();
for(int i = 0; i<size;i++)
{
Autodesk.Revit.DB.XYZ point = points[i];
Autodesk.Revit.DB.XYZ temp = TransferRotate(point);
Autodesk.Revit.DB.XYZ transferedPoint = TransferMove(temp);
points2D[i] = new PointF((float)transferedPoint.X, (float)transferedPoint.Y);
}
m_transferedCurves.Add(transferedPoints);
m_curves2D.Add(points2D);
}
private XYZ UpdateMaxRange(XYZ pnt)
{
return new XYZ(
pnt.X > m_originMax.X ? pnt.X : m_originMax.X,
pnt.Y > m_originMax.Y ? pnt.Y : m_originMax.Y,
pnt.Z > m_originMax.Z ? pnt.Z : m_originMax.Z);
}
private XYZ UpdateMinRange(XYZ pnt)
{
return new XYZ(
pnt.X < m_originMin.X ? pnt.X : m_originMin.X,
pnt.Y < m_originMin.Y ? pnt.Y : m_originMin.Y,
pnt.Z < m_originMin.Z ? pnt.Z : m_originMin.Z);
}
/// <summary>
/// rotate points with origion matrix
/// </summary>
/// <param name="point"></param>
/// <returns></returns>
private Autodesk.Revit.DB.XYZ TransferRotate(Autodesk.Revit.DB.XYZ point)
{
double x = point.X;
double y = point.Y;
double z = point.Z;
return new XYZ(
x * m_origin[0, 0] + y * m_origin[0, 1] + z * m_origin[0, 2],
x * m_origin[1, 0] + y * m_origin[1, 1] + z * m_origin[1, 2],
x * m_origin[2, 0] + y * m_origin[2, 1] + z * m_origin[2, 2]);
}
/// <summary>
/// move the point so that the center of the curves in 3D view is origin
/// </summary>
/// <param name="point">points to be moved</param>
/// <returns>moved result</returns>
private Autodesk.Revit.DB.XYZ TransferMove(Autodesk.Revit.DB.XYZ point)
{
//transform the origin of the old coordinate system in the new coordinate system
return new XYZ(
point.X - (m_transferedMax.X + m_transferedMin.X) / 2,
point.Y - (m_transferedMax.Y + m_transferedMin.Y) / 2,
point.Z - (m_transferedMax.Z + m_transferedMin.Z) / 2);
}
}
/// <summary>
/// utility class provide arithmetic of matrix
/// </summary>
public class MatrixArith
{
/// <summary>
/// multiply cross two matrix
/// </summary>
/// <param name="m1">left matrix</param>
/// <param name="m2">right matrix</param>
/// <returns>result matrix</returns>
public static double[,] MultiCross(double[,] m1, double[,] m2)
{
double[,] result = new double[3, 3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
result[i, j] += m1[i, k] * m2[k, j];
}
}
}
return result;
}
}
}
@@ -0,0 +1,80 @@
//
// (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 System.Drawing;
using System.Drawing.Drawing2D;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB;
using System.Reflection;
namespace Revit.SDK.Samples.InPlaceMembers.CS
{
/// <summary>
/// generate GraphicsData by given geometry object
/// </summary>
public class GraphicsDataFactory
{
/// <summary>
/// create GraphicsData of given AnalyticalModel3D
/// </summary>
/// <param name="model">AnalyticalModel3D contains geometry data</param>
/// <returns></returns>
public static GraphicsData CreateGraphicsData(AnalyticalModel model)
{
IList<Curve> curveList = model.GetCurves(AnalyticalCurveType.ActiveCurves);
if (curveList.Count > 0)
{
GraphicsData data = new GraphicsData();
IEnumerator<Curve> curves = curveList.GetEnumerator();
curves.Reset();
while (curves.MoveNext())
{
Curve curve = curves.Current as Curve;
try
{
List<XYZ> points = curve.Tessellate() as List<XYZ>;
data.InsertCurve(points);
}
catch
{
}
}
data.UpdataData();
return data;
}
else
{
throw new Exception("Can't get curves.");
}
}
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>InPlaceMembers.dll</Assembly>
<ClientId>2194e2a9-69bf-494b-8fe1-739c16f43a96</ClientId>
<FullClassName>Revit.SDK.Samples.InPlaceMembers.CS.Command</FullClassName>
<Text>In-Place Members</Text>
<Description>Display In-Place Member's Properties and AnalyticalModel.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,115 @@
<?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>{4996A0A3-C581-4B6B-858F-67F22712CF02}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Revit.SDK.Samples.InPlaceMembers.CS</RootNamespace>
<AssemblyName>InPlaceMembers</AssemblyName>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<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>
</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="GraphicsData.cs" />
<Compile Include="GraphicsDataFactory.cs" />
<Compile Include="Command.cs" />
<Compile Include="InPlaceMembersForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InPlaceMembersForm.Designer.cs">
<DependentUpon>InPlaceMembersForm.cs</DependentUpon>
</Compile>
<Compile Include="PictureBox3D.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="InPlaceMembersForm.resx">
<SubType>Designer</SubType>
<DependentUpon>InPlaceMembersForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PictureBox3D.resx">
<SubType>Designer</SubType>
<DependentUpon>PictureBox3D.cs</DependentUpon>
</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>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
</Project>
@@ -0,0 +1,130 @@
//
// (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.InPlaceMembers.CS
{
partial class InPlaceMembersForm
{
/// <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.instancePropertyGrid = new System.Windows.Forms.PropertyGrid();
this.OKbutton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.modelPictureBox = new Revit.SDK.Samples.InPlaceMembers.CS.PictureBox3D();
this.SuspendLayout();
//
// instancePropertyGrid
//
this.instancePropertyGrid.Location = new System.Drawing.Point(12, 12);
this.instancePropertyGrid.Name = "instancePropertyGrid";
this.instancePropertyGrid.Size = new System.Drawing.Size(547, 238);
this.instancePropertyGrid.TabIndex = 2;
//
// OKbutton
//
this.OKbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.OKbutton.Location = new System.Drawing.Point(346, 573);
this.OKbutton.Name = "OKbutton";
this.OKbutton.Size = new System.Drawing.Size(88, 23);
this.OKbutton.TabIndex = 0;
this.OKbutton.Text = "&OK";
this.OKbutton.UseVisualStyleBackColor = true;
this.OKbutton.Click += new System.EventHandler(this.OKbutton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(471, 573);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(88, 23);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// modelPictureBox
//
this.modelPictureBox.Cursor = System.Windows.Forms.Cursors.SizeAll;
this.modelPictureBox.DataSource = null;
this.modelPictureBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.modelPictureBox.Location = new System.Drawing.Point(12, 256);
this.modelPictureBox.Name = "modelPictureBox";
this.modelPictureBox.Size = new System.Drawing.Size(547, 311);
this.modelPictureBox.TabIndex = 1;
this.modelPictureBox.UseVisualStyleBackColor = true;
//
// InPlaceMembersForm
//
this.AcceptButton = this.OKbutton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(571, 606);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.OKbutton);
this.Controls.Add(this.modelPictureBox);
this.Controls.Add(this.instancePropertyGrid);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InPlaceMembersForm";
this.ShowInTaskbar = false;
this.Text = "In-Place Members";
this.Load += new System.EventHandler(this.InPlaceMembersForm_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PropertyGrid instancePropertyGrid;
private PictureBox3D modelPictureBox;
private System.Windows.Forms.Button OKbutton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -0,0 +1,163 @@
//
// (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;
namespace Revit.SDK.Samples.InPlaceMembers.CS
{
/// <summary>
/// Main form class, use to diaplay the preview picture box and property grid.
/// </summary>
public partial class InPlaceMembersForm : System.Windows.Forms.Form,IMessageFilter
{
/// <summary>
/// Properties instance
/// </summary>
private Properties m_instanceProperties;
/// <summary>
/// Graphics data
/// </summary>
private GraphicsData m_graphicsData;
/// <summary>
/// window message key number
/// </summary>
private const int WM_KEYDOWN = 0X0100;
/// <summary>
/// constructor
/// </summary>
/// <param name="p"></param>
/// <param name="graphicsData"></param>
public InPlaceMembersForm(Properties p, GraphicsData graphicsData)
{
m_instanceProperties = p;
m_graphicsData = graphicsData;
Application.AddMessageFilter(this);
InitializeComponent();
}
/// <summary>
/// load event handle
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InPlaceMembersForm_Load(object sender, EventArgs e)
{
instancePropertyGrid.SelectedObject = m_instanceProperties;
modelPictureBox.DataSource = m_graphicsData;
}
/// <summary>
/// implement IMessageFilter interface
/// </summary>
/// <param name="m">The message to be dispatched.</param>
/// <returns>true to filter the message and stop it from being dispatched;
/// false to allow the message to continue to the next filter or control.</returns>
public bool PreFilterMessage(ref Message m)
{
if (!modelPictureBox.Focused)
{
return false;
}
if (m.Msg == WM_KEYDOWN)
{
System.Windows.Forms.Keys k = (System.Windows.Forms.Keys)(int)m.WParam;
KeyEventArgs e = new KeyEventArgs(k);
switch (e.KeyCode)
{
case Keys.Left:
m_graphicsData.RotateY(true);
break;
case Keys.Right:
m_graphicsData.RotateY(false);
break;
case Keys.Up:
m_graphicsData.RotateX(true);
break;
case Keys.Down:
m_graphicsData.RotateX(false);
break;
case Keys.PageUp:
m_graphicsData.RotateZ(true);
break;
case Keys.PageDown:
m_graphicsData.RotateZ(false);
break;
case Keys.S:
modelPictureBox.MoveY(true);
break;
case Keys.W:
modelPictureBox.MoveY(false);
break;
case Keys.A:
modelPictureBox.MoveX(true);
break;
case Keys.D:
modelPictureBox.MoveX(false);
break;
case Keys.Home:
modelPictureBox.Scale(true);
break;
case Keys.End:
modelPictureBox.Scale(false);
break;
default:
break;
}
return true;
}
return false;
}
/// <summary>
/// ok button event handler
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OKbutton_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// Cancel button event handler.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
@@ -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>
@@ -0,0 +1,196 @@
//
// (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 System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.ComponentModel;
namespace Revit.SDK.Samples.InPlaceMembers.CS
{
/// <summary>
/// picturebox wich can display 3D geometry outline
/// </summary>
public class PictureBox3D : Button
{
IGraphicsData m_sourceData; //datasource
Matrix m_transform; //transform matrix between origin data and display data
/// <summary>
/// paint outline
/// </summary>
/// <param name="pe"></param>
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
if (null == m_sourceData)
{
return;
}
//prepare data
Graphics g = pe.Graphics;
g.Clear(System.Drawing.Color.White);
Pen pen = new Pen(System.Drawing.Color.DarkGreen);
GraphicsPath path = new GraphicsPath();
//draw curves one by one
List<PointF[]> curves = m_sourceData.PointCurves();
foreach (PointF[] curve in curves)
{
path.Reset();
path.AddLines(curve);
path.Transform(m_transform);
g.DrawPath(pen, path);
}
}
/// <summary>
/// scale the view by default value
/// </summary>
/// <param name="zoomIn">zomme in or zoom out</param>
public void Scale(bool zoomIn)
{
float ratio = 1.0f;
if(zoomIn)
{
ratio = 10.0f/11.0f;
}
else
{
ratio = 11.0f/10.0f;
}
m_transform.Scale(ratio, ratio, MatrixOrder.Append);
Invalidate();
}
/// <summary>
/// move view in horizontal direction
/// </summary>
/// <param name="left">left or right</param>
public void MoveX(bool left)
{
float len = 0.0f;
if (left)
{
len = -5.0f;
}
else
{
len = 5.0f;
}
m_transform.Translate(len, 0, MatrixOrder.Append);
Invalidate();
}
/// <summary>
/// move view in vertical direction
/// </summary>
/// <param name="up">up or down</param>
public void MoveY(bool up)
{
float len = 0.0f;
if (up)
{
len = 5.0f;
}
else
{
len = -5.0f;
}
m_transform.Translate(0, len, MatrixOrder.Append);
Invalidate();
}
/// <summary>
/// datasource which can be any class inherited from IGraphicsData
/// </summary>
public IGraphicsData DataSource
{
get
{
return m_sourceData;
}
set
{
if (null != value)
{
m_sourceData = value;
RectangleF rec = m_sourceData.Region;
PointF[] plgpts = GetDisplayRegion();
m_transform = new Matrix(rec, plgpts);
m_sourceData.UpdateViewEvent += new UpdateViewDelegate(Invalidate);
}
}
}
/// <summary>
/// get the display region, adjust the proportion and location
/// </summary>
/// <returns></returns>
private PointF[] GetDisplayRegion()
{
RectangleF rec = m_sourceData.Region;
const float MARGIN = 8.0f;
float realWidth = this.Width - MARGIN *2;
float realHeight = this.Height - MARGIN*2;
float minX = MARGIN;
float minY = MARGIN;
float ratioRec = rec.Height / rec.Width;
float ratioBox = realHeight / realWidth;
if (ratioRec > ratioBox)
{
float temp = realWidth;
realWidth = realHeight * rec.Width /rec.Height;
minX = (temp - realWidth)/2.0f;
}
else
{
float temp = realHeight;
realHeight = realWidth * rec.Height/rec.Width;
minY = (temp - realHeight) / 2.0f;
}
if (rec.Width < (GraphicsData.MINEDGElENGTH + 1) &&
rec.Height < (GraphicsData.MINEDGElENGTH + 1))
{
minX = realWidth / 2.0f;
minY = realHeight / 2.0f;
}
PointF[] plgpts = new PointF[3];
plgpts[0] = new PointF(minX, minY);
plgpts[1] = new PointF(realWidth + minX, minY);
plgpts[2] = new PointF(minX, realHeight + minY);
return plgpts;
}
}
}
@@ -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>
+150
View File
@@ -0,0 +1,150 @@
//
// (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.ComponentModel;
using Autodesk.Revit.DB;
using System;
namespace Revit.SDK.Samples.InPlaceMembers.CS
{
/// <summary>
/// This class is used as PropertyGrid.SelectedObject.
/// </summary>
public class Properties
{
private int m_ID;
private string m_Name;
private string m_Family;
private string m_Type;
private string m_StructuralType;
private string m_StructuralUsage;
private string m_Material;
/// <summary>
/// the value of the element id as an integer
/// </summary>
[CategoryAttribute("Identity")]
public int ID
{
get
{
return m_ID;
}
}
/// <summary>
/// a human readable name for the Element.
/// </summary>
[CategoryAttribute("Identity")]
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// a human readable name for the family name.
/// </summary>
[CategoryAttribute("Category")]
public string Family
{
get
{
return m_Family;
}
}
/// <summary>
/// a human readable name for the family type name.
/// </summary>
[CategoryAttribute("Category")]
public string Type
{
get
{
return m_Type;
}
}
/// <summary>
/// the primary structural type of the instance, such as beam or column etc.
/// </summary>
[CategoryAttribute("Structural")]
public string StructuralType
{
get
{
return m_StructuralType;
}
}
/// <summary>
/// the primary structural usage of the instance, such as brace, girder etc.
/// </summary>
[CategoryAttribute("Structural")]
public string StructuralUsage
{
get
{
return m_StructuralUsage;
}
}
/// <summary>
/// the physical material from which the instance is made.
/// </summary>
[CategoryAttribute("Structural")]
public string Material
{
get
{
return m_Material;
}
}
/// <summary>
/// get this family instance's properties to display.
/// </summary>
/// <param name="f">a In-Place family instance</param>
public Properties(FamilyInstance f)
{
m_ID = f.Id.IntegerValue;
m_Name = f.Name;
m_Family = f.Symbol.Family.Name;
m_Type = f.Symbol.Name;
m_StructuralType = f.StructuralType.ToString();
try
{
m_StructuralUsage = f.StructuralUsage.ToString();
}
catch(Exception)
{
m_StructuralUsage = null;
}
m_Material = f.StructuralMaterialType.ToString();
}
}
}
@@ -0,0 +1,58 @@
//
// (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("InPlaceMembers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InPlaceMembers")]
[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("18c54da4-fac9-455f-ac23-8cdb326a7b76")]
// 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")]