added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,280 @@
//
// (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.ComponentModel;
using System.Collections.ObjectModel;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The LevelConverter class is inherited from the TypeConverter class which is used to
/// show the property which returns Level type as like a combo box in the PropertyGrid control.
/// </summary>
public class LevelConverter : TypeConverter
{
/// <summary>
/// To store the levels element
/// </summary>
static private Dictionary<String, Level> m_levels = new Dictionary<String, Level>();
/// <summary>
/// Initialize the levels data.
/// </summary>
/// <param name="levels"></param>
static public void SetStandardValues(ReadOnlyCollection<Level> levels)
{
m_levels.Clear();
foreach (Level level in levels)
{
m_levels.Add(level.Id.IntegerValue.ToString(), level);
}
}
/// <summary>
/// Get a level by a level id.
/// </summary>
/// <param name="id">The id of the level</param>
/// <returns>Returns a level which id equals the specified id.</returns>
static public Level GetLevelByID(int id)
{
return m_levels[id.ToString()];
}
/// <summary>
/// Override the CanConvertTo method.
/// </summary>
/// <param name="context"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(Level))
return true;
return base.CanConvertTo(context, destinationType);
}
/// <summary>
/// Override the ConvertTo method, convert a level type value to a string type value for displaying in the PropertyGrid.
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(String) && value is Level)
{
Level level = (Level)value;
return level.Name + "[" + level.Id.IntegerValue.ToString() + "]";
}
return base.ConvertTo(context, culture, value, destinationType);
}
/// <summary>
/// Override the CanConvertFrom method.
/// </summary>
/// <param name="context"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(String))
return true;
return base.CanConvertFrom(context, sourceType);
}
/// <summary>
/// Override the ConvertFrom method, convert a string type value to a level type value.
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is String)
{
try
{
String levelString = (String)value;
int leftBracket = levelString.IndexOf('[');
int rightBracket = levelString.IndexOf(']');
String idString = levelString.Substring(leftBracket + 1, rightBracket - leftBracket - 1);
return m_levels[idString];
}
catch (Exception ex)
{
Autodesk.Revit.UI.TaskDialog.Show("Revit", ex.Message);
}
}
return base.ConvertFrom(context, culture, value);
}
/// <summary>
/// Override the GetStandardValuesSupported method for displaying a level list in the PropertyGrid.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
/// <summary>
/// Override the StandardValuesCollection method for supplying a level list in the PropertyGrid.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(m_levels.Values);
}
}
/// <summary>
/// The FootPrintRoofLineConverter class is inherited from the ExpandableObjectConverter class which is used to
/// expand the property which returns FootPrintRoofLine type as like a tree view in the PropertyGrid control.
/// </summary>
public class FootPrintRoofLineConverter : ExpandableObjectConverter
{
// To store the FootPrintRoofLines data.
static private Dictionary<String, FootPrintRoofLine> m_footPrintLines = new Dictionary<String, FootPrintRoofLine>();
/// <summary>
/// Initialize the FootPrintRoofLines data.
/// </summary>
/// <param name="footPrintRoofLines"></param>
static public void SetStandardValues(List<FootPrintRoofLine> footPrintRoofLines)
{
m_footPrintLines.Clear();
foreach (FootPrintRoofLine footPrintLine in footPrintRoofLines)
{
if (m_footPrintLines.ContainsKey(footPrintLine.Id.ToString()))
continue;
m_footPrintLines.Add(footPrintLine.Id.ToString(), footPrintLine);
}
}
/// <summary>
/// Override the CanConvertTo method.
/// </summary>
/// <param name="context"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(FootPrintRoofLine))
return true;
return base.CanConvertTo(context, destinationType);
}
/// <summary>
/// Override the ConvertTo method, convert a FootPrintRoofLine type value to a string type value for displaying in the PropertyGrid.
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(System.String) && value is FootPrintRoofLine)
{
FootPrintRoofLine footPrintLine = (FootPrintRoofLine)value;
return footPrintLine.Name + "[" + footPrintLine.Id.ToString() + "]";
}
return base.ConvertTo(context, culture, value, destinationType);
}
/// <summary>
/// Override the CanConvertFrom method.
/// </summary>
/// <param name="context"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
return true;
return base.CanConvertFrom(context, sourceType);
}
/// <summary>
/// Override the ConvertFrom method, convert a string type value to a FootPrintRoofLine type value.
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is String)
{
try
{
String footPrintLineString = (String)value;
int leftBracket = footPrintLineString.IndexOf('[');
int rightBracket = footPrintLineString.IndexOf(']');
String idString = footPrintLineString.Substring(leftBracket + 1, rightBracket - leftBracket - 1);
return m_footPrintLines[idString];
}
catch (Exception ex)
{
Autodesk.Revit.UI.TaskDialog.Show("Revit", ex.Message);
}
}
return base.ConvertFrom(context, culture, value);
}
/// <summary>
/// Override the GetStandardValuesSupported method for displaying a FootPrintRoofLine list in the PropertyGrid.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
/// <summary>
/// Override the StandardValuesCollection method for supplying a FootPrintRoofLine list in the PropertyGrid.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(m_footPrintLines.Values);
}
};
}
@@ -0,0 +1,160 @@
//
// (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.ComponentModel;
using System.Collections.ObjectModel;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The ExtrusionRoofWrapper class is use to edit a extrusion roof in a PropertyGrid.
/// It contains a extrusion roof.
/// </summary>
public class ExtrusionRoofWrapper
{
// To store the extrusion roof which will be edited in a PropertyGrid.
private ExtrusionRoof m_roof;
/// <summary>
/// The construct of the ExtrusionRoofWrapper class.
/// </summary>
/// <param name="roof">The extrusion roof which will be edited in a PropertyGrid.</param>
public ExtrusionRoofWrapper(ExtrusionRoof roof)
{
m_roof = roof;
}
#region The properties will be shown in the PropertyGrid
/// <summary>
/// The reference plane of the extrusion roof.
/// </summary>
[Category("Constrains")]
[Description("The reference plane of the extrusion roof.")]
public String WorkPlane
{
get
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.SKETCH_PLANE_PARAM);
return para.AsString();
}
}
/// <summary>
/// The extrusion start point of the extrusion roof.
/// </summary>
[Category("Constrains")]
[DisplayName("Extrusion Start")]
[Description("The extrusion of a roof can extend in either direction along the reference plane. If the extrusion extends away from the plane, the start and end points are positive values. If the extrusion extends toward the plane, the start and end points are negative.")]
public String ExtrusionStart
{
get
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.EXTRUSION_START_PARAM);
return para.AsValueString();
}
set
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.EXTRUSION_START_PARAM);
if (para.SetValueString(value) == false)
{
throw new Exception("Invalid Input");
}
}
}
/// <summary>
/// The extrusion end point of the extrusion roof.
/// </summary>
[Category("Constrains")]
[DisplayName("Extrusion End")]
[Description("The extrusion of a roof can extend in either direction along the reference plane. If the extrusion extends away from the plane, the start and end points are positive values. If the extrusion extends toward the plane, the start and end points are negative.")]
public String ExtrusionEnd
{
get
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.EXTRUSION_END_PARAM);
return para.AsValueString();
}
set
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.EXTRUSION_END_PARAM);
if (para.SetValueString(value) == false)
{
throw new Exception("Invalid Input");
}
}
}
/// <summary>
/// The reference level of the extrusion roof.
/// </summary>
[TypeConverterAttribute(typeof(LevelConverter)), Category("Constrains")]
[DisplayName("Reference Level")]
[Description("The reference level of the extrusion roof.")]
public Level ReferenceLevel
{
get
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM);
return LevelConverter.GetLevelByID(para.AsElementId().IntegerValue);
}
set
{
// update reference level
Parameter para = m_roof.get_Parameter(BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM);
Autodesk.Revit.DB.ElementId id = new Autodesk.Revit.DB.ElementId(value.Id.IntegerValue);
para.Set(id);
}
}
/// <summary>
/// The offset from the reference level of the extrusion roof.
/// </summary>
[Category("Constrains")]
[DisplayName("Level Offset")]
[Description("The offset from the reference level.")]
public String LevelOffset
{
get
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.ROOF_CONSTRAINT_OFFSET_PARAM);
return para.AsValueString();
}
set
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.ROOF_CONSTRAINT_OFFSET_PARAM);
if (para.SetValueString(value) == false)
{
throw new Exception("Invalid Input");
}
}
}
#endregion
}
}
@@ -0,0 +1,365 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Collections.ObjectModel;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The Util class is used to translate Revit coordination to windows coordination.
/// </summary>
public class Util
{
/// <summary>
/// Translate a Revit 3D point to a windows 2D point according the boundingbox.
/// </summary>
/// <param name="pointXYZ">A Revit 3D point</param>
/// <param name="boundingbox">The boundingbox of the roof whose footprint lines will be displayed in GDI.</param>
/// <returns>A windows 2D point.</returns>
static public PointF Translate(Autodesk.Revit.DB.XYZ pointXYZ, BoundingBoxXYZ boundingbox)
{
double centerX = (boundingbox.Min.X + boundingbox.Max.X) / 2;
double centerY = (boundingbox.Min.Y + boundingbox.Max.Y) / 2;
return new PointF((float)(pointXYZ.X - centerX), -(float)(pointXYZ.Y - centerY));
}
};
/// <summary>
/// The FootPrintRoofLine class is used to edit the foot print data of a footprint roof.
/// </summary>
public class FootPrintRoofLine
{
// To store the footprint roof which the foot print data belong to.
private FootPrintRoof m_roof;
// To store the model curve data which the foot print data stand for.
private ModelCurve m_curve;
// To store the boundingbox of the roof
private BoundingBoxXYZ m_boundingbox;
/// <summary>
/// The construct of the FootPrintRoofLine class.
/// </summary>
/// <param name="roof">The footprint roof which the foot print data belong to.</param>
/// <param name="curve">The model curve data which the foot print data stand for.</param>
public FootPrintRoofLine(FootPrintRoof roof, ModelCurve curve)
{
m_roof = roof;
m_curve = curve;
m_boundingbox = m_roof.get_BoundingBox(Revit.SDK.Samples.NewRoof.CS.Command.ActiveView);
}
/// <summary>
/// Draw the footprint line in GDI.
/// </summary>
/// <param name="graphics"></param>
/// <param name="pen"></param>
public void Draw(System.Drawing.Graphics graphics, System.Drawing.Pen pen)
{
Curve curve = m_curve.GeometryCurve;
DrawCurve(graphics, pen, curve);
}
/// <summary>
/// Draw the curve in GDI.
/// </summary>
/// <param name="graphics"></param>
/// <param name="pen"></param>
/// <param name="curve"></param>
private void DrawCurve(Graphics graphics, System.Drawing.Pen pen, Curve curve)
{
List<PointF> poinsts = new List<PointF>();
foreach (Autodesk.Revit.DB.XYZ point in curve.Tessellate())
{
poinsts.Add(Util.Translate(point,m_boundingbox));
}
graphics.DrawCurve(pen, poinsts.ToArray());
}
/// <summary>
/// Get the model curve data which the foot print data stand for.
/// </summary>
[Browsable(false)]
public ModelCurve ModelCurve
{
get
{
return m_curve;
}
}
/// <summary>
/// Get the id value of the model curve.
/// </summary>
[Browsable(false)]
public int Id
{
get
{
return m_curve.Id.IntegerValue;
}
}
/// <summary>
/// Get the name of the model curve.
/// </summary>
[Browsable(false)]
public String Name
{
get
{
return m_curve.Name;
}
}
/// <summary>
/// Get/Set the slope definition of a model curve of the roof.
/// </summary>
[Description("The slope definition of the FootPrintRoof line.")]
public bool DefinesSlope
{
get
{
return m_roof.get_DefinesSlope(m_curve);
}
set
{
m_roof.set_DefinesSlope(m_curve, value);
}
}
/// <summary>
/// Get/Set the slope angle of the FootPrintRoof line..
/// </summary>
[Description("The slope angle of the FootPrintRoof line.")]
public double SlopeAngle
{
get
{
return m_roof.get_SlopeAngle(m_curve);
}
set
{
m_roof.set_SlopeAngle(m_curve, value);
}
}
/// <summary>
/// Get/Set the offset of the FootPrintRoof line.
/// </summary>
[Description("The offset of the FootPrintRoof line.")]
public double Offset
{
get
{
return m_roof.get_Offset(m_curve);
}
set
{
m_roof.set_Offset(m_curve, value);
}
}
/// <summary>
/// Get/Set the overhang value of the FootPrintRoof line if the roof is created by picked wall.
/// </summary>
[Description("The overhang value of the FootPrintRoof line if the roof is created by picked wall.")]
public double Overhang
{
get
{
return m_roof.get_Overhang(m_curve);
}
set
{
m_roof.set_Overhang(m_curve, value);
}
}
/// <summary>
/// Get/Set ExtendIntoWall value whether you want the overhang to be measured from the core of the wall or not.
/// </summary>
[Description("whether you want the overhang to be measured from the core of the wall or not.")]
public bool ExtendIntoWall
{
get
{
return m_roof.get_ExtendIntoWall(m_curve);
}
set
{
m_roof.set_ExtendIntoWall(m_curve, value);
}
}
};
/// <summary>
/// The FootPrintRoofWrapper class is use to edit a footprint roof in a PropertyGrid.
/// It contains a footprint roof.
/// </summary>
public class FootPrintRoofWrapper
{
// To store the footprint roof which will be edited in a PropertyGrid.
private FootPrintRoof m_roof;
// To store the footprint line data of the roof which will be edited.
private FootPrintRoofLine m_footPrintLine;
// To store the footprint lines data of the roof.
private List<FootPrintRoofLine> m_roofLines;
// To store the boundingbox of the roof
private BoundingBoxXYZ m_boundingbox;
public event EventHandler OnFootPrintRoofLineChanged;
/// <summary>
/// The construct of the FootPrintRoofWrapper class.
/// </summary>
/// <param name="roof">The footprint roof which will be edited in a PropertyGrid.</param>
public FootPrintRoofWrapper(FootPrintRoof roof)
{
m_roof = roof;
m_roofLines = new List<FootPrintRoofLine>();
ModelCurveArrArray curveloops = m_roof.GetProfiles();
foreach(ModelCurveArray curveloop in curveloops)
{
foreach(ModelCurve curve in curveloop)
{
m_roofLines.Add(new FootPrintRoofLine(m_roof, curve));
}
}
FootPrintRoofLineConverter.SetStandardValues(m_roofLines);
m_footPrintLine = m_roofLines[0];
m_boundingbox = m_roof.get_BoundingBox(Revit.SDK.Samples.NewRoof.CS.Command.ActiveView);
}
/// <summary>
/// Get the bounding box of the roof.
/// </summary>
[Browsable(false)]
public BoundingBoxXYZ Boundingbox
{
get
{
return m_boundingbox;
}
}
/// <summary>
/// Get/Set the current footprint roof line which will be edited in the PropertyGrid.
/// </summary>
[TypeConverterAttribute(typeof(FootPrintRoofLineConverter)), Category("Footprint Roof Line Information")]
public FootPrintRoofLine FootPrintLine
{
get
{
return m_footPrintLine;
}
set
{
m_footPrintLine = value;
OnFootPrintRoofLineChanged(this, new EventArgs());
}
}
/// <summary>
/// The base level of the footprint roof.
/// </summary>
[TypeConverterAttribute(typeof(LevelConverter)), Category("Constrains")]
[DisplayName("Base Level")]
public Level BaseLevel
{
get
{
Parameter para = m_roof.get_Parameter(BuiltInParameter.ROOF_BASE_LEVEL_PARAM);
return LevelConverter.GetLevelByID(para.AsElementId().IntegerValue);
}
set
{
// update base level
Parameter para = m_roof.get_Parameter(BuiltInParameter.ROOF_BASE_LEVEL_PARAM);
Autodesk.Revit.DB.ElementId id = new Autodesk.Revit.DB.ElementId(value.Id.IntegerValue);
para.Set(id);
}
}
/// <summary>
/// The eave cutter type of the footprint roof.
/// </summary>
[Category("Construction")]
[DisplayName("Rafter Cut")]
[Description("The eave cutter type of the footprint roof.")]
public EaveCutterType EaveCutterType
{
get
{
return m_roof.EaveCuts;
}
set
{
m_roof.EaveCuts = value;
}
}
/// <summary>
/// Get the footprint roof lines data.
/// </summary>
[Browsable(false)]
public ReadOnlyCollection<FootPrintRoofLine> FootPrintRoofLines
{
get
{
return new ReadOnlyCollection<FootPrintRoofLine>(m_roofLines);
}
}
/// <summary>
/// Draw the footprint lines.
/// </summary>
/// <param name="graphics">The graphics object.</param>
/// <param name="displayPen">A display pen.</param>
/// <param name="highlightPen">A highlight pen.</param>
public void DrawFootPrint(Graphics graphics, Pen displayPen, Pen highlightPen)
{
foreach (FootPrintRoofLine line in m_roofLines)
{
if (line.Id == m_footPrintLine.Id)
{
line.Draw(graphics, highlightPen);
}
else
{
line.Draw(graphics, displayPen);
}
}
}
}
}
@@ -0,0 +1,66 @@
// (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.NewRoof.RoofForms.CS
{
partial class GraphicsControl
{
/// <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 Component 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.SuspendLayout();
//
// GraphicsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "GraphicsControl";
this.Size = new System.Drawing.Size(151, 146);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,135 @@
//
// (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.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The GraphicsControl is used to display the footprint roof lines with GDI.
/// </summary>
public partial class GraphicsControl : UserControl
{
// A reference to FootPrintRoofWrapper, It constrains the DrawFootPrint() method to
// draw footprint roof lines in the PictureBox control.
private FootPrintRoofWrapper m_footPrintRoofWrapper;
// To store a highlight pen to highlight the specified footprint roof line.
private Pen m_highLightPen;
// To store a display pen to draw the footprint roof lines.
private Pen m_displayPen;
// To store the draw center location of the PictureBox control, it is the origin of the drawing.
public PointF m_drawCenter;
// To store a value to decide the scale of the drawing.
private float m_scale;
/// <summary>
/// The private construct
/// </summary>
private GraphicsControl()
{
InitializeComponent();
}
/// <summary>
/// The construct of the GraphicsControl.
/// </summary>
/// <param name="footPrintRoofWrapper">A reference to FootPrintRoofWrapper which will be displayed in
/// the picture box control.</param>
public GraphicsControl(FootPrintRoofWrapper footPrintRoofWrapper)
{
InitializeComponent();
this.Load += new EventHandler(GraphicsControl_Load);
m_displayPen = new Pen(System.Drawing.Color.Green, 0);
m_highLightPen = new Pen(System.Drawing.Color.Red, 0);
m_footPrintRoofWrapper = footPrintRoofWrapper;
}
/// <summary>
/// When the GraphicsControl was loaded, then add the picture box control to it
/// and initialize the draw center and scale value.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void GraphicsControl_Load(object sender, EventArgs e)
{
PictureBox picturebox = new PictureBox();
picturebox.Dock = DockStyle.Fill;
this.Controls.Add(picturebox);
picturebox.Paint += new PaintEventHandler(picturebox_Paint);
// initialize the draw center and scale value
m_drawCenter = new PointF(picturebox.Size.Width / 2, picturebox.Size.Height / 2);
Autodesk.Revit.DB.XYZ size = m_footPrintRoofWrapper.Boundingbox.Max - m_footPrintRoofWrapper.Boundingbox.Min;
float tempscale1 = (float)((0.9 * picturebox.Width) / size.X);
float tempscale2 = (float)((0.9 * picturebox.Height) / size.Y);
if (tempscale1 > tempscale2)
{
m_scale = tempscale2;
}
else
{
m_scale = tempscale1;
}
// Book the OnFootPrintRoofLineChanged event to refresh the picture box
m_footPrintRoofWrapper.OnFootPrintRoofLineChanged += new EventHandler(m_footPrintRoofWrapper_OnFootPrintRoofLineChanged);
}
/// <summary>
/// When the current selected FootPrintRoofLine changed in the PropertyGrid, then update the drawing.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void m_footPrintRoofWrapper_OnFootPrintRoofLineChanged(object sender, EventArgs e)
{
this.Refresh();
}
/// <summary>
/// Display the footprint roof lines in the picture box control.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void picturebox_Paint(object sender, PaintEventArgs e)
{
Graphics graphics = e.Graphics;
graphics.Clear(System.Drawing.Color.White);
graphics.TranslateTransform(m_drawCenter.X, m_drawCenter.Y);
graphics.ScaleTransform(m_scale, m_scale);
graphics.PageUnit = GraphicsUnit.Pixel;
m_footPrintRoofWrapper.DrawFootPrint(graphics, m_displayPen, m_highLightPen);
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,154 @@
//
// (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.NewRoof.RoofForms.CS
{
partial class RoofEditorForm
{
/// <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.roofEditorPropertyGrid = new System.Windows.Forms.PropertyGrid();
this.label1 = new System.Windows.Forms.Label();
this.roofTypesComboBox = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// roofEditorPropertyGrid
//
this.roofEditorPropertyGrid.Location = new System.Drawing.Point(6, 19);
this.roofEditorPropertyGrid.Name = "roofEditorPropertyGrid";
this.roofEditorPropertyGrid.Size = new System.Drawing.Size(365, 385);
this.roofEditorPropertyGrid.TabIndex = 0;
this.roofEditorPropertyGrid.ToolbarVisible = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Roof Type:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// roofTypesComboBox
//
this.roofTypesComboBox.FormattingEnabled = true;
this.roofTypesComboBox.Location = new System.Drawing.Point(75, 9);
this.roofTypesComboBox.Name = "roofTypesComboBox";
this.roofTypesComboBox.Size = new System.Drawing.Size(314, 21);
this.roofTypesComboBox.TabIndex = 2;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.roofEditorPropertyGrid);
this.groupBox1.Location = new System.Drawing.Point(12, 36);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(377, 410);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Roof Properties";
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(233, 452);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 4;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(314, 452);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 5;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// RoofEditorForm
//
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(401, 487);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.roofTypesComboBox);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "RoofEditorForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Roof Editor";
this.Load += new System.EventHandler(this.RoofEditorForm_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PropertyGrid roofEditorPropertyGrid;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox roofTypesComboBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -0,0 +1,130 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The RoofEditorForm is the main edit form to edit a roof data.
/// </summary>
public partial class RoofEditorForm : System.Windows.Forms.Form
{
// To store the roof which will be edited.
private RoofBase m_roof;
// A reference to the roofs manager
private RoofsManager.CS.RoofsManager m_roofsManager;
// To store the FootPrintRoofWrapper data of the roof.
private FootPrintRoofWrapper m_footPrintRoofWrapper;
// To store the ExtrusionRoofWrapper data of the roof.
private ExtrusionRoofWrapper m_extrusionRoofWrapper;
// A GraphicsControl to display the roof lines of footprint roof.
private GraphicsControl m_graphicsControl;
/// <summary>
/// The private construct.
/// </summary>
private RoofEditorForm()
{
InitializeComponent();
}
/// <summary>
/// The construct of the RoofEditorForm class.
/// </summary>
/// <param name="roofsManager">A reference to the roofs manager</param>
/// <param name="roof">The roof which will be edited.</param>
public RoofEditorForm(RoofsManager.CS.RoofsManager roofsManager, RoofBase roof)
{
m_roofsManager = roofsManager;
m_roof = roof;
InitializeComponent();
m_footPrintRoofWrapper = null;
m_extrusionRoofWrapper = null;
if (m_roof is FootPrintRoof)
{
m_footPrintRoofWrapper = new FootPrintRoofWrapper(m_roof as FootPrintRoof);
}
else
{
m_extrusionRoofWrapper = new ExtrusionRoofWrapper(m_roof as ExtrusionRoof);
}
}
/// <summary>
/// When the RoofEditorForm was loaded, then initialize data of the controls in the form.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RoofEditorForm_Load(object sender, EventArgs e)
{
this.roofTypesComboBox.DataSource = m_roofsManager.RoofTypes;
this.roofTypesComboBox.DisplayMember = "Name";
this.roofTypesComboBox.ValueMember = "Id";
this.roofTypesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.roofTypesComboBox.SelectedValue = m_roof.RoofType.Id;
if (m_roof is FootPrintRoof)
{
this.roofEditorPropertyGrid.SelectedObject = m_footPrintRoofWrapper;
this.Size = new Size(814, 515);
Label label = new Label();
label.Text = "Footprint roof lines:";
label.AutoSize = true;
label.Location = new System.Drawing.Point(398, 12);
this.Controls.Add(label);
m_graphicsControl = new GraphicsControl(m_footPrintRoofWrapper);
m_graphicsControl.Location = new System.Drawing.Point(398, 36);
m_graphicsControl.Size = new Size(400, 440);
this.Controls.Add(m_graphicsControl);
}
else
{
this.roofEditorPropertyGrid.SelectedObject = m_extrusionRoofWrapper;
}
this.roofEditorPropertyGrid.ExpandAllGridItems();
}
/// <summary>
/// When the OK button was clicked, update the roof type of the editing roof.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void okButton_Click(object sender, EventArgs e)
{
m_roof.RoofType = this.roofTypesComboBox.SelectedItem as Autodesk.Revit.DB.RoofType;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+514
View File
@@ -0,0 +1,514 @@
//
// (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.NewRoof.RoofForms.CS
{
partial class RoofForm
{
/// <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.footPrintRoofsListView = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.roofsTabControl = new System.Windows.Forms.TabControl();
this.footprintRoofTabPage = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.roofTypesComboBox = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.levelsComboBox = new System.Windows.Forms.ComboBox();
this.levelLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.selectFootPrintButton = new System.Windows.Forms.Button();
this.extrusionRoofTabPage = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.extrusionEndTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.extrusionStartTextBox = new System.Windows.Forms.TextBox();
this.refPanesComboBox = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.extrusionRoofTypesComboBox = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.refLevelComboBox = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.selectProfileButton = new System.Windows.Forms.Button();
this.extrusionRoofsListView = new System.Windows.Forms.ListView();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.editRoofButton = new System.Windows.Forms.Button();
this.createRoofButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.roofsTabControl.SuspendLayout();
this.footprintRoofTabPage.SuspendLayout();
this.groupBox2.SuspendLayout();
this.extrusionRoofTabPage.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// footPrintRoofsListView
//
this.footPrintRoofsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4});
this.footPrintRoofsListView.Location = new System.Drawing.Point(3, 6);
this.footPrintRoofsListView.Name = "footPrintRoofsListView";
this.footPrintRoofsListView.Size = new System.Drawing.Size(368, 231);
this.footPrintRoofsListView.TabIndex = 2;
this.footPrintRoofsListView.UseCompatibleStateImageBehavior = false;
this.footPrintRoofsListView.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "Roof Id";
//
// columnHeader2
//
this.columnHeader2.Text = "Name";
//
// columnHeader3
//
this.columnHeader3.Text = "Base Level";
//
// columnHeader4
//
this.columnHeader4.Text = "Roof Type";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.roofsTabControl);
this.groupBox1.Controls.Add(this.editRoofButton);
this.groupBox1.Controls.Add(this.createRoofButton);
this.groupBox1.Location = new System.Drawing.Point(2, 2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(395, 447);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Roofs";
//
// roofsTabControl
//
this.roofsTabControl.Controls.Add(this.footprintRoofTabPage);
this.roofsTabControl.Controls.Add(this.extrusionRoofTabPage);
this.roofsTabControl.Location = new System.Drawing.Point(6, 19);
this.roofsTabControl.Name = "roofsTabControl";
this.roofsTabControl.SelectedIndex = 0;
this.roofsTabControl.Size = new System.Drawing.Size(382, 383);
this.roofsTabControl.TabIndex = 5;
//
// footprintRoofTabPage
//
this.footprintRoofTabPage.Controls.Add(this.groupBox2);
this.footprintRoofTabPage.Controls.Add(this.footPrintRoofsListView);
this.footprintRoofTabPage.Location = new System.Drawing.Point(4, 22);
this.footprintRoofTabPage.Name = "footprintRoofTabPage";
this.footprintRoofTabPage.Padding = new System.Windows.Forms.Padding(3);
this.footprintRoofTabPage.Size = new System.Drawing.Size(374, 357);
this.footprintRoofTabPage.TabIndex = 0;
this.footprintRoofTabPage.Text = "Footprint Roofs";
this.footprintRoofTabPage.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.roofTypesComboBox);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.levelsComboBox);
this.groupBox2.Controls.Add(this.levelLabel);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.selectFootPrintButton);
this.groupBox2.Location = new System.Drawing.Point(6, 243);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(365, 108);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Create FootPrintRoof";
//
// roofTypesComboBox
//
this.roofTypesComboBox.FormattingEnabled = true;
this.roofTypesComboBox.Location = new System.Drawing.Point(64, 73);
this.roofTypesComboBox.Name = "roofTypesComboBox";
this.roofTypesComboBox.Size = new System.Drawing.Size(295, 21);
this.roofTypesComboBox.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 76);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(60, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Roof Type:";
//
// levelsComboBox
//
this.levelsComboBox.FormattingEnabled = true;
this.levelsComboBox.Location = new System.Drawing.Point(64, 46);
this.levelsComboBox.Name = "levelsComboBox";
this.levelsComboBox.Size = new System.Drawing.Size(295, 21);
this.levelsComboBox.TabIndex = 4;
//
// levelLabel
//
this.levelLabel.AutoSize = true;
this.levelLabel.Location = new System.Drawing.Point(6, 49);
this.levelLabel.Name = "levelLabel";
this.levelLabel.Size = new System.Drawing.Size(36, 13);
this.levelLabel.TabIndex = 3;
this.levelLabel.Text = "Level:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Footprint:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// selectFootPrintButton
//
this.selectFootPrintButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.selectFootPrintButton.Location = new System.Drawing.Point(64, 17);
this.selectFootPrintButton.Name = "selectFootPrintButton";
this.selectFootPrintButton.Size = new System.Drawing.Size(295, 23);
this.selectFootPrintButton.TabIndex = 1;
this.selectFootPrintButton.Text = "&Select Footprint in Revit";
this.selectFootPrintButton.UseVisualStyleBackColor = true;
//
// extrusionRoofTabPage
//
this.extrusionRoofTabPage.Controls.Add(this.groupBox3);
this.extrusionRoofTabPage.Controls.Add(this.extrusionRoofsListView);
this.extrusionRoofTabPage.Location = new System.Drawing.Point(4, 22);
this.extrusionRoofTabPage.Name = "extrusionRoofTabPage";
this.extrusionRoofTabPage.Padding = new System.Windows.Forms.Padding(3);
this.extrusionRoofTabPage.Size = new System.Drawing.Size(374, 357);
this.extrusionRoofTabPage.TabIndex = 1;
this.extrusionRoofTabPage.Text = "Extrusion Roofs";
this.extrusionRoofTabPage.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.extrusionEndTextBox);
this.groupBox3.Controls.Add(this.label5);
this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Controls.Add(this.extrusionStartTextBox);
this.groupBox3.Controls.Add(this.refPanesComboBox);
this.groupBox3.Controls.Add(this.label2);
this.groupBox3.Controls.Add(this.extrusionRoofTypesComboBox);
this.groupBox3.Controls.Add(this.label6);
this.groupBox3.Controls.Add(this.refLevelComboBox);
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Controls.Add(this.label8);
this.groupBox3.Controls.Add(this.selectProfileButton);
this.groupBox3.Location = new System.Drawing.Point(3, 207);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(368, 154);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Create ExtrusionRoof";
//
// extrusionEndTextBox
//
this.extrusionEndTextBox.Location = new System.Drawing.Point(285, 123);
this.extrusionEndTextBox.Name = "extrusionEndTextBox";
this.extrusionEndTextBox.Size = new System.Drawing.Size(77, 20);
this.extrusionEndTextBox.TabIndex = 12;
this.extrusionEndTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.extrusionEndTextBox_Validating);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(207, 126);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(75, 13);
this.label5.TabIndex = 11;
this.label5.Text = "Extrusion End:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 126);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(78, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Extrusion Start:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// extrusionStartTextBox
//
this.extrusionStartTextBox.Location = new System.Drawing.Point(84, 124);
this.extrusionStartTextBox.Name = "extrusionStartTextBox";
this.extrusionStartTextBox.Size = new System.Drawing.Size(74, 20);
this.extrusionStartTextBox.TabIndex = 9;
this.extrusionStartTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.extrusionStartTextBox_Validating);
//
// refPanesComboBox
//
this.refPanesComboBox.FormattingEnabled = true;
this.refPanesComboBox.Location = new System.Drawing.Point(84, 45);
this.refPanesComboBox.Name = "refPanesComboBox";
this.refPanesComboBox.Size = new System.Drawing.Size(278, 21);
this.refPanesComboBox.TabIndex = 8;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Ref Plane:";
//
// extrusionRoofTypesComboBox
//
this.extrusionRoofTypesComboBox.FormattingEnabled = true;
this.extrusionRoofTypesComboBox.Location = new System.Drawing.Point(84, 97);
this.extrusionRoofTypesComboBox.Name = "extrusionRoofTypesComboBox";
this.extrusionRoofTypesComboBox.Size = new System.Drawing.Size(278, 21);
this.extrusionRoofTypesComboBox.TabIndex = 6;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 100);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(60, 13);
this.label6.TabIndex = 5;
this.label6.Text = "Roof Type:";
//
// refLevelComboBox
//
this.refLevelComboBox.FormattingEnabled = true;
this.refLevelComboBox.Location = new System.Drawing.Point(84, 71);
this.refLevelComboBox.Name = "refLevelComboBox";
this.refLevelComboBox.Size = new System.Drawing.Size(278, 21);
this.refLevelComboBox.TabIndex = 4;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 74);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(56, 13);
this.label7.TabIndex = 3;
this.label7.Text = "Ref Level:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 22);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(39, 13);
this.label8.TabIndex = 2;
this.label8.Text = "Profile:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// selectProfileButton
//
this.selectProfileButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.selectProfileButton.Location = new System.Drawing.Point(84, 17);
this.selectProfileButton.Name = "selectProfileButton";
this.selectProfileButton.Size = new System.Drawing.Size(263, 23);
this.selectProfileButton.TabIndex = 1;
this.selectProfileButton.Text = "&Select Profile in Revit";
this.selectProfileButton.UseVisualStyleBackColor = true;
//
// extrusionRoofsListView
//
this.extrusionRoofsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader5,
this.columnHeader6,
this.columnHeader7,
this.columnHeader8});
this.extrusionRoofsListView.Location = new System.Drawing.Point(3, 6);
this.extrusionRoofsListView.Name = "extrusionRoofsListView";
this.extrusionRoofsListView.Size = new System.Drawing.Size(368, 197);
this.extrusionRoofsListView.TabIndex = 3;
this.extrusionRoofsListView.UseCompatibleStateImageBehavior = false;
this.extrusionRoofsListView.View = System.Windows.Forms.View.Details;
//
// columnHeader5
//
this.columnHeader5.Text = "Roof Id";
//
// columnHeader6
//
this.columnHeader6.Text = "Name";
//
// columnHeader7
//
this.columnHeader7.Text = "Reference Level";
this.columnHeader7.Width = 102;
//
// columnHeader8
//
this.columnHeader8.Text = "Roof Type";
//
// editRoofButton
//
this.editRoofButton.Location = new System.Drawing.Point(207, 408);
this.editRoofButton.Name = "editRoofButton";
this.editRoofButton.Size = new System.Drawing.Size(181, 23);
this.editRoofButton.TabIndex = 4;
this.editRoofButton.Text = "Edit";
this.editRoofButton.UseVisualStyleBackColor = true;
this.editRoofButton.Click += new System.EventHandler(this.editRoofButton_Click);
//
// createRoofButton
//
this.createRoofButton.Location = new System.Drawing.Point(6, 408);
this.createRoofButton.Name = "createRoofButton";
this.createRoofButton.Size = new System.Drawing.Size(181, 23);
this.createRoofButton.TabIndex = 3;
this.createRoofButton.Text = "Create";
this.createRoofButton.UseVisualStyleBackColor = true;
this.createRoofButton.Click += new System.EventHandler(this.createRoofButton_Click);
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(240, 455);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 4;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(322, 455);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 5;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// RoofForm
//
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(401, 487);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "RoofForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "New Roof";
this.Load += new System.EventHandler(this.RoofForm_Load);
this.groupBox1.ResumeLayout(false);
this.roofsTabControl.ResumeLayout(false);
this.footprintRoofTabPage.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.extrusionRoofTabPage.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView footPrintRoofsListView;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button editRoofButton;
private System.Windows.Forms.Button createRoofButton;
private System.Windows.Forms.TabControl roofsTabControl;
private System.Windows.Forms.TabPage footprintRoofTabPage;
private System.Windows.Forms.TabPage extrusionRoofTabPage;
private System.Windows.Forms.ListView extrusionRoofsListView;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ComboBox roofTypesComboBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox levelsComboBox;
private System.Windows.Forms.Label levelLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button selectFootPrintButton;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox extrusionEndTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox extrusionStartTextBox;
private System.Windows.Forms.ComboBox refPanesComboBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox extrusionRoofTypesComboBox;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox refLevelComboBox;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button selectProfileButton;
}
}
@@ -0,0 +1,382 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The main form to create or delete roof in Revit.
/// </summary>
public partial class RoofForm : System.Windows.Forms.Form
{
// A reference to the roofs manager
private RoofsManager.CS.RoofsManager m_roofsManager;
// To store the extrusion start and extrusion end value for creating extrusion roof.
private double m_start, m_end;
/// <summary>
/// The private construct.
/// </summary>
private RoofForm()
{
InitializeComponent();
}
/// <summary>
/// The construct of the RoofForm class.
/// </summary>
/// <param name="roofsManager">A reference to the roofs manager</param>
public RoofForm(RoofsManager.CS.RoofsManager roofsManager)
{
m_roofsManager = roofsManager;
m_start = -10.0;
m_end = 10.0;
InitializeComponent();
}
/// <summary>
/// When the RoofForm was loaded, then initialize data of the controls in the form.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RoofForm_Load(object sender, EventArgs e)
{
foreach (FootPrintRoof roof in m_roofsManager.FootPrintRoofs)
{
this.footPrintRoofsListView.Items.Add(new RoofItem(roof));
}
foreach (ExtrusionRoof roof in m_roofsManager.ExtrusionRoofs)
{
this.extrusionRoofsListView.Items.Add(new RoofItem(roof));
}
this.levelsComboBox.DataSource = m_roofsManager.Levels;
this.levelsComboBox.DisplayMember = "Name";
this.levelsComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.roofTypesComboBox.DataSource = m_roofsManager.RoofTypes;
this.roofTypesComboBox.DisplayMember = "Name";
this.roofTypesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.refLevelComboBox.DataSource = m_roofsManager.Levels;
this.refLevelComboBox.DisplayMember = "Name";
this.refLevelComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.extrusionRoofTypesComboBox.DataSource = m_roofsManager.RoofTypes;
this.extrusionRoofTypesComboBox.DisplayMember = "Name";
this.extrusionRoofTypesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
this.refPanesComboBox.DataSource = m_roofsManager.ReferencePlanes;
this.refPanesComboBox.DisplayMember = "Name";
this.refPanesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
// Book Select Button Click Event
this.selectFootPrintButton.Click += new EventHandler(selectFootPrintButton_Click);
this.selectProfileButton.Click += new EventHandler(selectProfileButton_Click);
if (m_roofsManager.RoofKind == Revit.SDK.Samples.NewRoof.RoofsManager.CS.CreateRoofKind.FootPrintRoof)
{
this.roofsTabControl.SelectedTab = this.footprintRoofTabPage;
}
else
{
this.roofsTabControl.SelectedTab = this.extrusionRoofTabPage;
}
this.footPrintRoofsListView.MultiSelect = false;
this.footPrintRoofsListView.FullRowSelect = true;
this.footPrintRoofsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
this.footPrintRoofsListView.MouseDoubleClick += new MouseEventHandler(roofsListView_MouseDoubleClick);
this.extrusionRoofsListView.MultiSelect = false;
this.extrusionRoofsListView.FullRowSelect = true;
this.extrusionRoofsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
this.extrusionRoofsListView.MouseDoubleClick += new MouseEventHandler(roofsListView_MouseDoubleClick);
this.extrusionStartTextBox.Text = m_start.ToString();
this.extrusionEndTextBox.Text = m_end.ToString();
}
/// <summary>
/// When selectFootPrintButton was clicked, then select some footprint loops in Revit.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void selectFootPrintButton_Click(object sender, EventArgs e)
{
this.m_roofsManager.RoofKind = Revit.SDK.Samples.NewRoof.RoofsManager.CS.CreateRoofKind.FootPrintRoof;
this.Close();
}
/// <summary>
/// When selectFootPrintButton was clicked, then select profile in Revit.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void selectProfileButton_Click(object sender, EventArgs e)
{
this.m_roofsManager.RoofKind = Revit.SDK.Samples.NewRoof.RoofsManager.CS.CreateRoofKind.ExtrusionRoof;
this.Close();
}
/// <summary>
/// when createRoofButton was clicked, then create a new roof.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void createRoofButton_Click(object sender, EventArgs e)
{
if (this.roofsTabControl.SelectedTab == this.footprintRoofTabPage)
{
createFootPrintRoof();
}
else
{
createExtrusionRoof();
}
}
/// <summary>
/// When editRoofButton was click, then create a new RoofEditorForm to edit the selected roof.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void editRoofButton_Click(object sender, EventArgs e)
{
if (this.footPrintRoofsListView.SelectedItems.Count != 0
|| this.extrusionRoofsListView.SelectedItems.Count != 0)
{
RoofItem item = null;
if (this.roofsTabControl.SelectedTab == this.footprintRoofTabPage)
{
item = this.footPrintRoofsListView.SelectedItems[0] as RoofItem;
}
else
{
item = this.extrusionRoofsListView.SelectedItems[0] as RoofItem;
}
if (item != null)
{
EditRoofItem(item.ListView, item);
}
}
else
{
TaskDialog.Show("Revit", "To edit a roof, you should select a roof or double click a roof in the list first.");
}
}
/// <summary>
/// Create a new footprint roof.
/// </summary>
private void createFootPrintRoof()
{
try
{
if (m_roofsManager.FootPrint.Size != 0)
{
Autodesk.Revit.DB.Level level = levelsComboBox.SelectedItem as Autodesk.Revit.DB.Level;
Autodesk.Revit.DB.RoofType roofType = roofTypesComboBox.SelectedItem as Autodesk.Revit.DB.RoofType;
if (level != null && roofType != null)
{
Autodesk.Revit.DB.FootPrintRoof roof = m_roofsManager.CreateFootPrintRoof(level, roofType);
if (roof == null)
{
TaskDialog.Show("Revit", "Invalid footprint2");
}
else
{
this.footPrintRoofsListView.Items.Add(new RoofItem(roof));
this.footPrintRoofsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
}
}
else
{
TaskDialog.Show("Revit", "You should supply footprint to create footprint roof, click select button to select footprint in Revit.");
}
}
catch (Exception ex)
{
TaskDialog.Show("Revit", ex.Message + " : Footprint must be in closed loops.");
}
}
/// <summary>
/// Create a extrusion roof.
/// </summary>
private void createExtrusionRoof()
{
try
{
if (m_roofsManager.Profile.Size != 0)
{
Autodesk.Revit.DB.Level level = this.refLevelComboBox.SelectedItem as Autodesk.Revit.DB.Level;
Autodesk.Revit.DB.RoofType roofType = this.extrusionRoofTypesComboBox.SelectedItem as Autodesk.Revit.DB.RoofType;
Autodesk.Revit.DB.ReferencePlane refPlane = refPanesComboBox.SelectedItem as Autodesk.Revit.DB.ReferencePlane;
if (level != null && roofType != null && refPlane != null)
{
Autodesk.Revit.DB.ExtrusionRoof roof = m_roofsManager.CreateExtrusionRoof(refPlane, level, roofType, m_start, m_end);
if (roof == null)
{
TaskDialog.Show("Revit", "Invalid profile");
}
else
{
this.extrusionRoofsListView.Items.Add(new RoofItem(roof));
this.extrusionRoofsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
}
}
else
{
TaskDialog.Show("Revit", "You should supply profile to create extrusion roof, click select button to select profile in Revit.");
}
}
catch (Exception ex)
{
TaskDialog.Show("Revit", ex.Message);
}
}
/// <summary>
/// Edit a roof's properties.
/// </summary>
/// <param name="item">It contains a roof element.</param>
private void EditRoofItem(object sender, RoofItem item)
{
try
{
m_roofsManager.BeginTransaction();
DialogResult result = DialogResult.None;
using (RoofEditorForm editorForm = new RoofEditorForm(m_roofsManager, item.Roof))
{
result = editorForm.ShowDialog();
}
if (result == DialogResult.OK)
{
if (m_roofsManager.EndTransaction() == TransactionStatus.Committed)
{
ListView listView = sender as ListView;
if (item.Update())
{
listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
else
{
m_roofsManager.FootPrintRoofs.Erase(item.Roof);
listView.Items.Remove(item);
listView.Refresh();
}
}
else
{
m_roofsManager.AbortTransaction();
}
}
else
{
m_roofsManager.AbortTransaction();
}
}
catch (Exception ex)
{
TaskDialog.Show("Revit", ex.Message);
m_roofsManager.AbortTransaction();
}
}
/// <summary>
/// When the event occurred, then create a new RoofEditorForm to edit the roof.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void roofsListView_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
RoofItem item = null;
if (this.roofsTabControl.SelectedTab == this.footprintRoofTabPage)
{
item = this.footPrintRoofsListView.GetItemAt(e.X, e.Y) as RoofItem;
}
else
{
item = this.extrusionRoofsListView.GetItemAt(e.X, e.Y) as RoofItem;
}
if (item != null)
{
EditRoofItem(sender, item);
}
}
}
/// <summary>
/// Validate the extrusion start value.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void extrusionStartTextBox_Validating(object sender, CancelEventArgs e)
{
try
{
m_start = double.Parse(extrusionStartTextBox.Text);
}
catch
{
TaskDialog.Show("Revit", "You should input a decimal value.");
e.Cancel = true;
}
}
/// <summary>
/// Validate the extrusion end value.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void extrusionEndTextBox_Validating(object sender, CancelEventArgs e)
{
try
{
m_end = double.Parse(extrusionEndTextBox.Text);
}
catch
{
TaskDialog.Show("Revit", "You should input a decimal value.");
e.Cancel = true;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,104 @@
//
// (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.Windows.Forms;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRoof.RoofForms.CS
{
/// <summary>
/// The RoofItem is used to display a roof info in the ListView as a ListViewItem.
/// </summary>
class RoofItem : ListViewItem
{
// To store the roof which the RoofItem stands for.
Autodesk.Revit.DB.RoofBase m_roof;
/// <summary>
/// The construct of the RoofItem class.
/// </summary>
/// <param name="roof"></param>
public RoofItem(Autodesk.Revit.DB.RoofBase roof) : base(roof.Id.IntegerValue.ToString())
{
m_roof = roof;
this.SubItems.Add(roof.Name);
if (m_roof is Autodesk.Revit.DB.FootPrintRoof)
{
Parameter para = roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_BASE_LEVEL_PARAM);
this.SubItems.Add(LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name);
}
else if (m_roof is Autodesk.Revit.DB.ExtrusionRoof)
{
Parameter para = roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM);
this.SubItems.Add(LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name);
}
this.SubItems.Add(roof.RoofType.Name);
}
/// <summary>
/// When the roof was edited, then the data of the RoofItem should be updated synchronously.
/// </summary>
/// <returns>Update successfully return true, otherwise return false.</returns>
public bool Update()
{
try
{
this.SubItems[1].Text = m_roof.Name;
if (m_roof is Autodesk.Revit.DB.FootPrintRoof)
{
Parameter para = m_roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_BASE_LEVEL_PARAM);
this.SubItems[2].Text = LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name;
}
else if (m_roof is Autodesk.Revit.DB.ExtrusionRoof)
{
Parameter para = m_roof.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM);
this.SubItems[2].Text = LevelConverter.GetLevelByID(para.AsElementId().IntegerValue).Name;
}
this.SubItems[3].Text = m_roof.RoofType.Name;
}
catch
{
return false;
}
return true;
}
/// <summary>
/// Get the roof which the RoofItem stands for.
/// </summary>
public Autodesk.Revit.DB.RoofBase Roof
{
get
{
return m_roof;
}
}
}
}