mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-08-18 03:19:17 +00:00
added Revit 2022 SDK minus except *rvt and *rfa
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// (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;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
|
||||
using Element = Autodesk.Revit.DB.Element;
|
||||
using GeometryElement = Autodesk.Revit.DB.GeometryElement;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the Revit add-in interface IExternalCommand
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.ReadOnly)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
|
||||
public class Command : IExternalCommand
|
||||
{
|
||||
// internal buffer
|
||||
private static ExternalCommandData m_commandData;
|
||||
|
||||
/// <summary>
|
||||
/// singleton in the external application
|
||||
/// </summary>
|
||||
public static ExternalCommandData CommandData
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_commandData;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this method as an external command for Revit.
|
||||
/// </summary>
|
||||
/// <param name="commandData">An object that is passed to the external application
|
||||
/// which contains data related to the command,
|
||||
/// such as the application object and active view.</param>
|
||||
/// <param name="message">A message that can be set by the external application
|
||||
/// which will be displayed if a failure or cancellation is returned by
|
||||
/// the external command.</param>
|
||||
/// <param name="elements">A set of elements to which the external application
|
||||
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
|
||||
/// <returns>Return the status of the external command.
|
||||
/// A result of Succeeded means that the API external method functioned as expected.
|
||||
/// Cancelled can be used to signify that the user cancelled the external operation
|
||||
/// at some point. Failure should be returned if the application is unable to proceed with
|
||||
/// the operation.</returns>
|
||||
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
|
||||
ref string message, Autodesk.Revit.DB.ElementSet elements)
|
||||
{
|
||||
try
|
||||
{
|
||||
// initialize member
|
||||
m_commandData = commandData;
|
||||
// process data from Revit and show dialog
|
||||
ObjectViewer viewer = new ObjectViewer();
|
||||
using (ObjectViewerForm viewerFrm = new ObjectViewerForm(viewer))
|
||||
{
|
||||
if (viewerFrm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ErrorMessageException msgEx)
|
||||
{
|
||||
// deal with checked exception
|
||||
message = msgEx.Message;
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
catch
|
||||
{
|
||||
message = "External Application is aborted for unknown reason.";
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
return Autodesk.Revit.UI.Result.Cancelled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// (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;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// pass error message to UI or back to internal error messagebox by Execute method in IExternalCommand
|
||||
/// </summary>
|
||||
public class ErrorMessageException : ApplicationException
|
||||
{
|
||||
/// <summary>
|
||||
/// constructor entirely using baseclass'
|
||||
/// </summary>
|
||||
public ErrorMessageException()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor entirely using baseclass'
|
||||
/// </summary>
|
||||
/// <param name="message">error message</param>
|
||||
public ErrorMessageException(String message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
//
|
||||
// (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.ObjectModel;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using Element = Autodesk.Revit.DB.Element;
|
||||
using GeometryElement = Autodesk.Revit.DB.GeometryElement;
|
||||
using GeometryOptions = Autodesk.Revit.DB.Options;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// The GeometryDatafactory object is used to transform Revit geometry data
|
||||
/// to appropriate format for GDI.
|
||||
/// </summary>
|
||||
public class GeometryData
|
||||
{
|
||||
// boundingBox of the geometry
|
||||
private BoundingBoxXYZ m_bbox;
|
||||
// curves can represent the wireframe of the geometry
|
||||
private List<List<XYZ>> m_curve3Ds = new List<List<XYZ>>();
|
||||
|
||||
/// <summary>
|
||||
/// 3D graphics data of the geometry
|
||||
/// </summary>
|
||||
public Graphics3DData Data3D
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Graphics3DData(new List<List<XYZ>>(m_curve3Ds), m_bbox);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create 3D and 2D data of given GeometryElement
|
||||
/// </summary>
|
||||
/// <param name="elem"></param>
|
||||
/// <param name="detail"></param>
|
||||
/// <param name="currentView"></param>
|
||||
public GeometryData(Element elem, ViewDetailLevel detail, View currentView)
|
||||
{
|
||||
Options opt = Command.CommandData.Application.Application.Create.NewGeometryOptions();
|
||||
opt.DetailLevel = detail;
|
||||
opt.ComputeReferences = false;
|
||||
GeometryElement geoElement = elem.get_Geometry(opt);
|
||||
|
||||
Autodesk.Revit.DB.XYZ xyz = new Autodesk.Revit.DB.XYZ(0, 0, 0);
|
||||
Transform transform = Transform.CreateTranslation(xyz);
|
||||
AddGeoElement(geoElement, transform);
|
||||
|
||||
m_bbox = elem.get_BoundingBox(currentView);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create 3D and 2D data of given GeometryElement
|
||||
/// </summary>
|
||||
/// <param name="elem">of which geometry data be gotten</param>
|
||||
/// <param name="currentView">current view of Revit</param>
|
||||
public GeometryData(Element elem, View currentView)
|
||||
{
|
||||
Options opt = Command.CommandData.Application.Application.Create.NewGeometryOptions();
|
||||
opt.View = currentView;
|
||||
opt.ComputeReferences = false;
|
||||
GeometryElement geoElement = elem.get_Geometry(opt);
|
||||
|
||||
Autodesk.Revit.DB.XYZ xyz = new Autodesk.Revit.DB.XYZ(0, 0, 0);
|
||||
Transform transform = Transform.CreateTranslation(xyz);
|
||||
AddGeoElement(geoElement, transform);
|
||||
|
||||
m_bbox = elem.get_BoundingBox(currentView);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the solids in a Geometric primitive
|
||||
/// </summary>
|
||||
/// <param name="obj">a geometry object of element</param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddGeoElement(GeometryObject obj, Transform transform)
|
||||
{
|
||||
GeometryElement geometry = obj as GeometryElement;
|
||||
if (null == geometry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//get all geometric primitives contained in the GeometryElement
|
||||
IEnumerator<GeometryObject> Objects = geometry.GetEnumerator();
|
||||
|
||||
AddGeometryObjects(Objects, transform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// iterate GeometryObject in GeometryObjectArray and generate data accordingly
|
||||
/// </summary>
|
||||
/// <param name="objects"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddGeometryObjects(IEnumerator<GeometryObject> objects, Transform transform)
|
||||
{
|
||||
//foreach (GeometryObject o in objects)
|
||||
while (objects.MoveNext())
|
||||
{
|
||||
GeometryObject o = objects.Current;
|
||||
|
||||
//if the type of the geometric primitive is Solid
|
||||
string geoType = o.GetType().Name;
|
||||
switch (geoType)
|
||||
{
|
||||
case "Solid":
|
||||
AddSolid(o, transform);
|
||||
break;
|
||||
case "Face":
|
||||
AddFace(o, transform);
|
||||
break;
|
||||
case "Mesh":
|
||||
AddMesh(o, transform);
|
||||
break;
|
||||
case "Curve":
|
||||
case "Line":
|
||||
case "Arc":
|
||||
AddCurve(o, transform);
|
||||
break;
|
||||
case "Profile":
|
||||
AddProfile(o, transform);
|
||||
break;
|
||||
case "Element":
|
||||
AddGeoElement(o, transform);
|
||||
break;
|
||||
case "Instance":
|
||||
AddInstance(o, transform);
|
||||
break;
|
||||
case "Edge":
|
||||
AddEdge(o, transform);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Solid
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddSolid(GeometryObject obj, Transform transform)
|
||||
{
|
||||
Solid solid = obj as Solid;
|
||||
if (null == solid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//a solid has many faces
|
||||
FaceArray faces = solid.Faces;
|
||||
if (faces.Size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Face face in faces)
|
||||
{
|
||||
AddFace(face, transform);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Face
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddFace(GeometryObject obj, Transform transform)
|
||||
{
|
||||
Face face = obj as Face;
|
||||
if (null == face)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mesh mesh = face.Triangulate();
|
||||
if (null == mesh)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AddMesh(mesh, transform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Profile
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddProfile(GeometryObject obj, Transform transform)
|
||||
{
|
||||
Profile profile = obj as Profile;
|
||||
if (null == profile)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Curve curve in profile.Curves)
|
||||
{
|
||||
AddCurve(curve, transform);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Mesh
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddMesh(GeometryObject obj, Transform transform)
|
||||
{
|
||||
Mesh mesh = obj as Mesh;
|
||||
if (null == mesh)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//a face has a mesh, all meshes are made of triangles
|
||||
for (int i = 0; i < mesh.NumTriangles; i++)
|
||||
{
|
||||
MeshTriangle triangular = mesh.get_Triangle(i);
|
||||
List<XYZ> points = new List<XYZ>();
|
||||
try
|
||||
{
|
||||
for (int n = 0; n < 3; n++)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ point = triangular.get_Vertex(n);
|
||||
Autodesk.Revit.DB.XYZ newPoint = MathUtil.GetBasis(point, transform);
|
||||
points.Add(newPoint);
|
||||
}
|
||||
Autodesk.Revit.DB.XYZ iniPoint = points[0];
|
||||
points.Add(iniPoint);
|
||||
m_curve3Ds.Add(points);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Curve
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddCurve(GeometryObject obj, Transform transform)
|
||||
{
|
||||
Curve curve = obj as Curve;
|
||||
if (null == curve)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (curve.IsBound)
|
||||
{
|
||||
List<XYZ> points = curve.Tessellate() as List<XYZ>;
|
||||
List<XYZ> result = new List<XYZ>();
|
||||
foreach (Autodesk.Revit.DB.XYZ point in points)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ newPoint = MathUtil.GetBasis(point, transform);
|
||||
result.Add(newPoint);
|
||||
}
|
||||
m_curve3Ds.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Instance
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddInstance(GeometryObject obj, Transform transform)
|
||||
{
|
||||
GeometryInstance instance = obj as GeometryInstance;
|
||||
if (null == instance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//get a transformation of the affine 3-space
|
||||
Transform allTransform = AddTransform(transform, instance.Transform);
|
||||
|
||||
GeometryElement instanceGeometry = instance.SymbolGeometry;
|
||||
if (null == instanceGeometry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//get all geometric primitives contained in the GeometryElement
|
||||
//GeometryObjectArray instanceGeometries = instanceGeometry.Objects;
|
||||
IEnumerator<GeometryObject> Objects = instanceGeometry.GetEnumerator();
|
||||
|
||||
AddGeometryObjects(Objects, allTransform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generate data of a Edge
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="transform"></param>
|
||||
private void AddEdge(GeometryObject obj, Transform transform)
|
||||
{
|
||||
Edge edge = obj as Edge;
|
||||
if (null == edge)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<XYZ> points = edge.Tessellate() as List<XYZ>;
|
||||
List<XYZ> result = new List<XYZ>();
|
||||
foreach (Autodesk.Revit.DB.XYZ point in points)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ newPoint = MathUtil.GetBasis(point, transform);
|
||||
result.Add(newPoint);
|
||||
}
|
||||
m_curve3Ds.Add(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add 2 Transform Matrix
|
||||
/// </summary>
|
||||
/// <param name="tran1"></param>
|
||||
/// <param name="tran2"></param>
|
||||
/// <returns></returns>
|
||||
private Transform AddTransform(Transform tran1, Transform tran2)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ xyz = new Autodesk.Revit.DB.XYZ(0, 0, 0);
|
||||
Transform result = Transform.CreateTranslation(xyz);
|
||||
result.Origin = MathUtil.AddXYZ(tran1.Origin, tran2.Origin);
|
||||
|
||||
Autodesk.Revit.DB.XYZ[] left = new Autodesk.Revit.DB.XYZ[3];
|
||||
Autodesk.Revit.DB.XYZ[] right = new Autodesk.Revit.DB.XYZ[3];
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
left[i] = tran1.get_Basis(i);
|
||||
right[i] = tran2.get_Basis(i);
|
||||
}
|
||||
|
||||
Autodesk.Revit.DB.XYZ[] temp = MathUtil.MultiCross(left, right);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
result.set_Basis(i, temp[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.Text;
|
||||
using System.Drawing;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// data class for graphics 2D
|
||||
/// </summary>
|
||||
public class Graphics2DData
|
||||
{
|
||||
// curves represent the wireframe of the 2D geometry
|
||||
private readonly List<PointF[]> m_curves = new List<PointF[]>();
|
||||
// the number of points consists of m_curves
|
||||
private readonly int m_numPoints;
|
||||
private static EmptyGraphics2DData m_empty = new EmptyGraphics2DData();
|
||||
|
||||
// boundingbox of the 2D geometry
|
||||
private RectangleF m_bbox = new RectangleF(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Represents a new instance of the Graphics2DData class with member data left uninitialized
|
||||
/// </summary>
|
||||
public static Graphics2DData Empty
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of points consists of 2D geometry's wireframe
|
||||
/// </summary>
|
||||
public int NumPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_numPoints;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BoundingBox of the 2D geometry
|
||||
/// </summary>
|
||||
public RectangleF BBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bbox;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Curves represent the wireframe of the 2D geometry
|
||||
/// </summary>
|
||||
public List<PointF[]> ConstCurves
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_curves;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// only for Empty class
|
||||
/// </summary>
|
||||
protected Graphics2DData()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="curves">curves represent the wireframe of the 2D geometry</param>
|
||||
public Graphics2DData(List<List<UV>> curves)
|
||||
{
|
||||
// initialize m_curves and m_bbox
|
||||
bool isFirst = true; // is the first List<UV> instance in curves
|
||||
foreach (List<UV> uvs in curves)
|
||||
{
|
||||
PointF[] pnts = new PointF[uvs.Count];
|
||||
m_curves.Add(pnts);
|
||||
for (int i = 0; i < uvs.Count; i++)
|
||||
{
|
||||
Autodesk.Revit.DB.UV uv = uvs[i];
|
||||
pnts[i] = new PointF((float)uv.U, (float)uv.V);
|
||||
RectangleF tmpBBox = new RectangleF(pnts[i], new SizeF(0.0f, 0.0f));
|
||||
m_numPoints++;
|
||||
if (!isFirst)
|
||||
{
|
||||
// union the m_bbox with next curve's BBox
|
||||
m_bbox = RectangleF.Union(m_bbox, tmpBBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bbox = tmpBBox;
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a PointF class with member data left uninitialized
|
||||
/// </summary>
|
||||
class EmptyGraphics2DData : Graphics2DData
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// trigger when view data updated
|
||||
/// </summary>
|
||||
public delegate void UpdateViewDelegate();
|
||||
|
||||
/// <summary>
|
||||
/// data class for graphics 3D
|
||||
/// </summary>
|
||||
public class Graphics3DData
|
||||
{
|
||||
/// <summary>
|
||||
/// Chooses the camera direction to the view
|
||||
/// </summary>
|
||||
public enum ViewDirections
|
||||
{
|
||||
/// <summary>
|
||||
/// top direction
|
||||
/// </summary>
|
||||
Top,
|
||||
|
||||
/// <summary>
|
||||
/// front view
|
||||
/// </summary>
|
||||
Front,
|
||||
|
||||
/// <summary>
|
||||
/// left view
|
||||
/// </summary>
|
||||
Left,
|
||||
|
||||
/// <summary>
|
||||
/// right view
|
||||
/// </summary>
|
||||
Right,
|
||||
|
||||
/// <summary>
|
||||
/// bottom view
|
||||
/// </summary>
|
||||
Bottom,
|
||||
|
||||
/// <summary>
|
||||
/// back view
|
||||
/// </summary>
|
||||
Back,
|
||||
|
||||
/// <summary>
|
||||
/// iso view diection
|
||||
/// </summary>
|
||||
IsoMetric
|
||||
}
|
||||
|
||||
// default angle when rotate around X,Y,Z axis
|
||||
private const double RotateAngle = System.Math.PI / 90;
|
||||
// initial curves data before UCS transform
|
||||
private readonly List<List<Vector>> m_iniCurves = new List<List<Vector>>();
|
||||
// curves data after UCS transform
|
||||
private readonly List<List<Vector>> m_curves = new List<List<Vector>>();
|
||||
// number of points representing the 3D geometry
|
||||
private readonly int m_numPoints;
|
||||
|
||||
// BoundingBox of the 3D geometry
|
||||
private BoundingBoxXYZ m_bbox = new BoundingBoxXYZ();
|
||||
// current UCS
|
||||
private UCS m_currentUCS = new UCS();
|
||||
|
||||
/// <summary>
|
||||
/// Current UCS used to transform
|
||||
/// </summary>
|
||||
public UCS CurrentUCS
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_currentUCS;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_currentUCS = value;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
if (null != UpdateViewEvent)
|
||||
{
|
||||
UpdateViewEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of points representing the 3D geometry
|
||||
/// </summary>
|
||||
public int NumPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_numPoints;
|
||||
}
|
||||
}
|
||||
|
||||
// 7 UCS according to camera directions in ViewDirections
|
||||
private static readonly UCS[] SpecialUCSs = new UCS[7];
|
||||
// small angle used to Rotate UCS around X, Y, Z axis
|
||||
private static readonly UCS RotateXUCS;
|
||||
private static readonly UCS RotateAntiXUCS;
|
||||
private static readonly UCS RotateYUCS;
|
||||
private static readonly UCS RotateAntiYUCS;
|
||||
private static readonly UCS RotateZUCS;
|
||||
private static readonly UCS RotateAntiZUCS;
|
||||
|
||||
/// <summary>
|
||||
/// static constructor used to initialize static members
|
||||
/// </summary>
|
||||
static Graphics3DData()
|
||||
{
|
||||
// initialize small angle
|
||||
double angle = RotateAngle;
|
||||
double antiAngle = -RotateAngle;
|
||||
double sin = Math.Sin(angle);
|
||||
double cos = Math.Cos(angle);
|
||||
double antiSin = Math.Sin(antiAngle);
|
||||
double antiCos = Math.Cos(antiAngle);
|
||||
// initialize 6 Rotate UCS
|
||||
Vector origin = new Vector();
|
||||
RotateXUCS =
|
||||
new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, cos, sin));
|
||||
RotateAntiXUCS =
|
||||
new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, antiCos, antiSin));
|
||||
RotateYUCS =
|
||||
new UCS(origin, new Vector(cos, 0.0, -sin), new Vector(0.0, 1.0, 0.0));
|
||||
RotateAntiYUCS =
|
||||
new UCS(origin, new Vector(antiCos, 0.0, -antiSin), new Vector(0.0, 1.0, 0.0));
|
||||
RotateZUCS =
|
||||
new UCS(origin, new Vector(cos, sin, 0.0), new Vector(-sin, cos, 0.0));
|
||||
RotateAntiZUCS =
|
||||
new UCS(origin, new Vector(antiCos, antiSin, 0.0), new Vector(-antiSin, antiCos, 0.0));
|
||||
|
||||
// initialize 7 special UCS
|
||||
SpecialUCSs[(int)ViewDirections.IsoMetric] = new UCS(origin,
|
||||
new Vector(-0.408248290463863, 0.408248290463863, 0.816496580927726),
|
||||
new Vector(0.707106781186548, 0.707106781186548, 0.0));
|
||||
SpecialUCSs[(int)ViewDirections.Top] =
|
||||
new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, 1.0, 0.0));
|
||||
SpecialUCSs[(int)ViewDirections.Front] =
|
||||
new UCS(origin, new Vector(-1.0, 0.0, 0.0), new Vector(0.0, 0.0, 1.0));
|
||||
SpecialUCSs[(int)ViewDirections.Left] =
|
||||
new UCS(origin, new Vector(0.0, -1.0, 0.0), new Vector(0.0, 0.0, 1.0));
|
||||
SpecialUCSs[(int)ViewDirections.Right] =
|
||||
new UCS(origin, new Vector(0.0, 1.0, 0.0), new Vector(0.0, 0.0, 1.0));
|
||||
SpecialUCSs[(int)ViewDirections.Bottom] =
|
||||
new UCS(origin, new Vector(-1.0, 0.0, 0.0), new Vector(0.0, 1.0, 0.0));
|
||||
SpecialUCSs[(int)ViewDirections.Back] =
|
||||
new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, 0.0, 1.0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// view data update
|
||||
/// </summary>
|
||||
public event UpdateViewDelegate UpdateViewEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Curves represent the wireframe of the 3D geometry
|
||||
/// </summary>
|
||||
public List<List<Vector>> ConstCurves
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_curves;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BoundingBox of the 3D geometry
|
||||
/// </summary>
|
||||
public BoundingBoxXYZ BBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bbox;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="curves">curves represent the wireframe of the 3D geometry</param>
|
||||
/// <param name="bbox">oundingBox of the 3D geometry</param>
|
||||
public Graphics3DData(List<List<XYZ>> curves, BoundingBoxXYZ bbox)
|
||||
{
|
||||
if (null == bbox)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (UCS ucs in SpecialUCSs)
|
||||
{
|
||||
ucs.Origin = FindBBoxCenter(bbox);
|
||||
}
|
||||
|
||||
foreach (List<XYZ> pnts in curves)
|
||||
{
|
||||
List<Vector> vectors = new List<Vector>();
|
||||
m_iniCurves.Add(vectors);
|
||||
foreach (Autodesk.Revit.DB.XYZ pnt in pnts)
|
||||
{
|
||||
vectors.Add(new Vector(pnt.X, pnt.Y, pnt.Z));
|
||||
m_numPoints++;
|
||||
}
|
||||
}
|
||||
SetViewDirection(ViewDirections.IsoMetric);
|
||||
InitializeBBox(bbox);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// change the camera direction to the geometry
|
||||
/// </summary>
|
||||
/// <param name="viewDirection">camera direction</param>
|
||||
public void SetViewDirection(ViewDirections viewDirection)
|
||||
{
|
||||
m_currentUCS = SpecialUCSs[(int)viewDirection];
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate around Z axis with default angle
|
||||
/// </summary>
|
||||
/// <param name="direction">minus or positive angle</param>
|
||||
public void RotateZ(bool direction)
|
||||
{
|
||||
if (direction)
|
||||
{
|
||||
m_currentUCS = m_currentUCS + RotateZUCS;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentUCS = m_currentUCS + RotateAntiZUCS;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate around Y axis with default angle
|
||||
/// </summary>
|
||||
/// <param name="direction">minus or positive angle</param>
|
||||
public void RotateY(bool direction)
|
||||
{
|
||||
if (direction)
|
||||
{
|
||||
m_currentUCS = m_currentUCS + RotateYUCS;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentUCS = m_currentUCS + RotateAntiYUCS;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate around X axis with default angle
|
||||
/// </summary>
|
||||
/// <param name="direction">minus or positive angle</param>
|
||||
public void RotateX(bool direction)
|
||||
{
|
||||
if (direction)
|
||||
{
|
||||
m_currentUCS = m_currentUCS + RotateXUCS;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentUCS = m_currentUCS + RotateAntiXUCS;
|
||||
UpdateDisplayData(m_currentUCS);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update data according to current UCS
|
||||
/// </summary>
|
||||
/// <param name="lc"></param>
|
||||
private void UpdateDisplayData(UCS lc)
|
||||
{
|
||||
m_curves.Clear();
|
||||
foreach (List<Vector> iniVectors in m_iniCurves)
|
||||
{
|
||||
List<Vector> vectors = new List<Vector>();
|
||||
m_curves.Add(vectors);
|
||||
for (int i = 0; i < iniVectors.Count; i++)
|
||||
{
|
||||
// transform points to local coordinate system
|
||||
vectors.Add(lc.GC2LC(iniVectors[i]));
|
||||
}
|
||||
}
|
||||
// trigger update view event
|
||||
if (null != UpdateViewEvent)
|
||||
{
|
||||
UpdateViewEvent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// move the BoundingBox to the center of the Coordinate System,
|
||||
/// modify its size to the size of Geometry's BoundingBox
|
||||
/// </summary>
|
||||
/// <param name="bbox"></param>
|
||||
private void InitializeBBox(BoundingBoxXYZ bbox)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ size = MathUtil.SubXYZ(bbox.Max, bbox.Min);
|
||||
m_bbox.Max = MathUtil.DivideXYZ(size, 2.0);
|
||||
m_bbox.Min = MathUtil.DivideXYZ(size, -2.0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// find the center of the BoundingBox
|
||||
/// </summary>
|
||||
/// <param name="bbox">BoundingBox</param>
|
||||
/// <returns>center Point</returns>
|
||||
private Vector FindBBoxCenter(BoundingBoxXYZ bbox)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ center = MathUtil.DivideXYZ(MathUtil.AddXYZ(bbox.Max, bbox.Min), 2.0);
|
||||
return MathUtil.XYZ2Vector(center);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
//
|
||||
// (C) Copyright 2003-2014 by Autodesk, Inc. All rights reserved.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM 'AS IS' AND WITH ALL ITS FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
using Autodesk.Revit.Structural;
|
||||
using Autodesk.Revit.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// interface as the datasource of view, include nececessary members
|
||||
/// </summary>
|
||||
public interface IGraphicsData
|
||||
{
|
||||
/// <summary>
|
||||
/// 2D lines
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<PointF[]> PointCurves();
|
||||
|
||||
/// <summary>
|
||||
/// view data update
|
||||
/// </summary>
|
||||
event UpdateViewDelegate UpdateViewEvent;
|
||||
|
||||
/// <summary>
|
||||
/// region of 3D view data
|
||||
/// </summary>
|
||||
RectangleF Region
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// abstrace class include general members
|
||||
/// </summary>
|
||||
public abstract class GraphicsDataBase : IGraphicsData
|
||||
{
|
||||
protected XYZ m_transferedMax; //3D max point after transfered
|
||||
protected XYZ m_transferedMin; //3D min point after transfered
|
||||
protected XYZ m_originMax = new XYZ(double.MinValue, double.MinValue, double.MinValue); //3D max point
|
||||
protected XYZ m_originMin = new XYZ(double.MaxValue, double.MaxValue, double.MaxValue); //3d min point
|
||||
protected double[,] m_origin = { { 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0 } }; //tranform matrix between origin matrix and view matrix
|
||||
|
||||
public const float MINEDGElENGTH = 1.0f; //minimum value of the region box's edge
|
||||
public const double ROTATEANGLE = System.Math.PI / 90; //default angle when rotate around X,Y,Z axis
|
||||
|
||||
public virtual event UpdateViewDelegate UpdateViewEvent;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
public GraphicsDataBase()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public double[,] Origin
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_origin;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_origin = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize some member data
|
||||
/// </summary>
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
m_transferedMax = new XYZ(double.MinValue, double.MinValue, double.MinValue);
|
||||
m_transferedMin = new XYZ(double.MaxValue, double.MaxValue, double.MaxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// trig updata view event
|
||||
/// </summary>
|
||||
public virtual void UpdataData()
|
||||
{
|
||||
UpdateViewEvent();
|
||||
}
|
||||
|
||||
public abstract List<PointF[]> PointCurves();
|
||||
|
||||
/// <summary>
|
||||
/// rectangular region of 3D view data
|
||||
/// </summary>
|
||||
public RectangleF Region
|
||||
{
|
||||
get
|
||||
{
|
||||
float width = (float)Math.Abs(m_transferedMax.X - m_transferedMin.X);
|
||||
float height = (float)Math.Abs(m_transferedMax.Y - m_transferedMin.Y);
|
||||
|
||||
if (width < 1f)
|
||||
{
|
||||
width = 1f;
|
||||
}
|
||||
if (height < 1f)
|
||||
{
|
||||
height = 1f;
|
||||
}
|
||||
|
||||
float maxX = (width / 2);
|
||||
float maxY = (height / 2);
|
||||
float minX = -(width / 2);
|
||||
float minY = -(height / 2);
|
||||
|
||||
RectangleF rec = new RectangleF(minX, minY, width, height);
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate around Z axis with default angle
|
||||
/// </summary>
|
||||
/// <param name="direction">minus or positive angle</param>
|
||||
public void RotateZ(bool direction)
|
||||
{
|
||||
double angle = ROTATEANGLE;
|
||||
if (!direction)
|
||||
{
|
||||
angle = -ROTATEANGLE;
|
||||
}
|
||||
|
||||
RotateZ(ref m_origin, angle);
|
||||
UpdataData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate 3*3 matrix around Z axis
|
||||
/// </summary>
|
||||
/// <param name="origin">matrix to rotate</param>
|
||||
/// <param name="angle"></param>
|
||||
private void RotateZ(ref double[,] origin, double angle)
|
||||
{
|
||||
double sin = Math.Sin(angle);
|
||||
double cos = Math.Cos(angle);
|
||||
|
||||
double[,] rotate = { { cos, sin, 0.0 }, { -sin, cos, 0.0 }, { 0.0, 0.0, 1.0 } };
|
||||
origin = MathUtil.MultiCross(m_origin, rotate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate around Y axis with default angle
|
||||
/// </summary>
|
||||
/// <param name="direction">minus or positive angle</param>
|
||||
public void RotateY(bool direction)
|
||||
{
|
||||
double angle = ROTATEANGLE;
|
||||
if (!direction)
|
||||
{
|
||||
angle = -ROTATEANGLE;
|
||||
}
|
||||
|
||||
RotateY(ref m_origin, angle);
|
||||
UpdataData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate 3*3 matrix around Y axis
|
||||
/// </summary>
|
||||
/// <param name="origin">matrix to rotate</param>
|
||||
/// <param name="angle"></param>
|
||||
private void RotateY(ref double[,] origin, double angle)
|
||||
{
|
||||
double sin = Math.Sin(angle);
|
||||
double cos = Math.Cos(angle);
|
||||
|
||||
double[,] rotate = { { cos, 0.0, -sin }, { 0.0, 1.0, 0.0 }, { sin, 0.0, cos } };
|
||||
origin = MathUtil.MultiCross(m_origin, rotate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate around X axis with default angle
|
||||
/// </summary>
|
||||
/// <param name="direction">minus or positive angle</param>
|
||||
public void RotateX(bool direction)
|
||||
{
|
||||
double angle = ROTATEANGLE;
|
||||
if (!direction)
|
||||
{
|
||||
angle = -ROTATEANGLE;
|
||||
}
|
||||
|
||||
RotateX(ref m_origin, angle);
|
||||
UpdataData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate 3*3 matrix around X axis
|
||||
/// </summary>
|
||||
/// <param name="origin">matrix to rotate</param>
|
||||
/// <param name="angle"></param>
|
||||
private void RotateX(ref double[,] origin, double angle)
|
||||
{
|
||||
double sin = Math.Sin(angle);
|
||||
double cos = Math.Cos(angle);
|
||||
|
||||
double[,] rotate = { { 1.0, 0.0, 0.0 }, { 0.0, cos, sin }, { 0.0, -sin, cos } };
|
||||
origin = MathUtil.MultiCross(m_origin, rotate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// datasource that can bind to PictureBox3D
|
||||
/// </summary>
|
||||
public class GraphicsData : GraphicsDataBase
|
||||
{
|
||||
List<XYZArray> m_originCurves;
|
||||
List<XYZArray> m_transferedCurves;
|
||||
List<PointF[]> m_curves2D;
|
||||
|
||||
public override event UpdateViewDelegate UpdateViewEvent;
|
||||
|
||||
/// <summary>
|
||||
/// constructor to initialize member data
|
||||
/// </summary>
|
||||
public GraphicsData()
|
||||
: base()
|
||||
{
|
||||
m_originCurves = new List<XYZArray>();
|
||||
m_transferedCurves = new List<XYZArray>();
|
||||
m_curves2D = new List<PointF[]>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// curves array
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override List<PointF[]> PointCurves()
|
||||
{
|
||||
return m_curves2D;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// insert curves array into datasource
|
||||
/// </summary>
|
||||
/// <param name="points">points compose the curve</param>
|
||||
public void InsertCurve(XYZArray points)
|
||||
{
|
||||
m_originCurves.Add(points);
|
||||
foreach (XYZ point in points)
|
||||
{
|
||||
XYZ temp = TransferRotate(point);
|
||||
UpdateRange(point, ref m_originMin, ref m_originMax);
|
||||
UpdateRange(temp, ref m_transferedMin, ref m_transferedMax);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update 3D view data
|
||||
/// </summary>
|
||||
public override void UpdataData()
|
||||
{
|
||||
m_transferedCurves.Clear();
|
||||
m_curves2D.Clear();
|
||||
|
||||
foreach (XYZArray points in m_originCurves)
|
||||
{
|
||||
SynChroData(points);
|
||||
}
|
||||
|
||||
if (null != UpdateViewEvent)
|
||||
{
|
||||
UpdateViewEvent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update 3D view curve data with origin data and transfer matrix
|
||||
/// </summary>
|
||||
/// <param name="points"></param>
|
||||
private void SynChroData(XYZArray points)
|
||||
{
|
||||
int size = points.Size;
|
||||
PointF[] points2D = new PointF[size];
|
||||
XYZArray transferedPoints = new XYZArray();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
XYZ point = points.get_Item(i);
|
||||
XYZ temp = TransferMove(point);
|
||||
XYZ transferedPoint = TransferRotate(temp);
|
||||
|
||||
points2D[i] = new PointF((float)transferedPoint.X, (float)transferedPoint.Y);
|
||||
transferedPoints.Append(ref transferedPoint);
|
||||
}
|
||||
m_transferedCurves.Add(transferedPoints);
|
||||
m_curves2D.Add(points2D);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// compare to get the max and min value
|
||||
/// </summary>
|
||||
/// <param name="point">point to be compared</param>
|
||||
/// <param name="min"></param>
|
||||
/// <param name="max"></param>
|
||||
private void UpdateRange(XYZ point, ref XYZ min, ref XYZ max)
|
||||
{
|
||||
if (point.X > max.X)
|
||||
{
|
||||
max.X = point.X;
|
||||
}
|
||||
if (point.Y > max.Y)
|
||||
{
|
||||
max.Y = point.Y;
|
||||
}
|
||||
if (point.Z > max.Z)
|
||||
{
|
||||
max.Z = point.Z;
|
||||
}
|
||||
if (point.X < min.X)
|
||||
{
|
||||
min.X = point.X;
|
||||
}
|
||||
if (point.Y < min.Y)
|
||||
{
|
||||
min.Y = point.Y;
|
||||
}
|
||||
if (point.Z < min.Z)
|
||||
{
|
||||
min.Z = point.Z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rotate points with origion matrix
|
||||
/// </summary>
|
||||
/// <param name="point"></param>
|
||||
/// <returns></returns>
|
||||
private XYZ TransferRotate(XYZ point)
|
||||
{
|
||||
XYZ newPoint = new XYZ();
|
||||
double x = point.X;
|
||||
double y = point.Y;
|
||||
double z = point.Z;
|
||||
|
||||
//transform the origin of the old coordinate system in the new coordinate system
|
||||
newPoint.X = x * m_origin[0, 0] + y * m_origin[0, 1] + z * m_origin[0, 2];
|
||||
newPoint.Y = x * m_origin[1, 0] + y * m_origin[1, 1] + z * m_origin[1, 2];
|
||||
newPoint.Z = x * m_origin[2, 0] + y * m_origin[2, 1] + z * m_origin[2, 2];
|
||||
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// move the point so that the center of the curves in 3D view is origin
|
||||
/// </summary>
|
||||
/// <param name="point">points to be moved</param>
|
||||
/// <returns>moved result</returns>
|
||||
private XYZ TransferMove(XYZ point)
|
||||
{
|
||||
XYZ newPoint = new XYZ();
|
||||
|
||||
//transform the origin of the old coordinate system in the new coordinate system
|
||||
newPoint.X = point.X - (m_transferedMax.X + m_transferedMin.X) / 2;
|
||||
newPoint.Y = point.Y - (m_transferedMax.Y + m_transferedMin.Y) / 2;
|
||||
newPoint.Z = point.Z - (m_transferedMax.Z + m_transferedMin.Z) / 2;
|
||||
|
||||
return newPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// utility class provide arithmetic of matrix
|
||||
/// </summary>
|
||||
public static class MathUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// multiply cross two matrix
|
||||
/// </summary>
|
||||
/// <param name="m1">left matrix</param>
|
||||
/// <param name="m2">right matrix</param>
|
||||
/// <returns>result matrix</returns>
|
||||
public static Autodesk.Revit.DB.XYZ[] MultiCross(Autodesk.Revit.DB.XYZ[] m1, Autodesk.Revit.DB.XYZ[] m2)
|
||||
{
|
||||
Autodesk.Revit.DB.XYZ[] result = new Autodesk.Revit.DB.XYZ[3];
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
result[i] = new Autodesk.Revit.DB.XYZ();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
switch (j)
|
||||
{
|
||||
case 0:
|
||||
result[i] = new XYZ(
|
||||
result[i].X + ((m1[i])[k] * (m2[k])[j]),
|
||||
result[i].Y,
|
||||
result[i].Z);
|
||||
break;
|
||||
case 1:
|
||||
result[i] = new XYZ(
|
||||
result[i].X,
|
||||
result[i].Y + (m1[i])[k] * (m2[k])[j],
|
||||
result[i].Z);
|
||||
break;
|
||||
case 2:
|
||||
result[i] = new XYZ(
|
||||
result[i].X,
|
||||
result[i].Y,
|
||||
result[i].Z + (m1[i])[k] * (m2[k])[j]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// subtract two Autodesk.Revit.DB.XYZ as Matrix
|
||||
/// </summary>
|
||||
/// <param name="lhs"></param>
|
||||
/// <param name="rhs"></param>
|
||||
/// <returns></returns>
|
||||
public static Autodesk.Revit.DB.XYZ SubXYZ(Autodesk.Revit.DB.XYZ lhs, Autodesk.Revit.DB.XYZ rhs)
|
||||
{
|
||||
double x = lhs.X - rhs.X;
|
||||
double y = lhs.Y - rhs.Y;
|
||||
double z = lhs.Z - rhs.Z;
|
||||
|
||||
Autodesk.Revit.DB.XYZ result = new Autodesk.Revit.DB.XYZ (x, y, z);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add two Autodesk.Revit.DB.XYZ as Matrix
|
||||
/// </summary>
|
||||
/// <param name="lhs"></param>
|
||||
/// <param name="rhs"></param>
|
||||
/// <returns></returns>
|
||||
public static Autodesk.Revit.DB.XYZ AddXYZ(Autodesk.Revit.DB.XYZ lhs, Autodesk.Revit.DB.XYZ rhs)
|
||||
{
|
||||
double x = lhs.X + rhs.X;
|
||||
double y = lhs.Y + rhs.Y;
|
||||
double z = lhs.Z + rhs.Z;
|
||||
|
||||
Autodesk.Revit.DB.XYZ result = new Autodesk.Revit.DB.XYZ (x, y, z);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// divide a Autodesk.Revit.DB.XYZ by a number
|
||||
/// </summary>
|
||||
/// <param name="lhs">divided XYZ</param>
|
||||
/// <param name="rhs">number</param>
|
||||
/// <returns>result</returns>
|
||||
public static Autodesk.Revit.DB.XYZ DivideXYZ(Autodesk.Revit.DB.XYZ lhs, double rhs)
|
||||
{
|
||||
return new Autodesk.Revit.DB.XYZ (lhs.X / rhs, lhs.Y / rhs, lhs.Z / rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the coordinates from old coordinate system in the new coordinate system
|
||||
/// </summary>
|
||||
/// <param name="point"></param>
|
||||
/// <param name="transform"></param>
|
||||
/// <returns></returns>
|
||||
public static Autodesk.Revit.DB.XYZ GetBasis(Autodesk.Revit.DB.XYZ point, Transform transform)
|
||||
{
|
||||
double x = point.X;
|
||||
double y = point.Y;
|
||||
double z = point.Z;
|
||||
double x2;
|
||||
double y2;
|
||||
double z2;
|
||||
|
||||
//transform basis of the old coordinate system in the new coordinate system
|
||||
Autodesk.Revit.DB.XYZ b0 = transform.get_Basis(0);
|
||||
Autodesk.Revit.DB.XYZ b1 = transform.get_Basis(1);
|
||||
Autodesk.Revit.DB.XYZ b2 = transform.get_Basis(2);
|
||||
Autodesk.Revit.DB.XYZ origin = transform.Origin;
|
||||
|
||||
//transform the origin of the old coordinate system in the new coordinate system
|
||||
x2 = x * b0.X + y * b1.X + z * b2.X + origin.X;
|
||||
y2 = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y;
|
||||
z2 = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z;
|
||||
|
||||
Autodesk.Revit.DB.XYZ newPoint = new Autodesk.Revit.DB.XYZ (x2, y2, z2);
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// transform a Vector instance to a Autodesk.Revit.DB.XYZ instance
|
||||
/// </summary>
|
||||
/// <param name="v">transformed Vector</param>
|
||||
/// <returns>result XYZ</returns>
|
||||
public static Autodesk.Revit.DB.XYZ Vector2XYZ(Vector v)
|
||||
{
|
||||
return new Autodesk.Revit.DB.XYZ (v.X, v.Y, v.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// transform a Autodesk.Revit.DB.XYZ instance to a Vector instance
|
||||
/// </summary>
|
||||
/// <param name="pnt">transformed XYZ</param>
|
||||
/// <returns>result Vector</returns>
|
||||
public static Vector XYZ2Vector(Autodesk.Revit.DB.XYZ pnt)
|
||||
{
|
||||
return new Vector(pnt.X, pnt.Y, pnt.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
|
||||
using Element = Autodesk.Revit.DB.Element;
|
||||
using GeomElement = Autodesk.Revit.DB.GeometryElement;
|
||||
using GeomInstance = Autodesk.Revit.DB.Instance;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// generate GraphicsData by give geometry object
|
||||
/// </summary>
|
||||
public class ModelData
|
||||
{
|
||||
// BoundingBox of the geometry
|
||||
private BoundingBoxXYZ m_bbox;
|
||||
private List<List<XYZ>> m_curve3Ds = new List<List<XYZ>>();
|
||||
private List<List<UV>> m_curve2Ds = new List<List<UV>>();
|
||||
|
||||
/// <summary>
|
||||
/// 3D graphics data of the geometry
|
||||
/// </summary>
|
||||
public Graphics3DData Data3D
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Graphics3DData(new List<List<XYZ>>(m_curve3Ds), m_bbox);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 2D graphics data of the geometry
|
||||
/// </summary>
|
||||
public Graphics2DData Data2D
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Graphics2DData(new List<List<UV>>(m_curve2Ds));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate appropriate graphics data object from exact analytical model type.
|
||||
/// </summary>
|
||||
/// <param name="element">The selected element maybe has analytical model lines</param>
|
||||
/// <returns>A graphics data object appropriate for GDI.</returns>
|
||||
public ModelData(Element element)
|
||||
{
|
||||
try
|
||||
{
|
||||
AnalyticalModel analyticalMode = GetAnalyticalModel(element);
|
||||
View currentView = Command.CommandData.Application.ActiveUIDocument.Document.ActiveView;
|
||||
m_bbox = element.get_BoundingBox(currentView);
|
||||
|
||||
if (null == analyticalMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetModelData(analyticalMode);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the analytical model object from an element.
|
||||
/// </summary>
|
||||
/// <param name="element">The selected element maybe has analytical model lines</param>
|
||||
/// <returns>Return analytical model object, or else return null.</returns>
|
||||
private AnalyticalModel GetAnalyticalModel(Element element)
|
||||
{
|
||||
return element.GetAnalyticalModel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create GraphicsData of give AnalyticalModel
|
||||
/// </summary>
|
||||
/// <param name="model">AnalyticalModel contains geometry data</param>
|
||||
/// <returns>A graphics data object appropriate for GDI.</returns>
|
||||
private void GetModelData(AnalyticalModel model)
|
||||
{
|
||||
foreach (Curve curve in model.GetCurves(AnalyticalCurveType.RawCurves))
|
||||
{
|
||||
try
|
||||
{
|
||||
m_curve3Ds.Add(curve.Tessellate() as List<XYZ>);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RevitAddIns>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>ObjectViewer.dll</Assembly>
|
||||
<ClientId>d2b483cc-16de-4c6e-9457-8eacd59a8dd3</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.ObjectViewer.CS.Command</FullClassName>
|
||||
<Text>Object Viewer</Text>
|
||||
<Description>Display the selected element in a preview window and generic properties in a grid.</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
</RevitAddIns>
|
||||
@@ -0,0 +1,241 @@
|
||||
//
|
||||
// (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.ObjectViewer.CS
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
|
||||
using Element = Autodesk.Revit.DB.Element;
|
||||
using GeometryElement = Autodesk.Revit.DB.GeometryElement;
|
||||
|
||||
/// <summary>
|
||||
/// main command class of the ObjectViewer application
|
||||
/// </summary>
|
||||
public class ObjectViewer
|
||||
{
|
||||
/// <summary>
|
||||
/// choose the display kinds of preview
|
||||
/// </summary>
|
||||
public enum DisplayKinds
|
||||
{
|
||||
/// <summary>
|
||||
/// Geometry Model
|
||||
/// </summary>
|
||||
GeometryModel,
|
||||
|
||||
/// <summary>
|
||||
/// AnalyticalModel
|
||||
/// </summary>
|
||||
AnalyticalModel
|
||||
}
|
||||
|
||||
private Element m_selected; // selected element to display
|
||||
private View m_currentView; // current View for preview
|
||||
// current detail level for preview
|
||||
private ViewDetailLevel m_detailLevel = ViewDetailLevel.Fine;
|
||||
private List<View> m_allViews = new List<View>(); // all Views in current project
|
||||
// current display kind for preview
|
||||
private DisplayKinds m_displayKind = DisplayKinds.GeometryModel;
|
||||
// selected element's parameters' data
|
||||
private SortableBindingList<Para> m_paras;
|
||||
// current sketch instance to draw the element
|
||||
private Sketch3D m_currentSketch3D = null;
|
||||
// indicate whether select view or detail
|
||||
private bool m_isSelectView = true;
|
||||
|
||||
/// <summary>
|
||||
/// Current display kind for preview
|
||||
/// </summary>
|
||||
public DisplayKinds DisplayKind
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_displayKind;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_displayKind = value;
|
||||
UpdateSketch3D();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current View for preview
|
||||
/// </summary>
|
||||
public View CurrentView
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_currentView;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_currentView = value;
|
||||
m_isSelectView = true;
|
||||
UpdateSketch3D();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All Views in current project
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<View> AllViews
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ReadOnlyCollection<View>(m_allViews);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current detail level for preview
|
||||
/// </summary>
|
||||
public ViewDetailLevel DetailLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_detailLevel;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_detailLevel = value;
|
||||
m_isSelectView = false;
|
||||
UpdateSketch3D();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current sketch instance to draw the element
|
||||
/// </summary>
|
||||
public Sketch3D CurrentSketch3D
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_currentSketch3D;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selected element's parameters' data
|
||||
/// </summary>
|
||||
public SortableBindingList<Para> Params
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_paras;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
public ObjectViewer()
|
||||
{
|
||||
UIDocument doc = Command.CommandData.Application.ActiveUIDocument;
|
||||
ElementSet selection = new ElementSet();
|
||||
foreach (ElementId elementId in doc.Selection.GetElementIds())
|
||||
{
|
||||
selection.Insert(doc.Document.GetElement(elementId));
|
||||
}
|
||||
// only one element should be selected
|
||||
if (0 == selection.Size)
|
||||
{
|
||||
throw new ErrorMessageException("Please select an element.");
|
||||
}
|
||||
|
||||
if (1 < selection.Size)
|
||||
{
|
||||
throw new ErrorMessageException("Please select only one element.");
|
||||
}
|
||||
// get selected element
|
||||
foreach (Element e in selection)
|
||||
{
|
||||
m_selected = e;
|
||||
}
|
||||
// get current view and all views
|
||||
m_currentView = doc.Document.ActiveView;
|
||||
FilteredElementIterator itor = (new FilteredElementCollector(doc.Document)).OfClass(typeof(View)).GetElementIterator();
|
||||
itor.Reset();
|
||||
while (itor.MoveNext())
|
||||
{
|
||||
View view = itor.Current as View;
|
||||
// Skip view templates because they're invisible in project browser, invalid for geometry elements
|
||||
if (null != view && !view.IsTemplate)
|
||||
{
|
||||
m_allViews.Add(view);
|
||||
}
|
||||
}
|
||||
|
||||
// create a instance of Sketch3D
|
||||
GeometryData geomFactory = new GeometryData(m_selected, m_currentView);
|
||||
m_currentSketch3D = new Sketch3D(geomFactory.Data3D, Graphics2DData.Empty);
|
||||
|
||||
//get a instance of ParametersFactory and then use it to create Parameters
|
||||
ParasFactory parasFactory = new ParasFactory(m_selected);
|
||||
m_paras = parasFactory.CreateParas();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update current Sketch3D using current UCS and settings
|
||||
/// </summary>
|
||||
private void UpdateSketch3D()
|
||||
{
|
||||
if (m_displayKind == DisplayKinds.GeometryModel)
|
||||
{
|
||||
GeometryData geomFactory;
|
||||
if(m_isSelectView)
|
||||
{
|
||||
geomFactory = new GeometryData(m_selected, m_currentView);
|
||||
m_detailLevel = ViewDetailLevel.Undefined;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
geomFactory = new GeometryData(m_selected, m_detailLevel, m_currentView);
|
||||
}
|
||||
|
||||
Graphics3DData geom3DData = geomFactory.Data3D;
|
||||
Graphics3DData old3DData = m_currentSketch3D.Data3D;
|
||||
geom3DData.CurrentUCS = old3DData.CurrentUCS;
|
||||
m_currentSketch3D.Data3D = geom3DData;
|
||||
m_currentSketch3D.Data2D = Graphics2DData.Empty;
|
||||
}
|
||||
else if (m_displayKind == DisplayKinds.AnalyticalModel)
|
||||
{
|
||||
ModelData modelFactory = new ModelData(m_selected);
|
||||
Graphics3DData model3DData = modelFactory.Data3D;
|
||||
Graphics2DData model2DData = modelFactory.Data2D;
|
||||
Graphics3DData old3DData = m_currentSketch3D.Data3D;
|
||||
model3DData.CurrentUCS = old3DData.CurrentUCS;
|
||||
m_currentSketch3D.Data3D = model3DData;
|
||||
m_currentSketch3D.Data2D = model2DData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?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>{274E118B-8191-47B8-8E6E-83F65D8A82E4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Revit.SDK.Samples.ObjectViewer.CS</RootNamespace>
|
||||
<AssemblyName>ObjectViewer</AssemblyName>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<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="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="ErrorMessageException.cs" />
|
||||
<Compile Include="GeometryData.cs" />
|
||||
<Compile Include="Graphics2DData.cs" />
|
||||
<Compile Include="Graphics3DData.cs" />
|
||||
<Compile Include="MathUtil.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ModelData.cs" />
|
||||
<Compile Include="ObjectViewer.cs" />
|
||||
<Compile Include="ObjectViewerForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ObjectViewerForm.Designer.cs">
|
||||
<DependentUpon>ObjectViewerForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Para.cs" />
|
||||
<Compile Include="ParasFactory.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Sketch.cs" />
|
||||
<Compile Include="SortableBindingList.cs" />
|
||||
<Compile Include="UCS.cs" />
|
||||
<Compile Include="Vector.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="ObjectViewerForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ObjectViewerForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
|
||||
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,306 @@
|
||||
//
|
||||
// (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.ObjectViewer.CS
|
||||
{
|
||||
partial class ObjectViewerForm
|
||||
{
|
||||
/// <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.parametersDataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.physicalModelRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.analyticalModelRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.previewBox = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.viewDirectionComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.viewListBox = new System.Windows.Forms.ListBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.detailLevelComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.closeButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.parametersDataGridView)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewBox)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// parametersDataGridView
|
||||
//
|
||||
this.parametersDataGridView.AllowUserToAddRows = false;
|
||||
this.parametersDataGridView.AllowUserToDeleteRows = false;
|
||||
this.parametersDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.parametersDataGridView.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.parametersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.parametersDataGridView.Location = new System.Drawing.Point(490, 25);
|
||||
this.parametersDataGridView.Name = "parametersDataGridView";
|
||||
this.parametersDataGridView.RowHeadersVisible = false;
|
||||
this.parametersDataGridView.RowTemplate.Height = 24;
|
||||
this.parametersDataGridView.Size = new System.Drawing.Size(404, 567);
|
||||
this.parametersDataGridView.TabIndex = 10;
|
||||
this.parametersDataGridView.TabStop = false;
|
||||
//
|
||||
// physicalModelRadioButton
|
||||
//
|
||||
this.physicalModelRadioButton.AutoSize = true;
|
||||
this.physicalModelRadioButton.Checked = true;
|
||||
this.physicalModelRadioButton.Location = new System.Drawing.Point(6, 110);
|
||||
this.physicalModelRadioButton.Name = "physicalModelRadioButton";
|
||||
this.physicalModelRadioButton.Size = new System.Drawing.Size(96, 17);
|
||||
this.physicalModelRadioButton.TabIndex = 8;
|
||||
this.physicalModelRadioButton.TabStop = true;
|
||||
this.physicalModelRadioButton.Text = "Physical Model";
|
||||
this.physicalModelRadioButton.UseVisualStyleBackColor = true;
|
||||
this.physicalModelRadioButton.CheckedChanged += new System.EventHandler(this.physicalModelRadioButton_CheckedChanged);
|
||||
//
|
||||
// analyticalModelRadioButton
|
||||
//
|
||||
this.analyticalModelRadioButton.AutoSize = true;
|
||||
this.analyticalModelRadioButton.Location = new System.Drawing.Point(6, 133);
|
||||
this.analyticalModelRadioButton.Name = "analyticalModelRadioButton";
|
||||
this.analyticalModelRadioButton.Size = new System.Drawing.Size(102, 17);
|
||||
this.analyticalModelRadioButton.TabIndex = 9;
|
||||
this.analyticalModelRadioButton.TabStop = true;
|
||||
this.analyticalModelRadioButton.Text = "Analytical Model";
|
||||
this.analyticalModelRadioButton.UseVisualStyleBackColor = true;
|
||||
this.analyticalModelRadioButton.CheckedChanged += new System.EventHandler(this.analyticalModelRadioButton_CheckedChanged);
|
||||
//
|
||||
// previewBox
|
||||
//
|
||||
this.previewBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.previewBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.previewBox.Cursor = System.Windows.Forms.Cursors.Cross;
|
||||
this.previewBox.Location = new System.Drawing.Point(12, 25);
|
||||
this.previewBox.Name = "previewBox";
|
||||
this.previewBox.Size = new System.Drawing.Size(472, 425);
|
||||
this.previewBox.TabIndex = 4;
|
||||
this.previewBox.TabStop = false;
|
||||
this.previewBox.Paint += new System.Windows.Forms.PaintEventHandler(this.previewBox_Paint);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.groupBox1.Controls.Add(this.label5);
|
||||
this.groupBox1.Controls.Add(this.viewDirectionComboBox);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.viewListBox);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.detailLevelComboBox);
|
||||
this.groupBox1.Controls.Add(this.physicalModelRadioButton);
|
||||
this.groupBox1.Controls.Add(this.analyticalModelRadioButton);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 456);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(472, 160);
|
||||
this.groupBox1.TabIndex = 6;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Preview";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(6, 65);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(78, 13);
|
||||
this.label5.TabIndex = 11;
|
||||
this.label5.Text = "View Direction:";
|
||||
//
|
||||
// viewDirectionComboBox
|
||||
//
|
||||
this.viewDirectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.viewDirectionComboBox.FormattingEnabled = true;
|
||||
this.viewDirectionComboBox.Items.AddRange(new object[] {
|
||||
"Top",
|
||||
"Front",
|
||||
"Left",
|
||||
"Right",
|
||||
"Bottom",
|
||||
"Back",
|
||||
"IsoMetric"});
|
||||
this.viewDirectionComboBox.Location = new System.Drawing.Point(6, 82);
|
||||
this.viewDirectionComboBox.Name = "viewDirectionComboBox";
|
||||
this.viewDirectionComboBox.Size = new System.Drawing.Size(158, 21);
|
||||
this.viewDirectionComboBox.TabIndex = 6;
|
||||
this.viewDirectionComboBox.SelectedIndexChanged += new System.EventHandler(this.viewDirectionComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(167, 16);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(82, 13);
|
||||
this.label4.TabIndex = 9;
|
||||
this.label4.Text = "Displayed View:";
|
||||
//
|
||||
// viewListBox
|
||||
//
|
||||
this.viewListBox.FormattingEnabled = true;
|
||||
this.viewListBox.Location = new System.Drawing.Point(170, 33);
|
||||
this.viewListBox.Name = "viewListBox";
|
||||
this.viewListBox.Size = new System.Drawing.Size(296, 121);
|
||||
this.viewListBox.TabIndex = 7;
|
||||
this.viewListBox.SelectedIndexChanged += new System.EventHandler(this.viewListBox_SelectedIndexChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(66, 13);
|
||||
this.label1.TabIndex = 7;
|
||||
this.label1.Text = "Detail Level:";
|
||||
//
|
||||
// detailLevelComboBox
|
||||
//
|
||||
this.detailLevelComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.detailLevelComboBox.FormattingEnabled = true;
|
||||
this.detailLevelComboBox.Items.AddRange(new object[] {
|
||||
"Undefined",
|
||||
"Coarse",
|
||||
"Medium",
|
||||
"Fine"});
|
||||
this.detailLevelComboBox.Location = new System.Drawing.Point(6, 33);
|
||||
this.detailLevelComboBox.Name = "detailLevelComboBox";
|
||||
this.detailLevelComboBox.Size = new System.Drawing.Size(158, 21);
|
||||
this.detailLevelComboBox.TabIndex = 5;
|
||||
this.detailLevelComboBox.SelectedIndexChanged += new System.EventHandler(this.detailLevelComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(13, 8);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(48, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Preview:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(491, 8);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(63, 13);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "Parameters:";
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(738, 598);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.okButton.TabIndex = 11;
|
||||
this.okButton.Text = "&OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.OKButton_Click);
|
||||
//
|
||||
// closeButton
|
||||
//
|
||||
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.closeButton.Location = new System.Drawing.Point(819, 598);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.closeButton.TabIndex = 12;
|
||||
this.closeButton.Text = "&Cancel";
|
||||
this.closeButton.UseVisualStyleBackColor = true;
|
||||
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
||||
//
|
||||
// ObjectViewerForm
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.closeButton;
|
||||
this.ClientSize = new System.Drawing.Size(906, 628);
|
||||
this.Controls.Add(this.closeButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.previewBox);
|
||||
this.Controls.Add(this.parametersDataGridView);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ObjectViewerForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Object Viewer";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ObjectViewerForm_FormClosed);
|
||||
this.Load += new System.EventHandler(this.ObjectViewerForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.parametersDataGridView)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewBox)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView parametersDataGridView;
|
||||
private System.Windows.Forms.RadioButton physicalModelRadioButton;
|
||||
private System.Windows.Forms.RadioButton analyticalModelRadioButton;
|
||||
private System.Windows.Forms.PictureBox previewBox;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ComboBox detailLevelComboBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListBox viewListBox;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button closeButton;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.ComboBox viewDirectionComboBox;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
//
|
||||
// (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.ObjectViewer.CS
|
||||
{
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// a class inherit from Form is used to
|
||||
/// display an element and its parameters
|
||||
/// </summary>
|
||||
public partial class ObjectViewerForm : System.Windows.Forms.Form, IMessageFilter
|
||||
{
|
||||
private ObjectViewer m_viewer;
|
||||
private SortableBindingList<Para> m_paras;
|
||||
private Sketch3D m_currentSketch;
|
||||
|
||||
// key down code
|
||||
private const int WM_KEYDOWN = 0X0100;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="viewer"></param>
|
||||
public ObjectViewerForm(ObjectViewer viewer)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
m_viewer = viewer;
|
||||
m_paras = viewer.Params;
|
||||
m_currentSketch = viewer.CurrentSketch3D;
|
||||
|
||||
Application.AddMessageFilter(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize the controller
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ObjectViewerForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
// detailLevelComboBox
|
||||
detailLevelComboBox.SelectedIndex = (int)m_viewer.DetailLevel;
|
||||
|
||||
// viewListBox
|
||||
viewListBox.DataSource = m_viewer.AllViews;
|
||||
viewListBox.DisplayMember = "Name";
|
||||
viewListBox.SelectedItem = m_viewer.CurrentView;
|
||||
|
||||
// physicalModelRadioButton and analyticalModelRadioButton
|
||||
physicalModelRadioButton.Checked =
|
||||
(m_viewer.DisplayKind == ObjectViewer.DisplayKinds.GeometryModel);
|
||||
analyticalModelRadioButton.Checked =
|
||||
(m_viewer.DisplayKind == ObjectViewer.DisplayKinds.AnalyticalModel);
|
||||
|
||||
// viewDirectionComboBox
|
||||
viewDirectionComboBox.SelectedIndex = (int)Graphics3DData.ViewDirections.IsoMetric;
|
||||
|
||||
// m_currentSketch
|
||||
m_currentSketch = m_viewer.CurrentSketch3D;
|
||||
m_currentSketch.DisplayBBox = new RectangleF(new PointF(0.0f, 0.0f), previewBox.Size);
|
||||
m_currentSketch.UpdateViewEvent += delegate
|
||||
{
|
||||
previewBox.Invalidate();
|
||||
};
|
||||
|
||||
// parametersDataGridView
|
||||
parametersDataGridView.DataSource = m_paras;
|
||||
parametersDataGridView.Columns[0].Width = parametersDataGridView.Width / 2;
|
||||
parametersDataGridView.Columns[0].HeaderText = "Parameter Name";
|
||||
parametersDataGridView.Columns[1].Width = parametersDataGridView.Width / 2;
|
||||
parametersDataGridView.Columns[1].HeaderText = "Value";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prefilter the message, action zoom, transform, rotate etc.
|
||||
/// </summary>
|
||||
/// <param name="m">The message captured</param>
|
||||
/// <returns>Informs if this message is used. </returns>
|
||||
public bool PreFilterMessage(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_KEYDOWN)
|
||||
{
|
||||
// mouse is out of previewBox
|
||||
if (Cursor.Current != Cursors.Cross)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// deal with key down event
|
||||
System.Windows.Forms.Keys k = (System.Windows.Forms.Keys)(int)m.WParam;
|
||||
KeyEventArgs e = new KeyEventArgs(k);
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
m_currentSketch.Data3D.RotateY(true);
|
||||
break;
|
||||
case Keys.Right:
|
||||
m_currentSketch.Data3D.RotateY(false);
|
||||
break;
|
||||
case Keys.Up:
|
||||
m_currentSketch.Data3D.RotateX(true);
|
||||
break;
|
||||
case Keys.Down:
|
||||
m_currentSketch.Data3D.RotateX(false);
|
||||
break;
|
||||
case Keys.PageUp:
|
||||
m_currentSketch.Data3D.RotateZ(true);
|
||||
break;
|
||||
case Keys.PageDown:
|
||||
m_currentSketch.Data3D.RotateZ(false);
|
||||
break;
|
||||
case Keys.S:
|
||||
m_currentSketch.MoveY(true);
|
||||
break;
|
||||
case Keys.W:
|
||||
m_currentSketch.MoveY(false);
|
||||
break;
|
||||
case Keys.A:
|
||||
m_currentSketch.MoveX(true);
|
||||
break;
|
||||
case Keys.D:
|
||||
m_currentSketch.MoveX(false);
|
||||
break;
|
||||
case Keys.Home:
|
||||
m_currentSketch.Zoom(true);
|
||||
break;
|
||||
case Keys.End:
|
||||
m_currentSketch.Zoom(false);
|
||||
break;
|
||||
case Keys.Escape:
|
||||
this.Close();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove message map
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ObjectViewerForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Application.RemoveMessageFilter(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// previewBox redraw
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void previewBox_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
m_currentSketch.Draw(e.Graphics);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// display physicalModel
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void physicalModelRadioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (physicalModelRadioButton.Checked)
|
||||
{
|
||||
m_viewer.DisplayKind = ObjectViewer.DisplayKinds.GeometryModel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// display analyticalModel
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void analyticalModelRadioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (analyticalModelRadioButton.Checked)
|
||||
{
|
||||
m_viewer.DisplayKind = ObjectViewer.DisplayKinds.AnalyticalModel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the View to show the element
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void viewListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(!viewListBox.Focused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_viewer.CurrentView = viewListBox.SelectedItem as Autodesk.Revit.DB.View;
|
||||
detailLevelComboBox.SelectedIndex = (int)m_viewer.DetailLevel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the camera direction to the view
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void viewDirectionComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
m_currentSketch.Data3D.SetViewDirection(
|
||||
(Graphics3DData.ViewDirections)viewDirectionComboBox.SelectedIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the detail level to show the element
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void detailLevelComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(!detailLevelComboBox.Focused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_viewer.DetailLevel = (ViewDetailLevel)detailLevelComboBox.SelectedIndex;
|
||||
viewListBox.SelectedItem = m_viewer.CurrentView;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Submit the edition of parameters
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OKButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel all edit
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void closeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,164 @@
|
||||
//
|
||||
// (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.Data;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// a class used to define a parameter of Element
|
||||
/// </summary>
|
||||
public class Para
|
||||
{
|
||||
private Parameter m_parameter; //one parameter of a element
|
||||
|
||||
/// <summary>
|
||||
/// parameter's name
|
||||
/// </summary>
|
||||
public string ParaName
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_parameter.Definition.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// parameter's value
|
||||
/// </summary>
|
||||
//public Object Value // jeremy
|
||||
public string Value // jeremy
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetParameterValue(m_parameter);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
SetParameterValue(m_parameter,value);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get parameter's value
|
||||
/// </summary>
|
||||
/// <param name="parameter">parameter of Element</param>
|
||||
/// <returns>parameter's value include unit if have</returns>
|
||||
public static string GetParameterValue(Parameter parameter) // jeremy
|
||||
//public static Object GetParameterValue(Parameter parameter) // jeremy
|
||||
{
|
||||
switch (parameter.StorageType)
|
||||
{
|
||||
case StorageType.Double:
|
||||
//get value with unit, AsDouble() can get value without unit
|
||||
return parameter.AsValueString();
|
||||
case StorageType.ElementId:
|
||||
return parameter.AsElementId().IntegerValue.ToString();
|
||||
case StorageType.Integer:
|
||||
//get value with unit, AsInteger() can get value without unit
|
||||
return parameter.AsValueString();
|
||||
case StorageType.None:
|
||||
return parameter.AsValueString();
|
||||
case StorageType.String:
|
||||
return parameter.AsString();
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set parameter's value
|
||||
/// </summary>
|
||||
/// <param name="parameter">parameter of a Material</param>
|
||||
/// <param name="value">
|
||||
/// value will be set to parameter
|
||||
/// </param>
|
||||
public static void SetParameterValue(Parameter parameter, Object value)
|
||||
{
|
||||
//first,check whether this parameter is read only
|
||||
if(parameter.IsReadOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (parameter.StorageType)
|
||||
{
|
||||
case StorageType.Double:
|
||||
//set value with unit, Set() can set value without unit
|
||||
parameter.SetValueString(value as string);
|
||||
break;
|
||||
case StorageType.ElementId:
|
||||
Autodesk.Revit.DB.ElementId elementId = (Autodesk.Revit.DB.ElementId)(value);
|
||||
parameter.Set(elementId);
|
||||
break;
|
||||
case StorageType.Integer:
|
||||
//set value with unit, Set() can set value without unit
|
||||
parameter.SetValueString(value as string);
|
||||
break;
|
||||
case StorageType.None:
|
||||
parameter.SetValueString(value as string);
|
||||
break;
|
||||
case StorageType.String:
|
||||
parameter.Set(value as string);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor of Para
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public Para(Parameter parameter)
|
||||
{
|
||||
m_parameter = parameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// (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.Windows.Forms;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.ObjectViewer.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// a class used to create BindingList
|
||||
/// </summary>
|
||||
public class ParasFactory
|
||||
{
|
||||
private Element m_element; // element that selected in Revit by Mouse
|
||||
private SortableBindingList<Para> m_parasList; //a list store parameters' information
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// constructor of ParametersFactory
|
||||
/// </summary>
|
||||
/// <param name="element">the element of which parameters will be gotten</param>
|
||||
public ParasFactory(Element element)
|
||||
{
|
||||
m_element = element;
|
||||
m_parasList = new SortableBindingList<Para>();
|
||||
//set m_parasList can be edit;
|
||||
m_parasList.AllowEdit = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// add Para's instances to m_parasList, finally return it
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SortableBindingList<Para> CreateParas()
|
||||
{
|
||||
try
|
||||
{
|
||||
ParameterSetIterator iterator = m_element.Parameters.ForwardIterator();
|
||||
Parameter parameter;
|
||||
iterator.Reset();
|
||||
|
||||
//use Iterator to loop, new a Para for each parameter and
|
||||
//add it to m_parameter; if failed return null
|
||||
for (; iterator.MoveNext(); )
|
||||
{
|
||||
parameter = iterator.Current as Parameter;
|
||||
if (null != parameter)
|
||||
{
|
||||
m_parasList.Add(new Para(parameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string errorText = "Create Paras failed: " + e.Message;
|
||||
TaskDialog.Show("Revit", errorText);
|
||||
return null;
|
||||
}
|
||||
return m_parasList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ObjectViewer_Upgrade")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ObjectViewer_Upgrade")]
|
||||
[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("b83aaa72-4410-4cef-9933-c1a2e9ea8c00")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,92 @@
|
||||
{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset0 Times New Roman;}}
|
||||
{\colortbl ;\red0\green0\blue255;}
|
||||
\viewkind4\uc1\pard\ltrpar\nowidctlpar\b\f0\fs20 Application:\b0 ObjectViewer\line\b Revit Platform:\b0 All\line\b Revit Version:\b0 2011.0\line\b First Released For:\b0 9.0\line\b Programming Language:\b0 C#\line\b Skill Level:\b0 Advanced\line\b Category:\b0 Views\line\b Type:\b0 ExternalCommand\line\line\b Subject:\b0 Show element's geometry,get and set its parameter value.\line\b Summary:\b0 \line This sample demonstrates two main features:\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360 1.\tab How to get physical or analytical model of selected element\f1 .\par
|
||||
\f0 2.\tab How to get and set parameter\rquote s value of selected element\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
\b Classes:\b0 \par
|
||||
\pard\ltrpar\nowidctlpar\fi360 Autodesk.Revit.UI.IExternalCommand\f1\par
|
||||
\f0 Autodesk.Revit.DB.Element\f1\par
|
||||
\f0 Autodesk.Revit.DB.GeometryElement\f1\par
|
||||
\f0 Autodesk.Revit.DB.Parameter\par
|
||||
Autodesk.Revit.DB.GeometryObject\par
|
||||
Autodesk.Revit.DB.Transform\par
|
||||
Autodesk.Revit.DB.Structure.AnalyticalModel\par
|
||||
\pard\ltrpar\nowidctlpar\par
|
||||
\b Project Files:\b0 \par
|
||||
Command.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 This file contains the class \ldblquote Command\rdblquote which inherits from \ldblquote IExternalCommand\rdblquote interface and implements the \ldblquote Execute\rdblquote method\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\fi240\f0\par
|
||||
\pard\ltrpar\nowidctlpar ErrorMessageException.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote ErrorMessageException\rdblquote which is used to pass error message to UI or back to internal error message box by Execute method in IExternalCommand\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
GeometryData.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote GeometryData\rdblquote which is used to get Revit geometry data and transform the data to appropriate format for GDI.\par
|
||||
\pard\ltrpar\nowidctlpar\par
|
||||
Graphics2DData.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains: \f1\par
|
||||
\f0 A class \ldblquote Graphics2DData\rdblquote which is a data class for graphics 2D\f1\par
|
||||
\f0 A class \ldblquote EmptyGraphics2DData\rdblquote which derives from \ldblquote Graphics2DData\rdblquote could represents a PointF class with uninitialized member data\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
Graphics3DData.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote Graphics3DData\rdblquote which is a data class for graphics 3D\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
MathUtil.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote MathUtil\rdblquote which provides matrix algorithm\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
ModelData.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote ModelData\rdblquote which is used to generate GraphicsData from element\rquote s analytical model\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
ObjectViewer.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains the class \ldblquote ObjectViewer\rdblquote which is main command class of the ObjectViewer application\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
ObjectViewerForm.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote ObjectViewerForm\rdblquote which is used to display selected element in a PictureBox and its parameters in a DataGridView; it also allows showing element in different conditions via RadioButtons, ComboBox and so on\f1 .\f0\par
|
||||
\pard\ltrpar\nowidctlpar\par
|
||||
Para.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote Para\rdblquote which is used to define a parameter of Element\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
ParasFactory.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote ParasFactory\rdblquote which is used to create a SortableBindingList<Para> collection\f1 .\f0 The SortableBindingList could store information about parameters according to an Element\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
Sketch.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote Sketch3D\rdblquote which provides methods to draw objects in PictureBox and deals with operations \ldblquote Move\rdblquote \ldblquote Zoom\rdblquote \ldblquote Rotate\rdblquote .\f1\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
UCS.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote UCS\rdblquote which stands for user coordinate system\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
Vector.cs\par
|
||||
\pard\ltrpar\nowidctlpar\li360\tx720 It contains a class \ldblquote Vector\rdblquote which is Point class used to store point coordinate value\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\f0\par
|
||||
\b Description:\b0 \par
|
||||
This sample demonstrates the following functionalities:\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360 -\tab The command only works with one selected element\f1 .\par
|
||||
\f0 -\tab In a Dialog, displays selected element in a preview window on the left and generic properties grid on the right.\par
|
||||
-\tab The dialog contains radio buttons for switching between physical and analytical model. If the element does not have a physical or analytical model, option should be disabled and preview window should be grayed\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360\f0 -\tab The dialog contains lists for selecting the following opinions:\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li720\tx720 -\tab Detail Level for physical model\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li720\f0 -\tab Views for physical model\f1 .\par
|
||||
\f0 -\tab View direction for both models (physical and analytical model)\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360\f0 -\tab The selected element has its geometry, physical or analytical displayed in the preview pane. The elements generic properties should be displayed in the grid.\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360 -\tab The preview panel default to a view direction of -1,-1,-1 i.e. looking down at an angle to the object\par
|
||||
-\tab When mouse is inside the region of preview window, user zoom, rotate and move model:\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li720\tx720 -\tab Click \lquote A\rquote , \lquote S\rquote , \lquote D\rquote , \lquote W\rquote keys to move model to left, down, right and up\f1 .\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li720\f0 -\tab Click \lquote up arrow\rquote , \lquote down arrow\rquote , \lquote left arrow\rquote , \lquote right arrow\rquote , \lquote Pg Up\rquote , \lquote Pg Down\rquote to rotate model around center.\par
|
||||
-\tab Click \lquote Home\rquote and \lquote End\rquote keys to zoom in and out model.\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360 -\tab All parameters displayed in the grid with their name, value, unit name\f1 .\f0 Parameter\rquote s value can be changed successfully if the input value is acceptable and this parameter is not read only. \f1\par
|
||||
\pard\ltrpar\nowidctlpar\par
|
||||
\f0 Implementations:\f1\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360\f0 -\tab The physical model is available via the Geometry property of the Element. \par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360 -\tab The analytical model could be found by the AnalyticalModel property available on specific elements. There are several forms of analytical model and all should be displayed by this sample. \par
|
||||
-\tab Special attention should be paid to Inplace Family Instances to ensure that they display correctly.\par
|
||||
\pard\ltrpar\nowidctlpar\li360\par
|
||||
\pard\ltrpar\nowidctlpar\b Instructions:\cf1\b0 \cf0\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360 1.\tab Draw a line, wall, beam or desk and so on.\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360 2.\tab Select one, and run this command.\par
|
||||
3.\tab A dialog will be shown to display selected element in a PictureBox and its parameters in a DataGridView, it is allowed to change parameter\rquote s value via changing value in DataGridView.\par
|
||||
4.\tab Select radio buttons \ldblquote Physical Model\rdblquote or \ldblquote Analytical Model\rdblquote to switching between physical and analytical model of selected element.\par
|
||||
\pard\ltrpar\nowidctlpar\fi360 Note: If this element doesn\rquote t have some model, the PictureBox should become gray.\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360 5.\tab As description above, click some keys to move rotate or zoom model, the model can be seen from different angles.\par
|
||||
\pard\ltrpar\nowidctlpar\fi-360\li360 6.\tab Changing selection of ComboBox \ldblquote Detail level\rdblquote , \ldblquote View direction\rdblquote and ListBox \ldblquote Displayed view\rdblquote will lead to transformation in PictureBox. It is similar to operations in Revit.\par
|
||||
}
|
||||
| ||||