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

View File

@ -5,7 +5,9 @@ using Autodesk.Revit.UI;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using uBIMEarthTools.Core;
using uBIMEarthTools.Model;
@ -123,18 +125,32 @@ namespace uBIMEarthTools.Commands
Common.SetTransaction(transaction);
#region
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())
IEnumerable<Element> familys = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).OfClass(typeof(FamilySymbol)).Where(x => x.Name == "钻孔标记");
if (!familys.Any())
{
MessageBox.Show("请先加载配套的“钻孔标记”族。", "uBIM", MessageBoxButtons.OK);
status = transGroup.Assimilate();
return Result.Succeeded;
transaction.Start("Load Family");
string filepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + "\\Family\\钻孔标记.rfa";
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();
transaction.Commit();
@ -237,8 +253,18 @@ namespace uBIMEarthTools.Commands
#region
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)
.OfClass(typeof(FamilySymbol)).First(x => x.Name == "常规模型地质块") as FamilySymbol).Family;
Autodesk.Revit.DB.Document fdoc = doc.EditFamily(family);
Transaction trans = new Transaction(fdoc);
trans.Start("Create FamilySymbol");

View File

@ -4,17 +4,19 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Resource.Designer.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Resource.resx" />
</ItemGroup>
<ItemGroup>
<None Remove="PackageContents.xml" />
<None Remove="uBIMEarthTools.addin" />
</ItemGroup>
<ItemGroup>
<Content Include="PackageContents.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="uBIMEarthTools.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="EPPlus" Version="5.6.4" />
@ -25,4 +27,18 @@
<PackageReference Include="Triangle" Version="0.0.6-Beta3" />
<PackageReference Include="uBIM.UI" Version="1.0.0" />
</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>