mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-20 19:06:20 +00:00
added Revit 2020 SDK files
This commit is contained in:
@@ -0,0 +1,263 @@
|
||||
//
|
||||
// (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 System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// A ExternalCommand class inherited IExternalCommand interface.
|
||||
/// This command will add needed shared parameters and initialize them.
|
||||
/// It will initialize door opening parameter based on family's actual geometry and
|
||||
/// country's standard. It will initialize each door instance's opening, ToRoom, FromRoom and
|
||||
/// internal door flag values according to door's current geometry.
|
||||
/// </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 InitializeCommand : IExternalCommand
|
||||
{
|
||||
#region IExternalCommand Members
|
||||
|
||||
/// <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,
|
||||
ElementSet elements)
|
||||
{
|
||||
Autodesk.Revit.UI.Result returnCode = Autodesk.Revit.UI.Result.Cancelled;
|
||||
|
||||
Transaction tran = new Transaction(commandData.Application.ActiveUIDocument.Document, "Initialize Command");
|
||||
tran.Start();
|
||||
|
||||
try
|
||||
{
|
||||
// one instance of DoorSwingData class.
|
||||
DoorSwingData databuffer = new DoorSwingData(commandData.Application);
|
||||
|
||||
using (InitializeForm initForm = new InitializeForm(databuffer))
|
||||
{
|
||||
// Show UI
|
||||
DialogResult dialogResult = initForm.ShowDialog();
|
||||
|
||||
if (DialogResult.OK == dialogResult)
|
||||
{
|
||||
databuffer.DeleteTempDoorInstances();
|
||||
|
||||
// update door type's opening feature based on family's actual geometry and
|
||||
// country's standard.
|
||||
databuffer.UpdateDoorFamiliesOpeningFeature();
|
||||
|
||||
// update each door instance's Opening feature and internal door flag
|
||||
returnCode = DoorSwingData.UpdateDoorsInfo(commandData.Application.ActiveUIDocument.Document, false, true, ref message);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// if there is anything wrong, give error information and return failed.
|
||||
message = ex.Message;
|
||||
returnCode = Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
|
||||
if (Autodesk.Revit.UI.Result.Succeeded == returnCode)
|
||||
{
|
||||
tran.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
tran.RollBack();
|
||||
}
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A ExternalCommand class inherited IExternalCommand interface.
|
||||
/// This command will update each door instance's opening, ToRoom, FromRoom and
|
||||
/// internal door flag values according to door's current geometry.
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
public class UpdateParamsCommand : IExternalCommand
|
||||
{
|
||||
#region IExternalCommand Members
|
||||
|
||||
/// <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)
|
||||
{
|
||||
Autodesk.Revit.UI.Result returnCode = Autodesk.Revit.UI.Result.Succeeded;
|
||||
Autodesk.Revit.UI.UIApplication app = commandData.Application;
|
||||
UIDocument doc = app.ActiveUIDocument;
|
||||
Transaction tran = new Transaction(doc.Document, "Update Parameters Command");
|
||||
tran.Start();
|
||||
|
||||
try
|
||||
{
|
||||
ElementSet elementSet = new ElementSet();
|
||||
foreach (ElementId elementId in doc.Selection.GetElementIds())
|
||||
{
|
||||
elementSet.Insert(doc.Document.GetElement(elementId));
|
||||
}
|
||||
if (elementSet.IsEmpty)
|
||||
{
|
||||
returnCode = DoorSwingData.UpdateDoorsInfo(doc.Document, false, true, ref message);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnCode = DoorSwingData.UpdateDoorsInfo(doc.Document, true, true, ref message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// if there is anything wrong, give error information and return failed.
|
||||
message = ex.Message;
|
||||
returnCode = Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
|
||||
if (Autodesk.Revit.UI.Result.Succeeded == returnCode)
|
||||
{
|
||||
tran.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
tran.RollBack();
|
||||
}
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A ExternalCommand class inherited IExternalCommand interface.
|
||||
/// This command will update door instance's geometry according to door's
|
||||
/// current To/From Room value.
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
public class UpdateGeometryCommand : IExternalCommand
|
||||
{
|
||||
#region IExternalCommand Members
|
||||
|
||||
/// <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)
|
||||
{
|
||||
Autodesk.Revit.UI.Result returnCode = Autodesk.Revit.UI.Result.Succeeded;
|
||||
Autodesk.Revit.UI.UIApplication app = commandData.Application;
|
||||
UIDocument doc = app.ActiveUIDocument;
|
||||
Transaction tran = new Transaction(doc.Document, "Update Geometry Command");
|
||||
tran.Start();
|
||||
|
||||
try
|
||||
{
|
||||
ElementSet elementSet = new ElementSet();
|
||||
foreach (ElementId elementId in doc.Selection.GetElementIds())
|
||||
{
|
||||
elementSet.Insert(doc.Document.GetElement(elementId));
|
||||
}
|
||||
if (elementSet.IsEmpty)
|
||||
{
|
||||
DoorSwingData.UpdateDoorsGeometry(doc.Document, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoorSwingData.UpdateDoorsGeometry(doc.Document, true);
|
||||
}
|
||||
|
||||
returnCode = Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// if there is anything wrong, give error information and return failed.
|
||||
message = ex.Message;
|
||||
returnCode = Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
|
||||
if (Autodesk.Revit.UI.Result.Succeeded == returnCode)
|
||||
{
|
||||
tran.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
tran.RollBack();
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
//
|
||||
// (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;
|
||||
using Autodesk.Revit.ApplicationServices;
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// Left/Right feature based on family's actual geometry and country's standard.
|
||||
/// </summary>
|
||||
public class DoorFamily
|
||||
{
|
||||
#region "Members"
|
||||
|
||||
// door family
|
||||
Family m_family;
|
||||
// opening value of one of this family's door which neither flipped nor mirrored.
|
||||
string m_basalOpeningValue;
|
||||
// one door instance of this family.
|
||||
FamilyInstance m_oneInstance;
|
||||
// Revit application
|
||||
UIApplication m_app;
|
||||
// the geometry of one of this family's door which neither flipped nor mirrored.
|
||||
DoorGeometry m_geometry;
|
||||
|
||||
#endregion
|
||||
|
||||
#region "Properties"
|
||||
|
||||
/// <summary>
|
||||
/// Retrieval the name of this family.
|
||||
/// </summary>
|
||||
public string FamilyName
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_family.Name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve opening value of one of this family's door which neither flipped nor mirrored.
|
||||
/// </summary>
|
||||
public string BasalOpeningValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(m_basalOpeningValue))
|
||||
{
|
||||
string paramValue = DoorSwingResource.Undefined;
|
||||
|
||||
// get current opening value.
|
||||
System.Collections.Generic.List<FamilySymbol> fss = new System.Collections.Generic.List<FamilySymbol>();
|
||||
foreach (ElementId elementId in m_family.GetFamilySymbolIds())
|
||||
{
|
||||
fss.Add((FamilySymbol)(m_app.ActiveUIDocument.Document.GetElement(elementId)));
|
||||
}
|
||||
FamilySymbol doorSymbol = fss[0];
|
||||
paramValue = doorSymbol.ParametersMap.get_Item("BasalOpening").AsString();
|
||||
|
||||
// deal with invalid string.
|
||||
if (!DoorSwingData.OpeningTypes.Contains(paramValue))
|
||||
{
|
||||
paramValue = DoorSwingResource.Undefined;
|
||||
}
|
||||
|
||||
m_basalOpeningValue = paramValue;
|
||||
}
|
||||
|
||||
return m_basalOpeningValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_basalOpeningValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the geometry of one door which belongs to this family and
|
||||
/// neither flipped nor mirrored.
|
||||
/// </summary>
|
||||
public DoorGeometry Geometry
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == m_geometry)
|
||||
{
|
||||
// create one instance of DoorFamilyGeometry class.
|
||||
m_geometry = new DoorGeometry(m_oneInstance);
|
||||
}
|
||||
|
||||
return m_geometry;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "Methods"
|
||||
|
||||
/// <summary>
|
||||
/// construct function.
|
||||
/// </summary>
|
||||
/// <param name="doorFamily"> one door family</param>
|
||||
/// <param name="app">Revit application</param>
|
||||
public DoorFamily(Family doorFamily, UIApplication app)
|
||||
{
|
||||
m_app = app;
|
||||
m_family = doorFamily;
|
||||
// one door instance which belongs to this family and neither flipped nor mirrored.
|
||||
m_oneInstance = CreateOneInstanceWithThisFamily();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Left/Right feature based on family's actual geometry and country's standard.
|
||||
/// </summary>
|
||||
public void UpdateOpeningFeature()
|
||||
{
|
||||
// get current Left/Right feature's value of this door family.
|
||||
List<FamilySymbol> ffs = new List<FamilySymbol>();
|
||||
foreach (ElementId elementId in m_family.GetFamilySymbolIds())
|
||||
{
|
||||
ffs.Add((FamilySymbol)(m_app.ActiveUIDocument.Document.GetElement(elementId)));
|
||||
}
|
||||
foreach (FamilySymbol doorSymbol in ffs)
|
||||
{
|
||||
// update the the related family shared parameter's value if user already added it.
|
||||
if (doorSymbol.ParametersMap.Contains("BasalOpening"))
|
||||
{
|
||||
Parameter basalOpeningParam = doorSymbol.ParametersMap.get_Item("BasalOpening");
|
||||
bool setResult = basalOpeningParam.Set(m_basalOpeningValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete the temporarily created door instance and its host.
|
||||
/// </summary>
|
||||
public void DeleteTempDoorInstance()
|
||||
{
|
||||
Document doc = m_app.ActiveUIDocument.Document;
|
||||
Autodesk.Revit.DB.Element tempWall = m_oneInstance.Host;
|
||||
doc.Delete(m_oneInstance.Id); // delete temporarily created door instance with this family.
|
||||
doc.Delete(tempWall.Id); // delete the door's host.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create one temporary door instance with this family.
|
||||
/// </summary>
|
||||
/// <returns>the created door.</returns>
|
||||
private FamilyInstance CreateOneInstanceWithThisFamily()
|
||||
{
|
||||
Autodesk.Revit.DB.Document doc = m_app.ActiveUIDocument.Document;
|
||||
Autodesk.Revit.Creation.Document creDoc = doc.Create;
|
||||
Autodesk.Revit.Creation.Application creApp = m_app.Application.Create;
|
||||
|
||||
// get one level. A project has at least one level.
|
||||
Level level = new FilteredElementCollector(doc).OfClass(typeof(Level)).FirstElement() as Level;
|
||||
|
||||
// create one wall as door's host
|
||||
Line wallCurve = Line.CreateBound(new Autodesk.Revit.DB.XYZ(0, 0, 0), new Autodesk.Revit.DB.XYZ(100, 0, 0));
|
||||
Wall host = Wall.Create(doc, wallCurve, level.Id, false);
|
||||
doc.Regenerate();
|
||||
|
||||
// door symbol.
|
||||
List<FamilySymbol> ffs = new List<FamilySymbol>();
|
||||
foreach (ElementId elementId in m_family.GetFamilySymbolIds())
|
||||
{
|
||||
ffs.Add((FamilySymbol)(m_app.ActiveUIDocument.Document.GetElement(elementId)));
|
||||
}
|
||||
FamilySymbol doorSymbol = ffs[0];
|
||||
|
||||
// create the door
|
||||
FamilyInstance createdFamilyInstance = creDoc.NewFamilyInstance(new Autodesk.Revit.DB.XYZ(0, 0, 0), doorSymbol, host, level,
|
||||
StructuralType.NonStructural);
|
||||
doc.Regenerate();
|
||||
|
||||
return createdFamilyInstance;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
//
|
||||
// (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.Linq;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// The DoorGeometry object is used to transform Revit geometry data
|
||||
/// to appropriate format for GDI.
|
||||
/// </summary>
|
||||
public class DoorGeometry
|
||||
{
|
||||
#region "Members"
|
||||
|
||||
// User preferences for parsing of geometry.
|
||||
Options m_options;
|
||||
// boundingBox of the geometry.
|
||||
BoundingBoxXYZ m_bbox;
|
||||
// curves can represent the wireFrame of the door's geometry.
|
||||
List<List<XYZ>> m_curve3Ds = new List<List<XYZ>>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region "Properties"
|
||||
|
||||
/// <summary>
|
||||
/// BoundingBox of the 2D geometry.
|
||||
/// </summary>
|
||||
public System.Drawing.RectangleF BBOX2D
|
||||
{
|
||||
get
|
||||
{
|
||||
return new System.Drawing.RectangleF((float)m_bbox.Min.X, (float)m_bbox.Min.Y,
|
||||
(float)(m_bbox.Max.X - m_bbox.Min.X), (float)(m_bbox.Max.Y - m_bbox.Min.Y));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "Methods"
|
||||
|
||||
/// <summary>
|
||||
/// construct function.
|
||||
/// </summary>
|
||||
/// <param name="door">of which geometry data is wanted.</param>
|
||||
public DoorGeometry(Autodesk.Revit.DB.Element door)
|
||||
{
|
||||
m_options = new Options();
|
||||
m_options.View = GetPlanform2DView(door);
|
||||
m_options.ComputeReferences = false;
|
||||
Autodesk.Revit.DB.GeometryElement geoEle = door.get_Geometry(m_options);
|
||||
AddGeometryElement(geoEle);
|
||||
|
||||
m_bbox = door.get_BoundingBox(m_options.View);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the line contains in m_curve3Ds in 2d Preview.Drawn as top view.
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics to draw</param>
|
||||
/// <param name="drawPen">The pen to draw curves.</param>
|
||||
public void DrawGraphics(System.Drawing.Graphics graphics, System.Drawing.Pen drawPen)
|
||||
{
|
||||
for (int i = 0; i < m_curve3Ds.Count; i++)
|
||||
{
|
||||
List<XYZ> points = m_curve3Ds[i];
|
||||
|
||||
for (int j = 0; j < (points.Count - 1); j++)
|
||||
{
|
||||
// ignore xyz.Z value, drawn as top view.
|
||||
System.Drawing.PointF startPoint = new System.Drawing.PointF((float)points[j].X, (float)points[j].Y);
|
||||
System.Drawing.PointF endPoint = new System.Drawing.PointF((float)points[j + 1].X, (float)points[j + 1].Y);
|
||||
graphics.DrawLine(drawPen, startPoint, endPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the ViewPlan corresponding to the door's level.
|
||||
/// </summary>
|
||||
/// <param name="door">
|
||||
/// one door whose level is corresponding to the retrieved ViewPlan.
|
||||
/// </param>
|
||||
/// <returns>One ViewPlan</returns>
|
||||
static private ViewPlan GetPlanform2DView(Autodesk.Revit.DB.Element door)
|
||||
{
|
||||
IEnumerable<ViewPlan> viewPlans = from elem in
|
||||
new FilteredElementCollector(door.Document).OfClass(typeof(ViewPlan)).ToElements()
|
||||
let viewPlan = elem as ViewPlan
|
||||
where viewPlan != null && !viewPlan.IsTemplate && viewPlan.GenLevel.Id.IntegerValue == door.LevelId.IntegerValue
|
||||
select viewPlan;
|
||||
if (viewPlans.Count() > 0)
|
||||
{
|
||||
return viewPlans.First();
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// iterate GeometryObject in GeometryObjectArray and generate data accordingly.
|
||||
/// </summary>
|
||||
/// <param name="geoEle">a geometry object of element</param>
|
||||
private void AddGeometryElement(Autodesk.Revit.DB.GeometryElement geoEle)
|
||||
{
|
||||
// get all geometric primitives contained in the Geometry Element
|
||||
//GeometryObjectArray geoObjArray = geoEle.Objects;
|
||||
IEnumerator<GeometryObject> Objects = geoEle.GetEnumerator();
|
||||
|
||||
// iterate each Geometry Object and generate data accordingly.
|
||||
//foreach (GeometryObject geoObj in geoObjArray)
|
||||
while (Objects.MoveNext())
|
||||
{
|
||||
GeometryObject geoObj = Objects.Current;
|
||||
|
||||
if (geoObj is Curve)
|
||||
{
|
||||
AddCurve(geoObj);
|
||||
}
|
||||
else if (geoObj is Edge)
|
||||
{
|
||||
AddEdge(geoObj);
|
||||
}
|
||||
else if (geoObj is Autodesk.Revit.DB.GeometryElement)
|
||||
{
|
||||
AddElement(geoObj);
|
||||
}
|
||||
else if (geoObj is Face)
|
||||
{
|
||||
AddFace(geoObj);
|
||||
}
|
||||
else if (geoObj is Autodesk.Revit.DB.GeometryInstance)
|
||||
{
|
||||
AddInstance(geoObj);
|
||||
}
|
||||
else if (geoObj is Mesh)
|
||||
{
|
||||
AddMesh(geoObj);
|
||||
}
|
||||
else if (geoObj is Profile)
|
||||
{
|
||||
AddProfile(geoObj);
|
||||
}
|
||||
else if (geoObj is Solid)
|
||||
{
|
||||
AddSolid(geoObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Curve.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddCurve(GeometryObject obj)
|
||||
{
|
||||
Curve curve = obj as Curve;
|
||||
|
||||
if (!curve.IsBound)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get a polyline approximation to the curve.
|
||||
List<XYZ> points = curve.Tessellate() as List<XYZ>;
|
||||
|
||||
m_curve3Ds.Add(points);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of an Edge.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddEdge(GeometryObject obj)
|
||||
{
|
||||
Edge edge = obj as Edge;
|
||||
|
||||
// get a polyline approximation to the edge.
|
||||
List<XYZ> points = edge.Tessellate() as List<XYZ>;
|
||||
|
||||
m_curve3Ds.Add(points);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Geometry Element.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddElement(GeometryObject obj)
|
||||
{
|
||||
Autodesk.Revit.DB.GeometryElement geoEle = obj as Autodesk.Revit.DB.GeometryElement;
|
||||
AddGeometryElement(geoEle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Face.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddFace(GeometryObject obj)
|
||||
{
|
||||
Face face = obj as Face;
|
||||
|
||||
// get a triangular mesh approximation to the face.
|
||||
Mesh mesh = face.Triangulate();
|
||||
if (null != mesh)
|
||||
{
|
||||
AddMesh(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Geometry Instance.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddInstance(GeometryObject obj)
|
||||
{
|
||||
Autodesk.Revit.DB.GeometryInstance instance = obj as Autodesk.Revit.DB.GeometryInstance;
|
||||
Autodesk.Revit.DB.GeometryElement geoElement = instance.SymbolGeometry;
|
||||
|
||||
AddGeometryElement(geoElement);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Mesh.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddMesh(GeometryObject obj)
|
||||
{
|
||||
Mesh mesh = obj as Mesh;
|
||||
List<XYZ> points = new List<XYZ>();
|
||||
|
||||
// get all triangles of the mesh.
|
||||
for (int i = 0; i < mesh.NumTriangles; i++)
|
||||
{
|
||||
MeshTriangle trigangle = mesh.get_Triangle(i);
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
// A vertex of the triangle.
|
||||
Autodesk.Revit.DB.XYZ point = trigangle.get_Vertex(j);
|
||||
|
||||
double x = point.X;
|
||||
double y = point.Y;
|
||||
double z = point.Z;
|
||||
|
||||
points.Add(point);
|
||||
}
|
||||
|
||||
Autodesk.Revit.DB.XYZ iniPoint = points[0];
|
||||
points.Add(iniPoint);
|
||||
|
||||
m_curve3Ds.Add(points);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Profile.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddProfile(GeometryObject obj)
|
||||
{
|
||||
Profile profile = obj as Profile;
|
||||
|
||||
// get the curves that make up the boundary of the profile.
|
||||
CurveArray curves = profile.Curves;
|
||||
|
||||
foreach (Curve curve in curves)
|
||||
{
|
||||
AddCurve(curve);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Solid.
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element.</param>
|
||||
private void AddSolid(GeometryObject obj)
|
||||
{
|
||||
Solid solid = obj as Solid;
|
||||
|
||||
// get the faces that belong to the solid.
|
||||
FaceArray faces = solid.Faces;
|
||||
|
||||
foreach (Face face in faces)
|
||||
{
|
||||
AddFace(face);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
//
|
||||
// (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.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.ApplicationServices;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// Static class used to add project shared parameters.
|
||||
/// </summary>
|
||||
public static class DoorSharedParameters
|
||||
{
|
||||
#region "Methods"
|
||||
|
||||
/// <summary>
|
||||
/// Add shared parameters needed in this sample.
|
||||
/// parameter 1: one string parameter named as "BasalOpening" which is used for customization of door opening for each country.
|
||||
/// parameter 2: one string parameter named as "InstanceOpening" to indicate the door's opening value.
|
||||
/// parameter 3: one YESNO parameter named as "Internal Door" to flag the door is internal door or not.
|
||||
/// </summary>
|
||||
/// <param name="app">Revit application.</param>
|
||||
public static void AddSharedParameters(UIApplication app)
|
||||
{
|
||||
// Create a new Binding object with the categories to which the parameter will be bound.
|
||||
CategorySet categories = app.Application.Create.NewCategorySet();
|
||||
|
||||
// get door category and insert into the CategorySet.
|
||||
Category doorCategory = app.ActiveUIDocument.Document.Settings.Categories.
|
||||
get_Item(BuiltInCategory.OST_Doors);
|
||||
categories.Insert(doorCategory);
|
||||
|
||||
// create one instance binding for "Internal Door" and "InstanceOpening" parameters;
|
||||
// and one type binding for "BasalOpening" parameters
|
||||
InstanceBinding instanceBinding = app.Application.Create.NewInstanceBinding(categories);
|
||||
TypeBinding typeBinding = app.Application.Create.NewTypeBinding(categories);
|
||||
BindingMap bindingMap = app.ActiveUIDocument.Document.ParameterBindings;
|
||||
|
||||
// Open the shared parameters file
|
||||
// via the private method AccessOrCreateSharedParameterFile
|
||||
DefinitionFile defFile = AccessOrCreateSharedParameterFile(app.Application);
|
||||
if (null == defFile)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Access an existing or create a new group in the shared parameters file
|
||||
DefinitionGroups defGroups = defFile.Groups;
|
||||
DefinitionGroup defGroup = defGroups.get_Item("DoorProjectSharedParameters");
|
||||
|
||||
if (null == defGroup)
|
||||
{
|
||||
defGroup = defGroups.Create("DoorProjectSharedParameters");
|
||||
}
|
||||
|
||||
// Access an existing or create a new external parameter definition belongs to a specific group.
|
||||
|
||||
// for "BasalOpening"
|
||||
if (!AlreadyAddedSharedParameter(app.ActiveUIDocument.Document, "BasalOpening", BuiltInCategory.OST_Doors))
|
||||
{
|
||||
Definition basalOpening = defGroup.Definitions.get_Item("BasalOpening");
|
||||
|
||||
if (null == basalOpening)
|
||||
{
|
||||
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions1 = new ExternalDefinitionCreationOptions("BasalOpening", ParameterType.Text);
|
||||
basalOpening = defGroup.Definitions.Create(ExternalDefinitionCreationOptions1);
|
||||
}
|
||||
|
||||
// Add the binding and definition to the document.
|
||||
bindingMap.Insert(basalOpening, typeBinding, BuiltInParameterGroup.PG_GEOMETRY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for "InstanceOpening"
|
||||
if (!AlreadyAddedSharedParameter(app.ActiveUIDocument.Document, "InstanceOpening", BuiltInCategory.OST_Doors))
|
||||
{
|
||||
Definition instanceOpening = defGroup.Definitions.get_Item("InstanceOpening");
|
||||
|
||||
if (null == instanceOpening)
|
||||
{
|
||||
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions2 = new ExternalDefinitionCreationOptions("InstanceOpening", ParameterType.Text);
|
||||
instanceOpening = defGroup.Definitions.Create(ExternalDefinitionCreationOptions2);
|
||||
}
|
||||
|
||||
// Add the binding and definition to the document.
|
||||
bindingMap.Insert(instanceOpening, instanceBinding, BuiltInParameterGroup.PG_GEOMETRY);
|
||||
}
|
||||
|
||||
// for "Internal Door"
|
||||
if (!AlreadyAddedSharedParameter(app.ActiveUIDocument.Document, "Internal Door", BuiltInCategory.OST_Doors))
|
||||
{
|
||||
Definition internalDoorFlag = defGroup.Definitions.get_Item("Internal Door");
|
||||
|
||||
if (null == internalDoorFlag)
|
||||
{
|
||||
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions3 = new ExternalDefinitionCreationOptions("Internal Door", ParameterType.YesNo);
|
||||
internalDoorFlag = defGroup.Definitions.Create(ExternalDefinitionCreationOptions3);
|
||||
}
|
||||
|
||||
// Add the binding and definition to the document.
|
||||
bindingMap.Insert(internalDoorFlag, instanceBinding);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access an existing or create a new shared parameters file.
|
||||
/// </summary>
|
||||
/// <param name="app">Revit Application.</param>
|
||||
/// <returns>the shared parameters file.</returns>
|
||||
private static DefinitionFile AccessOrCreateSharedParameterFile(Application app)
|
||||
{
|
||||
// The location of this command assembly
|
||||
string currentCommandAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
|
||||
// The path of ourselves shared parameters file
|
||||
string sharedParameterFilePath = Path.GetDirectoryName(currentCommandAssemblyPath);
|
||||
sharedParameterFilePath = sharedParameterFilePath + "\\MySharedParameterFile.txt";
|
||||
|
||||
//Method's return
|
||||
DefinitionFile sharedParameterFile = null;
|
||||
|
||||
// Check if the file exits
|
||||
System.IO.FileInfo documentMessage = new FileInfo(sharedParameterFilePath);
|
||||
bool fileExist = documentMessage.Exists;
|
||||
|
||||
// Create file for external shared parameter since it does not exist
|
||||
if (!fileExist)
|
||||
{
|
||||
FileStream fileFlow = File.Create(sharedParameterFilePath);
|
||||
fileFlow.Close();
|
||||
}
|
||||
|
||||
// Set ourselves file to the externalSharedParameterFile
|
||||
app.SharedParametersFilename = sharedParameterFilePath;
|
||||
sharedParameterFile = app.OpenSharedParameterFile();
|
||||
|
||||
return sharedParameterFile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Has the specific document shared parameter already been added ago?
|
||||
/// </summary>
|
||||
/// <param name="doc">Revit project in which the shared parameter will be added.</param>
|
||||
/// <param name="paraName">the name of the shared parameter.</param>
|
||||
/// <param name="boundCategory">Which category the parameter will bind to</param>
|
||||
/// <returns>Returns true if already added ago else returns false.</returns>
|
||||
private static bool AlreadyAddedSharedParameter(Document doc, string paraName, BuiltInCategory boundCategory)
|
||||
{
|
||||
try
|
||||
{
|
||||
BindingMap bindingMap = doc.ParameterBindings;
|
||||
DefinitionBindingMapIterator bindingMapIter = bindingMap.ForwardIterator();
|
||||
|
||||
while (bindingMapIter.MoveNext())
|
||||
{
|
||||
if (bindingMapIter.Key.Name.Equals(paraName))
|
||||
{
|
||||
ElementBinding binding = bindingMapIter.Current as ElementBinding;
|
||||
CategorySet categories = binding.Categories;
|
||||
|
||||
foreach (Category category in categories)
|
||||
{
|
||||
if (category.Id.IntegerValue.Equals((int)boundCategory))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RevitAddIns>
|
||||
<AddIn Type="Application">
|
||||
<Name>DoorSwing</Name>
|
||||
<Assembly>DoorSwing.dll</Assembly>
|
||||
<ClientId>090C61F3-4D37-4896-A3E6-AEFA9C67A895</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.DoorSwing.CS.ExternalApplication</FullClassName>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>DoorSwing.dll</Assembly>
|
||||
<ClientId>62b98036-f713-4e67-a18a-37e96fd025cd</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.DoorSwing.CS.InitializeCommand</FullClassName>
|
||||
<Text>Customize door opening expression</Text>
|
||||
<Description>Customize door opening expression based on geometry and your country standard.</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>DoorSwing.dll</Assembly>
|
||||
<ClientId>d0527082-51d2-4fc6-874e-4bcc623f49d6</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.DoorSwing.CS.UpdateParamsCommand</FullClassName>
|
||||
<Text>Update Door Properties</Text>
|
||||
<Description>Update Door Properties according to geometries.</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>DoorSwing.dll</Assembly>
|
||||
<ClientId>9b27bd73-78c2-46d7-978c-6d550cd2cf93</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.DoorSwing.CS.UpdateGeometryCommand</FullClassName>
|
||||
<Text>Update Door Geometries</Text>
|
||||
<Description>Update door geometry according to From/To room property.</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
</RevitAddIns>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?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>{B509317E-B7F9-4365-8980-18EDC3B6F6F9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Revit.SDK.Samples.DoorSwing.CS</RootNamespace>
|
||||
<AssemblyName>DoorSwing</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
</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="PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="DoorFamily.cs" />
|
||||
<Compile Include="DoorFamilyGeometry.cs" />
|
||||
<Compile Include="DoorSwingData.cs" />
|
||||
<Compile Include="ExternalApplication.cs" />
|
||||
<Compile Include="InitializeForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="InitializeForm.Designer.cs">
|
||||
<DependentUpon>InitializeForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="DoorSharedParameters.cs" />
|
||||
<Compile Include="DoorSwingResource.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DoorSwingResource.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="InitializeForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>InitializeForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="DoorSwingResource.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>DoorSwingResource.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>
|
||||
<PropertyGroup>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,531 @@
|
||||
//
|
||||
// (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.Collections;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores all the needed data and operates RevitAPI.
|
||||
/// </summary>
|
||||
public class DoorSwingData
|
||||
{
|
||||
#region "Memebers"
|
||||
|
||||
// store door-opening types: user to decide how he wants to identify
|
||||
// the Left, Right or others information.
|
||||
public static List<String> OpeningTypes = new List<string>();
|
||||
|
||||
// store current project's door families.
|
||||
List<DoorFamily> m_doorFamilies = new List<DoorFamily>();
|
||||
|
||||
Autodesk.Revit.UI.UIApplication m_app;
|
||||
|
||||
#endregion
|
||||
|
||||
#region "Properties"
|
||||
|
||||
// retrieves door families.
|
||||
public List<DoorFamily> DoorFamilies
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_doorFamilies;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "Methods"
|
||||
|
||||
/// <summary>
|
||||
/// fill OpeningTypes static member variable.
|
||||
/// </summary>
|
||||
static DoorSwingData()
|
||||
{
|
||||
// fill door's opening types. User can modify the DoorSwingResource according to
|
||||
// how he wants to identify the Left, Right or others opening information.
|
||||
OpeningTypes.Clear();
|
||||
|
||||
// Undefined means this door family is insensible of door opening feature.
|
||||
// User didn't add the relevant parameters or just gave an invalid value.
|
||||
OpeningTypes.Add(DoorSwingResource.Undefined);
|
||||
OpeningTypes.Add(DoorSwingResource.LeftDoor);
|
||||
OpeningTypes.Add(DoorSwingResource.RightDoor);
|
||||
OpeningTypes.Add(DoorSwingResource.TwoLeaf);
|
||||
OpeningTypes.Add(DoorSwingResource.TwoLeafActiveLeafLeft);
|
||||
OpeningTypes.Add(DoorSwingResource.TwoLeafActiveLeafRight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor.
|
||||
/// </summary>
|
||||
/// <param name="app"> Revit application</param>
|
||||
public DoorSwingData(Autodesk.Revit.UI.UIApplication app)
|
||||
{
|
||||
m_app = app;
|
||||
|
||||
// store door families in m_doorFamilies.
|
||||
PrepareDoorFamilies();
|
||||
|
||||
// add needed shared parameters
|
||||
// if the parameters already added will not add again.
|
||||
DoorSharedParameters.AddSharedParameters(app);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update door instances information: Left/Right information, related rooms information.
|
||||
/// </summary>
|
||||
/// <param name="creFilter">One element filter utility object.</param>
|
||||
/// <param name="doc">Revit project.</param>
|
||||
/// <param name="onlyUpdateSelect">
|
||||
/// true means only update selected doors' information otherwise false.
|
||||
/// </param>
|
||||
/// <param name="showUpdateResultMessage">
|
||||
/// this parameter is used for invoking this method in Application's events (document save and document saveAs).
|
||||
/// update door infos in Application level events should not show unnecessary messageBox.
|
||||
/// </param>
|
||||
public static Autodesk.Revit.UI.Result UpdateDoorsInfo(Document doc, bool onlyUpdateSelect,
|
||||
bool showUpdateResultMessage, ref string message)
|
||||
{
|
||||
if ((!AssignedAllRooms(doc)) && showUpdateResultMessage)
|
||||
{
|
||||
TaskDialogResult dialogResult = TaskDialog.Show("Door Swing", "One or more eligible areas of this level " +
|
||||
"have no assigned room(s). Doors bounding these areas " +
|
||||
"will be designated as external doors. Proceed anyway?",
|
||||
TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No);
|
||||
|
||||
if (TaskDialogResult.No == dialogResult)
|
||||
{
|
||||
message = "Update cancelled. Please assign rooms for all eligible areas first.";
|
||||
return Autodesk.Revit.UI.Result.Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
// begin update door parameters.
|
||||
IEnumerator iter;
|
||||
int doorCount = 0;
|
||||
bool checkSharedParameters = false;
|
||||
|
||||
if (onlyUpdateSelect) // update doors in select elements
|
||||
{
|
||||
UIDocument newUIdoc = new UIDocument(doc);
|
||||
ElementSet es = new ElementSet();
|
||||
foreach (ElementId elementId in newUIdoc.Selection.GetElementIds())
|
||||
{
|
||||
es.Insert(newUIdoc.Document.GetElement(elementId));
|
||||
}
|
||||
iter = es.GetEnumerator();
|
||||
}
|
||||
else // update all doors in current Revit project.
|
||||
{
|
||||
ElementClassFilter familyInstanceFilter = new ElementClassFilter(typeof(FamilyInstance));
|
||||
ElementCategoryFilter doorsCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_Doors);
|
||||
LogicalAndFilter doorInstancesFilter = new LogicalAndFilter(familyInstanceFilter, doorsCategoryfilter);
|
||||
iter = new FilteredElementCollector(doc).WherePasses(doorInstancesFilter).GetElementIterator();
|
||||
}
|
||||
|
||||
iter.Reset();
|
||||
while (iter.MoveNext())
|
||||
{
|
||||
// find door instance
|
||||
FamilyInstance door = iter.Current as FamilyInstance;
|
||||
|
||||
if (onlyUpdateSelect)
|
||||
{
|
||||
if (null == door)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null == door.Category)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!door.Category.Name.Equals("Doors"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// check if has needed parameters.
|
||||
if (!checkSharedParameters)
|
||||
{
|
||||
checkSharedParameters = true;
|
||||
|
||||
if (!(door.Symbol.ParametersMap.Contains("BasalOpening") &&
|
||||
door.ParametersMap.Contains("InstanceOpening") &&
|
||||
door.ParametersMap.Contains("Internal Door")))
|
||||
{
|
||||
message = "Cannot update door parameters. Please customize door opening expression first.";
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
}
|
||||
|
||||
// get one door.
|
||||
doorCount++;
|
||||
|
||||
// update one door's Opening parameter value.
|
||||
if (UpdateOpeningFeatureOfOneDoor(door) == Autodesk.Revit.UI.Result.Failed)
|
||||
{
|
||||
message = "Cannot update door parameters. Please customize door opening expression first.";
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
|
||||
// update one door's from/to room.
|
||||
UpdateFromToRoomofOneDoor(door, false);
|
||||
|
||||
// update one door's internalDoor flag
|
||||
UpdateInternalDoorFlagFeatureofOneDoor(door);
|
||||
}
|
||||
|
||||
if (showUpdateResultMessage)
|
||||
{
|
||||
|
||||
if (onlyUpdateSelect)
|
||||
{
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Door Swing", "Updated all selected doors of " + doc.Title +
|
||||
" (" + doorCount + " doors).\r\n (Selection may " +
|
||||
"include miscellaneous elements.)");
|
||||
}
|
||||
else
|
||||
{
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Door Swing", "Updated all doors of " + doc.Title + " (" +
|
||||
doorCount + " doors).");
|
||||
}
|
||||
}
|
||||
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Doors related rooms: update doors' geometry according to its To/From room information.
|
||||
/// </summary>
|
||||
/// <param name="creFilter">One element filter utility object.</param>
|
||||
/// <param name="doc">Revit project.</param>
|
||||
/// <param name="onlyUpdateSelect">
|
||||
/// true means only update selected doors' information else false.
|
||||
/// </param>
|
||||
public static void UpdateDoorsGeometry(Document doc, bool onlyUpdateSelect)
|
||||
{
|
||||
IEnumerator iter;
|
||||
int doorCount = 0;
|
||||
|
||||
if (onlyUpdateSelect) // update doors in select elements
|
||||
{
|
||||
UIDocument newUIdoc = new UIDocument(doc);
|
||||
ElementSet es = new ElementSet();
|
||||
foreach (ElementId elementId in newUIdoc.Selection.GetElementIds())
|
||||
{
|
||||
es.Insert(newUIdoc.Document.GetElement(elementId));
|
||||
}
|
||||
iter = es.GetEnumerator();
|
||||
}
|
||||
else // update all doors in current Revit document
|
||||
{
|
||||
ElementClassFilter familyInstanceFilter = new ElementClassFilter(typeof(FamilyInstance));
|
||||
ElementCategoryFilter doorsCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_Doors);
|
||||
LogicalAndFilter doorInstancesFilter = new LogicalAndFilter(familyInstanceFilter, doorsCategoryfilter);
|
||||
iter = new FilteredElementCollector(doc).WherePasses(doorInstancesFilter).GetElementIterator();
|
||||
}
|
||||
|
||||
iter.Reset();
|
||||
while (iter.MoveNext())
|
||||
{
|
||||
// find door instance
|
||||
FamilyInstance door = iter.Current as FamilyInstance;
|
||||
|
||||
if (onlyUpdateSelect)
|
||||
{
|
||||
if (null == door)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null == door.Category)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!door.Category.Name.Equals("Doors"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// find one door.
|
||||
doorCount++;
|
||||
|
||||
// update one door.
|
||||
UpdateFromToRoomofOneDoor(door, true);
|
||||
doc.Regenerate();
|
||||
}
|
||||
|
||||
if (onlyUpdateSelect)
|
||||
{
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Door Swing", "Updated all selected doors (" + doorCount +
|
||||
" doors).\r\n (Selection may include miscellaneous elements.)");
|
||||
}
|
||||
else
|
||||
{
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Door Swing", "Updated all doors of this project (" +
|
||||
doorCount + " doors).");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update doors' Left/Right information.
|
||||
/// </summary>
|
||||
/// <param name="door">one door instance.</param>
|
||||
private static Autodesk.Revit.UI.Result UpdateOpeningFeatureOfOneDoor(FamilyInstance door)
|
||||
{
|
||||
// flag whether the opening value should switch from its corresponding family's basic opening value.
|
||||
bool switchesOpeningValueFlag = false;
|
||||
|
||||
// When the door is being mirrored once, the door switches its direction;
|
||||
// When the door is being flipped once, the door switches its direction.
|
||||
// When the door is being mirrored and flipped, the door's direction remains the same.
|
||||
if (door.FacingFlipped ^ door.HandFlipped)
|
||||
{
|
||||
switchesOpeningValueFlag = true;
|
||||
}
|
||||
|
||||
// get door's Opening parameter which indicates whether the door is Left or Right.
|
||||
Parameter openingParam = door.ParametersMap.get_Item("InstanceOpening");
|
||||
|
||||
// country's standard Left/Right opening for this door type.
|
||||
String basalOpeningValue = door.Symbol.ParametersMap.get_Item("BasalOpening").AsString();
|
||||
|
||||
string rightOpeningValue; // actual opening value of the door.
|
||||
if (switchesOpeningValueFlag)
|
||||
{
|
||||
if (DoorSwingResource.LeftDoor.Equals(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = DoorSwingResource.RightDoor;
|
||||
}
|
||||
else if (DoorSwingResource.RightDoor.Equals(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = DoorSwingResource.LeftDoor;
|
||||
}
|
||||
else if (DoorSwingResource.TwoLeafActiveLeafLeft.Equals(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = DoorSwingResource.TwoLeafActiveLeafRight;
|
||||
}
|
||||
else if (DoorSwingResource.TwoLeafActiveLeafRight.Equals(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = DoorSwingResource.TwoLeafActiveLeafLeft;
|
||||
}
|
||||
else if (DoorSwingResource.TwoLeaf.Equals(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = DoorSwingResource.TwoLeaf;
|
||||
}
|
||||
else if (DoorSwingResource.Undefined.Equals(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = DoorSwingResource.Undefined;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OpeningTypes.Contains(basalOpeningValue))
|
||||
{
|
||||
rightOpeningValue = basalOpeningValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
}
|
||||
|
||||
// update door's Opening param.
|
||||
openingParam.Set(rightOpeningValue);
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update one door's internalDoor flag which indicates the door is internal door or external door.
|
||||
/// </summary>
|
||||
/// <param name="door">one door instance.</param>
|
||||
private static void UpdateInternalDoorFlagFeatureofOneDoor(FamilyInstance door)
|
||||
{
|
||||
// get the "Internal Door" shared parameter.
|
||||
Parameter internalDoorFlagParam = door.ParametersMap.get_Item("Internal Door");
|
||||
|
||||
// "Internal Door" is decided based on whether door's ToRoom and FromRoom properties both have values.
|
||||
// 1 means internal door, 0 means external door.
|
||||
if (null != door.ToRoom && null != door.FromRoom) // considered as internal door.
|
||||
{
|
||||
internalDoorFlagParam.Set(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalDoorFlagParam.Set(0); // considered as external door.
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Doors related rooms: update one door's To/From room information or geometry.
|
||||
/// </summary>
|
||||
/// <param name="door">one door instance.</param>
|
||||
/// <param name="updateGeo">
|
||||
/// true means update geometry else update To/From room information.
|
||||
/// </param>
|
||||
private static void UpdateFromToRoomofOneDoor(FamilyInstance door, bool updateGeo)
|
||||
{
|
||||
if (null == door.ToRoom && null == door.FromRoom)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// update the door's geometry according to door's To/From room info.
|
||||
// standard: door.ToRoom should keep consistent with door.Room else need update.
|
||||
if ((null == door.Room) && (null == door.FromRoom))
|
||||
{
|
||||
// only external door may have this status.
|
||||
// door.Room are consistent with door.FromRoom, so need update.
|
||||
if (updateGeo) // update geometry
|
||||
{
|
||||
door.flipHand();
|
||||
door.flipFacing();
|
||||
}
|
||||
else // update To/From Room.
|
||||
{
|
||||
door.FlipFromToRoom();
|
||||
}
|
||||
}
|
||||
else if ((null != door.Room) && (null != door.FromRoom))
|
||||
{
|
||||
// door.Room are consistent with door.FromRoom, so need update.
|
||||
if (door.Room.Id.IntegerValue.Equals(door.FromRoom.Id.IntegerValue))
|
||||
{
|
||||
if (updateGeo) // update geometry
|
||||
{
|
||||
door.flipHand();
|
||||
door.flipFacing();
|
||||
}
|
||||
else // update To/From Room.
|
||||
{
|
||||
door.FlipFromToRoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Iterate through plan topology to determine if all plan circuits have assigned rooms.
|
||||
/// </summary>
|
||||
/// <param name="doc">Revit project.</param>
|
||||
/// <returns> true means all plan circuits have assigned rooms else not.</returns>
|
||||
private static bool AssignedAllRooms(Document doc)
|
||||
{
|
||||
PlanTopologySet planTopologies = doc.PlanTopologies;
|
||||
|
||||
// Iterate plan topology for each level.
|
||||
foreach (PlanTopology planTopology in planTopologies)
|
||||
{
|
||||
PlanCircuitSet circuits = planTopology.Circuits;
|
||||
|
||||
// Iterate each circuit in this plan topology.
|
||||
foreach (PlanCircuit circuit in circuits)
|
||||
{
|
||||
bool locatedRoom = circuit.IsRoomLocated;
|
||||
|
||||
if (!locatedRoom)
|
||||
{
|
||||
// If any circuit isn't assigned room, then method return false.
|
||||
return locatedRoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do Door symbols' Opening set based on family's basic geometry and country's standard.
|
||||
/// </summary>
|
||||
public void UpdateDoorFamiliesOpeningFeature()
|
||||
{
|
||||
for (int i = 0; i < m_doorFamilies.Count; i++)
|
||||
{
|
||||
m_doorFamilies[i].UpdateOpeningFeature();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete temporarily created door instances which are used to retrieve geometry. Retrieved
|
||||
/// geometry will shown to users. So they can initialize door opening parameter more visually.
|
||||
/// </summary>
|
||||
public void DeleteTempDoorInstances()
|
||||
{
|
||||
for (int i = 0; i < m_doorFamilies.Count; i++)
|
||||
{
|
||||
m_doorFamilies[i].DeleteTempDoorInstance();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get all the door families in the project.
|
||||
/// And store them in two lists separately based on opening parameter.
|
||||
/// </summary>
|
||||
private void PrepareDoorFamilies()
|
||||
{
|
||||
// prepare DoorFamilies
|
||||
FilteredElementIterator familyIter = new FilteredElementCollector(m_app.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator();
|
||||
|
||||
while (familyIter.MoveNext())
|
||||
{
|
||||
Family doorFamily = familyIter.Current as Family;
|
||||
|
||||
if (null == doorFamily.FamilyCategory) // some family.FamilyCategory is null
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (doorFamily.FamilyCategory.Name !=
|
||||
m_app.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Doors).Name) // FamilyCategory.Name is not 'Doors'
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// create one instance of self class DoorFamily.
|
||||
DoorFamily tempDoorFamily = new DoorFamily(doorFamily, m_app);
|
||||
|
||||
// store the created DoorFamily instance
|
||||
m_doorFamilies.Add(tempDoorFamily);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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.DoorSwing.CS {
|
||||
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 DoorSwingResource {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal DoorSwingResource() {
|
||||
}
|
||||
|
||||
/// <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.DoorSwing.CS.DoorSwingResource", typeof(DoorSwingResource).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 string similar to L.
|
||||
/// </summary>
|
||||
internal static string LeftDoor {
|
||||
get {
|
||||
return ResourceManager.GetString("LeftDoor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to R.
|
||||
/// </summary>
|
||||
internal static string RightDoor {
|
||||
get {
|
||||
return ResourceManager.GetString("RightDoor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Double.
|
||||
/// </summary>
|
||||
internal static string TwoLeaf {
|
||||
get {
|
||||
return ResourceManager.GetString("TwoLeaf", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Double-R.
|
||||
/// </summary>
|
||||
internal static string TwoLeafActiveLeafLeft {
|
||||
get {
|
||||
return ResourceManager.GetString("TwoLeafActiveLeafLeft", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Double-L.
|
||||
/// </summary>
|
||||
internal static string TwoLeafActiveLeafRight {
|
||||
get {
|
||||
return ResourceManager.GetString("TwoLeafActiveLeafRight", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to N/A.
|
||||
/// </summary>
|
||||
internal static string Undefined {
|
||||
get {
|
||||
return ResourceManager.GetString("Undefined", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="LeftDoor" xml:space="preserve">
|
||||
<value>L</value>
|
||||
</data>
|
||||
<data name="RightDoor" xml:space="preserve">
|
||||
<value>R</value>
|
||||
</data>
|
||||
<data name="TwoLeaf" xml:space="preserve">
|
||||
<value>Double</value>
|
||||
</data>
|
||||
<data name="TwoLeafActiveLeafLeft" xml:space="preserve">
|
||||
<value>Double-R</value>
|
||||
</data>
|
||||
<data name="TwoLeafActiveLeafRight" xml:space="preserve">
|
||||
<value>Double-L</value>
|
||||
</data>
|
||||
<data name="Undefined" xml:space="preserve">
|
||||
<value>N/A</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,236 @@
|
||||
//
|
||||
// (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.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB.Events;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.ApplicationServices;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// A class inherited IExternalApplication interface.
|
||||
/// This class subscribes to some application level events and
|
||||
/// creates a custom Ribbon panel which contains three buttons.
|
||||
/// </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 ExternalApplication : IExternalApplication
|
||||
{
|
||||
#region "Members"
|
||||
|
||||
// An object that is passed to the external application which contains the controlled Revit application.
|
||||
UIControlledApplication m_controlApp;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IExternalApplication Members
|
||||
|
||||
/// <summary>
|
||||
/// Implement this method to implement the external application which should be called when
|
||||
/// Revit starts before a file or default template is actually loaded.
|
||||
/// <param name="application">An object that is passed to the external application
|
||||
/// which contains the controlled application.</param>
|
||||
/// <returns>Return the status of the external application.
|
||||
/// A result of Succeeded means that the external application successfully started.
|
||||
/// Cancelled can be used to signify that the user cancelled the external operation at
|
||||
/// some point.
|
||||
/// If false is returned then Revit should inform the user that the external application
|
||||
/// failed to load and the release the internal reference.</returns>
|
||||
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
|
||||
{
|
||||
m_controlApp = application;
|
||||
|
||||
#region Subscribe to related events
|
||||
|
||||
// Doors are updated from the application level events.
|
||||
// That will insure that the doc is correct when it is saved.
|
||||
// Subscribe to related events.
|
||||
application.ControlledApplication.DocumentSaving += new EventHandler<DocumentSavingEventArgs>(DocumentSavingHandler);
|
||||
application.ControlledApplication.DocumentSavingAs += new EventHandler<DocumentSavingAsEventArgs>(DocumentSavingAsHandler);
|
||||
|
||||
#endregion
|
||||
|
||||
#region create a custom Ribbon panel which contains three buttons
|
||||
|
||||
// The location of this command assembly
|
||||
string currentCommandAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
|
||||
// The directory path of buttons' images
|
||||
string buttonImageDir = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName
|
||||
(Path.GetDirectoryName(currentCommandAssemblyPath))));
|
||||
|
||||
// begin to create custom Ribbon panel and command buttons.
|
||||
// create a Ribbon panel.
|
||||
RibbonPanel doorPanel = application.CreateRibbonPanel("Door Swing");
|
||||
|
||||
// the first button in the DoorSwing panel, use to invoke the InitializeCommand.
|
||||
PushButton initialCommandBut = doorPanel.AddItem(new PushButtonData("Customize Door Opening",
|
||||
"Customize Door Opening",
|
||||
currentCommandAssemblyPath,
|
||||
typeof(InitializeCommand).FullName))
|
||||
as PushButton;
|
||||
initialCommandBut.ToolTip = "Customize the expression based on family's geometry and country's standard.";
|
||||
initialCommandBut.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "InitialCommand_Large.bmp")));
|
||||
initialCommandBut.Image = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "InitialCommand_Small.bmp")));
|
||||
|
||||
// the second button in the DoorSwing panel, use to invoke the UpdateParamsCommand.
|
||||
PushButton updateParamBut = doorPanel.AddItem(new PushButtonData("Update Door Properties",
|
||||
"Update Door Properties",
|
||||
currentCommandAssemblyPath,
|
||||
typeof(UpdateParamsCommand).FullName))
|
||||
as PushButton;
|
||||
updateParamBut.ToolTip = "Update door properties based on geometry.";
|
||||
updateParamBut.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateParameter_Large.bmp")));
|
||||
updateParamBut.Image = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateParameter_Small.bmp")));
|
||||
|
||||
// the third button in the DoorSwing panel, use to invoke the UpdateGeometryCommand.
|
||||
PushButton updateGeoBut = doorPanel.AddItem(new PushButtonData("Update Door Geometry",
|
||||
"Update Door Geometry",
|
||||
currentCommandAssemblyPath,
|
||||
typeof(UpdateGeometryCommand).FullName))
|
||||
as PushButton;
|
||||
updateGeoBut.ToolTip = "Update door geometry based on From/To room property.";
|
||||
updateGeoBut.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateGeometry_Large.bmp")));
|
||||
updateGeoBut.Image = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateGeometry_Small.bmp")));
|
||||
|
||||
#endregion
|
||||
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this method to implement the external application which should be called when
|
||||
/// Revit is about to exit, any documents must have been closed before this method is called.
|
||||
/// </summary>
|
||||
/// <param name="application">An object that is passed to the external application
|
||||
/// which contains the controlled application.</param>
|
||||
/// <returns>Return the status of the external application.
|
||||
/// A result of Succeeded means that the external application successfully shutdown.
|
||||
/// Cancelled can be used to signify that the user cancelled the external operation at some point.
|
||||
/// If false is returned then the Revit user should be warned of the failure of the external
|
||||
/// application to shut down correctly.</returns>
|
||||
public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application)
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This event is fired whenever a document is saved.
|
||||
/// Update door's information according to door's current geometry.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="args">An DocumentSavingEventArgs that contains the DocumentSaving event data.</param>
|
||||
private void DocumentSavingHandler(Object sender, DocumentSavingEventArgs args)
|
||||
{
|
||||
string message = "";
|
||||
Transaction tran = null;
|
||||
|
||||
try
|
||||
{
|
||||
Document doc = args.Document;
|
||||
if (doc.IsModifiable)
|
||||
{
|
||||
if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded)
|
||||
TaskDialog.Show("Door Swing", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
tran = new Transaction(doc, "Update parameters in Saving event");
|
||||
tran.Start();
|
||||
|
||||
if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded)
|
||||
TaskDialog.Show("Door Swing", message);
|
||||
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// if there are something wrong, give error information message.
|
||||
TaskDialog.Show("Door Swing", ex.Message);
|
||||
if (null != tran)
|
||||
{
|
||||
if (tran.HasStarted() && !tran.HasEnded())
|
||||
{
|
||||
tran.RollBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event is fired whenever a document is saved as.
|
||||
/// Update door's information according to door's current geometry.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="args">An DocumentSavingAsEventArgs that contains the DocumentSavingAs event data.</param>
|
||||
private void DocumentSavingAsHandler(Object sender, DocumentSavingAsEventArgs args)
|
||||
{
|
||||
string message = "";
|
||||
Transaction tran = null;
|
||||
try
|
||||
{
|
||||
Document doc = args.Document;
|
||||
if (doc.IsModifiable)
|
||||
{
|
||||
if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded)
|
||||
TaskDialog.Show("Door Swing", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
tran = new Transaction(doc, "Update parameters in Saving event");
|
||||
tran.Start();
|
||||
|
||||
if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded)
|
||||
TaskDialog.Show("Door Swing", message);
|
||||
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// if there are something wrong, give error message.
|
||||
TaskDialog.Show("Door Swing", ex.Message);
|
||||
|
||||
if (null != tran)
|
||||
{
|
||||
if (tran.HasStarted() && !tran.HasEnded())
|
||||
{
|
||||
tran.RollBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
//
|
||||
// (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.DoorSwing.CS
|
||||
{
|
||||
partial class InitializeForm
|
||||
{
|
||||
/// <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.previewPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.customizeDoorOpeningDataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.familyNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.OpeningColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.FamilyWithOpeningParameter = new System.Windows.Forms.Label();
|
||||
this.FamilyGeometry = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.customizeDoorOpeningDataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// previewPictureBox
|
||||
//
|
||||
this.previewPictureBox.Location = new System.Drawing.Point(11, 30);
|
||||
this.previewPictureBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.previewPictureBox.Name = "previewPictureBox";
|
||||
this.previewPictureBox.Size = new System.Drawing.Size(325, 341);
|
||||
this.previewPictureBox.TabIndex = 0;
|
||||
this.previewPictureBox.TabStop = false;
|
||||
this.previewPictureBox.Paint += new System.Windows.Forms.PaintEventHandler(this.previewPictureBox_Paint);
|
||||
//
|
||||
// customizeDoorOpeningDataGridView
|
||||
//
|
||||
this.customizeDoorOpeningDataGridView.AllowUserToAddRows = false;
|
||||
this.customizeDoorOpeningDataGridView.AllowUserToDeleteRows = false;
|
||||
this.customizeDoorOpeningDataGridView.AllowUserToOrderColumns = true;
|
||||
this.customizeDoorOpeningDataGridView.BackgroundColor = System.Drawing.Color.White;
|
||||
this.customizeDoorOpeningDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.customizeDoorOpeningDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.familyNameColumn,
|
||||
this.OpeningColumn});
|
||||
this.customizeDoorOpeningDataGridView.Location = new System.Drawing.Point(353, 30);
|
||||
this.customizeDoorOpeningDataGridView.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.customizeDoorOpeningDataGridView.Name = "customizeDoorOpeningDataGridView";
|
||||
this.customizeDoorOpeningDataGridView.RowHeadersVisible = false;
|
||||
this.customizeDoorOpeningDataGridView.RowTemplate.Height = 24;
|
||||
this.customizeDoorOpeningDataGridView.Size = new System.Drawing.Size(365, 341);
|
||||
this.customizeDoorOpeningDataGridView.TabIndex = 1;
|
||||
this.customizeDoorOpeningDataGridView.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.customizeDoorOpeningDataGridView_RowEnter);
|
||||
//
|
||||
// familyNameColumn
|
||||
//
|
||||
this.familyNameColumn.HeaderText = "Family Name";
|
||||
this.familyNameColumn.Name = "familyNameColumn";
|
||||
this.familyNameColumn.ReadOnly = true;
|
||||
this.familyNameColumn.Width = 180;
|
||||
//
|
||||
// OpeningColumn
|
||||
//
|
||||
this.OpeningColumn.HeaderText = "Door Opening";
|
||||
this.OpeningColumn.Name = "OpeningColumn";
|
||||
this.OpeningColumn.Width = 180;
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.Location = new System.Drawing.Point(512, 385);
|
||||
this.okButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(73, 29);
|
||||
this.okButton.TabIndex = 2;
|
||||
this.okButton.Text = "&OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(645, 385);
|
||||
this.cancelButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(73, 29);
|
||||
this.cancelButton.TabIndex = 3;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FamilyWithOpeningParameter
|
||||
//
|
||||
this.FamilyWithOpeningParameter.AutoSize = true;
|
||||
this.FamilyWithOpeningParameter.Location = new System.Drawing.Point(350, 8);
|
||||
this.FamilyWithOpeningParameter.Name = "FamilyWithOpeningParameter";
|
||||
this.FamilyWithOpeningParameter.Size = new System.Drawing.Size(247, 13);
|
||||
this.FamilyWithOpeningParameter.TabIndex = 7;
|
||||
this.FamilyWithOpeningParameter.Text = "Select a family to customize its opening expression:";
|
||||
//
|
||||
// FamilyGeometry
|
||||
//
|
||||
this.FamilyGeometry.AutoSize = true;
|
||||
this.FamilyGeometry.Location = new System.Drawing.Point(9, 9);
|
||||
this.FamilyGeometry.Name = "FamilyGeometry";
|
||||
this.FamilyGeometry.Size = new System.Drawing.Size(85, 13);
|
||||
this.FamilyGeometry.TabIndex = 9;
|
||||
this.FamilyGeometry.Text = "Family geometry:";
|
||||
//
|
||||
// InitializeForm
|
||||
//
|
||||
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(731, 425);
|
||||
this.Controls.Add(this.FamilyGeometry);
|
||||
this.Controls.Add(this.FamilyWithOpeningParameter);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.customizeDoorOpeningDataGridView);
|
||||
this.Controls.Add(this.previewPictureBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "InitializeForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Customize Door Opening Expression";
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.customizeDoorOpeningDataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox previewPictureBox;
|
||||
private System.Windows.Forms.DataGridView customizeDoorOpeningDataGridView;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn familyNameColumn;
|
||||
private System.Windows.Forms.DataGridViewComboBoxColumn OpeningColumn;
|
||||
private System.Windows.Forms.Label FamilyWithOpeningParameter;
|
||||
private System.Windows.Forms.Label FamilyGeometry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// (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.DoorSwing.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// A class inherit from Form is used to list all the door family exist in current project and
|
||||
/// initialize each door type's Left/Right feature.
|
||||
/// </summary>
|
||||
public partial class InitializeForm : System.Windows.Forms.Form
|
||||
{
|
||||
DoorSwingData m_dataBuffer;
|
||||
DoorGeometry m_currentGraphic;
|
||||
|
||||
/// <summary>
|
||||
/// constructor without any argument.
|
||||
/// </summary>
|
||||
private InitializeForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor overload.
|
||||
/// </summary>
|
||||
/// <param name="dataBuffer"> one reference of DoorSwingData.</param>
|
||||
public InitializeForm(DoorSwingData dataBuffer) : this()
|
||||
{
|
||||
m_dataBuffer = dataBuffer;
|
||||
|
||||
// set data source of customizeDoorOpeningDataGridView.
|
||||
customizeDoorOpeningDataGridView.AutoGenerateColumns = false;
|
||||
customizeDoorOpeningDataGridView.DataSource = m_dataBuffer.DoorFamilies;
|
||||
familyNameColumn.DataPropertyName = "FamilyName";
|
||||
OpeningColumn.DataPropertyName = "BasalOpeningValue";
|
||||
OpeningColumn.DataSource = DoorSwingData.OpeningTypes;
|
||||
|
||||
customizeDoorOpeningDataGridView.Focus();
|
||||
if (customizeDoorOpeningDataGridView.Rows.Count != 0)
|
||||
{
|
||||
customizeDoorOpeningDataGridView.Rows[0].Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Preview door's geometry when user select one door family in customizeDoorOpeningDataGridView.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void customizeDoorOpeningDataGridView_RowEnter(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
DoorFamily selectedDoorFamily = customizeDoorOpeningDataGridView.Rows[e.RowIndex].DataBoundItem as DoorFamily;
|
||||
m_currentGraphic = selectedDoorFamily.Geometry;
|
||||
|
||||
// update the dialog box's display.
|
||||
previewPictureBox.Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PreviewBox redraw.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void previewPictureBox_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
// do nothing.
|
||||
if (null == m_currentGraphic)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// The object of Graphics to draw sketch.
|
||||
Graphics graphics = e.Graphics;
|
||||
// Get the element bounding box's rectangle area.
|
||||
RectangleF doorGeoRectangleF = m_currentGraphic.BBOX2D;
|
||||
// Get the display rectangle area of PreviewBox.
|
||||
RectangleF displayRectangleF = previewPictureBox.DisplayRectangle;
|
||||
|
||||
// Calculate the draw area according to the size of the sketch: Adjust the shrink to change borders
|
||||
if ((doorGeoRectangleF.Width * displayRectangleF.Height) > (doorGeoRectangleF.Height * displayRectangleF.Width))
|
||||
{
|
||||
displayRectangleF.Inflate((float)(-0.1 * displayRectangleF.Width), (float)(-1 + (doorGeoRectangleF.Height * 0.8 * displayRectangleF.Width) / (doorGeoRectangleF.Width * displayRectangleF.Height)));
|
||||
}
|
||||
else
|
||||
{
|
||||
displayRectangleF.Inflate((float)(-1 + (doorGeoRectangleF.Width * 0.8 * displayRectangleF.Height) / (doorGeoRectangleF.Height * displayRectangleF.Width)), (float)(-0.1 * displayRectangleF.Height));
|
||||
}
|
||||
|
||||
// Mapping the point in sketch to point in draw area.
|
||||
PointF[] plgpts = new PointF[3];
|
||||
plgpts[0].X = displayRectangleF.Left;
|
||||
plgpts[0].Y = displayRectangleF.Bottom;
|
||||
plgpts[1].X = displayRectangleF.Right;
|
||||
plgpts[1].Y = displayRectangleF.Bottom;
|
||||
plgpts[2].X = displayRectangleF.Left;
|
||||
plgpts[2].Y = displayRectangleF.Top;
|
||||
|
||||
// Get the transform matrix.
|
||||
System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(doorGeoRectangleF, plgpts);
|
||||
|
||||
// Clear the object of graphics.
|
||||
graphics.Clear(previewPictureBox.BackColor);
|
||||
// Transform the object of graphics.
|
||||
graphics.Transform = matrix;
|
||||
// The pen for drawing profiles
|
||||
Pen drawPen = new Pen(System.Drawing.Color.Red, (float)0.05);
|
||||
|
||||
// Draw profiles.
|
||||
m_currentGraphic.DrawGraphics(graphics, drawPen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="familyNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="OpeningColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DoorSwing")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DoorSwing")]
|
||||
[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("ab85a835-98fb-4c7a-95df-e402d80d8b6e")]
|
||||
|
||||
// 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")]
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Reference in New Issue
Block a user