update installer

This commit is contained in:
Zhuangkh 2022-10-12 17:59:18 +08:00
parent c52fcfc606
commit ddc463824b
6 changed files with 58 additions and 18 deletions

View File

@ -18,6 +18,7 @@ using System.Runtime.InteropServices;
using TriangleNet; using TriangleNet;
using uBIMEarthTools.Utils; using uBIMEarthTools.Utils;
using uBIMEarthTools.Model; using uBIMEarthTools.Model;
using System.Reflection;
namespace uBIMEarthTools.Commands namespace uBIMEarthTools.Commands
{ {
@ -61,11 +62,8 @@ namespace uBIMEarthTools.Commands
if (!familys.Any()) if (!familys.Any())
{ {
transaction.Start("Load Family"); transaction.Start("Load Family");
byte[] bit = Resource. as byte[]; string filepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Family\\地质钻孔圆柱.rfa";
string filepath = AppConfig.APP_TEMP_PATH + "\\地质钻孔圆柱.rfa";
File.WriteAllBytes(filepath, bit);
doc.LoadFamily(filepath); doc.LoadFamily(filepath);
File.Delete(filepath);
transaction.Commit(); transaction.Commit();
} }

View File

@ -5,7 +5,9 @@ using Autodesk.Revit.UI;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using uBIMEarthTools.Core; using uBIMEarthTools.Core;
using uBIMEarthTools.Model; using uBIMEarthTools.Model;
@ -123,18 +125,32 @@ namespace uBIMEarthTools.Commands
Common.SetTransaction(transaction); Common.SetTransaction(transaction);
#region #region
transaction.Start("load the FamilySymbol");
IEnumerable<FamilySymbol> familysymbols_bj = from elem in new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)) IEnumerable<Element> familys = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).OfClass(typeof(FamilySymbol)).Where(x => x.Name == "钻孔标记");
let fstmp = elem as FamilySymbol if (!familys.Any())
where fstmp.Name.Contains("钻孔标记")
select fstmp;
if (!familysymbols_bj.Any())
{ {
MessageBox.Show("请先加载配套的“钻孔标记”族。", "uBIM", MessageBoxButtons.OK); transaction.Start("Load Family");
status = transGroup.Assimilate(); string filepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Family\\钻孔标记.rfa";
return Result.Succeeded; doc.LoadFamily(filepath);
transaction.Commit();
} }
FamilySymbol fs_bj = doc.GetElement(familysymbols_bj.First().Id) as FamilySymbol;
transaction.Start("load the FamilySymbol");
//IEnumerable<FamilySymbol> familysymbols_bj = from elem in new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol))
// let fstmp = elem as FamilySymbol
// where fstmp.Name.Contains("钻孔标记")
// select fstmp;
//if (!familysymbols_bj.Any())
//{
// MessageBox.Show("请先加载配套的“钻孔标记”族。", "uBIM", MessageBoxButtons.OK);
// status = transGroup.Assimilate();
// return Result.Succeeded;
//}
//FamilySymbol fs_bj = doc.GetElement(familysymbols_bj.First().Id) as FamilySymbol;
//fs_bj.Activate();
var fs_bj = (new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_GenericModel).OfClass(typeof(FamilySymbol))
.Where(x => x.Name == "钻孔标记").First() as FamilySymbol);
fs_bj.Activate(); fs_bj.Activate();
transaction.Commit(); transaction.Commit();
@ -237,8 +253,18 @@ namespace uBIMEarthTools.Commands
#region #region
using (FilterProgressForm prf1 = new FilterProgressForm("生成地质模型", "{0} of " + geologyBlocks.Count.ToString(), geologyBlocks.Count)) using (FilterProgressForm prf1 = new FilterProgressForm("生成地质模型", "{0} of " + geologyBlocks.Count.ToString(), geologyBlocks.Count))
{ {
familys = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).OfClass(typeof(FamilySymbol)).Where(x => x.Name == "常规模型地质块");
if (!familys.Any())
{
transaction.Start("Load Family");
string filepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Family\\常规模型地质块.rfa";
doc.LoadFamily(filepath);
transaction.Commit();
}
Family family = (new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel) Family family = (new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel)
.OfClass(typeof(FamilySymbol)).First(x => x.Name == "常规模型地质块") as FamilySymbol).Family; .OfClass(typeof(FamilySymbol)).First(x => x.Name == "常规模型地质块") as FamilySymbol).Family;
Autodesk.Revit.DB.Document fdoc = doc.EditFamily(family); Autodesk.Revit.DB.Document fdoc = doc.EditFamily(family);
Transaction trans = new Transaction(fdoc); Transaction trans = new Transaction(fdoc);
trans.Start("Create FamilySymbol"); trans.Start("Create FamilySymbol");

View File

@ -4,17 +4,19 @@
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Resource.Designer.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Resource.resx" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="PackageContents.xml" /> <None Remove="PackageContents.xml" />
<None Remove="uBIMEarthTools.addin" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="PackageContents.xml"> <Content Include="PackageContents.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="uBIMEarthTools.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="EPPlus" Version="5.6.4" /> <PackageReference Include="EPPlus" Version="5.6.4" />
@ -25,4 +27,18 @@
<PackageReference Include="Triangle" Version="0.0.6-Beta3" /> <PackageReference Include="Triangle" Version="0.0.6-Beta3" />
<PackageReference Include="uBIM.UI" Version="1.0.0" /> <PackageReference Include="uBIM.UI" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Family\地质钻孔圆柱.rfa">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Family\常规模型地质块.rfa">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Family\钻孔标记.rfa">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="uBIMEarthTools.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>