导线,统一视口功能
This commit is contained in:
@@ -124,8 +124,11 @@ namespace RookieStation.CommonTools.Views
|
||||
|
||||
private void btnSelectPath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
|
||||
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
|
||||
VistaFolderBrowserDialog folderBrowserDialog = new VistaFolderBrowserDialog()
|
||||
{
|
||||
Multiselect = false,
|
||||
};
|
||||
if (folderBrowserDialog.ShowDialog())
|
||||
{
|
||||
FamilyFolder = folderBrowserDialog.SelectedPath;
|
||||
btnSelectPath.ToolTip = FamilyFolder;
|
||||
@@ -137,7 +140,7 @@ namespace RookieStation.CommonTools.Views
|
||||
|
||||
private void btnSearch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (tbSearch.Text == "")
|
||||
if (tbSearch.Text == "" || lbFamilyLib.ItemsSource == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
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.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdCreateCentralizeAnnotation : 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;
|
||||
using (Transaction trans = new Transaction(doc, "cmd"))
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectionFilter selfilter = new SelectionFilter();
|
||||
var refers = uidoc.Selection.PickObjects(ObjectType.Element, "请选择元素");
|
||||
|
||||
trans.Start();
|
||||
//Do Something.
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException ex)
|
||||
{
|
||||
if (trans.GetStatus() == TransactionStatus.Started)
|
||||
{
|
||||
trans.RollBack();
|
||||
}
|
||||
return Result.Cancelled;
|
||||
}
|
||||
}
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
public class SelectionFilter : ISelectionFilter
|
||||
{
|
||||
public bool AllowElement(Element element)
|
||||
{
|
||||
if (element.Category.Name == "XXX")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AllowReference(Reference refer, XYZ point)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
foreach (var g2 in lightSymbolGroup)
|
||||
{
|
||||
var instance = g2.ElementAt(0);
|
||||
var wattage = instance.Symbol.get_Parameter(BuiltInParameter.FBX_LIGHT_WATTAGE).AsValueString();
|
||||
//var wattage = instance.Symbol.get_Parameter(BuiltInParameter.FBX_LIGHT_WATTAGE).AsValueString();
|
||||
var mark = instance.Symbol.get_Parameter(BuiltInParameter.WINDOW_TYPE_ID).AsString();
|
||||
var annotation = instance.Symbol.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_COMMENTS).AsString();
|
||||
var comment = annotation == null ? $"{instance.Symbol.FamilyName}" : $"{instance.Symbol.FamilyName},{annotation}";
|
||||
|
||||
@@ -24,178 +24,188 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
View activeview = doc.ActiveView;
|
||||
if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet)
|
||||
{
|
||||
CurveArray curveArray = new CurveArray();
|
||||
var tableLocation = uidoc.Selection.PickPoint(ObjectSnapTypes.Endpoints, "请选择布图区域左上角端点");
|
||||
|
||||
var sql = SQLiteUtil.GetInstance();
|
||||
sql.CreateDb(UserConstant.DbFolder + "Inventory.db");
|
||||
List<string[]> tableRow = sql.QueryTable("MainMaterials");
|
||||
sql.CloseConncetion();
|
||||
//FilteredElementCollector collectorAll = new FilteredElementCollector(doc);
|
||||
//collectorAll.WherePasses(new LogicalOrFilter(new ElementIsElementTypeFilter(false), new ElementIsElementTypeFilter(true)));
|
||||
var collectorAll = new FilteredElementCollector(doc);
|
||||
ElementClassFilter instanceFilter = new ElementClassFilter(typeof(FamilyInstance));
|
||||
ElementClassFilter hostobjectFilter = new ElementClassFilter(typeof(HostObject));
|
||||
LogicalOrFilter orFilter = new LogicalOrFilter(instanceFilter, hostobjectFilter);
|
||||
collectorAll.WherePasses(orFilter);
|
||||
List<MaterialItem> materialItems = new List<MaterialItem>();
|
||||
double similarity = 0.4;//相似度
|
||||
for (int i = 0; i < tableRow.Count; i++)
|
||||
try
|
||||
{
|
||||
var description = tableRow[i][1];
|
||||
var position = tableRow[i][6];
|
||||
bool isExist = false;
|
||||
foreach (var ele in collectorAll)
|
||||
{
|
||||
string name = string.Empty;
|
||||
FamilyInstance fi = ele as FamilyInstance;
|
||||
if (fi != null)
|
||||
{
|
||||
name = fi.Symbol.FamilyName;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = ele.Name;
|
||||
}
|
||||
if (CommonUtils.levenshtein(description, name) > similarity || CommonUtils.levenshtein(position, name) > similarity)
|
||||
{
|
||||
isExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isExist)
|
||||
{
|
||||
MaterialItem item = new MaterialItem()
|
||||
{
|
||||
Description = tableRow[i][1],
|
||||
FireRating = tableRow[i][2],
|
||||
Legend = $"{UserConstant.MainMaterialFolder}{tableRow[i][1]}.png",
|
||||
Specifications = tableRow[i][4],
|
||||
Pigment = tableRow[i][5],
|
||||
Position = tableRow[i][6],
|
||||
Remark = tableRow[i][7],
|
||||
};
|
||||
materialItems.Add(item);
|
||||
}
|
||||
}
|
||||
var width = 346 / 304.8;
|
||||
var height = 283 / 304.8;
|
||||
var gridWidth = width / 7;
|
||||
var gridHeight = height / (materialItems.Count + 1);//表头要加1
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
var colStart = new XYZ(tableLocation.X + j * gridWidth, tableLocation.Y, 0);
|
||||
var colEnd = new XYZ(tableLocation.X + j * gridWidth, tableLocation.Y - height, 0);
|
||||
Line colLine = Line.CreateBound(colStart, colEnd);
|
||||
curveArray.Append(colLine);
|
||||
}
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains("宋")).FirstOrDefault() as TextNoteType;
|
||||
var opts = new TextNoteOptions(textNoteType.Id)
|
||||
{
|
||||
HorizontalAlignment = HorizontalTextAlignment.Center,
|
||||
VerticalAlignment = VerticalTextAlignment.Middle
|
||||
};
|
||||
for (int i = 0; i <= materialItems.Count; i++)
|
||||
{
|
||||
var rowStart = new XYZ(tableLocation.X, tableLocation.Y - i * gridHeight, 0);
|
||||
var rowEnd = new XYZ(tableLocation.X + width, tableLocation.Y - i * gridHeight, 0);
|
||||
Line rowLine = Line.CreateBound(rowStart, rowEnd);
|
||||
curveArray.Append(rowLine);
|
||||
CurveArray curveArray = new CurveArray();
|
||||
var tableLocation = uidoc.Selection.PickPoint(ObjectSnapTypes.Endpoints, "请选择布图区域左上角端点");
|
||||
|
||||
if (i == 0)//创建表头
|
||||
var sql = SQLiteUtil.GetInstance();
|
||||
sql.CreateDb(UserConstant.DbFolder + "Inventory.db");
|
||||
List<string[]> tableRow = sql.QueryTable("MainMaterials");
|
||||
sql.CloseConncetion();
|
||||
//FilteredElementCollector collectorAll = new FilteredElementCollector(doc);
|
||||
//collectorAll.WherePasses(new LogicalOrFilter(new ElementIsElementTypeFilter(false), new ElementIsElementTypeFilter(true)));
|
||||
var collectorAll = new FilteredElementCollector(doc);
|
||||
ElementClassFilter instanceFilter = new ElementClassFilter(typeof(FamilyInstance));
|
||||
ElementClassFilter hostobjectFilter = new ElementClassFilter(typeof(HostObject));
|
||||
LogicalOrFilter orFilter = new LogicalOrFilter(instanceFilter, hostobjectFilter);
|
||||
collectorAll.WherePasses(orFilter);
|
||||
List<MaterialItem> materialItems = new List<MaterialItem>();
|
||||
double similarity = 0.4;//相似度
|
||||
for (int i = 0; i < tableRow.Count; i++)
|
||||
{
|
||||
var description = tableRow[i][1];
|
||||
var position = tableRow[i][6];
|
||||
bool isExist = false;
|
||||
foreach (var ele in collectorAll)
|
||||
{
|
||||
string name = string.Empty;
|
||||
FamilyInstance fi = ele as FamilyInstance;
|
||||
if (fi != null)
|
||||
{
|
||||
name = fi.Symbol.FamilyName;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = ele.Name;
|
||||
}
|
||||
if (CommonUtils.levenshtein(description, name) > similarity || CommonUtils.levenshtein(position, name) > similarity)
|
||||
{
|
||||
isExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isExist)
|
||||
{
|
||||
MaterialItem item = new MaterialItem()
|
||||
{
|
||||
Description = tableRow[i][1],
|
||||
FireRating = tableRow[i][2],
|
||||
Legend = $"{UserConstant.MainMaterialFolder}{tableRow[i][1]}.png",
|
||||
Specifications = tableRow[i][4],
|
||||
Pigment = tableRow[i][5],
|
||||
Position = tableRow[i][6],
|
||||
Remark = tableRow[i][7],
|
||||
};
|
||||
materialItems.Add(item);
|
||||
}
|
||||
}
|
||||
var width = 346 / 304.8;
|
||||
var height = 283 / 304.8;
|
||||
var gridWidth = width / 7;
|
||||
var gridHeight = height / (materialItems.Count + 1);//表头要加1
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
var colStart = new XYZ(tableLocation.X + j * gridWidth, tableLocation.Y, 0);
|
||||
var colEnd = new XYZ(tableLocation.X + j * gridWidth, tableLocation.Y - height, 0);
|
||||
Line colLine = Line.CreateBound(colStart, colEnd);
|
||||
curveArray.Append(colLine);
|
||||
}
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains("宋")).FirstOrDefault() as TextNoteType;
|
||||
var opts = new TextNoteOptions(textNoteType.Id)
|
||||
{
|
||||
HorizontalAlignment = HorizontalTextAlignment.Center,
|
||||
VerticalAlignment = VerticalTextAlignment.Middle
|
||||
};
|
||||
for (int i = 0; i <= materialItems.Count; i++)
|
||||
{
|
||||
var rowStart = new XYZ(tableLocation.X, tableLocation.Y - i * gridHeight, 0);
|
||||
var rowEnd = new XYZ(tableLocation.X + width, tableLocation.Y - i * gridHeight, 0);
|
||||
Line rowLine = Line.CreateBound(rowStart, rowEnd);
|
||||
curveArray.Append(rowLine);
|
||||
|
||||
if (i == 0)//创建表头
|
||||
{
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 0.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"材料名称\nDESCRIPTION",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 1.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"防火等级\nFIRE RATING",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 2.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"图例\nLEGEND",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 3.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"规格\nSPECIFICATIONS",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 4.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"颜色\nPIGMENT",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 5.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"位置\nPOSITION",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 6.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"备注\nREMARK",
|
||||
opts);
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = materialItems[i - 1];//从0开始,i=0已运行,并跳过此段
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 0.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"材料名称\nDESCRIPTION",
|
||||
item.Description,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 1.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"防火等级\nFIRE RATING",
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 2.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"图例\nLEGEND",
|
||||
item.FireRating,
|
||||
opts);
|
||||
|
||||
var it = ImageType.Create(doc, new ImageTypeOptions(item.Legend));
|
||||
var ii = ImageInstance.Create(doc,
|
||||
activeview,
|
||||
it.Id,
|
||||
new ImagePlacementOptions(new XYZ(tableLocation.X + 2.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
BoxPlacement.Center));
|
||||
doc.Regenerate();
|
||||
ii.get_Parameter(BuiltInParameter.RASTER_SHEETHEIGHT).SetValueString("21");
|
||||
ii.get_Parameter(BuiltInParameter.RASTER_SHEETWIDTH).SetValueString("21");
|
||||
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 3.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"规格\nSPECIFICATIONS",
|
||||
item.Specifications,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 4.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"颜色\nPIGMENT",
|
||||
item.Pigment,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 5.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"位置\nPOSITION",
|
||||
item.Position,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 6.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
"备注\nREMARK",
|
||||
item.Remark,
|
||||
opts);
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = materialItems[i - 1];//从0开始,i=0已运行,并跳过此段
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 0.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
item.Description,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 1.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
item.FireRating,
|
||||
opts);
|
||||
doc.Create.NewDetailCurveArray(activeview, curveArray);
|
||||
|
||||
var it = ImageType.Create(doc, new ImageTypeOptions(item.Legend));
|
||||
var ii = ImageInstance.Create(doc,
|
||||
activeview,
|
||||
it.Id,
|
||||
new ImagePlacementOptions(new XYZ(tableLocation.X + 2.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
BoxPlacement.Center));
|
||||
doc.Regenerate();
|
||||
ii.get_Parameter(BuiltInParameter.RASTER_SHEETHEIGHT).SetValueString("21");
|
||||
ii.get_Parameter(BuiltInParameter.RASTER_SHEETWIDTH).SetValueString("21");
|
||||
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 3.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
item.Specifications,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 4.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
item.Pigment,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 5.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
item.Position,
|
||||
opts);
|
||||
TextNote.Create(doc,
|
||||
doc.ActiveView.Id,
|
||||
new XYZ(tableLocation.X + 6.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0),
|
||||
item.Remark,
|
||||
opts);
|
||||
}
|
||||
|
||||
doc.Create.NewDetailCurveArray(activeview, curveArray);
|
||||
|
||||
//ii.Width = 10;
|
||||
//ii.Height = 10;
|
||||
//ii.Width = 10;
|
||||
//ii.Height = 10;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
|
||||
if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet)
|
||||
{
|
||||
var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Viewport>(), "请选择参考的视口");
|
||||
var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Viewport>(), "请选择参考的视口确定比例尺");
|
||||
var viewport = doc.GetElement(portRefer) as Viewport;
|
||||
var viewPlan = doc.GetElement(viewport.ViewId);
|
||||
if (!(viewPlan is ViewPlan))
|
||||
|
||||
143
RookieStation/Drawing/ExecuteCmds/CmdCreateWires.cs
Normal file
143
RookieStation/Drawing/ExecuteCmds/CmdCreateWires.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Electrical;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using RookieStation.Extension;
|
||||
using RookieStation.ParcelAreaModule.Views;
|
||||
using RookieStation.Utils;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdCreateWires : 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;
|
||||
bool isContinue = true;
|
||||
|
||||
try
|
||||
{
|
||||
while (isContinue)
|
||||
{
|
||||
//var refers = uidoc.Selection.PickObjects(ObjectType.Element, new SelectFilter<FamilyInstance>(), "请选择灯具");
|
||||
//var instances = refers.Select(refer => doc.GetElement(refer) as FamilyInstance);
|
||||
var instances = uidoc.Selection.PickElementsByRectangle(new SelectFilter<FamilyInstance>(), "请选择灯具").Cast<FamilyInstance>();
|
||||
//var instances = refers.Select(refer => doc.GetElement(refer) as FamilyInstance).OrderBy(fi => RsRevitUtils.GetLocationPointByElement(fi).X).ThenBy(fi => RsRevitUtils.GetLocationPointByElement(fi).Y);
|
||||
var instancesGroupByX = instances.GroupBy(fi => RsRevitUtils.GetLocationPointByElement(fi).X);
|
||||
var instancesGroupByY = instances.GroupBy(fi => RsRevitUtils.GetLocationPointByElement(fi).Y);
|
||||
IOrderedEnumerable<FamilyInstance> instancesOrdered = null;
|
||||
if (instancesGroupByX.Count() <= instancesGroupByY.Count())
|
||||
{
|
||||
instancesOrdered = instances.OrderBy(fi => RsRevitUtils.GetLocationPointByElement(fi).X).ThenBy(fi => RsRevitUtils.GetLocationPointByElement(fi).Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
instancesOrdered = instances.OrderBy(fi => RsRevitUtils.GetLocationPointByElement(fi).Y).ThenBy(fi => RsRevitUtils.GetLocationPointByElement(fi).X);
|
||||
}
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
for (int i = 0; i < instancesOrdered.Count() - 1; i++)
|
||||
{
|
||||
var fi = instancesOrdered.ElementAt(i);
|
||||
var fi1 = instancesOrdered.ElementAt(i + 1);
|
||||
CreateWire(doc, fi, fi1, i);
|
||||
}
|
||||
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
FamilyInstance closestInstance = null;
|
||||
if (instance.MEPModel.ConnectorManager.UnusedConnectors.Size > 0)
|
||||
{
|
||||
var p = RsRevitUtils.GetLocationPointByElement(instance);
|
||||
var mindistance = 10.0;
|
||||
foreach (var instanceSearched in instances)
|
||||
{
|
||||
var sp = RsRevitUtils.GetLocationPointByElement(instanceSearched);
|
||||
var sdistance = sp.DistanceTo(p);
|
||||
if (sdistance < mindistance && sdistance != 0)
|
||||
{
|
||||
closestInstance = instanceSearched;
|
||||
mindistance = sdistance;
|
||||
}
|
||||
}
|
||||
CreateWire(doc, instance, closestInstance, 0);
|
||||
}
|
||||
}
|
||||
}, "创建导线");
|
||||
}
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
public void CreateWire(Document doc, FamilyInstance firstInstance, FamilyInstance endInstance, int i)
|
||||
{
|
||||
var wireTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.WireType);
|
||||
var firstConnectors = firstInstance.MEPModel.ConnectorManager.Connectors;
|
||||
Connector connector = null;
|
||||
foreach (Connector it in firstConnectors)
|
||||
{
|
||||
connector = it;
|
||||
break;
|
||||
}
|
||||
var loc = connector.Origin;
|
||||
|
||||
var endConnectors = endInstance.MEPModel.ConnectorManager.Connectors;
|
||||
|
||||
Connector connector1 = null;
|
||||
|
||||
foreach (Connector it in endConnectors)
|
||||
{
|
||||
connector1 = it;
|
||||
break;
|
||||
}
|
||||
var loc1 = connector1.Origin;
|
||||
List<XYZ> pts = new List<XYZ>();
|
||||
pts.Add(loc);
|
||||
var l = Line.CreateBound(loc, loc1);
|
||||
if (l.Length > 2200 / 304.8)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var off = l.Direction.CrossProduct(XYZ.BasisZ * 2);
|
||||
var cp = (loc + loc1) / 2;
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
pts.Add(off.Add(cp));
|
||||
}
|
||||
else
|
||||
{
|
||||
pts.Add(off.Negate().Add(cp));
|
||||
}
|
||||
pts.Add(loc1);
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
Wire.Create(doc, wireTypeId, doc.ActiveView.Id, WiringType.Arc, pts, connector, connector1);
|
||||
}, "创建导线");
|
||||
}
|
||||
|
||||
internal class SelectFilter<T> : ISelectionFilter
|
||||
{
|
||||
public bool AllowElement(Autodesk.Revit.DB.Element elem)
|
||||
{
|
||||
return elem is T && elem.Category.Id.IntegerValue == -2001120;
|
||||
}
|
||||
|
||||
public bool AllowReference(Reference refer, XYZ point)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
147
RookieStation/Drawing/ExecuteCmds/CmdUnifyViewportOnViewSheet.cs
Normal file
147
RookieStation/Drawing/ExecuteCmds/CmdUnifyViewportOnViewSheet.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using RookieStation.Extension;
|
||||
using RookieStation.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdUnifyViewportOnViewSheet : 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;
|
||||
if (uidoc.ActiveView.ViewType != ViewType.FloorPlan)
|
||||
{
|
||||
message = "请打开楼层平面视图";
|
||||
}
|
||||
var uiViews = uidoc.GetOpenUIViews();
|
||||
var uiviews = from v in uiViews
|
||||
where v.ViewId == doc.ActiveView.Id
|
||||
select v;
|
||||
var uiview = uiviews.FirstOrDefault();
|
||||
uiview.ZoomToFit();
|
||||
var pts = uiview.GetZoomCorners();
|
||||
try
|
||||
{
|
||||
//var box = uidoc.Selection.PickBox(PickBoxStyle.Directional, "请选择出图的范围框");
|
||||
var viewplans = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).Cast<ViewPlan>().Where(v => v.ViewType == ViewType.FloorPlan && v.IsTemplate == false);
|
||||
var viewSheets = new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)).Cast<ViewSheet>().Where(v => v.ViewType == ViewType.DrawingSheet && v.IsTemplate == false);
|
||||
var titleBlocks = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_TitleBlocks).Cast<FamilySymbol>().Where(s => s.Name.Contains("A3"));
|
||||
var min = new XYZ(0.0229658792650917, 0.0229658792650921, 0);
|
||||
var max = new XYZ(1.15813648293937, 0.951443569553805, 0);
|
||||
var mid = (max + min) / 2;
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
foreach (var plan in viewplans)
|
||||
{
|
||||
var isDrawing = plan.GetParameters("视图分类").FirstOrDefault().AsString().Contains("出图");
|
||||
var isDetailDrawing = plan.Name.Contains("大样");
|
||||
|
||||
if (!isDrawing || isDetailDrawing)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
plan.CropBoxActive = true;
|
||||
BoundingBoxXYZ boundingBox = GetBoundingBoxXYZ(pts);
|
||||
//BoundingBoxXYZ boundingBox = GetBoundingBoxXYZ(box);
|
||||
plan.CropBoxVisible = true;
|
||||
plan.CropBox = boundingBox;
|
||||
var sheets = from sheet in viewSheets
|
||||
where sheet.Name == plan.Name
|
||||
select sheet;
|
||||
var hasplace = plan.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NUMBER).HasValue;
|
||||
var sheetNumber = plan.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NUMBER).AsString();
|
||||
var sheetName = plan.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NAME).AsString();
|
||||
|
||||
if (hasplace)
|
||||
{
|
||||
var existsheets = from sheet in viewSheets
|
||||
where sheet.Name == sheetName && sheet.SheetNumber == sheetNumber
|
||||
select sheet;
|
||||
var existsheet = existsheets.FirstOrDefault();
|
||||
existsheet.Name = plan.Name;
|
||||
var ports = existsheet.GetAllViewports().Where(id =>
|
||||
{
|
||||
var p = doc.GetElement(id) as Viewport;
|
||||
return p.ViewId == plan.Id;
|
||||
}).Select(id => doc.GetElement(id) as Viewport);
|
||||
var port = ports.FirstOrDefault();
|
||||
port.SetBoxCenter(mid);
|
||||
//doc.Regenerate();
|
||||
|
||||
//port.GetLabelOutline().MinimumPoint = new XYZ(0.835, 0.0214, 0);
|
||||
//port.GetLabelOutline().MaximumPoint = new XYZ(1.12266834170198, 0.0803862248629855, -0.0691517320142279);
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewSheet planSheet;
|
||||
if (sheets.Count() == 0)
|
||||
{
|
||||
planSheet = ViewSheet.Create(doc, titleBlocks.FirstOrDefault().Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
planSheet = sheets.FirstOrDefault();
|
||||
}
|
||||
planSheet.Name = plan.Name;
|
||||
var port = Viewport.Create(doc, planSheet.Id, plan.Id, mid);
|
||||
//doc.Regenerate();
|
||||
//port.GetLabelOutline().MinimumPoint = new XYZ(0.835196807743834, 0.0213681401338879, -0.0691517320142279);
|
||||
//port.GetLabelOutline().MaximumPoint = new XYZ(1.12266834170198, 0.0803862248629855, -0.0691517320142279);
|
||||
}
|
||||
}
|
||||
}, "设置裁剪框");
|
||||
}, "统一图纸平面的视口位置");
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.Message);
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
public BoundingBoxXYZ GetBoundingBoxXYZ(IList<XYZ> pts)
|
||||
{
|
||||
BoundingBoxXYZ boundingBox = new BoundingBoxXYZ();
|
||||
boundingBox.Min = new XYZ(pts[0].X, pts[0].Y, 0);
|
||||
boundingBox.Max = new XYZ(pts[1].X, pts[1].Y, 0);
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
public BoundingBoxXYZ GetBoundingBoxXYZ(PickedBox pb)
|
||||
{
|
||||
BoundingBoxXYZ boundingBox = new BoundingBoxXYZ();
|
||||
double minX;
|
||||
double minY;
|
||||
double maxX;
|
||||
double maxY;
|
||||
minX = Math.Min(pb.Min.X, pb.Max.X);
|
||||
minY = Math.Min(pb.Min.Y, pb.Max.Y);
|
||||
maxX = Math.Max(pb.Min.X, pb.Max.X);
|
||||
maxY = Math.Max(pb.Min.Y, pb.Max.Y);
|
||||
|
||||
boundingBox.Max = new XYZ(maxX, maxY, 0);
|
||||
boundingBox.Min = new XYZ(minX, minY, 0);
|
||||
return boundingBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using RookieStation.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class UnifyViewPlanCropBoxAndPositionOnViewSheet : 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;
|
||||
var box = uidoc.Selection.PickBox(PickBoxStyle.Crossing, "请选择出图的范围框");
|
||||
var viewplans = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).Cast<ViewPlan>();
|
||||
ICollection<Element> wallinstances = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).WhereElementIsNotElementType().ToElements();
|
||||
//min (0.0229658792650917, 0.0229658792650921, 0)
|
||||
//max (1.15813648293937, 0.951443569553805, 0)
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
foreach (var v in viewplans)
|
||||
{
|
||||
//var isdrawing = item.GetParameters("视图分类").FirstOrDefault().AsString().Contains("出图");
|
||||
|
||||
//if (isdrawing)
|
||||
//{
|
||||
//}
|
||||
v.CropBoxActive = true;
|
||||
BoundingBoxXYZ boundingBox = new BoundingBoxXYZ();
|
||||
boundingBox.Max = box.Max;
|
||||
boundingBox.Min = box.Min;
|
||||
v.CropBox = boundingBox;
|
||||
}
|
||||
}, "设置裁剪框");
|
||||
}, "统一图纸平面的视口");
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,9 +121,9 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
Line referline = RsRevitUtils.GetGuideGeometryAndDeleteGuide(doc, eleIdsAdded);
|
||||
|
||||
double backgroundWallLength = referline.Length;
|
||||
if (backgroundWallLength < 1500 / 304.8)
|
||||
if (backgroundWallLength < 3000 / 304.8)
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "距离太接");
|
||||
TaskDialog.Show("温馨提示", "长度需大于3000mm");
|
||||
return Result.Cancelled;
|
||||
}
|
||||
List<ElementId> wallIds = new List<ElementId>();
|
||||
@@ -152,8 +152,8 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
if (n == 0)
|
||||
{
|
||||
var offestline = referline.CreateOffset(aluminumPlasticPanelThickness / 2 + baseLayerThickness, -XYZ.BasisZ);
|
||||
var wall = Wall.Create(doc, offestline, aluminumPlasticPanelType.Id, baseLevel.Id, aluminumPlasticPanelHeight, skirtingLineHeight, false, false);
|
||||
wallIds.Add(wall.Id);
|
||||
var skirtingLinewall = Wall.Create(doc, offestline, aluminumPlasticPanelType.Id, baseLevel.Id, aluminumPlasticPanelHeight, skirtingLineHeight, false, false);
|
||||
wallIds.Add(skirtingLinewall.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,11 +168,11 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
}
|
||||
Line line = Line.CreateBound(startpoint, endpoint);
|
||||
var offestline = line.CreateOffset(aluminumPlasticPanelThickness / 2 + baseLayerThickness, -XYZ.BasisZ);
|
||||
var wall = Wall.Create(doc, offestline, aluminumPlasticPanelType.Id, baseLevel.Id, aluminumPlasticPanelHeight, skirtingLineHeight, false, false);
|
||||
var aluminumPlasticPanelwall = Wall.Create(doc, offestline, aluminumPlasticPanelType.Id, baseLevel.Id, aluminumPlasticPanelHeight, skirtingLineHeight, false, false);
|
||||
//不允许连接
|
||||
WallUtils.DisallowWallJoinAtEnd(wall, 0);
|
||||
WallUtils.DisallowWallJoinAtEnd(aluminumPlasticPanelwall, 0);
|
||||
//curves.Add()
|
||||
wallIds.Add(wall.Id);
|
||||
wallIds.Add(aluminumPlasticPanelwall.Id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,13 +181,13 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
wallIds.Add(skirtingwall.Id);
|
||||
|
||||
var baseLayerOffestLine = referline.CreateOffset(baseLayerThickness / 2, -XYZ.BasisZ);
|
||||
var baseLayerWall = Wall.Create(doc, baseLayerOffestLine, baseLayerType.Id, baseLevel.Id, UserConstant.Height / 304.8, 0, false, false);
|
||||
var baseLayerWall = Wall.Create(doc, baseLayerOffestLine, baseLayerType.Id, baseLevel.Id, skirtingLineHeight + aluminumPlasticPanelHeight, 0, false, false);
|
||||
wallIds.Add(baseLayerWall.Id);
|
||||
//高度大于3000才有灰色乳胶漆
|
||||
if (UserConstant.Height > 3000)
|
||||
{
|
||||
double baseHeight = aluminumPlasticPanelHeight + skirtingLineHeight;
|
||||
var greyEmulsionPaintOffestLine = referline.CreateOffset(baseLayerThickness + greyEmulsionPaintWidth / 2, -XYZ.BasisZ);
|
||||
var greyEmulsionPaintOffestLine = referline.CreateOffset(greyEmulsionPaintWidth / 2, -XYZ.BasisZ);
|
||||
Wall greyPaintWall = Wall.Create(doc, greyEmulsionPaintOffestLine, greyEmulsionPaintType.Id, baseLevel.Id, UserConstant.Height / 304.8 - baseHeight, baseHeight, false, false);
|
||||
wallIds.Add(greyPaintWall.Id);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:RookieStation"
|
||||
xmlns:local="clr-namespace:RookieStation.MailingAreaModule.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Width="126"
|
||||
Height="338"
|
||||
@@ -51,7 +51,7 @@
|
||||
hc:InfoElement.Title="铝塑板高度:"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
PreviewTextInput="tb_PreviewTextInput"
|
||||
Text="2400"
|
||||
Text="2440"
|
||||
TextAlignment="Center" />
|
||||
<hc:TextBox
|
||||
x:Name="tbAluminumpLasticPanelGap"
|
||||
@@ -59,7 +59,7 @@
|
||||
hc:InfoElement.Title="铝塑板分缝:"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
PreviewTextInput="tb_PreviewTextInput"
|
||||
Text="2"
|
||||
Text="3"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace RookieStation.MailingAreaModule.Views
|
||||
public WpfReceptionArea()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tbAluminumpLasticPanelHeight.Text = (UserConstant.Height / 3 * 2).ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,29 +44,8 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
{
|
||||
loader.UnhookAssemblyResolve();
|
||||
}
|
||||
//if (shelfcards.IsPlace)
|
||||
//{
|
||||
// PlaceCards(shelfcards, uidoc);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// NumberCards(shelfcards, uidoc);
|
||||
//}
|
||||
|
||||
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)
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace RookieStation.ProjectConfig.ExecuteCmds
|
||||
{
|
||||
try
|
||||
{
|
||||
var scale = Convert.ToInt32(Properties.Settings.Default.Scale);
|
||||
v.get_Parameter(BuiltInParameter.VIEW_SCALE).Set(scale);
|
||||
var scale = Properties.Settings.Default.Scale;
|
||||
v.get_Parameter(BuiltInParameter.VIEW_SCALE).SetValueString(scale);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:RookieStation.ProjectConfig"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
@@ -76,6 +77,7 @@
|
||||
Grid.Column="1"
|
||||
Height="30"
|
||||
VerticalContentAlignment="Center"
|
||||
hc:InfoElement.Necessary="True"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
PreviewTextInput="tb_PreviewTextInput"
|
||||
TextAlignment="Center" />
|
||||
@@ -99,8 +101,8 @@
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Text="图纸比例:1/ " />
|
||||
<TextBox
|
||||
Text="平面图比例:1/ " />
|
||||
<hc:TextBox
|
||||
x:Name="tbScale"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
|
||||
@@ -32,20 +32,21 @@ namespace RookieStation.ProjectConfig.Views
|
||||
|
||||
tbHeight.Text = Properties.Settings.Default.Height.ToString();
|
||||
tbOrders.Text = Properties.Settings.Default.Orders.ToString();
|
||||
tbProjectName.Text = Properties.Settings.Default.ProjectName.ToString();
|
||||
tbSchoolName.Text = Properties.Settings.Default.SchoolName.ToString();
|
||||
tbProjectName.Text = Properties.Settings.Default.ProjectName;
|
||||
tbSchoolName.Text = Properties.Settings.Default.SchoolName;
|
||||
tbScale.Text = Properties.Settings.Default.Scale;
|
||||
}
|
||||
|
||||
private void btnConfirm_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//ProjectConfigUtil.SetCfgPairs("Height", tbHeight.Text);
|
||||
//ProjectConfigUtil.SetCfgPairs("Orders", tbOrders.Text);
|
||||
Properties.Settings.Default.Height = Convert.ToDouble(tbHeight.Text);
|
||||
Properties.Settings.Default.Orders = Convert.ToInt32(tbOrders.Text);
|
||||
Properties.Settings.Default.SchoolName = tbSchoolName.Text;
|
||||
Properties.Settings.Default.ProjectName = tbProjectName.Text;
|
||||
Properties.Settings.Default.Scale = tbScale.Text;
|
||||
Properties.Settings.Default.Date = tpDate.SelectedDate.Value.ToString("d");
|
||||
Properties.Settings.Default.Height = Convert.ToDouble(tbHeight.Text.Trim());
|
||||
Properties.Settings.Default.Orders = Convert.ToInt32(tbOrders.Text.Trim());
|
||||
Properties.Settings.Default.SchoolName = tbSchoolName.Text.Trim();
|
||||
Properties.Settings.Default.ProjectName = tbProjectName.Text.Trim();
|
||||
Properties.Settings.Default.Scale = tbScale.Text.Trim();
|
||||
Properties.Settings.Default.Date = tpDate.SelectedDate.Value.ToString("d").Trim();
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
Close();
|
||||
|
||||
20
RookieStation/Properties/Resources.Designer.cs
generated
20
RookieStation/Properties/Resources.Designer.cs
generated
@@ -250,6 +250,16 @@ namespace RookieStation.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap UnifyViewport {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("UnifyViewport", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
@@ -280,6 +290,16 @@ namespace RookieStation.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Wire {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Wire", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
|
||||
@@ -175,6 +175,9 @@
|
||||
<data name="SwitchLegend" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SwitchLegend.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="UnifyViewport" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\视口.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ViewPlanDim" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ViewPlanDim.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -184,6 +187,9 @@
|
||||
<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>
|
||||
<data name="Wire" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Wire.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="WorkSchedule" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\WorkSchedule.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
2
RookieStation/Properties/Settings.Designer.cs
generated
2
RookieStation/Properties/Settings.Designer.cs
generated
@@ -75,7 +75,7 @@ namespace RookieStation.Properties {
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("C:\\ProgramData\\Autodesk\\Revit\\Addins\\2020\\RsLibrary\\FamilyLibrary")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("C:\\ProgramData\\Autodesk\\Revit\\Addins\\2020\\RsTools\\FamilyLibrary")]
|
||||
public string FamilyFolder {
|
||||
get {
|
||||
return ((string)(this["FamilyFolder"]));
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</ArrayOfString></Value>
|
||||
</Setting>
|
||||
<Setting Name="FamilyFolder" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">C:\ProgramData\Autodesk\Revit\Addins\2020\RsLibrary\FamilyLibrary</Value>
|
||||
<Value Profile="(Default)">C:\ProgramData\Autodesk\Revit\Addins\2020\RsTools\FamilyLibrary</Value>
|
||||
</Setting>
|
||||
<Setting Name="ProjectName" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">漳州职业技术学院</Value>
|
||||
|
||||
BIN
RookieStation/Resources/Wire.png
Normal file
BIN
RookieStation/Resources/Wire.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 485 B |
BIN
RookieStation/Resources/视口.png
Normal file
BIN
RookieStation/Resources/视口.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 410 B |
@@ -100,6 +100,7 @@
|
||||
<Compile Include="CommonTools\Views\ProgressMonitorView.xaml.cs">
|
||||
<DependentUpon>ProgressMonitorView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateCentralizeAnnotation.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateLightLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateShelvesLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdBatchExportDwg.cs" />
|
||||
@@ -107,7 +108,8 @@
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateSocketLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateSwitchLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateViewSectionAnnotation.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\UnifyViewPlanCropBoxAndPositionOnViewSheet.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateWires.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdUnifyViewportOnViewSheet.cs" />
|
||||
<Compile Include="Drawing\Models\LegendItem.cs" />
|
||||
<Compile Include="Drawing\Models\MaterialItem.cs" />
|
||||
<Compile Include="Drawing\Models\ShelfStatistic.cs" />
|
||||
@@ -162,6 +164,7 @@
|
||||
<Compile Include="ParcelAreaModule\Models\Shelf.cs" />
|
||||
<Compile Include="UserConstant.cs" />
|
||||
<Compile Include="Utils\SQLiteUtil.cs" />
|
||||
<Compile Include="Utils\VistaFolderBrowserDialog.cs" />
|
||||
<Compile Include="Utils\WindowsThumbnailProvider.cs" />
|
||||
<Compile Include="Utils\WinIntPtr.cs" />
|
||||
<Compile Include="ParcelAreaModule\Views\WpfEntranceGate.xaml.cs">
|
||||
@@ -201,6 +204,9 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\智能翼闸.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\开关\三联开关 - 暗装.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -219,6 +225,9 @@
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\亚克力水晶字.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\壁挂灯箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\精工背发光字.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -331,9 +340,6 @@
|
||||
<None Include="RsLibrary\FamilyLibrary\货架\货架端牌.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\侧招灯箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\台卡.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -446,8 +452,10 @@
|
||||
<None Include="Resources\SwitchLegend.png" />
|
||||
<None Include="Resources\SocketLegend.png" />
|
||||
<Content Include="Resources\WallFinishes.png" />
|
||||
<None Include="Resources\Wire.png" />
|
||||
<Content Include="Resources\YTX.ico" />
|
||||
<None Include="Resources\WorkSchedule.png" />
|
||||
<None Include="Resources\视口.png" />
|
||||
<Content Include="RsLibrary\MainMaterials\吊灯.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -141,6 +141,8 @@ namespace RookieStation.RibbonMenu
|
||||
|
||||
CreatePushButton<CmdCreateViewPlanAnnotation>(drawingPanel, "平面标注", Properties.Resources.ViewPlanDim, ViewPlanCmdEnabled);
|
||||
CreatePushButton<CmdCreateViewSectionAnnotation>(drawingPanel, "立面标注", Properties.Resources.ViewSectionDim, ViewSectionCmdEnabled);
|
||||
CreatePushButton<CmdCreateWires>(drawingPanel, "创建导线", Properties.Resources.Wire, ViewPlanCmdEnabled);
|
||||
CreatePushButton<CmdUnifyViewportOnViewSheet>(drawingPanel, "统一视口", Properties.Resources.UnifyViewport, ViewPlanCmdEnabled);
|
||||
CreatePushButton<CmdBatchExportDwg>(drawingPanel, "批量导出DWG", Properties.Resources.ExportDWG, null);
|
||||
|
||||
//通用面板
|
||||
|
||||
BIN
RookieStation/RsLibrary/FamilyLibrary/其他/人流箭头.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/其他/人流箭头.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.0002.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.0002.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.0003.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.0003.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.0004.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.0004.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-右.0002.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-右.0002.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-右.0003.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-右.0003.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-右.0004.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-右.0004.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-左.0003.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-左.0003.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-左.0004.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-左.0004.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-左.0005.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/收检台-左.0005.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/智能翼闸.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/智能翼闸.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/寄件接待台.0002.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/寄件接待台.0002.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/寄件接待台.0003.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/寄件接待台.0003.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/寄件接待台.0004.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/寄件接待台.0004.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-1-5m.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-1-5m.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-1.5m.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-1.5m.0001.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-1.5m.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-1.5m.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-3-0m.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-3-0m.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-3.0m.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-3.0m.0001.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-3.0m.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/家具/绿动回收台-3.0m.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/壁挂灯箱.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/壁挂灯箱.0001.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/壁挂灯箱.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/壁挂灯箱.rfa
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0008.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0008.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0009.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0009.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0010.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0010.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/轨道射灯.0003.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/轨道射灯.0003.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/货架/货架端牌.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/货架/货架端牌.0001.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/货架/货架端牌.0002.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/货架/货架端牌.0002.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/门/幕墙门-双开地弹玻璃门.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/门/幕墙门-双开地弹玻璃门.0001.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/门/幕墙门-双开地弹玻璃门.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/门/幕墙门-双开地弹玻璃门.rfa
Normal file
Binary file not shown.
315
RookieStation/Utils/VistaFolderBrowserDialog.cs
Normal file
315
RookieStation/Utils/VistaFolderBrowserDialog.cs
Normal file
@@ -0,0 +1,315 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
public sealed class VistaFolderBrowserDialog
|
||||
{
|
||||
public string SelectedPath { get; set; }
|
||||
|
||||
public string SelectedElementName { get; private set; }
|
||||
|
||||
public string[] SeletcedPaths { get; private set; }
|
||||
|
||||
public string[] SelectedElementNames { get; private set; }
|
||||
|
||||
public bool AllowNonStoragePlaces { get; set; }
|
||||
|
||||
public bool Multiselect { get; set; }
|
||||
|
||||
public bool ShowDialog() => ShowDialog(IntPtr.Zero);
|
||||
|
||||
public bool ShowDialog(Window owner) => ShowDialog(owner == null ? IntPtr.Zero : new WindowInteropHelper(owner).Handle);
|
||||
|
||||
public bool ShowDialog(IWin32Window owner) => ShowDialog(owner == null ? IntPtr.Zero : owner.Handle);
|
||||
|
||||
public bool ShowDialog(IntPtr owner)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major < 6)
|
||||
{
|
||||
throw new InvalidOperationException("The dialog need at least Windows Vista to work.");
|
||||
}
|
||||
|
||||
IFileOpenDialog dialog = CreateNativeDialog();
|
||||
try
|
||||
{
|
||||
SetInitialFolder(dialog);
|
||||
SetOptions(dialog);
|
||||
|
||||
if (dialog.Show(owner) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetDialogResults(dialog);
|
||||
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.ReleaseComObject(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPathAndElementName(IShellItem item, out string path, out string elementName)
|
||||
{
|
||||
item.GetDisplayName(SIGDN.PARENTRELATIVEFORADDRESSBAR, out elementName);
|
||||
try
|
||||
{
|
||||
item.GetDisplayName(SIGDN.FILESYSPATH, out path);
|
||||
}
|
||||
catch (ArgumentException ex) when (ex.HResult == -2147024809)
|
||||
{
|
||||
path = null;
|
||||
}
|
||||
}
|
||||
|
||||
private IFileOpenDialog CreateNativeDialog()
|
||||
{
|
||||
return new FileOpenDialog() as IFileOpenDialog;
|
||||
}
|
||||
|
||||
private void SetInitialFolder(IFileOpenDialog dialog)
|
||||
{
|
||||
IShellItem item;
|
||||
if (!string.IsNullOrEmpty(SelectedPath))
|
||||
{
|
||||
IntPtr idl;
|
||||
uint atts = 0;
|
||||
if (NativeMethods.SHILCreateFromPath(SelectedPath, out idl, ref atts) == 0
|
||||
&& NativeMethods.SHCreateShellItem(IntPtr.Zero, IntPtr.Zero, idl, out item) == 0)
|
||||
{
|
||||
dialog.SetFolder(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetOptions(IFileOpenDialog dialog)
|
||||
{
|
||||
dialog.SetOptions(GetDialogOptions());
|
||||
}
|
||||
|
||||
private FOS GetDialogOptions()
|
||||
{
|
||||
FOS options = FOS.PICKFOLDERS;
|
||||
if (this.Multiselect)
|
||||
{
|
||||
options |= FOS.ALLOWMULTISELECT;
|
||||
}
|
||||
if (!AllowNonStoragePlaces)
|
||||
{
|
||||
options |= FOS.FORCEFILESYSTEM;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
private void SetDialogResults(IFileOpenDialog dialog)
|
||||
{
|
||||
IShellItem item;
|
||||
if (!this.Multiselect)
|
||||
{
|
||||
dialog.GetResult(out item);
|
||||
string path, value;
|
||||
GetPathAndElementName(item, out path, out value);
|
||||
this.SelectedPath = path;
|
||||
this.SeletcedPaths = new[] { path };
|
||||
this.SelectedElementName = value;
|
||||
this.SelectedElementNames = new[] { value };
|
||||
}
|
||||
else
|
||||
{
|
||||
IShellItemArray items;
|
||||
dialog.GetResults(out items);
|
||||
|
||||
uint count;
|
||||
items.GetCount(out count);
|
||||
|
||||
this.SeletcedPaths = new string[count];
|
||||
this.SelectedElementNames = new string[count];
|
||||
|
||||
for (uint i = 0; i < count; ++i)
|
||||
{
|
||||
items.GetItemAt(i, out item);
|
||||
string path, value;
|
||||
GetPathAndElementName(item, out path, out value);
|
||||
this.SeletcedPaths[i] = path;
|
||||
this.SelectedElementNames[i] = value;
|
||||
}
|
||||
|
||||
this.SelectedPath = null;
|
||||
this.SelectedElementName = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class NativeMethods
|
||||
{
|
||||
[DllImport("shell32.dll")]
|
||||
public static extern int SHILCreateFromPath([MarshalAs(UnmanagedType.LPWStr)] string pszPath, out IntPtr ppIdl, ref uint rgflnOut);
|
||||
|
||||
[DllImport("shell32.dll")]
|
||||
public static extern int SHCreateShellItem(IntPtr pidlParent, IntPtr psfParent, IntPtr pidl, out IShellItem ppsi);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetActiveWindow();
|
||||
}
|
||||
|
||||
[ComImport, Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IShellItem
|
||||
{
|
||||
void BindToHandler([In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc, [In] ref Guid bhid, [In] ref Guid riid, out IntPtr ppv);
|
||||
|
||||
void GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
void GetDisplayName([In] SIGDN sigdnName, [MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
|
||||
|
||||
void GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
void Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder);
|
||||
}
|
||||
|
||||
[ComImport, Guid("B63EA76D-1F85-456F-A19C-48159EFA858B"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
private interface IShellItemArray
|
||||
{
|
||||
void BindToHandler([In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc, [In] ref Guid rbhid, [In] ref Guid riid, out IntPtr ppvOut);
|
||||
|
||||
void GetPropertyStore([In] int Flags, [In] ref Guid riid, out IntPtr ppv);
|
||||
|
||||
void GetPropertyDescriptionList([In, MarshalAs(UnmanagedType.Struct)] ref IntPtr keyType, [In] ref Guid riid, out IntPtr ppv);
|
||||
|
||||
void GetAttributes([In, MarshalAs(UnmanagedType.I4)] IntPtr dwAttribFlags, [In] uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
void GetCount(out uint pdwNumItems);
|
||||
|
||||
void GetItemAt([In] uint dwIndex, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
void EnumItems([MarshalAs(UnmanagedType.Interface)] out IntPtr ppenumShellItems);
|
||||
}
|
||||
|
||||
[ComImport, Guid("d57c7288-d4ad-4768-be02-9d969532d960"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(FileOpenDialog))]
|
||||
private interface IFileOpenDialog
|
||||
{
|
||||
[PreserveSig]
|
||||
int Show([In] IntPtr parent);
|
||||
|
||||
void SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.Struct)] ref IntPtr rgFilterSpec);
|
||||
|
||||
void SetFileTypeIndex([In] uint iFileType);
|
||||
|
||||
void GetFileTypeIndex(out uint piFileType);
|
||||
|
||||
void Advise([In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde, out uint pdwCookie);
|
||||
|
||||
void Unadvise([In] uint dwCookie);
|
||||
|
||||
void SetOptions([In] FOS fos);
|
||||
|
||||
void GetOptions(out FOS pfos);
|
||||
|
||||
void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||
|
||||
void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||
|
||||
void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||
|
||||
void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
|
||||
|
||||
void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
||||
|
||||
void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
||||
|
||||
void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
|
||||
|
||||
void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||
|
||||
void AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, FileDialogCustomPlace fdcp);
|
||||
|
||||
void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);
|
||||
|
||||
void Close([MarshalAs(UnmanagedType.Error)] int hr);
|
||||
|
||||
void SetClientGuid([In] ref Guid guid);
|
||||
|
||||
void ClearClientData();
|
||||
|
||||
void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
|
||||
|
||||
void GetResults([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppenum);
|
||||
|
||||
void GetSelectedItems([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppsai);
|
||||
}
|
||||
|
||||
[ComImport, Guid("DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7")]
|
||||
private class FileOpenDialog
|
||||
{
|
||||
}
|
||||
|
||||
private enum SIGDN : uint
|
||||
{
|
||||
DESKTOPABSOLUTEEDITING = 0x8004c000,
|
||||
|
||||
DESKTOPABSOLUTEPARSING = 0x80028000,
|
||||
|
||||
FILESYSPATH = 0x80058000,
|
||||
|
||||
NORMALDISPLAY = 0,
|
||||
|
||||
PARENTRELATIVE = 0x80080001,
|
||||
|
||||
PARENTRELATIVEEDITING = 0x80031001,
|
||||
|
||||
PARENTRELATIVEFORADDRESSBAR = 0x8007c001,
|
||||
|
||||
PARENTRELATIVEPARSING = 0x80018001,
|
||||
|
||||
URL = 0x80068000
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum FOS
|
||||
{
|
||||
ALLNONSTORAGEITEMS = 0x80,
|
||||
|
||||
ALLOWMULTISELECT = 0x200,
|
||||
|
||||
CREATEPROMPT = 0x2000,
|
||||
|
||||
DEFAULTNOMINIMODE = 0x20000000,
|
||||
|
||||
DONTADDTORECENT = 0x2000000,
|
||||
|
||||
FILEMUSTEXIST = 0x1000,
|
||||
|
||||
FORCEFILESYSTEM = 0x40,
|
||||
|
||||
FORCESHOWHIDDEN = 0x10000000,
|
||||
|
||||
HIDEMRUPLACES = 0x20000,
|
||||
|
||||
HIDEPINNEDPLACES = 0x40000,
|
||||
|
||||
NOCHANGEDIR = 8,
|
||||
|
||||
NODEREFERENCELINKS = 0x100000,
|
||||
|
||||
NOREADONLYRETURN = 0x8000,
|
||||
|
||||
NOTESTFILECREATE = 0x10000,
|
||||
|
||||
NOVALIDATE = 0x100,
|
||||
|
||||
OVERWRITEPROMPT = 2,
|
||||
|
||||
PATHMUSTEXIST = 0x800,
|
||||
|
||||
PICKFOLDERS = 0x20,
|
||||
|
||||
SHAREAWARE = 0x4000,
|
||||
|
||||
STRICTFILETYPES = 4
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
</value>
|
||||
</setting>
|
||||
<setting name="FamilyFolder" serializeAs="String">
|
||||
<value>C:\ProgramData\Autodesk\Revit\Addins\2020\RsLibrary\FamilyLibrary</value>
|
||||
<value>C:\ProgramData\Autodesk\Revit\Addins\2020\RsTools\FamilyLibrary</value>
|
||||
</setting>
|
||||
<setting name="ProjectName" serializeAs="String">
|
||||
<value>漳州职业技术学院</value>
|
||||
|
||||
@@ -411,12 +411,6 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_9DD160189CFD41F5B9852D6C05F96F45"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_9E53E94CA4C84976ACF61A45CF3C085E"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
@@ -525,6 +519,12 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_C90548C0E250410999B35113FBE05958"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_C93A254F3D5E4FDBAE49E9981D5FA10D"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
@@ -2160,26 +2160,6 @@
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9DD160189CFD41F5B9852D6C05F96F45"
|
||||
{
|
||||
"SourcePath" = "8:..\\RookieStation\\bin\\Release\\RsLibrary\\FamilyLibrary\\标识标牌\\侧招灯箱.rfa"
|
||||
"TargetName" = "8:侧招灯箱.rfa"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_B551F2A6C0904D6BBC32D147053B2218"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9E53E94CA4C84976ACF61A45CF3C085E"
|
||||
{
|
||||
"SourcePath" = "8:..\\RookieStation\\bin\\Release\\RsLibrary\\Texture\\菜鸟驿站寄件业务收费标准(210_297竖版).jpg"
|
||||
@@ -2482,6 +2462,26 @@
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C90548C0E250410999B35113FBE05958"
|
||||
{
|
||||
"SourcePath" = "8:..\\RookieStation\\bin\\Release\\RsLibrary\\FamilyLibrary\\标识标牌\\壁挂灯箱.rfa"
|
||||
"TargetName" = "8:壁挂灯箱.rfa"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_B551F2A6C0904D6BBC32D147053B2218"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:FALSE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C93A254F3D5E4FDBAE49E9981D5FA10D"
|
||||
{
|
||||
"SourcePath" = "8:..\\RookieStation\\bin\\Release\\RsLibrary\\MainMaterials\\灰色乳胶漆.png"
|
||||
@@ -3258,15 +3258,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:菜鸟驿站工具集"
|
||||
"ProductCode" = "8:{4B2A717E-F947-4900-B5F1-1A37FC1A5984}"
|
||||
"PackageCode" = "8:{504731B2-B217-4AED-AEF6-5511412AB677}"
|
||||
"ProductCode" = "8:{67534FBD-95B2-49AC-A7EF-14FAF44FE06A}"
|
||||
"PackageCode" = "8:{998F4BCF-4E63-4C8C-A8A7-3901B6D7EE28}"
|
||||
"UpgradeCode" = "8:{127EC3EC-7539-468B-84EA-E1ECDD6204E6}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:TRUE"
|
||||
"ProductVersion" = "8:1.0.4"
|
||||
"ProductVersion" = "8:1.0.5"
|
||||
"Manufacturer" = "8:YTX Engineering"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
|
||||
Reference in New Issue
Block a user