添加项目文件。
29
RookieStation.sln
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31025.218
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RookieStation", "RookieStation\RookieStation.csproj", "{057C7E8D-42A1-4912-B522-498DB7484894}"
|
||||||
|
EndProject
|
||||||
|
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "RookieStationSetup", "RookieStationSetup\RookieStationSetup.vdproj", "{ACB3490C-778E-4EC3-99F7-243388ACCE4C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{057C7E8D-42A1-4912-B522-498DB7484894}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{057C7E8D-42A1-4912-B522-498DB7484894}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{057C7E8D-42A1-4912-B522-498DB7484894}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{057C7E8D-42A1-4912-B522-498DB7484894}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ACB3490C-778E-4EC3-99F7-243388ACCE4C}.Debug|Any CPU.ActiveCfg = Debug
|
||||||
|
{ACB3490C-778E-4EC3-99F7-243388ACCE4C}.Release|Any CPU.ActiveCfg = Release
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {2D748E39-17E6-471A-9DC8-9351921D58F6}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
71
RookieStation/CmdArrangeShelfCards.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace RookieStation.PackAreaModule
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdArrangeShelfCards : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
|
||||||
|
string addin_path = typeof(RsApp).Assembly.Location;
|
||||||
|
string assembly_directory = System.IO.Path.GetDirectoryName(addin_path);
|
||||||
|
AssemblyLoader loader = new AssemblyLoader(assembly_directory);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
loader.HookAssemblyResolve();
|
||||||
|
|
||||||
|
WpfShelfCards cards_number = new WpfShelfCards(uiapp);
|
||||||
|
|
||||||
|
System.Windows.Interop.WindowInteropHelper mainUI = new System.Windows.Interop.WindowInteropHelper(cards_number)
|
||||||
|
{
|
||||||
|
Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle
|
||||||
|
};
|
||||||
|
cards_number.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("错误", ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
loader.UnhookAssemblyResolve();
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
//if (IsVisible("端牌编号"))
|
||||||
|
//{
|
||||||
|
// WinIntPtr.ShowAndActive("端牌编号");
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// cardsPlacement = new WpfNumberShelfCard();
|
||||||
|
|
||||||
|
// System.Windows.Interop.WindowInteropHelper mainUI = new System.Windows.Interop.WindowInteropHelper(cardsPlacement);
|
||||||
|
// mainUI.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
|
||||||
|
|
||||||
|
// cardsPlacement.ShowDialog();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
//public static bool IsVisible(string winname)
|
||||||
|
//{
|
||||||
|
// IntPtr ParenthWndldsl = WinIntPtr.FindWindow(null, winname);
|
||||||
|
// if (!ParenthWndldsl.Equals(IntPtr.Zero))
|
||||||
|
// {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
RookieStation/CmdBrowserFamily.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RookieStation.CommonTools
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdBrowserFamily : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
//var dpid = new DockablePaneId(PaneIdentifiers.GetManagerPaneIdentifier());
|
||||||
|
var library_directory = UserConstant.LibraryPreDirectory;
|
||||||
|
System.Diagnostics.Process.Start(library_directory);
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
110
RookieStation/CmdLogoExtrusion.cs
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdLogoExtrusion : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
ICollection<ImportInstance> instances = new FilteredElementCollector(doc).OfClass(typeof(ImportInstance)).Cast<ImportInstance>().ToList();
|
||||||
|
List<Curve> curves = new List<Curve>();
|
||||||
|
|
||||||
|
var geometryElement = instances.First().get_Geometry(new Options());
|
||||||
|
|
||||||
|
foreach (var geomObj in geometryElement)
|
||||||
|
{
|
||||||
|
GeometryInstance geometryInstance = geomObj as GeometryInstance;
|
||||||
|
if (geometryInstance != null)
|
||||||
|
{
|
||||||
|
foreach (var instObj in geometryInstance.GetInstanceGeometry())
|
||||||
|
{
|
||||||
|
Curve curve = instObj as Curve;
|
||||||
|
if (curve == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
curves.Add(curve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CurveArrArray arrArray = new CurveArrArray();
|
||||||
|
CurveArray array = new CurveArray();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Curve curve = curves.Last();
|
||||||
|
array.Clear();
|
||||||
|
Curve tempcurve = curve;
|
||||||
|
var endxyz = tempcurve.GetEndPoint(1);
|
||||||
|
for (int j = curves.Count - 1; j >= 0; j--)
|
||||||
|
{
|
||||||
|
Curve cur = curves[j];
|
||||||
|
if (cur.Equals(tempcurve))
|
||||||
|
{
|
||||||
|
array.Append(cur);
|
||||||
|
curves.Remove(cur);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cur.GetEndPoint(0).IsAlmostEqualTo(endxyz))
|
||||||
|
{
|
||||||
|
tempcurve = cur;
|
||||||
|
endxyz = cur.GetEndPoint(1);
|
||||||
|
array.Append(cur);
|
||||||
|
curves.Remove(cur);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cur.GetEndPoint(1).IsAlmostEqualTo(endxyz))
|
||||||
|
{
|
||||||
|
tempcurve = cur;
|
||||||
|
endxyz = cur.GetEndPoint(0);
|
||||||
|
array.Append(cur);
|
||||||
|
curves.Remove(cur);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arrArray.Append(array);
|
||||||
|
} while (curves.Count > 0);
|
||||||
|
|
||||||
|
using (Transaction trans = new Transaction(doc, "cmd"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
trans.Start();
|
||||||
|
//foreach (var item in curves)
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
//doc.FamilyCreate.NewModelCurve()
|
||||||
|
SketchPlane plane = SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(XYZ.BasisZ, XYZ.Zero));
|
||||||
|
foreach (CurveArray arr in arrArray)
|
||||||
|
{
|
||||||
|
doc.FamilyCreate.NewModelCurveArray(arr, plane);
|
||||||
|
}
|
||||||
|
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = ex.Message;
|
||||||
|
if (trans.GetStatus() == TransactionStatus.Started)
|
||||||
|
{
|
||||||
|
trans.RollBack();
|
||||||
|
}
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
86
RookieStation/CmdNewDimension.cs
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdNewDimension : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
|
||||||
|
//var instance = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element, new ShelvesFilter(), "请选择货架")) as FamilyInstance;
|
||||||
|
List<FamilyInstance> instances = uidoc.Selection.PickObjects(ObjectType.Element, "请选择货架")
|
||||||
|
.Select(x => doc.GetElement(x))
|
||||||
|
.Cast<FamilyInstance>()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
ReferenceArray refArry = new ReferenceArray();
|
||||||
|
List<Face> reffaces = new List<Face>();
|
||||||
|
var ins = instances.FirstOrDefault();
|
||||||
|
|
||||||
|
var p = RsRevitUtils.GetXYZByElement(ins);
|
||||||
|
var v = ins.FacingOrientation;
|
||||||
|
Line line = Line.CreateUnbound(p, v);
|
||||||
|
//createoffest需要根据线的方向和参考方向进行叉乘
|
||||||
|
var line1 = line.CreateOffset(1000 / 304.8, XYZ.BasisZ) as Line;
|
||||||
|
if (instances.Count < 1)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
foreach (FamilyInstance instance in instances)
|
||||||
|
{
|
||||||
|
List<Face> allfaces = new List<Face>();
|
||||||
|
|
||||||
|
Options opt = new Options();
|
||||||
|
opt.ComputeReferences = true;
|
||||||
|
|
||||||
|
ICollection<ElementId> eleids = instance.GetSubComponentIds();
|
||||||
|
|
||||||
|
var referback = instance.GetReferences(FamilyInstanceReferenceType.Back);
|
||||||
|
var referfront = instance.GetReferences(FamilyInstanceReferenceType.Front);
|
||||||
|
//var geom = instance.GetGeometryObjectFromReference(referface.FirstOrDefault());
|
||||||
|
refArry.Append(referback.First());
|
||||||
|
refArry.Append(referfront.First());
|
||||||
|
|
||||||
|
using (Transaction trans = new Transaction(doc, "创建尺寸标注"))
|
||||||
|
{
|
||||||
|
trans.Start();
|
||||||
|
|
||||||
|
Dimension dim = doc.Create.NewDimension(doc.ActiveView, line1, refArry);
|
||||||
|
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
//var fas = RevitCommonUtils.GetFacesByFamilyInstance(instance, opt);
|
||||||
|
//var fas = RevitCommonUtils.GetFamilyInstanceFaces(instance, opt);
|
||||||
|
|
||||||
|
//foreach (Face face in fas)
|
||||||
|
//{
|
||||||
|
// bool a = face.Reference.ConvertToStableRepresentation(doc).Contains("612:SURFACE");
|
||||||
|
// bool b = face.Reference.ConvertToStableRepresentation(doc).Contains("546:SURFACE");
|
||||||
|
// if (a || b)
|
||||||
|
// {
|
||||||
|
// reffaces.Add(face);
|
||||||
|
// var pface = face as PlanarFace;
|
||||||
|
// //var geom = instance.GetGeometryObjectFromReference(face.Reference);
|
||||||
|
// refArry.Append(face.Reference);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//refArry.Append(reffaces.First().Reference);
|
||||||
|
//refArry.Append(reffaces.Last().Reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
132
RookieStation/CmdPlaceEntranceGate.cs
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace RookieStation.PackAreaModule
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceEntranceGate : IExternalCommand
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 选择一次后停止
|
||||||
|
/// </summary>
|
||||||
|
private static bool PlaceSingleInstanceAbort = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// revit窗口句柄
|
||||||
|
/// </summary>
|
||||||
|
private IntPtr revitWindow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加的元素
|
||||||
|
/// </summary>
|
||||||
|
private List<ElementId> eleIdsAdded = new List<ElementId>();
|
||||||
|
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
revitWindow = uiapp.MainWindowHandle;
|
||||||
|
|
||||||
|
WpfEntranceGate entrancegateLayout = CommonUtils.GenerateWindow<WpfEntranceGate>();
|
||||||
|
return doc.InvokeGroup<Result>(tg =>
|
||||||
|
{
|
||||||
|
if (entrancegateLayout.DialogResult != true)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FamilySymbol linesymbol = RsRevitUtils.GetGuideSymbol(doc);
|
||||||
|
eleIdsAdded.Clear();
|
||||||
|
uiapp.Application.DocumentChanged += Application_DocumentChanged;
|
||||||
|
uidoc.PromptForFamilyInstancePlacement(linesymbol);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
if (eleIdsAdded.Count == 0)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
Line refer_line = RsRevitUtils.GetGuideGeometryAndDeleteGuide(doc, eleIdsAdded);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
|
||||||
|
double interval = (330 + entrancegateLayout.passage_width) / 304.8;
|
||||||
|
double offest = 0.0;
|
||||||
|
//布置闸机的数量
|
||||||
|
List<XYZ> pts = GetInstancePointsByLine(refer_line, interval);
|
||||||
|
List<FamilyInstance> instances = new List<FamilyInstance>();
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
CreateGates(uidoc, pts, out instances, out offest);
|
||||||
|
}, "创建闸机位置");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
RsRevitUtils.AdjustInstances(doc, instances, refer_line, offest);
|
||||||
|
}, "调整闸机位置");
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
}, "布置入口闸机");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateGates(UIDocument uidoc, List<XYZ> pts, out List<FamilyInstance> fis, out double offest)
|
||||||
|
{
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
fis = new List<FamilyInstance>();
|
||||||
|
|
||||||
|
Level level = uidoc.ActiveView.GenLevel;
|
||||||
|
Family gate_family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Gate\\闸机.rfa");
|
||||||
|
ElementId symbol_id = gate_family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
FamilySymbol gate_symbol = doc.GetElement(symbol_id) as FamilySymbol;
|
||||||
|
offest = gate_symbol.GetParameters("深度").FirstOrDefault().AsDouble() / 2;
|
||||||
|
gate_symbol.Activate();
|
||||||
|
foreach (var pt in pts)
|
||||||
|
{
|
||||||
|
var instance = doc.Create.NewFamilyInstance(pt, gate_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
fis.Add(instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<XYZ> GetInstancePointsByLine(Line referline, double interval)
|
||||||
|
{
|
||||||
|
int n = 50;
|
||||||
|
List<XYZ> pts = new List<XYZ>();
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
double parameter = (i + 0.5) * interval;
|
||||||
|
if (!referline.IsInside(parameter + (interval / 2)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pts.Add(referline.Evaluate(parameter, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
return pts;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Application_DocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ICollection<ElementId> idsAdded = e.GetAddedElementIds();
|
||||||
|
int n = idsAdded.Count;
|
||||||
|
eleIdsAdded.AddRange(idsAdded);
|
||||||
|
if (PlaceSingleInstanceAbort && n == 1)
|
||||||
|
{
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
//KeyPress.OneKey(revitWindow, (char)System.Windows.Forms.Keys.Escape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
232
RookieStation/CmdPlaceExitGate.cs
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.DB.Events;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace RookieStation.PackAreaModule
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceExitGate : IExternalCommand
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否起始为通道
|
||||||
|
/// </summary>
|
||||||
|
internal bool isPassageStart;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选择一次后停止
|
||||||
|
/// </summary>
|
||||||
|
private static bool PlaceSingleInstanceAbort = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// revit窗口句柄
|
||||||
|
/// </summary>
|
||||||
|
private IntPtr revitWindow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加的元素
|
||||||
|
/// </summary>
|
||||||
|
private List<ElementId> eleIdsAdded = new List<ElementId>();
|
||||||
|
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
revitWindow = uiapp.MainWindowHandle;
|
||||||
|
|
||||||
|
WpfExitGate gate_layout = CommonUtils.GenerateWindow<WpfExitGate>();
|
||||||
|
|
||||||
|
if (gate_layout.DialogResult == true)
|
||||||
|
{
|
||||||
|
isPassageStart = gate_layout.isStartPassage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
double interval = (2 * (1030 + gate_layout.passage_width) + 100) / 304.8;
|
||||||
|
double gate_front_offest = 1630 / 304.8;
|
||||||
|
List<FamilyInstance> instances = new List<FamilyInstance>();
|
||||||
|
|
||||||
|
using (TransactionGroup tg = new TransactionGroup(doc, "布置出口收检台"))
|
||||||
|
{
|
||||||
|
tg.Start();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FamilySymbol line_symbol = RsRevitUtils.GetGuideSymbol(doc); ;
|
||||||
|
|
||||||
|
eleIdsAdded.Clear();
|
||||||
|
uiapp.Application.DocumentChanged += Application_DocumentChanged;
|
||||||
|
uidoc.PromptForFamilyInstancePlacement(line_symbol);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
if (eleIdsAdded.Count == 0)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
//直线向量
|
||||||
|
Line refer_line = RsRevitUtils.GetGuideGeometryAndDeleteGuide(doc, eleIdsAdded);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
|
||||||
|
int orders = UserConstant.Orders;
|
||||||
|
int n = GetGateCountByOrders(orders);
|
||||||
|
if (orders.Equals(0) || n == 0)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("温馨提示", "单量有误");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
int m = isPassageStart
|
||||||
|
? (int)Math.Floor((refer_line.Length * 304.8 / 1630) + 0.5)
|
||||||
|
: (int)Math.Floor(((refer_line.Length * 304.8) - 200) / 1630 + 0.5);
|
||||||
|
if (m < n)
|
||||||
|
{
|
||||||
|
n = m;
|
||||||
|
}
|
||||||
|
List<XYZ> pts = new List<XYZ>();
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
Family gate_family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Gate\\L型收检台.rfa");
|
||||||
|
IEnumerable<ElementId> left_symbolId = from id in gate_family.GetFamilySymbolIds()
|
||||||
|
where doc.GetElement(id).Name == "左"
|
||||||
|
select id;
|
||||||
|
IEnumerable<ElementId> right_symbolId = from id in gate_family.GetFamilySymbolIds()
|
||||||
|
where doc.GetElement(id).Name == "右"
|
||||||
|
select id;
|
||||||
|
FamilySymbol right_symbol = doc.GetElement(right_symbolId.FirstOrDefault()) as FamilySymbol;
|
||||||
|
//ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
FamilySymbol left_symbol = doc.GetElement(left_symbolId.FirstOrDefault()) as FamilySymbol;
|
||||||
|
Level level = uidoc.ActiveView.GenLevel;
|
||||||
|
if (isPassageStart)//起始是通道
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
XYZ p = refer_line.Evaluate(i * interval, false);
|
||||||
|
pts.Add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (XYZ location_XYZ in pts)
|
||||||
|
{
|
||||||
|
left_symbol.Activate();
|
||||||
|
FamilyInstance left_instance = doc.Create.NewFamilyInstance(location_XYZ, left_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(left_instance);
|
||||||
|
if (instances.Count() == n + 1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
right_symbol.Activate();
|
||||||
|
FamilyInstance right_instance = doc.Create.NewFamilyInstance(location_XYZ, right_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(right_instance);
|
||||||
|
if (instances.Count() == n + 1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//offest = symbol.GetParameters("深度").FirstOrDefault().AsDouble() / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.Delete(instances.First().Id);
|
||||||
|
instances.RemoveAt(0);
|
||||||
|
}
|
||||||
|
else//起始是收检台
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
XYZ p = refer_line.Evaluate((i * interval) + 1830 / 304.8, false);
|
||||||
|
|
||||||
|
pts.Add(p);
|
||||||
|
}
|
||||||
|
foreach (var pt in pts)
|
||||||
|
{
|
||||||
|
left_symbol.Activate();
|
||||||
|
var left_instance = doc.Create.NewFamilyInstance(pt, left_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
|
||||||
|
//offest = symbol.GetParameters("深度").FirstOrDefault().AsDouble() / 2;
|
||||||
|
instances.Add(left_instance);
|
||||||
|
if (instances.Count() == n)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
right_symbol.Activate();
|
||||||
|
var right_instance = doc.Create.NewFamilyInstance(pt, right_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(right_instance);
|
||||||
|
if (instances.Count() == n)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "加载并创建收检台");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
RsRevitUtils.AdjustInstances(doc, instances, refer_line, gate_front_offest);
|
||||||
|
}, "调整收检台位置");
|
||||||
|
//if (tg.GetStatus() == TransactionStatus.Started)
|
||||||
|
//{
|
||||||
|
// tg.RollBack();
|
||||||
|
//}
|
||||||
|
//return Result.Cancelled;
|
||||||
|
}
|
||||||
|
tg.Assimilate();
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetGateCountByOrders(int orders)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
if (0 < orders && orders <= 2000)
|
||||||
|
{
|
||||||
|
n = 2;
|
||||||
|
}
|
||||||
|
else if (2000 < orders && orders <= 4000)
|
||||||
|
{
|
||||||
|
n = 3;
|
||||||
|
}
|
||||||
|
else if (4000 < orders && orders <= 6000)
|
||||||
|
{
|
||||||
|
n = 4;
|
||||||
|
}
|
||||||
|
else if (6000 < orders && orders <= 8000)
|
||||||
|
{
|
||||||
|
n = 5;
|
||||||
|
}
|
||||||
|
else if (8000 < orders)
|
||||||
|
{
|
||||||
|
n = 6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Application_DocumentChanged(object sender, DocumentChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ICollection<ElementId> idsAdded = e.GetAddedElementIds();
|
||||||
|
int n = idsAdded.Count;
|
||||||
|
eleIdsAdded.AddRange(idsAdded);
|
||||||
|
if (PlaceSingleInstanceAbort && n == 1)
|
||||||
|
{
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
//KeyPress.OneKey(revitWindow, (char)System.Windows.Forms.Keys.Escape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
564
RookieStation/CmdPlaceFloorFinishes.cs
Normal file
@@ -0,0 +1,564 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.DB.Architecture;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace RookieStation.CommonTools
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceFloorFinishes : IExternalCommand
|
||||||
|
{
|
||||||
|
private static string AddinPath = typeof(CmdPlaceFloorFinishes).Assembly.Location;
|
||||||
|
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
Family family = null;
|
||||||
|
FamilySymbol symbol;
|
||||||
|
|
||||||
|
WpfFloorFinishes floorCovering = CommonUtils.GenerateWindow<WpfFloorFinishes>();
|
||||||
|
var rooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).ToList();
|
||||||
|
if (rooms.Count == 0)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("温馨提示", "项目中当前没有房间");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
double length;
|
||||||
|
double width;
|
||||||
|
double gap;
|
||||||
|
|
||||||
|
if (floorCovering.DialogResult == true)
|
||||||
|
{
|
||||||
|
length = floorCovering.cLength / 304.8;
|
||||||
|
width = floorCovering.cWidth / 304.8;
|
||||||
|
gap = floorCovering.cGap / 304.8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (TransactionGroup tg = new TransactionGroup(doc, "地面铺装"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var v = new FilteredElementCollector(doc).OfClass(typeof(View))
|
||||||
|
.Cast<View>()
|
||||||
|
.FirstOrDefault(x => x.ViewType == ViewType.FloorPlan && x.GenLevel.Elevation == 0);
|
||||||
|
|
||||||
|
var baselevel = new FilteredElementCollector(doc)
|
||||||
|
.OfClass(typeof(Level))
|
||||||
|
.Cast<Level>()
|
||||||
|
.FirstOrDefault(x => x.Elevation == 0);
|
||||||
|
|
||||||
|
List<ElementId> modelCurveIds = new List<ElementId>();
|
||||||
|
tg.Start();
|
||||||
|
if (uidoc.ActiveView.ViewType != ViewType.FloorPlan)
|
||||||
|
{
|
||||||
|
uidoc.RequestViewChange(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectFilter<Room> selfilter = new SelectFilter<Room>();
|
||||||
|
Reference roomrefer = uidoc.Selection.PickObject(ObjectType.Element, selfilter, "请选择房间");
|
||||||
|
Room room = doc.GetElement(roomrefer) as Room;
|
||||||
|
|
||||||
|
var roompoint = RsRevitUtils.GetXYZByElement(room);
|
||||||
|
var segments = room.GetBoundarySegments(new SpatialElementBoundaryOptions()).FirstOrDefault();
|
||||||
|
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
foreach (var seg in segments)
|
||||||
|
{
|
||||||
|
Curve cur = seg.GetCurve();
|
||||||
|
Plane plane = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ());
|
||||||
|
var mc = doc.Create.NewModelCurve(cur, SketchPlane.Create(doc, plane));
|
||||||
|
modelCurveIds.Add(mc.Id);
|
||||||
|
}
|
||||||
|
}, "模型线创建");
|
||||||
|
|
||||||
|
//Reference edge = uidoc.Selection.PickObject(ObjectType.Edge, "请选择边界");
|
||||||
|
SelectFilter<ModelLine> mlfilter = new SelectFilter<ModelLine>();
|
||||||
|
Reference refline = uidoc.Selection.PickObject(ObjectType.Element, mlfilter, "请选择基准边线");
|
||||||
|
//模型线选取
|
||||||
|
var ml = doc.GetElement(refline) as ModelLine;
|
||||||
|
Line line = ml.GeometryCurve as Line;
|
||||||
|
Line line1 = RsRevitUtils.GetLongestSegmentLine(segments, line);
|
||||||
|
XYZ basepoint = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选择基准点(位于基准线上)");
|
||||||
|
double alength = basepoint.DistanceTo(line.GetEndPoint(0)) + basepoint.DistanceTo(line.GetEndPoint(1));
|
||||||
|
if (line.Length - alength > 0.001)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请选择基准线上的点", "温馨提示");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
//if (basepoint.IsAlmostEqualTo(ml.GeometryCurve.GetEndPoint(0)) || basepoint.IsAlmostEqualTo(ml.GeometryCurve.GetEndPoint(1)))
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
//基准线端点
|
||||||
|
var endp1 = line.GetEndPoint(0);
|
||||||
|
var endp2 = line.GetEndPoint(1);
|
||||||
|
//基准点向端点的向量
|
||||||
|
XYZ v1 = endp1 - basepoint;
|
||||||
|
XYZ v2 = endp2 - basepoint;
|
||||||
|
//用于确认布置方向
|
||||||
|
var v0 = roompoint - basepoint;
|
||||||
|
List<Curve> curves = new List<Curve>();
|
||||||
|
List<FamilyInstance> instances = new List<FamilyInstance>();
|
||||||
|
//Curve currefer = null;
|
||||||
|
//Curve currefer1 = null;
|
||||||
|
|
||||||
|
double interval = length + gap;
|
||||||
|
List<XYZ> pts = new List<XYZ>();
|
||||||
|
List<XYZ> lastps = new List<XYZ>();
|
||||||
|
XYZ zdir1 = null;
|
||||||
|
XYZ zdir2 = null;
|
||||||
|
XYZ offestvector = null;
|
||||||
|
double d1 = 0.0;
|
||||||
|
double d2 = 0.0;
|
||||||
|
//切分基准线后,两侧向量不为0
|
||||||
|
if (!v1.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
if (endp1.DistanceTo(basepoint) < length)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("基准点与基准线端点距离太近");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
zdir1 = v1.CrossProduct(v0).Normalize();
|
||||||
|
//偏移的方向,直线的侧方向
|
||||||
|
offestvector = zdir1.CrossProduct(v1).Normalize();
|
||||||
|
Line l1 = Line.CreateBound(basepoint, ml.GeometryCurve.GetEndPoint(0));
|
||||||
|
|
||||||
|
for (int i = 0; i < 10000; i++)
|
||||||
|
{
|
||||||
|
var parameter = i * interval;
|
||||||
|
if (!l1.IsInside(parameter + interval - gap / 2))
|
||||||
|
{
|
||||||
|
var lastp1 = pts.Last() - offestvector * width / 2;
|
||||||
|
|
||||||
|
d1 = lastp1.DistanceTo(endp1) - length / 2 - gap;
|
||||||
|
|
||||||
|
var lastfinalpoint = lastp1 + (l1.Direction * (d1 / 2 + length / 2 + gap)) + (offestvector * width / 2);
|
||||||
|
|
||||||
|
lastps.Add(lastfinalpoint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
XYZ p = l1.Evaluate(parameter, false);
|
||||||
|
XYZ finalpoint = p + (l1.Direction * interval / 2) + (offestvector * width / 2);
|
||||||
|
//当选择的基准点为端点时
|
||||||
|
if (v2.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
finalpoint = p + (l1.Direction * (interval - gap) / 2) + (offestvector * width / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
pts.Add(finalpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!v2.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
if (endp2.DistanceTo(basepoint) < length)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("基准点与基准线端点距离太近");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
zdir2 = v2.CrossProduct(v0).Normalize();
|
||||||
|
offestvector = zdir2.CrossProduct(v2).Normalize();
|
||||||
|
Line l2 = Line.CreateBound(basepoint, ml.GeometryCurve.GetEndPoint(1));
|
||||||
|
|
||||||
|
for (int i = 0; i < 10000; i++)
|
||||||
|
{
|
||||||
|
var parameter = i * interval;
|
||||||
|
if (!l2.IsInside(parameter + interval - gap / 2))
|
||||||
|
{
|
||||||
|
//var lastdistance = pts.Last().DistanceTo(endp1) - interval / 2 - gap / 2;
|
||||||
|
|
||||||
|
var lastp2 = pts.Last() - offestvector * width / 2;
|
||||||
|
|
||||||
|
d2 = lastp2.DistanceTo(endp2) - length / 2 - gap;
|
||||||
|
|
||||||
|
var lastfinalpoint = lastp2 + (l2.Direction * (d2 / 2 + length / 2 + gap)) + (offestvector * width / 2);
|
||||||
|
|
||||||
|
lastps.Add(lastfinalpoint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
XYZ p = l2.Evaluate(parameter, false);
|
||||||
|
//附加的基准线的水平垂直偏移距离
|
||||||
|
var finalpoint = p + (l2.Direction * interval / 2) + (offestvector * width / 2);
|
||||||
|
if (v1.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
finalpoint = p + (l2.Direction * (interval - gap) / 2) + (offestvector * width / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
pts.Add(finalpoint);
|
||||||
|
}
|
||||||
|
//var lastl2 = pts.Last().DistanceTo(endp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Transaction trans = new Transaction(doc, "地面铺装"))
|
||||||
|
{
|
||||||
|
trans.Start();
|
||||||
|
//删除模型线
|
||||||
|
doc.Delete(modelCurveIds);
|
||||||
|
family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "FloorFinish\\地砖.rfa");
|
||||||
|
ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
symbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||||
|
symbol.Activate();
|
||||||
|
foreach (var p in pts)
|
||||||
|
{
|
||||||
|
var fi = doc.Create
|
||||||
|
.NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(fi);
|
||||||
|
}
|
||||||
|
foreach (var p in lastps)
|
||||||
|
{
|
||||||
|
var fi = doc.Create
|
||||||
|
.NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(fi);
|
||||||
|
}
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
using (Transaction trans = new Transaction(doc, "调整地砖"))
|
||||||
|
{
|
||||||
|
trans.Start();
|
||||||
|
XYZ veroffestdir = null;
|
||||||
|
if (zdir1 != null)
|
||||||
|
{
|
||||||
|
veroffestdir = zdir1.CrossProduct(line.Direction).Normalize();
|
||||||
|
}
|
||||||
|
if (zdir2 != null)
|
||||||
|
{
|
||||||
|
veroffestdir = zdir2.CrossProduct(line.Direction).Normalize();
|
||||||
|
}
|
||||||
|
//旋转角度
|
||||||
|
double angle = XYZ.BasisY.AngleTo(veroffestdir);
|
||||||
|
//判断相对于Y轴是正向角度(逆时针)还是逆向角度(顺时针)
|
||||||
|
var z = veroffestdir.CrossProduct(XYZ.BasisY).Normalize();
|
||||||
|
if (z.IsAlmostEqualTo(XYZ.BasisZ))
|
||||||
|
{
|
||||||
|
//逆向旋转,角度取负值
|
||||||
|
angle = -angle;
|
||||||
|
}
|
||||||
|
//单行调整地砖数量
|
||||||
|
int n = 0;
|
||||||
|
if (v2.IsAlmostEqualTo(XYZ.Zero) || v1.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
n = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n = 2;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < instances.Count; i++)
|
||||||
|
{
|
||||||
|
FamilyInstance fi = instances[i];
|
||||||
|
|
||||||
|
var filp = RsRevitUtils.GetXYZByElement(fi);
|
||||||
|
Line zaxis = Line.CreateUnbound(filp, XYZ.BasisZ);
|
||||||
|
|
||||||
|
//旋转,移动
|
||||||
|
ElementTransformUtils.RotateElement(doc, fi.Id, zaxis, angle);
|
||||||
|
fi.GetParameters("长").FirstOrDefault().Set(length);
|
||||||
|
fi.GetParameters("宽").FirstOrDefault().Set(width);
|
||||||
|
|
||||||
|
if (i >= instances.Count - n)
|
||||||
|
{
|
||||||
|
var loc = RsRevitUtils.GetXYZByElement(instances[i]);
|
||||||
|
|
||||||
|
var dis1 = loc.DistanceTo(endp1);
|
||||||
|
var dis2 = loc.DistanceTo(endp2);
|
||||||
|
|
||||||
|
if (dis1 < interval)
|
||||||
|
{
|
||||||
|
fi.GetParameters("长").FirstOrDefault().Set(d1);
|
||||||
|
}
|
||||||
|
else if (dis2 < interval)
|
||||||
|
{
|
||||||
|
fi.GetParameters("长").FirstOrDefault().Set(d2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//ElementTransformUtils.CopyElement(doc, fi.Id, offestvector * (width + gap));
|
||||||
|
////垂直基准线平移
|
||||||
|
//ElementTransformUtils.MoveElement(doc, fi.Id, offestdir);
|
||||||
|
|
||||||
|
////平行基准线平移
|
||||||
|
//ElementTransformUtils.MoveElement(doc, fi.Id, line.Direction * w / 2);
|
||||||
|
//if (i >= 1)
|
||||||
|
//{
|
||||||
|
// XYZ additionaldir = zdir.CrossProduct(line.Direction).Normalize() * i * (passagewidth + l);
|
||||||
|
// ElementTransformUtils.MoveElement(doc, fi.Id, additionaldir);
|
||||||
|
//}
|
||||||
|
//位于直线右侧时,需要进行左右翻转
|
||||||
|
//if (OnLeft == false && fi.CanFlipHand)
|
||||||
|
//{
|
||||||
|
// fi.flipHand();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
using (Transaction trans = new Transaction(doc, "复制地砖"))
|
||||||
|
{
|
||||||
|
List<ElementId> copyids = new List<ElementId>();
|
||||||
|
trans.Start();
|
||||||
|
for (int i = 0; i < instances.Count; i++)
|
||||||
|
{
|
||||||
|
FamilyInstance fi = instances[i];
|
||||||
|
int num = (int)Math.Floor(line1.Length / (width + gap));
|
||||||
|
double rem = line1.Length - num * (width + gap);
|
||||||
|
for (int j = 1; j <= num; j++)
|
||||||
|
{
|
||||||
|
ICollection<ElementId> eles;
|
||||||
|
if (j == num)
|
||||||
|
{
|
||||||
|
eles = ElementTransformUtils.CopyElement(doc, fi.Id, offestvector * ((rem / 2) + (width + gap) * (j - 0.5) + gap));
|
||||||
|
FamilyInstance copyinstance = doc.GetElement(eles.FirstOrDefault()) as FamilyInstance;
|
||||||
|
copyinstance.GetParameters("宽").FirstOrDefault().Set(rem);
|
||||||
|
|
||||||
|
copyids.AddRange(eles.ToList());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eles = ElementTransformUtils.CopyElement(doc, fi.Id, offestvector * (width + gap) * j);
|
||||||
|
copyids.AddRange(eles.ToList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var id in copyids)
|
||||||
|
{
|
||||||
|
FamilyInstance copyinstance = doc.GetElement(id) as FamilyInstance;
|
||||||
|
if (copyinstance.Room == null)
|
||||||
|
{
|
||||||
|
doc.Delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region MyRegion
|
||||||
|
|
||||||
|
//foreach (var seg in segments)
|
||||||
|
//{
|
||||||
|
// Curve cur = seg.GetCurve();
|
||||||
|
// if (cur.GetEndPoint(0).IsAlmostEqualTo(startP) || cur.GetEndPoint(1).IsAlmostEqualTo(startP))
|
||||||
|
// {
|
||||||
|
// currefer = cur;
|
||||||
|
// }
|
||||||
|
// if (cur.GetEndPoint(1).IsAlmostEqualTo(startP))
|
||||||
|
// {
|
||||||
|
// currefer1 = cur;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //XYZ p1 = cur.Evaluate(100 / 304.8, false);
|
||||||
|
// //XYZ p2 = cur.Evaluate(200 / 304.8, false);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//var n = Math.Floor(currefer1.Length / interval) + 1;
|
||||||
|
//var rem = currefer1.Length % interval / interval;
|
||||||
|
|
||||||
|
//var x = 0.5;
|
||||||
|
//if (rem < 0.334)
|
||||||
|
//{
|
||||||
|
// x = (1 + rem) / 4;
|
||||||
|
// for (int i = 0; i < n; i++)
|
||||||
|
// {
|
||||||
|
// Curve l = null;
|
||||||
|
// if (i == 0)
|
||||||
|
// {
|
||||||
|
// l = currefer.CreateOffset((i + x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
// if (i >= 1)
|
||||||
|
// {
|
||||||
|
// l = currefer.CreateOffset((i - 0.5 + 2 * x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
// if (i == n - 1)
|
||||||
|
// {
|
||||||
|
// l = currefer.CreateOffset((i - 1 + 3 * x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// curves.Add(l);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// for (int i = 0; i < n; i++)
|
||||||
|
// {
|
||||||
|
// //var v = cur.Direction.CrossProduct(XYZ.BasisZ);
|
||||||
|
// //createoffset的偏移方向由线方向 叉乘 自己给定的方向
|
||||||
|
|
||||||
|
// var l = currefer.CreateOffset((i + x) * interval, -XYZ.BasisZ);
|
||||||
|
// if (i == n - 1)
|
||||||
|
// {
|
||||||
|
// l = currefer.CreateOffset((i - 1 + x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
// curves.Add(l);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//var m = Math.Floor(currefer.Length / interval) + 1;
|
||||||
|
//var rem1 = currefer.Length % interval / interval;
|
||||||
|
//x = 0.5;
|
||||||
|
//if (rem1 < 0.334)
|
||||||
|
//{
|
||||||
|
// x = (1 + rem1) / 4;
|
||||||
|
// for (int i = 0; i < m; i++)
|
||||||
|
// {
|
||||||
|
// Curve l = null;
|
||||||
|
// if (i == 0)
|
||||||
|
// {
|
||||||
|
// l = currefer1.CreateOffset((i + x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
// if (i >= 1)
|
||||||
|
// {
|
||||||
|
// l = currefer1.CreateOffset((i - 0.5 + 2 * x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
// if (i == m - 1)
|
||||||
|
// {
|
||||||
|
// l = currefer1.CreateOffset((i - 1 + 3 * x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// curves.Add(l);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// for (int i = 0; i < m; i++)
|
||||||
|
// {
|
||||||
|
// var l = currefer1.CreateOffset((i + x) * interval, -XYZ.BasisZ);
|
||||||
|
// if (i == m - 1)
|
||||||
|
// {
|
||||||
|
// l = currefer.CreateOffset((i - 1 + x) * interval, -XYZ.BasisZ);
|
||||||
|
// }
|
||||||
|
// curves.Add(l);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//var pts = GetIntersectPoints(curves);
|
||||||
|
//Plane pl = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ());
|
||||||
|
//foreach (var item in curves)
|
||||||
|
//{
|
||||||
|
// ModelCurve model = doc.Create.NewModelCurve(item, SketchPlane.Create(doc, pl));
|
||||||
|
//}
|
||||||
|
|
||||||
|
//foreach (var p in pts)
|
||||||
|
//{
|
||||||
|
// var fi = doc.Create
|
||||||
|
// .NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
// instances.Add(fi);
|
||||||
|
//}
|
||||||
|
//foreach (var fi in instances)
|
||||||
|
//{
|
||||||
|
// var lp = fi.Location as LocationPoint;
|
||||||
|
// var p = lp.Point;
|
||||||
|
// foreach (var seg in segments)
|
||||||
|
// {
|
||||||
|
// var l = seg.GetCurve() as Line;
|
||||||
|
// if (l.Distance(p) - ((1 + rem) / 4 * interval) < 0.001)
|
||||||
|
// {
|
||||||
|
// if (l.Direction.X < 0.001)
|
||||||
|
// {
|
||||||
|
// fi.GetParameters("长度").FirstOrDefault().Set((1 + rem) / 2 * (interval - halfgap));
|
||||||
|
// }
|
||||||
|
// else if (l.Direction.Y < 0.001)
|
||||||
|
// {
|
||||||
|
// fi.GetParameters("宽度").FirstOrDefault().Set((1 + rem) / 2 * (interval - halfgap));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (l.Distance(p) - ((1 + rem1) / 4 * interval) < 0.001)
|
||||||
|
// {
|
||||||
|
// if (l.Direction.X < 0.001)
|
||||||
|
// {
|
||||||
|
// fi.GetParameters("长度").FirstOrDefault().Set((1 + rem1) / 2 * (interval - halfgap));
|
||||||
|
// }
|
||||||
|
// else if (l.Direction.Y < 0.001)
|
||||||
|
// {
|
||||||
|
// fi.GetParameters("宽度").FirstOrDefault().Set((1 + rem1) / 2 * (interval - halfgap));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (true)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//ModelCurve mc = doc.Create.NewModelCurve();
|
||||||
|
//var geoelem = room.get_Geometry(new Options());
|
||||||
|
//foreach (var geomObj in geoelem)
|
||||||
|
//{
|
||||||
|
// Solid geomSolid = geomObj as Solid;
|
||||||
|
// if (null != geomSolid)
|
||||||
|
// {
|
||||||
|
// foreach (Face geomFace in geomSolid.Faces)
|
||||||
|
// {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//Do Something.
|
||||||
|
|
||||||
|
#endregion MyRegion
|
||||||
|
|
||||||
|
tg.Assimilate();
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
if (tg.GetStatus() == TransactionStatus.Started)
|
||||||
|
{
|
||||||
|
tg.RollBack();
|
||||||
|
}
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<XYZ> GetIntersectPoints(List<Curve> curves)
|
||||||
|
{
|
||||||
|
//获取轴网的所有交点
|
||||||
|
List<XYZ> Points = new List<XYZ>();
|
||||||
|
foreach (Curve curve in curves)
|
||||||
|
{
|
||||||
|
Curve currentCurve = curve;
|
||||||
|
foreach (Curve cur in curves)
|
||||||
|
{
|
||||||
|
IntersectionResultArray ira = null;
|
||||||
|
SetComparisonResult scr = currentCurve.Intersect(cur, out ira);
|
||||||
|
if (scr == SetComparisonResult.Overlap && ira.Size == 1)
|
||||||
|
{
|
||||||
|
XYZ tp = ira.get_Item(0).XYZPoint;
|
||||||
|
if (Points.Where(m => m.IsAlmostEqualTo(tp)).Count() == 0)
|
||||||
|
{
|
||||||
|
Points.Add(tp); //收集所有的交点
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Points;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public class SelectionFilter : ISelectionFilter
|
||||||
|
//{
|
||||||
|
// public bool AllowElement(Element element)
|
||||||
|
// {
|
||||||
|
// if (element.Category.Id.IntegerValue == -2000160)
|
||||||
|
// {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public bool AllowReference(Reference refer, XYZ point)
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
243
RookieStation/CmdPlaceLamps.cs
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.DB.Architecture;
|
||||||
|
using Autodesk.Revit.DB.Electrical;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace RookieStation.PackAreaModule
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceLamps : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
DocumentSet docset = uiapp.Application.Documents;
|
||||||
|
Family family = null;
|
||||||
|
FamilySymbol symbol;
|
||||||
|
double lrdistance = 0.0;
|
||||||
|
double fbdistance = 0.0;
|
||||||
|
|
||||||
|
var rooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).ToList();
|
||||||
|
if (rooms.Count == 0)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("温馨提示", "项目中当前没有房间");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
WpfLampsLayout placeLamps = CommonUtils.GenerateWindow<WpfLampsLayout>();
|
||||||
|
|
||||||
|
if (placeLamps.DialogResult == true)
|
||||||
|
{
|
||||||
|
lrdistance = placeLamps.LRDistance / 304.8;
|
||||||
|
fbdistance = placeLamps.LRDistance / 304.8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
double interval = 2000 / 304.8;
|
||||||
|
|
||||||
|
using (TransactionGroup tg = new TransactionGroup(doc, "布置灯具"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var v = new FilteredElementCollector(doc).OfClass(typeof(View))
|
||||||
|
.Cast<View>()
|
||||||
|
.FirstOrDefault(x => x.ViewType == ViewType.FloorPlan && x.GenLevel.Elevation == 0);
|
||||||
|
|
||||||
|
var baselevel = new FilteredElementCollector(doc)
|
||||||
|
.OfClass(typeof(Level))
|
||||||
|
.Cast<Level>()
|
||||||
|
.FirstOrDefault(x => x.Elevation == 0);
|
||||||
|
|
||||||
|
List<ElementId> modelCurveIds = new List<ElementId>();
|
||||||
|
tg.Start();
|
||||||
|
if (uidoc.ActiveView.ViewType != ViewType.FloorPlan)
|
||||||
|
{
|
||||||
|
uidoc.RequestViewChange(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectFilter<Room> selfilter = new SelectFilter<Room>();
|
||||||
|
Reference roomrefer = uidoc.Selection.PickObject(ObjectType.Element, selfilter, "请选择房间");
|
||||||
|
Room room = doc.GetElement(roomrefer) as Room;
|
||||||
|
|
||||||
|
var roompoint = RsRevitUtils.GetXYZByElement(room);
|
||||||
|
|
||||||
|
IList<BoundarySegment> segments = room.GetBoundarySegments(new SpatialElementBoundaryOptions()).FirstOrDefault();
|
||||||
|
|
||||||
|
using (Transaction ts = new Transaction(doc, "模型线创建"))
|
||||||
|
{
|
||||||
|
ts.Start();
|
||||||
|
foreach (var seg in segments)
|
||||||
|
{
|
||||||
|
Curve cur = seg.GetCurve();
|
||||||
|
Plane plane = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ());
|
||||||
|
var mc = doc.Create.NewModelCurve(cur, SketchPlane.Create(doc, plane));
|
||||||
|
modelCurveIds.Add(mc.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
ts.Commit();
|
||||||
|
}
|
||||||
|
//Reference edge = uidoc.Selection.PickObject(ObjectType.Edge, "请选择边界");
|
||||||
|
SelectFilter<ModelLine> mlfilter = new SelectFilter<ModelLine>();
|
||||||
|
Reference refline = uidoc.Selection.PickObject(ObjectType.Element, mlfilter, "请选择基准边线");
|
||||||
|
//模型线选取
|
||||||
|
var ml = doc.GetElement(refline) as ModelLine;
|
||||||
|
Line line = ml.GeometryCurve as Line;
|
||||||
|
Line line1 = RsRevitUtils.GetLongestSegmentLine(segments, line);
|
||||||
|
//var m = doc.GetElement(refer.ElementId);
|
||||||
|
|
||||||
|
XYZ basepoint = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选择基准点(位于基准线上)");
|
||||||
|
double alength = basepoint.DistanceTo(line.GetEndPoint(0)) + basepoint.DistanceTo(line.GetEndPoint(1));
|
||||||
|
if (line.Length - alength > 0.001)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请选择基准线上的点", "温馨提示");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
//if (basepoint.IsAlmostEqualTo(ml.GeometryCurve.GetEndPoint(0)) || basepoint.IsAlmostEqualTo(ml.GeometryCurve.GetEndPoint(1)))
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
var endp1 = line.GetEndPoint(0);
|
||||||
|
var endp2 = line.GetEndPoint(1);
|
||||||
|
var v1 = endp1 - basepoint;
|
||||||
|
var v2 = endp2 - basepoint;
|
||||||
|
var v0 = roompoint - basepoint;
|
||||||
|
List<Curve> curves = new List<Curve>();
|
||||||
|
List<FamilyInstance> instances = new List<FamilyInstance>();
|
||||||
|
//Curve currefer = null;
|
||||||
|
//Curve currefer1 = null;
|
||||||
|
|
||||||
|
List<XYZ> pts = new List<XYZ>();
|
||||||
|
List<XYZ> lastps = new List<XYZ>();
|
||||||
|
XYZ zdir1 = null;
|
||||||
|
XYZ zdir2 = null;
|
||||||
|
XYZ offestvector = null;
|
||||||
|
|
||||||
|
if (!v1.IsAlmostEqualTo(XYZ.Zero) && endp1.DistanceTo(basepoint) > interval)
|
||||||
|
{
|
||||||
|
//if (endp1.DistanceTo(basepoint) < interval)
|
||||||
|
//{
|
||||||
|
// System.Windows.MessageBox.Show("基准点与基准线端点距离太近");
|
||||||
|
// return Result.Cancelled;
|
||||||
|
//}
|
||||||
|
zdir1 = v1.CrossProduct(v0).Normalize();
|
||||||
|
//偏移的方向,直线的侧方向
|
||||||
|
offestvector = zdir1.CrossProduct(v1).Normalize();
|
||||||
|
Line l1 = Line.CreateBound(basepoint, line.GetEndPoint(0));
|
||||||
|
|
||||||
|
for (int i = 0; i < 1000; i++)
|
||||||
|
{
|
||||||
|
var parameter = i * interval;
|
||||||
|
if (!l1.IsInside(parameter + lrdistance + interval / 2))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
XYZ p = l1.Evaluate(parameter, false);
|
||||||
|
XYZ finalpoint = p + (l1.Direction * interval / 2) + (offestvector * fbdistance);
|
||||||
|
if (v2.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
finalpoint = p + (l1.Direction * lrdistance) + (offestvector * fbdistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
pts.Add(finalpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!v2.IsAlmostEqualTo(XYZ.Zero) && endp2.DistanceTo(basepoint) > interval)
|
||||||
|
{
|
||||||
|
//if (endp2.DistanceTo(basepoint) < length)
|
||||||
|
//{
|
||||||
|
// System.Windows.MessageBox.Show("基准点与基准线端点距离太近");
|
||||||
|
// return Result.Cancelled;
|
||||||
|
//}
|
||||||
|
zdir2 = v2.CrossProduct(v0).Normalize();
|
||||||
|
offestvector = zdir2.CrossProduct(v2).Normalize();
|
||||||
|
var x = zdir2.CrossProduct(v2);
|
||||||
|
Line l2 = Line.CreateBound(basepoint, line.GetEndPoint(1));
|
||||||
|
|
||||||
|
for (int i = 0; i < 1000; i++)
|
||||||
|
{
|
||||||
|
var parameter = i * interval;
|
||||||
|
if (!l2.IsInside(parameter + lrdistance + interval / 2))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
XYZ p = l2.Evaluate(parameter, false);
|
||||||
|
//附加的基准线的水平垂直偏移距离
|
||||||
|
var finalpoint = p + (l2.Direction * interval / 2) + (offestvector * fbdistance);
|
||||||
|
if (v1.IsAlmostEqualTo(XYZ.Zero))
|
||||||
|
{
|
||||||
|
finalpoint = p + (l2.Direction * lrdistance) + (offestvector * fbdistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
pts.Add(finalpoint);
|
||||||
|
}
|
||||||
|
//var lastl2 = pts.Last().DistanceTo(endp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Transaction trans = new Transaction(doc, "载入布置灯具"))
|
||||||
|
{
|
||||||
|
trans.Start();
|
||||||
|
//删除模型线
|
||||||
|
doc.Delete(modelCurveIds);
|
||||||
|
family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Lamp\\成品吊灯.rfa");
|
||||||
|
ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
symbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||||
|
symbol.Activate();
|
||||||
|
foreach (var p in pts)
|
||||||
|
{
|
||||||
|
var fi = doc.Create
|
||||||
|
.NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(fi);
|
||||||
|
}
|
||||||
|
foreach (var p in lastps)
|
||||||
|
{
|
||||||
|
var fi = doc.Create
|
||||||
|
.NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(fi);
|
||||||
|
}
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
using (Transaction trans = new Transaction(doc, "复制灯具"))
|
||||||
|
{
|
||||||
|
trans.Start();
|
||||||
|
for (int i = 0; i < instances.Count; i++)
|
||||||
|
{
|
||||||
|
FamilyInstance fi = instances[i];
|
||||||
|
int num = (int)Math.Floor((line1.Length - 2 * fbdistance) / interval);
|
||||||
|
double rem = line1.Length - num * interval;
|
||||||
|
for (int j = 1; j <= num; j++)
|
||||||
|
{
|
||||||
|
ElementTransformUtils.CopyElement(doc, fi.Id, offestvector * interval * j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
tg.Assimilate();
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
if (tg.GetStatus() == TransactionStatus.Started)
|
||||||
|
{
|
||||||
|
tg.RollBack();
|
||||||
|
}
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
429
RookieStation/CmdPlaceReceptionArea.cs
Normal file
@@ -0,0 +1,429 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.DB.Architecture;
|
||||||
|
using Autodesk.Revit.DB.Events;
|
||||||
|
using Autodesk.Revit.DB.Structure;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Media3D;
|
||||||
|
|
||||||
|
namespace RookieStation.ShippingAreaModule
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceReceptionArea : IExternalCommand
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 选择一次后停止
|
||||||
|
/// </summary>
|
||||||
|
private static bool PlaceSingleInstanceAbort = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// revit窗口句柄
|
||||||
|
/// </summary>
|
||||||
|
private IntPtr revitWindow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加的元素
|
||||||
|
/// </summary>
|
||||||
|
private List<ElementId> eleIdsAdded = new List<ElementId>();
|
||||||
|
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
revitWindow = uiapp.MainWindowHandle;
|
||||||
|
|
||||||
|
WpfReceptionArea receptionAreaPlacement = CommonUtils.GenerateWindow<WpfReceptionArea>();
|
||||||
|
//初始值
|
||||||
|
//基层厚度
|
||||||
|
double base_layer_thickness = 15 / 304.8;
|
||||||
|
//踢脚线高度
|
||||||
|
double Skirting_line_height = 50 / 304.8;
|
||||||
|
//踢脚线厚度
|
||||||
|
double Skirting_line_thickness = 1.2 / 304.8;
|
||||||
|
//铝塑板长度
|
||||||
|
double aluminum_plastic_panel_length = 1220 / 304.8;
|
||||||
|
//铝塑板高度
|
||||||
|
double aluminum_plastic_panel_height = 2400 / 304.8;
|
||||||
|
//铝塑板厚度
|
||||||
|
double aluminum_plastic_panel_thickness = 3 / 304.8;
|
||||||
|
//分缝
|
||||||
|
double gap = 2 / 304.8;
|
||||||
|
//灰色乳胶漆厚度
|
||||||
|
double grey_emulsion_paint_width = 1 / 304.8;
|
||||||
|
//发光字族类型
|
||||||
|
string glow_text_symbol;
|
||||||
|
//墙间距
|
||||||
|
double lamps_wall_distance = 900 / 304.8;
|
||||||
|
//灯间距
|
||||||
|
double lamps_interval = 900 / 304.8;
|
||||||
|
|
||||||
|
if (receptionAreaPlacement.DialogResult == true)
|
||||||
|
{
|
||||||
|
//铝塑板长度
|
||||||
|
aluminum_plastic_panel_length = receptionAreaPlacement.aluminump_lastic_panel_length / 304.8;
|
||||||
|
//铝塑板高度
|
||||||
|
aluminum_plastic_panel_height = receptionAreaPlacement.aluminump_lastic_panel_height / 304.8;
|
||||||
|
//分缝
|
||||||
|
gap = receptionAreaPlacement.aluminump_lastic_panel_gap / 304.8;
|
||||||
|
|
||||||
|
glow_text_symbol = receptionAreaPlacement.glow_text_symbol;
|
||||||
|
|
||||||
|
lamps_wall_distance = receptionAreaPlacement.lamp_wall_distance / 304.8;
|
||||||
|
lamps_interval = receptionAreaPlacement.lamps_interval / 304.8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
Level baselevel = uidoc.ActiveView.GenLevel;
|
||||||
|
Family family = null;
|
||||||
|
FamilySymbol symbol;
|
||||||
|
return doc.InvokeGroup<Result>(tg =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FamilySymbol linesymbol = RsRevitUtils.GetGuideSymbol(doc);
|
||||||
|
eleIdsAdded.Clear();
|
||||||
|
uiapp.Application.DocumentChanged += Application_DocumentChanged;
|
||||||
|
uidoc.PromptForFamilyInstancePlacement(linesymbol);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
//在此处无法取消订阅
|
||||||
|
//uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
var interval = gap + aluminum_plastic_panel_length;
|
||||||
|
if (eleIdsAdded.Count == 0)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
Line refer_line = RsRevitUtils.GetGuideGeometryAndDeleteGuide(doc, eleIdsAdded);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
|
||||||
|
double backgroundwall_length = refer_line.Length;
|
||||||
|
if (backgroundwall_length < 1500 / 304.8)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("温馨提示", "距离太接");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
List<ElementId> wallids = new List<ElementId>();
|
||||||
|
WallType base_layer_type = null;
|
||||||
|
base_layer_thickness = RsRevitUtils.GetWallWidthByWallTypeName(doc, "阻燃板", out base_layer_type);
|
||||||
|
|
||||||
|
WallType grey_emulsion_paint_type = null;
|
||||||
|
grey_emulsion_paint_width = RsRevitUtils.GetWallWidthByWallTypeName(doc, "灰色乳胶漆", out grey_emulsion_paint_type);
|
||||||
|
|
||||||
|
WallType aluminum_plastic_panel_type = null;
|
||||||
|
aluminum_plastic_panel_thickness = RsRevitUtils.GetWallWidthByWallTypeName(doc, "铝塑板", out aluminum_plastic_panel_type);
|
||||||
|
|
||||||
|
WallType Skirting_line_type = null;
|
||||||
|
Skirting_line_thickness = RsRevitUtils.GetWallWidthByWallTypeName(doc, "踢脚线", out Skirting_line_type);
|
||||||
|
//铝塑板块数
|
||||||
|
int n = (int)Math.Floor(refer_line.Length / interval);
|
||||||
|
double rem = refer_line.Length % (gap + aluminum_plastic_panel_length);
|
||||||
|
if (base_layer_type == null || aluminum_plastic_panel_type == null || Skirting_line_type == null || grey_emulsion_paint_type == null)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("温馨提示", "需要新建装饰所需的墙类型,类型名称需分别包含阻燃板,灰色乳胶漆,铝塑板,踢脚线");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
//长度不满足设置的铝塑板长度时
|
||||||
|
if (n == 0)
|
||||||
|
{
|
||||||
|
var offestline = refer_line.CreateOffset(aluminum_plastic_panel_thickness / 2 + base_layer_thickness, -XYZ.BasisZ);
|
||||||
|
var wall = Wall.Create(doc, offestline, aluminum_plastic_panel_type.Id, doc.ActiveView.GenLevel.Id, aluminum_plastic_panel_height, Skirting_line_height, false, false);
|
||||||
|
wallids.Add(wall.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n + 1; i++)
|
||||||
|
{
|
||||||
|
var startpoint = refer_line.Evaluate(i * interval, false);
|
||||||
|
var endpoint = refer_line.Evaluate(((i + 1) * interval) - gap, false);
|
||||||
|
|
||||||
|
if (i == n)
|
||||||
|
{
|
||||||
|
endpoint = refer_line.GetEndPoint(1);
|
||||||
|
}
|
||||||
|
Line line = Line.CreateBound(startpoint, endpoint);
|
||||||
|
var offestline = line.CreateOffset(aluminum_plastic_panel_thickness / 2 + base_layer_thickness, -XYZ.BasisZ);
|
||||||
|
var wall = Wall.Create(doc, offestline, aluminum_plastic_panel_type.Id, doc.ActiveView.GenLevel.Id, aluminum_plastic_panel_height, Skirting_line_height, false, false);
|
||||||
|
//不允许连接
|
||||||
|
WallUtils.DisallowWallJoinAtEnd(wall, 0);
|
||||||
|
//curves.Add()
|
||||||
|
wallids.Add(wall.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var skirting_offestline = refer_line.CreateOffset(Skirting_line_thickness / 2 + base_layer_thickness, -XYZ.BasisZ);
|
||||||
|
var skirtingwall = Wall.Create(doc, skirting_offestline, Skirting_line_type.Id, doc.ActiveView.GenLevel.Id, Skirting_line_height, 0, false, false);
|
||||||
|
wallids.Add(skirtingwall.Id);
|
||||||
|
|
||||||
|
var base_layer_offestline = refer_line.CreateOffset(base_layer_thickness / 2, -XYZ.BasisZ);
|
||||||
|
var baselayerwall = Wall.Create(doc, base_layer_offestline, base_layer_type.Id, doc.ActiveView.GenLevel.Id, UserConstant.Height / 304.8, 0, false, false);
|
||||||
|
wallids.Add(baselayerwall.Id);
|
||||||
|
//高度大于3000才有灰色乳胶漆
|
||||||
|
if (UserConstant.Height > 3000)
|
||||||
|
{
|
||||||
|
double baseheight = aluminum_plastic_panel_height + Skirting_line_height;
|
||||||
|
var grey_emulsion_paint_offestline = refer_line.CreateOffset(base_layer_thickness + grey_emulsion_paint_width / 2, -XYZ.BasisZ);
|
||||||
|
var greypaintwall = Wall.Create(doc, grey_emulsion_paint_offestline, grey_emulsion_paint_type.Id, doc.ActiveView.GenLevel.Id, UserConstant.Height / 304.8 - baseheight, baseheight, false, false);
|
||||||
|
wallids.Add(greypaintwall.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.Regenerate();
|
||||||
|
doc.Create.NewGroup(wallids);
|
||||||
|
}, "背景墙创建");
|
||||||
|
|
||||||
|
//SelectFilter<Wall> wallfilter = new SelectFilter<Wall>();
|
||||||
|
//var wallrefer = uidoc.Selection.PickObject(ObjectType.Element, wallfilter, "请选择作为背景墙的墙体");
|
||||||
|
//var wall = doc.GetElement(wallrefer) as Wall;
|
||||||
|
|
||||||
|
//WallFaceSelectionFilter selfilter = new WallFaceSelectionFilter(wall.Id);
|
||||||
|
//var facerefer = uidoc.Selection.PickObject(ObjectType.Face, selfilter, "请选择要装饰的墙面");
|
||||||
|
|
||||||
|
//PlanarFace pf = wall.GetGeometryObjectFromReference(facerefer) as PlanarFace;
|
||||||
|
|
||||||
|
//XYZ normal = pf.FaceNormal;
|
||||||
|
//XYZ p1 = uidoc.Selection.PickObject(ObjectType.PointOnElement, selfilter, "请选取背景墙左侧端点").GlobalPoint;
|
||||||
|
|
||||||
|
//XYZ p2 = uidoc.Selection.PickObject(ObjectType.PointOnElement, selfilter, "请选取背景墙右侧端点").GlobalPoint;
|
||||||
|
|
||||||
|
//XYZ p1 = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选取背景墙左侧端点");
|
||||||
|
//XYZ p2 = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选取背景墙右侧端点");
|
||||||
|
|
||||||
|
//两点的水平距离
|
||||||
|
|
||||||
|
//if (UserConstant.Height / 3 * 2 < 2200)
|
||||||
|
//{
|
||||||
|
// TaskDialog.Show("温馨提示", "层高设置有误");
|
||||||
|
// return Result.Cancelled;
|
||||||
|
//}
|
||||||
|
|
||||||
|
#region 菜鸟使命布置
|
||||||
|
|
||||||
|
FamilyInstance signage = null;
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Sign\\菜鸟使命.rfa");
|
||||||
|
ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
symbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||||
|
symbol.Activate();
|
||||||
|
|
||||||
|
//var x = family.FamilyPlacementType;
|
||||||
|
//signage = doc.Create.NewFamilyInstance(facerefer, p2 + new XYZ(0, 0, height + 100 / 304.8), symbol, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
|
||||||
|
var endpoint = refer_line.GetEndPoint(0);
|
||||||
|
|
||||||
|
endpoint += (Skirting_line_height + aluminum_plastic_panel_height) * XYZ.BasisZ;
|
||||||
|
signage = doc.Create.NewFamilyInstance(endpoint, symbol, StructuralType.NonStructural);
|
||||||
|
//标准面要朝上,族要面向背侧
|
||||||
|
|
||||||
|
//symbol.GetParameters("背景墙长度").FirstOrDefault().Set(distance);
|
||||||
|
}, "菜鸟的使命");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
//族的正面要超前
|
||||||
|
RsRevitUtils.AdjustInstance(doc, signage, refer_line, grey_emulsion_paint_width + base_layer_thickness);
|
||||||
|
}, "调整菜鸟使命");
|
||||||
|
|
||||||
|
#endregion 菜鸟使命布置
|
||||||
|
|
||||||
|
double reception_length = refer_line.Length / 3 * 2;
|
||||||
|
double reception_wall_distance = 1000 / 304.8;
|
||||||
|
FamilyInstance reception = null;
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Furniture\\寄件接待台.rfa");
|
||||||
|
ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
symbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||||
|
symbol.Activate();
|
||||||
|
var wall_center_point = refer_line.Evaluate(0.5, true);
|
||||||
|
|
||||||
|
reception = doc.Create.NewFamilyInstance(wall_center_point, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
|
||||||
|
symbol.GetParameters("台面长度").FirstOrDefault().Set(reception_length);
|
||||||
|
//symbol.GetParameters("台面长度").FirstOrDefault().AsDouble();
|
||||||
|
}, "接待台布置");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
RsRevitUtils.AdjustInstance(doc, reception, refer_line, reception_wall_distance);
|
||||||
|
}, "调整接待台");
|
||||||
|
|
||||||
|
FamilyInstance logo = null;
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Sign\\菜鸟LOGO.rfa");
|
||||||
|
ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault(id => doc.GetElement(id).Name == glow_text_symbol);
|
||||||
|
symbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||||
|
symbol.Activate();
|
||||||
|
var wall_center_point = refer_line.Evaluate(0.5, true);
|
||||||
|
|
||||||
|
logo = doc.Create.NewFamilyInstance(wall_center_point, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
|
||||||
|
//symbol.GetParameters("背景墙长度").FirstOrDefault().Set(reception_length);
|
||||||
|
//width = symbol.GetParameters("台面宽度").FirstOrDefault().AsDouble();
|
||||||
|
}, "菜鸟LOG布置");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
RsRevitUtils.AdjustInstance(doc, logo, refer_line, aluminum_plastic_panel_thickness + base_layer_thickness);
|
||||||
|
}, "调整lOGO");
|
||||||
|
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Lamp\\圆形吊灯.rfa");
|
||||||
|
ElementId symbolId = family.GetFamilySymbolIds().FirstOrDefault();
|
||||||
|
symbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||||
|
symbol.Activate();
|
||||||
|
var normal_direction = refer_line.Direction;
|
||||||
|
List<XYZ> lamp_location_points = new List<XYZ>();
|
||||||
|
var lamps_location_line = refer_line.CreateOffset(lamps_wall_distance, -XYZ.BasisZ);
|
||||||
|
var center_point = lamps_location_line.Evaluate(0.5, true);
|
||||||
|
n = (int)Math.Floor(backgroundwall_length / lamps_interval);
|
||||||
|
//单侧的数量
|
||||||
|
int m = (int)Math.Floor((n + 1.0) / 2);
|
||||||
|
if ((n + 1) % 2 == 0)
|
||||||
|
{
|
||||||
|
//开始间隔为0.5
|
||||||
|
for (int i = 0; i < m; i++)
|
||||||
|
{
|
||||||
|
XYZ p = center_point.Add(normal_direction * (i + 0.5) * lamps_interval);
|
||||||
|
XYZ reversep = center_point.Add(-normal_direction * (i + 0.5) * lamps_interval);
|
||||||
|
|
||||||
|
lamp_location_points.Add(p);
|
||||||
|
lamp_location_points.Add(reversep);
|
||||||
|
}
|
||||||
|
foreach (XYZ p in lamp_location_points)
|
||||||
|
{
|
||||||
|
doc.Create.NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lamp_location_points.Add(center_point);
|
||||||
|
//i=0时居中,不在单侧,开始间隔为1
|
||||||
|
for (int i = 0; i < m; i++)
|
||||||
|
{
|
||||||
|
XYZ p = center_point.Add(normal_direction * (i + 1) * lamps_interval);
|
||||||
|
XYZ reversep = center_point.Add(-normal_direction * (i + 1) * lamps_interval);
|
||||||
|
lamp_location_points.Add(p);
|
||||||
|
lamp_location_points.Add(reversep);
|
||||||
|
}
|
||||||
|
foreach (XYZ p in lamp_location_points)
|
||||||
|
{
|
||||||
|
doc.Create.NewFamilyInstance(p, symbol, baselevel, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "吊灯布置");
|
||||||
|
|
||||||
|
//doc.Invoke(ts =>
|
||||||
|
//{
|
||||||
|
// if (backgroundwall.CanFlipFacing && backgroundwall.CanFlipHand && !backgroundwall.FacingOrientation.IsAlmostEqualTo(normal))
|
||||||
|
// {
|
||||||
|
// backgroundwall.flipFacing();
|
||||||
|
// backgroundwall.flipHand();
|
||||||
|
// }
|
||||||
|
// if (frontdesk.CanFlipFacing && backgroundwall.CanFlipHand && !frontdesk.FacingOrientation.IsAlmostEqualTo(normal))
|
||||||
|
// {
|
||||||
|
// frontdesk.flipFacing();
|
||||||
|
// frontdesk.flipHand();
|
||||||
|
// }
|
||||||
|
//}, "调整");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.Succeeded;
|
||||||
|
}, "前台布置");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Application_DocumentChanged(object sender, DocumentChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ICollection<ElementId> idsAdded = e.GetAddedElementIds();
|
||||||
|
int n = idsAdded.Count;
|
||||||
|
eleIdsAdded.AddRange(idsAdded);
|
||||||
|
if (PlaceSingleInstanceAbort && n == 1)
|
||||||
|
{
|
||||||
|
//KeyPress.OneKey(revitWindow, (char)System.Windows.Forms.Keys.Escape);
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Face GetPlaceFaceOfWall(Wall wall, XYZ normal)
|
||||||
|
{
|
||||||
|
Face face = null;
|
||||||
|
Options geomOptions = new Options();
|
||||||
|
geomOptions.ComputeReferences = true;
|
||||||
|
GeometryElement wallGeom = wall.get_Geometry(geomOptions);
|
||||||
|
|
||||||
|
foreach (GeometryObject geomObj in wallGeom)
|
||||||
|
{
|
||||||
|
Solid geomSolid = geomObj as Solid;
|
||||||
|
if (null != geomSolid)
|
||||||
|
{
|
||||||
|
foreach (Face geomFace in geomSolid.Faces)
|
||||||
|
{
|
||||||
|
if (geomFace.ComputeNormal(geomFace.Reference.UVPoint).IsAlmostEqualTo(normal))
|
||||||
|
{
|
||||||
|
face = geomFace;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Reference GetWallSideFaceReference(Wall wall, XYZ normal)
|
||||||
|
{
|
||||||
|
var facerefer = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Interior).FirstOrDefault();
|
||||||
|
var facerefer1 = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior).FirstOrDefault();
|
||||||
|
|
||||||
|
PlanarFace pf = wall.GetGeometryObjectFromReference(facerefer) as PlanarFace;
|
||||||
|
if (pf.FaceNormal.IsAlmostEqualTo(normal))
|
||||||
|
{
|
||||||
|
return facerefer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return facerefer1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WallFaceSelectionFilter : ISelectionFilter
|
||||||
|
{
|
||||||
|
private ElementId eid = null;
|
||||||
|
|
||||||
|
public WallFaceSelectionFilter(ElementId elementId)
|
||||||
|
{
|
||||||
|
eid = elementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AllowElement(Element element)
|
||||||
|
{
|
||||||
|
return element is Wall && eid == element.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AllowReference(Reference refer, XYZ point)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
560
RookieStation/CmdPlaceShelves.cs
Normal file
@@ -0,0 +1,560 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.DB.Architecture;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||||
|
|
||||||
|
namespace RookieStation.PackAreaModule
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceShelves : IExternalCommand
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 当前编号
|
||||||
|
/// </summary>
|
||||||
|
private int currentnum = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选择一次后停止
|
||||||
|
/// </summary>
|
||||||
|
//private static bool PlaceSingleInstanceAbort = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// revit窗口句柄
|
||||||
|
/// </summary>
|
||||||
|
private IntPtr revitWindow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加的元素
|
||||||
|
/// </summary>
|
||||||
|
private List<ElementId> eleIdsAdded = new List<ElementId>();
|
||||||
|
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
revitWindow = uiapp.MainWindowHandle;
|
||||||
|
WpfShelvesLayout placement = CommonUtils.GenerateWindow<WpfShelvesLayout>();
|
||||||
|
|
||||||
|
if (placement.DialogResult != true)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
ShelvesPlacementViewModel vm = placement.vm;
|
||||||
|
ObservableCollection<Shelf> shelves = vm.Data;
|
||||||
|
|
||||||
|
Level level = uidoc.ActiveView.GenLevel;
|
||||||
|
|
||||||
|
return doc.InvokeGroup<Result>(tg =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//定位线
|
||||||
|
FamilySymbol guide_Symbol = RsRevitUtils.GetGuideSymbol(doc);
|
||||||
|
|
||||||
|
eleIdsAdded.Clear();
|
||||||
|
uiapp.Application.DocumentChanged += Application_DocumentChanged;
|
||||||
|
uidoc.PromptForFamilyInstancePlacement(guide_Symbol);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
if (eleIdsAdded.Count == 0)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
Line refer_line = RsRevitUtils.GetGuideGeometryAndDeleteGuide(doc, eleIdsAdded);
|
||||||
|
uiapp.Application.DocumentChanged -= Application_DocumentChanged;
|
||||||
|
//始终位于左侧,Z轴朝上
|
||||||
|
var zaxis = XYZ.BasisZ;
|
||||||
|
Family shelf_family = null;
|
||||||
|
FamilySymbol shelf_symbol = null;
|
||||||
|
double shelf_spacing = vm.Spacing / 304.8;
|
||||||
|
//通道宽度
|
||||||
|
double passage_width = vm.PassageWidth / 304.8;
|
||||||
|
double parallel_referline_offest = vm.ParalelReferOffest / 304.8;
|
||||||
|
double vertical_referline_offest = vm.VerticalReferOffest / 304.8;
|
||||||
|
|
||||||
|
for (int i = 0; i < shelves.Count; i++)
|
||||||
|
{
|
||||||
|
//List<XYZ> all_points = new List<XYZ>();
|
||||||
|
List<XYZ> first_row_points = new List<XYZ>();
|
||||||
|
Shelf shelf = shelves[i];
|
||||||
|
double shelf_width = shelf.Width / 304.8;
|
||||||
|
double line_parameter = 0.0;
|
||||||
|
int n = 100;//循环次数
|
||||||
|
XYZ p = XYZ.Zero;
|
||||||
|
|
||||||
|
if (parallel_referline_offest < 0.001)//起点无间距
|
||||||
|
{
|
||||||
|
for (int j = 0; j < n; j++)
|
||||||
|
{
|
||||||
|
if (!refer_line.IsInside((line_parameter + shelf_width)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j % 2 == 0)
|
||||||
|
{
|
||||||
|
p = refer_line.Evaluate(line_parameter, false);
|
||||||
|
line_parameter += shelf_spacing + shelf_width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p = refer_line.Evaluate(line_parameter, false);
|
||||||
|
line_parameter += shelf_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
first_row_points.Add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else//起点有距离
|
||||||
|
{
|
||||||
|
line_parameter = parallel_referline_offest;
|
||||||
|
|
||||||
|
for (int j = 0; j < n; j++)
|
||||||
|
{
|
||||||
|
if (!refer_line.IsInside(line_parameter + shelf_width))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (j % 2 == 0)
|
||||||
|
{
|
||||||
|
p = refer_line.Evaluate(line_parameter, false);
|
||||||
|
line_parameter += shelf_width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p = refer_line.Evaluate(line_parameter, false);
|
||||||
|
line_parameter += shelf_spacing + shelf_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
first_row_points.Add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double l = shelf.Length / 304.8;
|
||||||
|
XYZ normal_vertical_offest_vector = zaxis.CrossProduct(refer_line.Direction).Normalize();
|
||||||
|
List<FamilyInstance> instances = new List<FamilyInstance>();
|
||||||
|
|
||||||
|
XYZ final_point = XYZ.Zero;
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
shelf_family = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Shelf\\单联货架.rfa");
|
||||||
|
var shelf_symbol_ids = shelf_family.GetFamilySymbolIds();
|
||||||
|
foreach (var id in shelf_symbol_ids)
|
||||||
|
{
|
||||||
|
FamilySymbol temp_symbol = doc.GetElement(id) as FamilySymbol;
|
||||||
|
if (temp_symbol.Name == shelf.SymbolName)
|
||||||
|
{
|
||||||
|
shelf_symbol = temp_symbol;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shelf_symbol.Activate();
|
||||||
|
}, "加载货架,激活类型");
|
||||||
|
|
||||||
|
switch (shelf.NumOfGroup)
|
||||||
|
{
|
||||||
|
case NumOfGroup.Single:
|
||||||
|
|
||||||
|
for (int j = 0; j < first_row_points.Count; j++)
|
||||||
|
{
|
||||||
|
XYZ pt = first_row_points[j];
|
||||||
|
XYZ offest_direction = normal_vertical_offest_vector * (vertical_referline_offest + l / 2);
|
||||||
|
//垂直基准线平移 平行基准线平移
|
||||||
|
final_point = pt + offest_direction + refer_line.Direction * shelf_width / 2;
|
||||||
|
//附加通道和(单联、多联)货架长度的偏移
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
double total_length = GetTotalLength(shelves, i);
|
||||||
|
//附加排在前面通道和所有货架的长度
|
||||||
|
XYZ additional_dir = normal_vertical_offest_vector * (i * passage_width + total_length);
|
||||||
|
final_point += additional_dir;
|
||||||
|
}
|
||||||
|
FamilyInstance instance = null;
|
||||||
|
//all_points.Add(final_point);
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
instance = doc.Create.NewFamilyInstance(final_point, shelf_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(instance);
|
||||||
|
}, "创建货架");
|
||||||
|
|
||||||
|
//位于直线右侧时,需要进行左右翻转
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
if (parallel_referline_offest < 0.001)
|
||||||
|
{
|
||||||
|
if (j % 2 != 0 && instance.CanFlipHand)
|
||||||
|
{
|
||||||
|
instance.flipHand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (j % 2 == 0 && instance.CanFlipHand)
|
||||||
|
{
|
||||||
|
instance.flipHand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "翻转货架");
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NumOfGroup.Double:
|
||||||
|
|
||||||
|
for (int j = 0; j < first_row_points.Count; j++)
|
||||||
|
{
|
||||||
|
XYZ pt = first_row_points[j];
|
||||||
|
//偏移距离
|
||||||
|
XYZ offest_direction = normal_vertical_offest_vector * (vertical_referline_offest + l);
|
||||||
|
//基础偏移距离,移动半个长度到直线的一侧,垂直基准线平移 平行基准线平移
|
||||||
|
final_point = pt + offest_direction + refer_line.Direction * shelf_width / 2;
|
||||||
|
//附加通道和(单联、多联)货架长度的偏移
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
double totallength = GetTotalLength(shelves, i);
|
||||||
|
|
||||||
|
XYZ additionaldir = normal_vertical_offest_vector * (i * passage_width + totallength);
|
||||||
|
final_point += additionaldir;
|
||||||
|
}
|
||||||
|
FamilyInstance end_instance = null;
|
||||||
|
FamilyInstance start_instance = null;
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
end_instance = doc.Create.NewFamilyInstance(final_point + l / 2 * normal_vertical_offest_vector, shelf_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
|
||||||
|
start_instance = doc.Create.NewFamilyInstance(final_point - l / 2 * normal_vertical_offest_vector, shelf_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
|
||||||
|
instances.Add(start_instance);
|
||||||
|
|
||||||
|
instances.Add(end_instance);
|
||||||
|
}, "创建货架");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
if (parallel_referline_offest < 0.001)
|
||||||
|
{
|
||||||
|
if (j % 2 != 0 && start_instance.CanFlipHand && end_instance.CanFlipHand)
|
||||||
|
{
|
||||||
|
start_instance.flipHand();
|
||||||
|
end_instance.flipHand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (j % 2 == 0 && start_instance.CanFlipHand && end_instance.CanFlipHand)
|
||||||
|
{
|
||||||
|
start_instance.flipHand();
|
||||||
|
end_instance.flipHand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "翻转货架");
|
||||||
|
|
||||||
|
//all_points.Add(final_point + l / 2 * normal_vertical_offest_vector);
|
||||||
|
//all_points.Add(final_point - l / 2 * normal_vertical_offest_vector);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NumOfGroup.Three:
|
||||||
|
|
||||||
|
for (int j = 0; j < first_row_points.Count; j++)
|
||||||
|
{
|
||||||
|
XYZ pt = first_row_points[j];
|
||||||
|
XYZ offestdir = normal_vertical_offest_vector * (vertical_referline_offest + l * 3 / 2);
|
||||||
|
//垂直基准线平移 平行基准线平移
|
||||||
|
final_point = pt + offestdir + refer_line.Direction * shelf_width / 2;
|
||||||
|
//附加通道和(单联、多联)货架长度的偏移
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
double totallength = GetTotalLength(shelves, i);
|
||||||
|
XYZ additionaldir = normal_vertical_offest_vector * (i * passage_width + totallength);
|
||||||
|
final_point += additionaldir;
|
||||||
|
}
|
||||||
|
FamilyInstance end_instance = null;
|
||||||
|
FamilyInstance center_instance = null;
|
||||||
|
FamilyInstance start_instance = null;
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
center_instance = doc.Create.NewFamilyInstance(final_point, shelf_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
end_instance = doc.Create.NewFamilyInstance(final_point + l * normal_vertical_offest_vector, shelf_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
start_instance = doc.Create.NewFamilyInstance(final_point - l * normal_vertical_offest_vector, shelf_symbol, level, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
|
||||||
|
instances.Add(center_instance);
|
||||||
|
instances.Add(end_instance);
|
||||||
|
instances.Add(start_instance);
|
||||||
|
}, "创建货架");
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
if (parallel_referline_offest < 0.001)
|
||||||
|
{
|
||||||
|
if (j % 2 != 0 && start_instance.CanFlipHand && center_instance.CanFlipHand && end_instance.CanFlipHand)
|
||||||
|
{
|
||||||
|
start_instance.flipHand();
|
||||||
|
center_instance.flipHand();
|
||||||
|
end_instance.flipHand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (j % 2 == 0 && start_instance.CanFlipHand && center_instance.CanFlipHand && end_instance.CanFlipHand)
|
||||||
|
{
|
||||||
|
start_instance.flipHand();
|
||||||
|
center_instance.flipHand();
|
||||||
|
end_instance.flipHand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "翻转货架");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<FamilyInstance> card_instances = new List<FamilyInstance>();
|
||||||
|
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
XYZ veroffestdir = zaxis.CrossProduct(refer_line.Direction).Normalize();
|
||||||
|
//旋转角度
|
||||||
|
double angle = XYZ.BasisY.AngleTo(veroffestdir);
|
||||||
|
//判断相对于Y轴是正向角度(逆时针)还是逆向角度(顺时针)
|
||||||
|
var z = veroffestdir.CrossProduct(XYZ.BasisY).Normalize();
|
||||||
|
if (z.IsAlmostEqualTo(XYZ.BasisZ))
|
||||||
|
{
|
||||||
|
//逆向旋转,角度取负值
|
||||||
|
angle = -angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < instances.Count; j++)
|
||||||
|
{
|
||||||
|
FamilyInstance instance = instances[j];
|
||||||
|
var location_XYZ = RsRevitUtils.GetXYZByElement(instance);
|
||||||
|
|
||||||
|
Line zline = Line.CreateUnbound(location_XYZ, XYZ.BasisZ);
|
||||||
|
//旋转,移动
|
||||||
|
ElementTransformUtils.RotateElement(doc, instance.Id, zline, angle);
|
||||||
|
//旋转后的
|
||||||
|
var hand_orientationd = instance.HandOrientation;
|
||||||
|
//货架左右切换时
|
||||||
|
if (instance.HandFlipped)
|
||||||
|
{
|
||||||
|
hand_orientationd = -hand_orientationd;
|
||||||
|
}
|
||||||
|
////垂直基准线平移
|
||||||
|
//ElementTransformUtils.MoveElement(doc, fi.Id, offestdir);
|
||||||
|
|
||||||
|
////平行基准线平移
|
||||||
|
//ElementTransformUtils.MoveElement(doc, fi.Id, line.Direction * w / 2);
|
||||||
|
//if (i >= 1)
|
||||||
|
//{
|
||||||
|
// XYZ additionaldir = zdir.CrossProduct(line.Direction).Normalize() * i * (passagewidth + l);
|
||||||
|
// ElementTransformUtils.MoveElement(doc, fi.Id, additionaldir);
|
||||||
|
//}
|
||||||
|
|
||||||
|
#region 布置端牌
|
||||||
|
|
||||||
|
FamilyInstance front_instance = null;
|
||||||
|
|
||||||
|
Reference front_face = instance.GetReferences(FamilyInstanceReferenceType.Front).FirstOrDefault();
|
||||||
|
PlaceCard(doc, location_XYZ, instance, hand_orientationd, front_face, out front_instance);
|
||||||
|
if (front_instance.CanFlipWorkPlane)
|
||||||
|
{
|
||||||
|
front_instance.IsWorkPlaneFlipped = true;
|
||||||
|
}
|
||||||
|
card_instances.Add(front_instance);
|
||||||
|
|
||||||
|
FamilyInstance back_instance = null;
|
||||||
|
|
||||||
|
Reference back_face = instance.GetReferences(FamilyInstanceReferenceType.Back).FirstOrDefault();
|
||||||
|
|
||||||
|
PlaceCard(doc, location_XYZ, instance, -hand_orientationd, back_face, out back_instance);
|
||||||
|
card_instances.Add(back_instance);
|
||||||
|
switch (shelf.NumOfGroup)
|
||||||
|
{
|
||||||
|
case NumOfGroup.Single:
|
||||||
|
|
||||||
|
front_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}", currentnum));
|
||||||
|
back_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}", currentnum));
|
||||||
|
currentnum += 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NumOfGroup.Double:
|
||||||
|
//根据组合加上组合数
|
||||||
|
if (j % 2 == 0 && j != 0)
|
||||||
|
{
|
||||||
|
currentnum += 2;
|
||||||
|
}
|
||||||
|
front_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}{1}{2}", currentnum, "~", currentnum + 1));
|
||||||
|
back_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}{1}{2}", currentnum, "~", currentnum + 1));
|
||||||
|
//最后一个需要加上组合数作为下一列的开始
|
||||||
|
if (j == instances.Count - 1)
|
||||||
|
{
|
||||||
|
currentnum += 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NumOfGroup.Three:
|
||||||
|
//根据组合加上组合数
|
||||||
|
if (j % 3 == 0 && j != 0)
|
||||||
|
{
|
||||||
|
currentnum += 3;
|
||||||
|
}
|
||||||
|
front_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}{1}{2}", currentnum, "~", currentnum + 2));
|
||||||
|
back_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}{1}{2}", currentnum, "~", currentnum + 2));
|
||||||
|
//最后一个需要加上组合数作为下一列的开始
|
||||||
|
if (j == instances.Count - 1)
|
||||||
|
{
|
||||||
|
currentnum += 3;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion 布置端牌
|
||||||
|
|
||||||
|
//Reference backface = fi.GetReferences(FamilyInstanceReferenceType.Back).FirstOrDefault();
|
||||||
|
//if (a.Contains("606:SURFACE"))
|
||||||
|
//{
|
||||||
|
// hand = -fi.HandOrientation;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}, "调整货架角度及布置端牌");
|
||||||
|
|
||||||
|
DeleteCards(doc, card_instances);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.Succeeded;
|
||||||
|
}, "布置货架及端牌");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除多余端牌
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="doc"></param>
|
||||||
|
/// <param name="card_instances"></param>
|
||||||
|
private void DeleteCards(Document doc, List<FamilyInstance> card_instances)
|
||||||
|
{
|
||||||
|
using (Transaction ts = new Transaction(doc, "删除多余端牌"))
|
||||||
|
{
|
||||||
|
ts.Start();
|
||||||
|
List<ElementId> ids_delete = new List<ElementId>();
|
||||||
|
|
||||||
|
foreach (var ins in card_instances)
|
||||||
|
{
|
||||||
|
var lp = RsRevitUtils.GetXYZByElement(ins);
|
||||||
|
foreach (var card in card_instances)
|
||||||
|
{
|
||||||
|
var lpt = RsRevitUtils.GetXYZByElement(card);
|
||||||
|
if (!card.Id.Equals(ins.Id) && lp.IsAlmostEqualTo(lpt))
|
||||||
|
{
|
||||||
|
ids_delete.Add(ins.Id);
|
||||||
|
ids_delete.Add(card.Id);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doc.Delete(ids_delete);
|
||||||
|
|
||||||
|
ts.Commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Application_DocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ICollection<ElementId> idsAdded = e.GetAddedElementIds();
|
||||||
|
int n = idsAdded.Count;
|
||||||
|
//List<Element> eles = new List<Element>();
|
||||||
|
//foreach (var id in idsAdded)
|
||||||
|
//{
|
||||||
|
// eles.Add(e.GetDocument().GetElement(id));
|
||||||
|
//}
|
||||||
|
eleIdsAdded.AddRange(idsAdded);
|
||||||
|
//if (PlaceSingleInstanceAbort && n == 1)
|
||||||
|
if (n == 1)
|
||||||
|
{
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
KeyPress.PostMessage(revitWindow, (uint)KeyPress.KEYBOARD_MSG.WM_KEYDOWN, (uint)System.Windows.Forms.Keys.Escape, 0);
|
||||||
|
//KeyPress.OneKey(revitWindow, (char)System.Windows.Forms.Keys.Escape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 布置端牌
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="doc"></param>
|
||||||
|
/// <param name="p"></param>
|
||||||
|
/// <param name="fi"></param>
|
||||||
|
/// <param name="handOrientation">左右方向</param>
|
||||||
|
/// <param name="facereference"></param>
|
||||||
|
/// <param name="card_instance"></param>
|
||||||
|
private void PlaceCard(Document doc, XYZ p, FamilyInstance fi, XYZ handOrientation, Reference facereference, out FamilyInstance card_instance)
|
||||||
|
{
|
||||||
|
var shelfwidth = fi.Symbol.GetParameters("宽度").FirstOrDefault().AsDouble();
|
||||||
|
|
||||||
|
Family card = RsRevitUtils.GetLoadedFamily(doc, UserConstant.LibraryPreDirectory + "Shelf\\货架端牌.rfa");
|
||||||
|
var cardsymbolIds = card.GetFamilySymbolIds();
|
||||||
|
|
||||||
|
FamilySymbol cardsymbol = null;
|
||||||
|
foreach (ElementId syid in cardsymbolIds)
|
||||||
|
{
|
||||||
|
var sy = doc.GetElement(syid) as FamilySymbol;
|
||||||
|
var cardwidth = sy.GetParameters("宽度").FirstOrDefault().AsDouble();
|
||||||
|
if (cardwidth == shelfwidth)
|
||||||
|
{
|
||||||
|
cardsymbol = sy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!cardsymbol.IsActive)
|
||||||
|
{
|
||||||
|
cardsymbol.Activate();
|
||||||
|
}
|
||||||
|
card_instance = doc.Create.NewFamilyInstance(facereference, p, handOrientation, cardsymbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取该行之前的所有货架长度总和(英制)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shelves"></param>
|
||||||
|
/// <param name="i">行数大于1即i>0</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private double GetTotalLength(ObservableCollection<Shelf> shelves, int i)
|
||||||
|
{
|
||||||
|
double totallength = 0.0;
|
||||||
|
for (int j = 0; j < i; j++)
|
||||||
|
{
|
||||||
|
switch (shelves[j].NumOfGroup)
|
||||||
|
{
|
||||||
|
case NumOfGroup.Single:
|
||||||
|
totallength += shelves[j].Length;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NumOfGroup.Double:
|
||||||
|
totallength += shelves[j].Length * 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NumOfGroup.Three:
|
||||||
|
totallength += shelves[j].Length * 3;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return totallength / 304.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
168
RookieStation/CmdPlaceWallFinishes.cs
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.DB.Architecture;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.ConstrainedExecution;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media.Effects;
|
||||||
|
|
||||||
|
namespace RookieStation.CommonTools
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdPlaceWallFinishes : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
|
||||||
|
Document doc = uidoc.Document;
|
||||||
|
|
||||||
|
List<Room> rooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).Cast<Room>().ToList();
|
||||||
|
if (rooms.Count == 0)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("温馨提示", "项目中当前没有房间");
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
ElementCategoryFilter ecf = new ElementCategoryFilter(BuiltInCategory.OST_Walls);
|
||||||
|
ElementCategoryFilter ecf1 = new ElementCategoryFilter(BuiltInCategory.OST_StackedWalls);
|
||||||
|
LogicalOrFilter lof = new LogicalOrFilter(ecf, ecf1);
|
||||||
|
var walltypes = new FilteredElementCollector(doc).WherePasses(lof).WhereElementIsElementType().Cast<WallType>().ToList();
|
||||||
|
WpfWallFinishes finishes = null;
|
||||||
|
|
||||||
|
string addin_path = typeof(RsApp).Assembly.Location;
|
||||||
|
string assembly_directory = System.IO.Path.GetDirectoryName(addin_path);
|
||||||
|
AssemblyLoader loader = new AssemblyLoader(assembly_directory);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
loader.HookAssemblyResolve();
|
||||||
|
|
||||||
|
finishes = new WpfWallFinishes(walltypes);
|
||||||
|
System.Windows.Interop.WindowInteropHelper mainUI = new System.Windows.Interop.WindowInteropHelper(finishes)
|
||||||
|
{
|
||||||
|
Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle
|
||||||
|
};
|
||||||
|
finishes.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TaskDialog.Show("错误", ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
loader.UnhookAssemblyResolve();
|
||||||
|
}
|
||||||
|
if (finishes.DialogResult != true)
|
||||||
|
{
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
WallType walltype = finishes.WallType;
|
||||||
|
bool iscontinue = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (iscontinue)
|
||||||
|
{
|
||||||
|
Reference refer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Room>(), "请选择布置的房间");
|
||||||
|
//walltype包含了叠层墙和基本墙,属于不同族,如果出现名称一样,则会过滤出来两个
|
||||||
|
//var walltypes = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).OfClass(typeof(WallType)).WhereElementIsElementType();
|
||||||
|
|
||||||
|
//var walls = new FilteredElementCollector(doc).OfClass(typeof(Wall));
|
||||||
|
//var walltype = walltypes.Where(x => x.Name == "常规 - 200mm").FirstOrDefault() as WallType;
|
||||||
|
|
||||||
|
Room room = uidoc.Document.GetElement(refer) as Room;
|
||||||
|
List<CurveLoop> curveLoopList = new List<CurveLoop>();
|
||||||
|
List<ElementId> walltojoin = new List<ElementId>();
|
||||||
|
List<List<ElementId>> walltojoinlist = new List<List<ElementId>>();
|
||||||
|
var opts = new SpatialElementBoundaryOptions();
|
||||||
|
//{
|
||||||
|
// SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish
|
||||||
|
//};
|
||||||
|
double wallwidth = walltype.Width;
|
||||||
|
double wallheight = finishes.WallHeight;
|
||||||
|
//BuiltInCategory builtInCategory = (BuiltInCategory)walltype.Category.Id.IntegerValue;
|
||||||
|
//if (walltype.Kind == WallKind.Stacked)
|
||||||
|
//{
|
||||||
|
// var li = walltype.GetSubelements();
|
||||||
|
// walltype.get
|
||||||
|
//}
|
||||||
|
//if (walltype.Kind == WallKind.Basic)
|
||||||
|
//{
|
||||||
|
// var compounds = walltype.GetCompoundStructure();
|
||||||
|
// for (int i = 0; i < compounds.LayerCount; i++)
|
||||||
|
// {
|
||||||
|
// offest += compounds.GetWidth();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
var segementsList = room.GetBoundarySegments(opts);
|
||||||
|
|
||||||
|
if (segementsList != null)
|
||||||
|
{
|
||||||
|
foreach (var boundarySegments in segementsList)
|
||||||
|
{
|
||||||
|
CurveLoop curveLoop = new CurveLoop();
|
||||||
|
foreach (var boundarySegment in boundarySegments)
|
||||||
|
{
|
||||||
|
curveLoop.Append(boundarySegment.GetCurve());
|
||||||
|
walltojoin.Add(boundarySegment.ElementId);
|
||||||
|
}
|
||||||
|
walltojoinlist.Add(walltojoin);
|
||||||
|
curveLoopList.Add(curveLoop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.Invoke(ts =>
|
||||||
|
{
|
||||||
|
Plane plane = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ());
|
||||||
|
//var mc = doc.Create.NewModelCurveArray(array, SketchPlane.Create(doc, plane));
|
||||||
|
for (int i = 0; i < curveLoopList.Count; i++)
|
||||||
|
{
|
||||||
|
//切线方向叉乘参数中的向量,内侧叉乘-z
|
||||||
|
var offestcurveloop = CurveLoop.CreateViaOffset(curveLoopList[i], wallwidth / 2, -XYZ.BasisZ);
|
||||||
|
for (int j = 0; j < offestcurveloop.Count(); j++)
|
||||||
|
{
|
||||||
|
Curve curve = offestcurveloop.ElementAt(j);
|
||||||
|
////c的方向叉乘参数中的向量,内侧叉乘-z
|
||||||
|
//var lc = c.CreateOffset(100 / 304.8, -XYZ.BasisZ);
|
||||||
|
|
||||||
|
//var x = curve.ComputeDerivatives(0.5, true).BasisX.CrossProduct(-XYZ.BasisZ).Normalize() * 100 / 304.8;
|
||||||
|
//var mc = doc.Create.NewModelCurve(lc, SketchPlane.Create(doc, plane));
|
||||||
|
//var mc = doc.Create.NewModelCurve(c, SketchPlane.Create(doc, plane));
|
||||||
|
var w = Wall.Create(doc, curve, walltype.Id, doc.ActiveView.GenLevel.Id, wallheight / 304.8, 0 / 304.8, false, false);
|
||||||
|
w.get_Parameter(BuiltInParameter.WALL_ATTR_ROOM_BOUNDING).Set(0);
|
||||||
|
doc.Regenerate();
|
||||||
|
//让门窗可以剪切出来
|
||||||
|
if (walltojoinlist[i][j].IntegerValue > 0)
|
||||||
|
{
|
||||||
|
Element elemtojoin = doc.GetElement(walltojoinlist[i][j]);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
JoinGeometryUtils.JoinGeometry(doc, elemtojoin, w);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//WallUtils.AllowWallJoinAtEnd(w, 0);
|
||||||
|
//offestcurves.Add(lc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "创建墙饰面");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||||
|
{
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
RookieStation/CmdProjectSettings.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Autodesk.Revit.DB;
|
||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||||
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||||
|
internal class CmdProjectSettings : IExternalCommand
|
||||||
|
{
|
||||||
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||||
|
{
|
||||||
|
UIApplication uiapp = commandData.Application;
|
||||||
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||||
|
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
|
||||||
|
string AddInPath = typeof(CmdProjectSettings).Assembly.Location;
|
||||||
|
string dirAssembly = Path.GetDirectoryName(AddInPath);
|
||||||
|
AssemblyLoader loader = new AssemblyLoader(dirAssembly);
|
||||||
|
WpfProjectSettings settings = CommonUtils.GenerateWindow<WpfProjectSettings>();
|
||||||
|
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
RookieStation/Custom/Enum.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
public enum NumOfGroup
|
||||||
|
{
|
||||||
|
[Description("单个")]
|
||||||
|
Single = 0,
|
||||||
|
|
||||||
|
[Description("双联")]
|
||||||
|
Double = 1,
|
||||||
|
|
||||||
|
[Description("三联")]
|
||||||
|
Three = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum LengthType
|
||||||
|
{
|
||||||
|
[Description("1000")]
|
||||||
|
x1000 = 1,
|
||||||
|
|
||||||
|
[Description("1200")]
|
||||||
|
x1200 = 2,
|
||||||
|
|
||||||
|
[Description("1500")]
|
||||||
|
x1500 = 3,
|
||||||
|
|
||||||
|
[Description("2000")]
|
||||||
|
x2000 = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WidthType
|
||||||
|
{
|
||||||
|
[Description("400")]
|
||||||
|
x400 = 1,
|
||||||
|
|
||||||
|
[Description("500")]
|
||||||
|
x500 = 2,
|
||||||
|
|
||||||
|
[Description("600")]
|
||||||
|
x600 = 3,
|
||||||
|
}
|
||||||
|
}
|
||||||
40
RookieStation/Custom/Shelf.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
public class Shelf
|
||||||
|
{
|
||||||
|
//public bool IsSelected { get; set; }
|
||||||
|
public LengthType LengthType { get; set; }
|
||||||
|
|
||||||
|
public WidthType WidthType { get; set; }
|
||||||
|
public NumOfGroup NumOfGroup { get; set; }
|
||||||
|
//public int StartNumber { get; set; }
|
||||||
|
//public int EndNumber { get; set; }
|
||||||
|
|
||||||
|
public double Length
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string strlength = CommonUtils.GetEnumDescription(LengthType);
|
||||||
|
return Convert.ToDouble(strlength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Width
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string strwidth = CommonUtils.GetEnumDescription(WidthType);
|
||||||
|
return Convert.ToDouble(strwidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SymbolName => String.Format("{0}{1}{2}{3}", CommonUtils.GetEnumDescription(LengthType), "mmx", CommonUtils.GetEnumDescription(WidthType), "mm");
|
||||||
|
}
|
||||||
|
}
|
||||||
56
RookieStation/Custom/UserConstant.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using Autodesk.Revit.UI.Selection;
|
||||||
|
using RookieStation.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
internal static class UserConstant
|
||||||
|
{
|
||||||
|
private static string AddinPath = typeof(RsApp).Assembly.Location;
|
||||||
|
|
||||||
|
public static string AddinDirectory => System.IO.Path.GetDirectoryName(AddinPath);
|
||||||
|
|
||||||
|
internal static string LibraryPreDirectory => AddinDirectory + "\\RsLibrary\\";
|
||||||
|
|
||||||
|
internal static ObjectSnapTypes SnapAll =>
|
||||||
|
ObjectSnapTypes.Intersections
|
||||||
|
| ObjectSnapTypes.Endpoints
|
||||||
|
| ObjectSnapTypes.Centers
|
||||||
|
| ObjectSnapTypes.Midpoints
|
||||||
|
| ObjectSnapTypes.Points
|
||||||
|
| ObjectSnapTypes.Nearest
|
||||||
|
| ObjectSnapTypes.Perpendicular
|
||||||
|
| ObjectSnapTypes.WorkPlaneGrid
|
||||||
|
| ObjectSnapTypes.Quadrants
|
||||||
|
| ObjectSnapTypes.Tangents;
|
||||||
|
|
||||||
|
private static double height;
|
||||||
|
private static int orders;
|
||||||
|
|
||||||
|
internal static double Height
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//var b = double.TryParse(ProjectConfigUtil.GetCfgValue("Height"), out height);
|
||||||
|
height = Properties.Settings.Default.Height;
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
set => height = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static int Orders
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//bool b = int.TryParse(ProjectConfigUtil.GetCfgValue("Orders"), out orders);
|
||||||
|
orders = Properties.Settings.Default.Orders;
|
||||||
|
return orders;
|
||||||
|
}
|
||||||
|
set => orders = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
RookieStation/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("RookieStation")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("RookieStation")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("057c7e8d-42a1-4912-b522-498db7484894")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
|
//通过使用 "*",如下所示:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
173
RookieStation/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace RookieStation.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RookieStation.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||||
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap cainiao {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("cainiao", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap EntranceGate {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("EntranceGate", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ExitGate {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ExitGate", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap FamilyLib {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("FamilyLib", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap FloorFinishes {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("FloorFinishes", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Lamp {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Lamp", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Reception {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Reception", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Shelf {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Shelf", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ShelfCard {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ShelfCard", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Shipping {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Shipping", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap WallFinishes {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("WallFinishes", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
154
RookieStation/Properties/Resources.resx
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="cainiao" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\cainiao.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="EntranceGate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\entrancegate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ExitGate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\exitgate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="FamilyLib" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\familylib.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="FloorFinishes" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\floorfinishes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Lamp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\lamp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Reception" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\reception.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Shelf" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\shelf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ShelfCard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\shelfcard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Shipping" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\shipping.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="WallFinishes" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\wallfinishes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
76
RookieStation/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace RookieStation.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("3000")]
|
||||||
|
public double Height {
|
||||||
|
get {
|
||||||
|
return ((double)(this["Height"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["Height"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("4500")]
|
||||||
|
public int Orders {
|
||||||
|
get {
|
||||||
|
return ((int)(this["Orders"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["Orders"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("1")]
|
||||||
|
public int CurrentNumber {
|
||||||
|
get {
|
||||||
|
return ((int)(this["CurrentNumber"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["CurrentNumber"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfString xmlns:xsi=\"http://www.w3." +
|
||||||
|
"org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <s" +
|
||||||
|
"tring>单个,1500,400</string>\r\n</ArrayOfString>")]
|
||||||
|
public global::System.Collections.Specialized.StringCollection Shelves {
|
||||||
|
get {
|
||||||
|
return ((global::System.Collections.Specialized.StringCollection)(this["Shelves"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["Shelves"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
RookieStation/Properties/Settings.settings
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="RookieStation.Properties" GeneratedClassName="Settings">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="Height" Type="System.Double" Scope="User">
|
||||||
|
<Value Profile="(Default)">3000</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="Orders" Type="System.Int32" Scope="User">
|
||||||
|
<Value Profile="(Default)">4500</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="CurrentNumber" Type="System.Int32" Scope="User">
|
||||||
|
<Value Profile="(Default)">1</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="Shelves" Type="System.Collections.Specialized.StringCollection" Scope="User">
|
||||||
|
<Value Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||||
|
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<string>单个,1500,400</string>
|
||||||
|
</ArrayOfString></Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
BIN
RookieStation/Resources/EntranceGate.png
Normal file
|
After Width: | Height: | Size: 473 B |
BIN
RookieStation/Resources/ExitGate.png
Normal file
|
After Width: | Height: | Size: 248 B |
BIN
RookieStation/Resources/FamilyLib.png
Normal file
|
After Width: | Height: | Size: 700 B |
BIN
RookieStation/Resources/FloorFinishes.png
Normal file
|
After Width: | Height: | Size: 156 B |
BIN
RookieStation/Resources/Lamp.png
Normal file
|
After Width: | Height: | Size: 928 B |
BIN
RookieStation/Resources/Reception.png
Normal file
|
After Width: | Height: | Size: 488 B |
BIN
RookieStation/Resources/Shelf.png
Normal file
|
After Width: | Height: | Size: 378 B |
BIN
RookieStation/Resources/ShelfCard.png
Normal file
|
After Width: | Height: | Size: 566 B |
BIN
RookieStation/Resources/Shipping.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
RookieStation/Resources/WallFinishes.png
Normal file
|
After Width: | Height: | Size: 627 B |
BIN
RookieStation/Resources/cainiao.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
11
RookieStation/RookieStation.addin
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RevitAddIns>
|
||||||
|
<AddIn Type="Application">
|
||||||
|
<Name>菜鸟驿站插件</Name>
|
||||||
|
<Assembly>RookieStation.dll</Assembly>
|
||||||
|
<ClientId>1aac8233-690c-4dd6-89c0-78221dd65497</ClientId>
|
||||||
|
<FullClassName>RookieStation.RsApp</FullClassName>
|
||||||
|
<VendorId>ADSK</VendorId>
|
||||||
|
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||||
|
</AddIn>
|
||||||
|
</RevitAddIns>
|
||||||
387
RookieStation/RookieStation.csproj
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{057C7E8D-42A1-4912-B522-498DB7484894}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>RookieStation</RootNamespace>
|
||||||
|
<AssemblyName>RookieStation</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</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>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</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>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="AdWindows, Version=2018.11.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Revit_API_x64.2020.0.0\lib\NET470\AdWindows.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EPPlus, Version=5.6.4.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\EPPlus.5.6.4\lib\net45\EPPlus.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\HandyControl.3.1.0\lib\net47\HandyControl.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.4.1\lib\net46\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="RevitAddInUtility, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Revit_API_x64.2020.0.0\lib\NET470\RevitAddInUtility.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="RevitAPI, Version=20.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||||
|
<HintPath>..\packages\Revit_API_x64.2020.0.0\lib\NET470\RevitAPI.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="RevitAPIUI, Version=20.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||||
|
<HintPath>..\packages\Revit_API_x64.2020.0.0\lib\NET470\RevitAPIUI.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.ComponentModel.Annotations.4.7.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Configuration.Install" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Security" />
|
||||||
|
<Reference Include="System.Threading.Tasks" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="UIFramework, Version=20.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||||
|
<HintPath>..\packages\Revit_API_x64.2020.0.0\lib\NET470\UIFramework.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UIFrameworkServices, Version=20.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||||
|
<HintPath>..\packages\Revit_API_x64.2020.0.0\lib\NET470\UIFrameworkServices.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="cmdExportWorkSchedule.cs" />
|
||||||
|
<Compile Include="CmdLogoExtrusion.cs" />
|
||||||
|
<Compile Include="CmdPlaceWallFinishes.cs" />
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Utils\AssemblyLoader.cs" />
|
||||||
|
<Compile Include="CmdNewDimension.cs" />
|
||||||
|
<Compile Include="Utils\DocumentExtension.cs" />
|
||||||
|
<Compile Include="Utils\EnumItemsSource.cs" />
|
||||||
|
<Compile Include="Utils\ExcelUtils.cs" />
|
||||||
|
<Compile Include="Utils\KeyPress.cs" />
|
||||||
|
<Compile Include="CmdBrowserFamily.cs" />
|
||||||
|
<Compile Include="CmdPlaceShelves.cs" />
|
||||||
|
<Compile Include="Utils\CommonUtils.cs" />
|
||||||
|
<Compile Include="Utils\ViewPlanCmdEnabled.cs" />
|
||||||
|
<Compile Include="CmdPlaceEntranceGate.cs" />
|
||||||
|
<Compile Include="CmdPlaceExitGate.cs" />
|
||||||
|
<Compile Include="Utils\RsRevitUtils.cs" />
|
||||||
|
<Compile Include="CmdPlaceFloorFinishes.cs" />
|
||||||
|
<Compile Include="CmdPlaceLamps.cs" />
|
||||||
|
<Compile Include="Custom\Enum.cs" />
|
||||||
|
<Compile Include="Utils\ProjectConfigUtil.cs" />
|
||||||
|
<Compile Include="CmdProjectSettings.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="CmdArrangeShelfCards.cs" />
|
||||||
|
<Compile Include="RsApp.cs" />
|
||||||
|
<Compile Include="ShelvesPlacementViewModel.cs" />
|
||||||
|
<Compile Include="Utils\SelectFilter.cs" />
|
||||||
|
<Compile Include="CmdPlaceReceptionArea.cs" />
|
||||||
|
<Compile Include="Custom\Shelf.cs" />
|
||||||
|
<Compile Include="Custom\UserConstant.cs" />
|
||||||
|
<Compile Include="Utils\WinIntPtr.cs" />
|
||||||
|
<Compile Include="WpfEntranceGate.xaml.cs">
|
||||||
|
<DependentUpon>WpfEntranceGate.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfExitGate.xaml.cs">
|
||||||
|
<DependentUpon>WpfExitGate.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfFloorFinishes.xaml.cs">
|
||||||
|
<DependentUpon>WpfFloorFinishes.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfLampsLayout.xaml.cs">
|
||||||
|
<DependentUpon>WpfLampsLayout.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfProjectSettings.xaml.cs">
|
||||||
|
<DependentUpon>WpfProjectSettings.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfShelfCards.xaml.cs">
|
||||||
|
<DependentUpon>WpfShelfCards.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfReceptionArea.xaml.cs">
|
||||||
|
<DependentUpon>WpfReceptionArea.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfShelvesLayout.xaml.cs">
|
||||||
|
<DependentUpon>WpfShelvesLayout.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WpfWallFinishes.xaml.cs">
|
||||||
|
<DependentUpon>WpfWallFinishes.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Door\幕墙门-双扇无边框.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Door\幕墙门-玻璃门.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\FloorFinish\地砖.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Furniture\寄件接待台.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Furniture\拆包桌.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Gate\L型收检台.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Gate\简易收检台.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Gate\闸机.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Lamp\吊灯.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Lamp\筒灯.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Shelf\三联货架.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Shelf\单联货架.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Shelf\双联货架.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Shelf\货架端牌.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\侧招灯箱.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\四牌.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\地贴.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\墙贴.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\常规门头.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\玻璃贴.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\菜鸟LOGO.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\菜鸟使命.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\Sign\防撞条.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\WallFinish\校园文化墙.rfa" />
|
||||||
|
<None Include="RsLibrary\台卡.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\定位线.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\寄件收费标准.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\快递指导规范.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\绿动箱.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\背景墙.rfa">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RsLibrary\菜鸟驿站.rte" />
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="RookieStation.addin">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="RookieStationDebug.addin" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="WpfEntranceGate.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfExitGate.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfFloorFinishes.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfLampsLayout.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfProjectSettings.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfShelfCards.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfReceptionArea.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfShelvesLayout.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WpfWallFinishes.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\Shipping.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Resources\WallFinishes.png" />
|
||||||
|
<Content Include="RsLibrary\Texture\免费WiFi.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\取件出口.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\取件区-右.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\取件区-左.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\寄件出口.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\寄件区-右.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\寄件区-左.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\服务承诺_损失赔偿方法_投诉处理办法(700mm_500mm竖版).jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\校园文化墙.jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\消防安全.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\监控提醒.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\确认台卡.jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\禁止吸烟.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\禁止寄递物品管理规定_附录禁止寄递物品指导目录(700mm_500mm竖版).jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\绿动区-右.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\绿动区-左.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\联系台卡.jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\菜鸟驿站寄件业务收费标准(210_297竖版).jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\货架端牌_校园.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\邮件快件实名收寄管理办法(700mm_500mm竖版).jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\邮件快件收寄验视规定(试行)(700mm_500mm竖版).jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="RsLibrary\Texture\验视台卡.jpg">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Resources\cainiao.png" />
|
||||||
|
<Content Include="Resources\EntranceGate.png" />
|
||||||
|
<Content Include="Resources\ExitGate.png" />
|
||||||
|
<Content Include="Resources\FamilyLib.png" />
|
||||||
|
<Content Include="Resources\FloorFinishes.png" />
|
||||||
|
<Content Include="Resources\Lamp.png" />
|
||||||
|
<Content Include="Resources\Reception.png" />
|
||||||
|
<Content Include="Resources\Shelf.png" />
|
||||||
|
<Content Include="Resources\ShelfCard.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
11
RookieStation/RookieStationDebug.addin
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RevitAddIns>
|
||||||
|
<AddIn Type="Application">
|
||||||
|
<Name>RsApp</Name>
|
||||||
|
<Assembly>C:\Users\Administrator\Desktop\工作内容\菜鸟驿站校企参数化设计开发需求文档v 0.1\RookieStation\RookieStation\bin\Debug\RookieStation.dll</Assembly>
|
||||||
|
<ClientId>1aac8233-690c-4dd6-89c0-78221dd65497</ClientId>
|
||||||
|
<FullClassName>RookieStation.RsApp</FullClassName>
|
||||||
|
<VendorId>ADSK</VendorId>
|
||||||
|
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||||
|
</AddIn>
|
||||||
|
</RevitAddIns>
|
||||||
202
RookieStation/RsApp.cs
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
using Autodesk.Revit.UI;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace RookieStation
|
||||||
|
{
|
||||||
|
internal class RsApp : IExternalApplication
|
||||||
|
{
|
||||||
|
private const string TabName = "菜鸟驿站工具";
|
||||||
|
private const string ProjectSettingsPanelName = "项目设置";
|
||||||
|
private const string ReceptionPanelName = "前台布置";
|
||||||
|
private const string EntranceAndExitGatePanelName = "取件区";
|
||||||
|
private const string FinishesPanelName = "饰面,完成面";
|
||||||
|
private const string CommonTools = "通用工具";
|
||||||
|
|
||||||
|
//获取Ribbon类所在的通用类库目录
|
||||||
|
private static string AddInPath = typeof(RsApp).Assembly.Location;
|
||||||
|
|
||||||
|
//获取AddInPath的目录
|
||||||
|
private static string DirRequestAssembly = Path.GetDirectoryName(AddInPath);
|
||||||
|
|
||||||
|
private BitmapSource ConvertFromBitmap(System.Drawing.Bitmap bitmap)
|
||||||
|
{
|
||||||
|
return Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IExternalApplication.OnShutdown(UIControlledApplication application)
|
||||||
|
{
|
||||||
|
return Result.Succeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IExternalApplication.OnStartup(UIControlledApplication application)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
application.CreateRibbonTab(TabName);
|
||||||
|
|
||||||
|
//UserPanel.AddItem(_loginPBData);
|
||||||
|
//".\\*.*"中的“.”表示通用类库文件所在的目录(Debug),“..”表示的是上级的目录(bin),“..”\\..,引号表示再上一级目录
|
||||||
|
//ContextualHelp contextualHelp = new ContextualHelp(ContextualHelpType.Url, "https://www.baidu.com");
|
||||||
|
//_loginPBData.SetContextualHelp(contextualHelp);
|
||||||
|
|
||||||
|
//项目设置
|
||||||
|
RibbonPanel projectPanel = application.CreateRibbonPanel(TabName, ProjectSettingsPanelName);
|
||||||
|
PushButtonData projectPBD = new PushButtonData("项目设置", "项目设置", AddInPath, "RookieStation.CmdProjectSettings")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.cainiao),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.cainiao)
|
||||||
|
};
|
||||||
|
var projectbtn = (PushButton)projectPanel.AddItem(projectPBD);
|
||||||
|
//前台布置
|
||||||
|
RibbonPanel receptionAreaPanel = application.CreateRibbonPanel(TabName, ReceptionPanelName);
|
||||||
|
PushButtonData receptionLayoutPBD = new PushButtonData("寄件区布置", "前台布置", AddInPath, "RookieStation.ShippingAreaModule.CmdPlaceReceptionArea")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.Reception),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.Reception)
|
||||||
|
};
|
||||||
|
var receptionbtn = (PushButton)receptionAreaPanel.AddItem(receptionLayoutPBD);
|
||||||
|
receptionbtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
//出入口布置
|
||||||
|
RibbonPanel packAreaPanel = application.CreateRibbonPanel(TabName, EntranceAndExitGatePanelName);
|
||||||
|
PushButtonData entrancegateLayoutPBD = new PushButtonData("入口布置", "入口闸机", AddInPath, "RookieStation.PackAreaModule.CmdPlaceEntranceGate")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.EntranceGate),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.EntranceGate)
|
||||||
|
};
|
||||||
|
PushButtonData exitGateLayoutPBD = new PushButtonData("出口布置", "出口收检台", AddInPath, "RookieStation.PackAreaModule.CmdPlaceExitGate")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.ExitGate),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.ExitGate)
|
||||||
|
};
|
||||||
|
//var gatebtn = (PushButton)gatePanel.AddItem(exportGateLayoutPBD);
|
||||||
|
|
||||||
|
//IList<RibbonItem> gateItemsStacked = packAreaPanel.AddStackedItems(entrancegateLayoutPBD, exitGateLayoutPBD);
|
||||||
|
//var entrancebtn = (PushButton)gateItemsStacked[0];
|
||||||
|
//var exitbtn = (PushButton)gateItemsStacked[1];
|
||||||
|
var entrancebtn = (PushButton)packAreaPanel.AddItem(entrancegateLayoutPBD);
|
||||||
|
var exitbtn = (PushButton)packAreaPanel.AddItem(exitGateLayoutPBD);
|
||||||
|
entrancebtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
exitbtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
|
||||||
|
PushButtonData placeShelvesPBD = new PushButtonData("货架布置", "货架布置", AddInPath, "RookieStation.PackAreaModule.CmdPlaceShelves")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.Shelf),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.Shelf)
|
||||||
|
};
|
||||||
|
var placeShelvesbtn = (PushButton)packAreaPanel.AddItem(placeShelvesPBD);
|
||||||
|
placeShelvesbtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
|
||||||
|
PushButtonData placeShelveCardsPBD = new PushButtonData("货架端牌", "货架端牌", AddInPath, "RookieStation.PackAreaModule.CmdArrangeShelfCards")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.ShelfCard),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.ShelfCard)
|
||||||
|
};
|
||||||
|
var placeShelveCardsbtn = (PushButton)packAreaPanel.AddItem(placeShelveCardsPBD);
|
||||||
|
|
||||||
|
PushButtonData placeLampsPBD = new PushButtonData("灯具布置", "灯具布置", AddInPath, "RookieStation.PackAreaModule.CmdPlaceLamps")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.Lamp),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.Lamp)
|
||||||
|
};
|
||||||
|
var placeLampsbtn = (PushButton)packAreaPanel.AddItem(placeLampsPBD);
|
||||||
|
placeLampsbtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
//饰面,完成面
|
||||||
|
RibbonPanel finishesPanel = application.CreateRibbonPanel(TabName, FinishesPanelName);
|
||||||
|
|
||||||
|
PushButtonData floorfinishesPBD = new PushButtonData("地面铺装", "地面铺装", AddInPath, "RookieStation.CommonTools.CmdPlaceFloorFinishes")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.FloorFinishes),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.FloorFinishes)
|
||||||
|
};
|
||||||
|
var floorcoveringbtn = (PushButton)finishesPanel.AddItem(floorfinishesPBD);
|
||||||
|
floorcoveringbtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
|
||||||
|
PushButtonData wallcoveringPBD = new PushButtonData("墙饰面", "墙饰面", AddInPath, "RookieStation.CommonTools.CmdPlaceWallFinishes")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.WallFinishes),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.WallFinishes)
|
||||||
|
};
|
||||||
|
var wallcoveringbtn = (PushButton)finishesPanel.AddItem(wallcoveringPBD);
|
||||||
|
wallcoveringbtn.AvailabilityClassName = "RookieStation.ViewPlanCmdEnabled";
|
||||||
|
//通用面板
|
||||||
|
RibbonPanel commonToolsPanel = application.CreateRibbonPanel(TabName, CommonTools);
|
||||||
|
|
||||||
|
PushButtonData browserfamilyPBD = new PushButtonData("浏览族", "浏览族文件", AddInPath, "RookieStation.CommonTools.CmdBrowserFamily")
|
||||||
|
{
|
||||||
|
LargeImage = ConvertFromBitmap(Properties.Resources.FamilyLib),
|
||||||
|
Image = ConvertFromBitmap(Properties.Resources.FamilyLib)
|
||||||
|
};
|
||||||
|
var browserfamilybtn = (PushButton)commonToolsPanel.AddItem(browserfamilyPBD);
|
||||||
|
|
||||||
|
return Result.Succeeded;
|
||||||
|
|
||||||
|
#region MyRegion
|
||||||
|
|
||||||
|
//RibbonPanel familyUtilPanel = application.CreateRibbonPanel(TabName, PanelName1);
|
||||||
|
|
||||||
|
//PushButtonData FamilyTransmitPBData = new PushButtonData("传递标准", "传递标准", AddInPath, "HandyUtils.Common.RExecute.CmdTransmitStandards");
|
||||||
|
//PushButtonData FamilyMassSavePBData = new PushButtonData("批量保存", "批量保存", AddInPath, "HandyUtils.Common.RExecute.CmdFamilyPreservation");
|
||||||
|
|
||||||
|
//IList<RibbonItem> FtItemsStacked = familyUtilPanel.AddStackedItems(FamilyTransmitPBData, FamilyMassSavePBData);
|
||||||
|
////((PushButton)(ribbonItemsStacked[0])).Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Reset.png"), UriKind.Absolute));
|
||||||
|
//((PushButton)FtItemsStacked[0]).Image = ConvertFromBitmap(Properties.Resources.One_Way_Transition_16px);
|
||||||
|
//((PushButton)FtItemsStacked[1]).Image = ConvertFromBitmap(Properties.Resources.Save_16px);
|
||||||
|
|
||||||
|
//familyUtilPanel.AddSeparator();
|
||||||
|
|
||||||
|
//PushButtonData ImportFamParaPBD = new PushButtonData("导入族参数", "族参数", AddInPath, "HandyUtils.Common.RExecute.CmdImportParams")
|
||||||
|
//{
|
||||||
|
// ToolTip = "导入族参数到族文件"
|
||||||
|
//};
|
||||||
|
|
||||||
|
//PushButtonData ImportSharedParaPBD = new PushButtonData("导入共享参数", "共享参数", AddInPath, "HandyUtils.Common.RExecute.CmdShareParams")
|
||||||
|
//{
|
||||||
|
// ToolTip = "导入参数到共享参数文件"
|
||||||
|
//};
|
||||||
|
//PushButtonData UpdateFamilyFilePBD = new PushButtonData("更新族文件", "更新族", AddInPath, "HandyUtils.Common.RExecute.CmdUpdateFiles")
|
||||||
|
//{
|
||||||
|
// ToolTip = "更新族文件缩略图及升级至当前版本"
|
||||||
|
//};
|
||||||
|
|
||||||
|
//IList<RibbonItem> ParaItemsStacked = familyUtilPanel.AddStackedItems(ImportFamParaPBD, ImportSharedParaPBD, UpdateFamilyFilePBD);
|
||||||
|
//((PushButton)ParaItemsStacked[0]).Image = ConvertFromBitmap(Properties.Resources.Add_Property_16px);
|
||||||
|
//((PushButton)ParaItemsStacked[1]).Image = ConvertFromBitmap(Properties.Resources.Import_16px);
|
||||||
|
//((PushButton)ParaItemsStacked[2]).Image = ConvertFromBitmap(Properties.Resources.Available_Updates_32px);
|
||||||
|
|
||||||
|
#endregion MyRegion
|
||||||
|
|
||||||
|
#region MyRegion
|
||||||
|
|
||||||
|
//RibbonPanel exportPanel = application.CreateRibbonPanel(TabName, "导出族信息");
|
||||||
|
|
||||||
|
//PushButtonData pbdSettings = new PushButtonData("设置", "导出选项", AddInPath, "HandyUtils.Common.RExecute.CmdSettings")
|
||||||
|
//{
|
||||||
|
// ToolTip = "设置导出选项"
|
||||||
|
//};
|
||||||
|
|
||||||
|
//PushButtonData pbdFamilyInfoExport = new PushButtonData("导出", "信息导出", AddInPath, "HandyUtils.Common.RExecute.CmdFamilyInfo")
|
||||||
|
//{
|
||||||
|
// ToolTip = "将族图片、族参数进行导出"
|
||||||
|
//};
|
||||||
|
//IList<RibbonItem> ExportItemsStacked = exportPanel.AddStackedItems(pbdSettings, pbdFamilyInfoExport);
|
||||||
|
//((PushButton)ExportItemsStacked[0]).Image = ConvertFromBitmap(Properties.Resources.Settings_16px);
|
||||||
|
//((PushButton)ExportItemsStacked[1]).Image = ConvertFromBitmap(Properties.Resources.Export_16px);
|
||||||
|
|
||||||
|
#endregion MyRegion
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
return Result.Cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
RookieStation/RsLibrary/Door/幕墙门-双扇无边框.rfa
Normal file
BIN
RookieStation/RsLibrary/Door/幕墙门-玻璃门.rfa
Normal file
BIN
RookieStation/RsLibrary/Equipment/配电箱.rfa
Normal file
BIN
RookieStation/RsLibrary/Equipment/高拍仪.rfa
Normal file
BIN
RookieStation/RsLibrary/FloorFinish/地砖.rfa
Normal file
BIN
RookieStation/RsLibrary/FloorFinish/自适应地砖.rfa
Normal file
BIN
RookieStation/RsLibrary/Furniture/L型收检接待台.rfa
Normal file
BIN
RookieStation/RsLibrary/Furniture/寄件接待台.rfa
Normal file
BIN
RookieStation/RsLibrary/Furniture/拆包桌.rfa
Normal file
BIN
RookieStation/RsLibrary/Gate/L型收检台.rfa
Normal file
BIN
RookieStation/RsLibrary/Gate/收检台-右.rfa
Normal file
BIN
RookieStation/RsLibrary/Gate/收检台-左.rfa
Normal file
BIN
RookieStation/RsLibrary/Gate/直线形收检台.rfa
Normal file
BIN
RookieStation/RsLibrary/Gate/简易收检台.rfa
Normal file
BIN
RookieStation/RsLibrary/Gate/闸机.rfa
Normal file
BIN
RookieStation/RsLibrary/Lamp/吊灯.rfa
Normal file
BIN
RookieStation/RsLibrary/Lamp/筒灯.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/Lamp/筒灯.rfa
Normal file
BIN
RookieStation/RsLibrary/Shelf/三联货架.rfa
Normal file
BIN
RookieStation/RsLibrary/Shelf/单联货架.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/Shelf/单联货架.rfa
Normal file
BIN
RookieStation/RsLibrary/Shelf/双联货架.rfa
Normal file
BIN
RookieStation/RsLibrary/Shelf/货架端牌.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/侧招灯箱.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/四牌.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/地贴.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/墙贴.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/常规门头.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/玻璃贴.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/菜鸟LOGO.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/菜鸟使命.rfa
Normal file
BIN
RookieStation/RsLibrary/Sign/防撞条.rfa
Normal file
BIN
RookieStation/RsLibrary/Texture/免费WiFi.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
RookieStation/RsLibrary/Texture/取件出口.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
RookieStation/RsLibrary/Texture/取件区-右.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
RookieStation/RsLibrary/Texture/取件区-左.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
RookieStation/RsLibrary/Texture/寄件出口.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
RookieStation/RsLibrary/Texture/寄件区-右.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
RookieStation/RsLibrary/Texture/寄件区-左.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 666 KiB |
BIN
RookieStation/RsLibrary/Texture/校园文化墙.jpg
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
RookieStation/RsLibrary/Texture/消防安全.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
RookieStation/RsLibrary/Texture/监控提醒.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
RookieStation/RsLibrary/Texture/确认台卡.jpg
Normal file
|
After Width: | Height: | Size: 918 KiB |
BIN
RookieStation/RsLibrary/Texture/禁止吸烟.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 715 KiB |
BIN
RookieStation/RsLibrary/Texture/绿动区-右.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
RookieStation/RsLibrary/Texture/绿动区-左.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
RookieStation/RsLibrary/Texture/联系台卡.jpg
Normal file
|
After Width: | Height: | Size: 958 KiB |
BIN
RookieStation/RsLibrary/Texture/菜鸟驿站寄件业务收费标准(210_297竖版).jpg
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
RookieStation/RsLibrary/Texture/货架端牌_校园.png
Normal file
|
After Width: | Height: | Size: 279 KiB |
BIN
RookieStation/RsLibrary/Texture/邮件快件实名收寄管理办法(700mm_500mm竖版).jpg
Normal file
|
After Width: | Height: | Size: 697 KiB |
|
After Width: | Height: | Size: 712 KiB |
BIN
RookieStation/RsLibrary/Texture/验视台卡.jpg
Normal file
|
After Width: | Height: | Size: 952 KiB |