Skip to content

Commit a286d7b

Browse files
authored
Merge pull request #129 from EverseDevelopment/develop
Develop
2 parents bc9cb5d + 9167e9f commit a286d7b

14 files changed

+494
-9
lines changed

.github/workflows/production_actions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ jobs:
153153
run: |
154154
(Get-Content GltfInstaller/Program.cs) -replace '0.0.0', $env:FULL_VERSION | Out-File -encoding ASCII GltfInstaller/Program.cs
155155
156+
- name: Configuring ClickupEndpoint
157+
run: |
158+
$apiUrl = "${{ secrets.EVERSE_LEIA_Clickup }}"
159+
(Get-Content Common_glTF_Exporter/Utils/ClickUpFormSender.cs) -replace 'ClickupEndPoint', $apiUrl | Out-File -encoding ASCII Common_glTF_Exporter/Utils/ClickUpFormSender.cs
160+
shell: pwsh
161+
156162
- name: Build and Publish App
157163
run: msbuild Revit_glTF_Exporter.sln /t:Clean,Build /p:platform="Any CPU" /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
158164

Common_glTF_Exporter/Common_glTF_Exporter.projitems

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<Compile Include="$(MSBuildThisFileDirectory)Transform\ModelRotation.cs" />
6565
<Compile Include="$(MSBuildThisFileDirectory)Transform\ModelScale.cs" />
6666
<Compile Include="$(MSBuildThisFileDirectory)Utils\Analytics.cs" />
67+
<Compile Include="$(MSBuildThisFileDirectory)Utils\ClickUpFormSender.cs" />
6768
<Compile Include="$(MSBuildThisFileDirectory)Utils\DirectoryUtils.cs" />
6869
<Compile Include="$(MSBuildThisFileDirectory)Utils\ExportLog.cs" />
6970
<Compile Include="$(MSBuildThisFileDirectory)Utils\Hyperlink.cs" />
@@ -82,6 +83,12 @@
8283
<Compile Include="$(MSBuildThisFileDirectory)Windows\AboutUsWindow.xaml.cs">
8384
<DependentUpon>AboutUsWindow.xaml</DependentUpon>
8485
</Compile>
86+
<Compile Include="$(MSBuildThisFileDirectory)Windows\ErrorReportWindow.xaml.cs">
87+
<DependentUpon>ErrorReportWindow.xaml</DependentUpon>
88+
</Compile>
89+
<Compile Include="$(MSBuildThisFileDirectory)Windows\ErrorWindow.xaml.cs">
90+
<DependentUpon>ErrorWindow.xaml</DependentUpon>
91+
</Compile>
8592
<Compile Include="$(MSBuildThisFileDirectory)Windows\FeedbackWindow.xaml.cs">
8693
<DependentUpon>FeedbackWindow.xaml</DependentUpon>
8794
</Compile>
@@ -145,6 +152,14 @@
145152
<SubType>Designer</SubType>
146153
<Generator>MSBuild:Compile</Generator>
147154
</Page>
155+
<Page Include="$(MSBuildThisFileDirectory)Windows\ErrorReportWindow.xaml">
156+
<SubType>Designer</SubType>
157+
<Generator>MSBuild:Compile</Generator>
158+
</Page>
159+
<Page Include="$(MSBuildThisFileDirectory)Windows\ErrorWindow.xaml">
160+
<SubType>Designer</SubType>
161+
<Generator>MSBuild:Compile</Generator>
162+
</Page>
148163
<Page Include="$(MSBuildThisFileDirectory)Windows\FeedbackWindow.xaml">
149164
<SubType>Designer</SubType>
150165
<Generator>MSBuild:Compile</Generator>

Common_glTF_Exporter/Core/GLTFVersion.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace Common_glTF_Exporter.Core
22
{
3+
using Common_glTF_Exporter.Utils;
34
using System;
45
using System.Collections.Generic;
56
using System.Text;
@@ -11,7 +12,7 @@
1112
public class GLTFVersion
1213
{
1314
public string version = "2.0";
14-
public string generator = "e-verse custom generator";
15+
public string generator = string.Concat("e-verse custom generator ", SettingsConfig.currentVersion);
1516
public string copyright = "free tool created by e-verse";
1617
}
1718
}

Common_glTF_Exporter/Core/GlTFExportContext.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public RenderNodeAction OnElementBegin(ElementId elementId)
178178
currentGeometry.Reset();
179179
currentVertices.Reset();
180180

181+
SettingsConfig.UpdatedLastElement(elementId);
181182
return RenderNodeAction.Proceed;
182183
}
183184

@@ -221,11 +222,11 @@ public void OnElementEnd(ElementId elementId)
221222
bufferViews,
222223
kvp.Value,
223224
kvp.Key,
224-
#if REVIT2024 || REVIT2025 || REVIT2026
225+
#if REVIT2024 || REVIT2025 || REVIT2026
225226
elementId.Value,
226-
#else
227+
#else
227228
elementId.IntegerValue,
228-
#endif
229+
#endif
229230
preferences,
230231
mat,
231232
images,

Common_glTF_Exporter/ExternalCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
3939
catch (Exception ex)
4040
{
4141
Analytics.Send("Error", ex.Message).GetAwaiter();
42+
ExportLog.Write($"Last Element Processed {SettingsConfig.lastElement}");
4243
ExportLog.WriteException(ex);
43-
MessageWindow.Show("Error", ex.Message);
44+
ErrorWindow.Show(ex.Message);
4445
return Result.Failed;
4546
}
4647
}

Common_glTF_Exporter/Materials/AssetProperties.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public static class AssetPropertiesUtils
1717
{ "PrismMetalSchema", Autodesk.Revit.DB.Visual.AdvancedMetal.SurfaceAlbedo },
1818
{ "PrismWoodSchema", Autodesk.Revit.DB.Visual.AdvancedWood.WoodCurlyDistortionMap },
1919
{ "HardwoodSchema", Autodesk.Revit.DB.Visual.Hardwood.HardwoodColor },
20-
{ "PrismMasonryCMUSchema", Autodesk.Revit.DB.Visual.MasonryCMU.MasonryCMUPatternMap },
20+
{ "PrismMasonryCMUSchema", Autodesk.Revit.DB.Visual.MasonryCMU.MasonryCMUColor },
21+
{ "MasonryCMUSchema", Autodesk.Revit.DB.Visual.MasonryCMU.MasonryCMUColor },
2122
{ "PrismOpaqueSchema", Autodesk.Revit.DB.Visual.AdvancedOpaque.OpaqueAlbedo }
2223
};
2324

@@ -30,7 +31,11 @@ public static Asset GetDiffuseBitmap(Asset theAsset, string baseSchema)
3031
return null;
3132

3233
var prop = theAsset.FindByName(diffusePropertyName);
33-
if (prop?.NumberOfConnectedProperties > 0)
34+
35+
if (prop == null)
36+
return null;
37+
38+
if (prop.NumberOfConnectedProperties == 1)
3439
{
3540
return prop.GetSingleConnectedAsset();
3641
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using Common_glTF_Exporter.Utils;
2+
using System;
3+
using System.IO;
4+
using System.Net.Http;
5+
using System.Net.Http.Headers;
6+
using System.Threading.Tasks;
7+
8+
public static class ClickUpFormSender
9+
{
10+
public static async Task CreateClickUpTask(string email, string errorDescription, string exError)
11+
{
12+
string url = "ClickupEndPoint";
13+
string description = $"{email}\n{errorDescription}\n{exError}";
14+
15+
using (var client = new HttpClient())
16+
{
17+
// Leer el archivo de forma síncrona (compatible con .NET Framework)
18+
byte[] fileBytes = File.ReadAllBytes(ExportLog.logFilePath);
19+
20+
var content = new ByteArrayContent(fileBytes);
21+
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
22+
23+
// Crear el JSON dinámicamente, incluyendo la descripción
24+
string taskJson = $"{{\"name\":\"Bug Report\",\"description\":\"{EscapeJson(description)}\"}}";
25+
26+
// Agregar headers
27+
content.Headers.Add("x-file-name", ExportLog.FileLogName);
28+
content.Headers.Add("x-task-json", taskJson);
29+
30+
try
31+
{
32+
Console.WriteLine("Uploading file...");
33+
HttpResponseMessage response = await client.PostAsync(url, content);
34+
35+
string responseText = await response.Content.ReadAsStringAsync();
36+
Console.WriteLine("Response status: " + response.StatusCode);
37+
Console.WriteLine("Response body: " + responseText);
38+
}
39+
catch (Exception ex)
40+
{
41+
Console.WriteLine("Error: " + ex.Message);
42+
}
43+
}
44+
}
45+
46+
// Escapa caracteres especiales para que no rompan el JSON
47+
private static string EscapeJson(string value)
48+
{
49+
return value
50+
.Replace("\\", "\\\\")
51+
.Replace("\"", "\\\"")
52+
.Replace("\n", "\\n")
53+
.Replace("\r", "\\r");
54+
}
55+
}

Common_glTF_Exporter/Utils/ExportLog.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ namespace Common_glTF_Exporter.Utils
66
{
77
public class ExportLog
88
{
9-
private static readonly string logFilePath = Path.Combine(Links.configDir, "leia_log.txt");
9+
public static readonly string FileLogName = "leia_log.txt";
10+
public static readonly string logFilePath = Path.Combine(Links.configDir, FileLogName);
1011

1112
public static void StartLog()
1213
{

Common_glTF_Exporter/Utils/LogConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static void SaveConfig()
3535
ExportLog.Write($"compression: {compression}");
3636
ExportLog.Write($"release: {release}");
3737
ExportLog.Write($"runs: {runs}");
38+
ExportLog.Write($"LeiaVersion: {SettingsConfig.currentVersion}");
3839
}
3940

4041
}

Common_glTF_Exporter/Utils/SettingsConfig.cs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using Autodesk.Revit.DB;
2+
using System;
23
using System.Collections.Generic;
34
using System.Configuration;
45
using System.IO;
@@ -15,6 +16,7 @@ public static class SettingsConfig
1516
Path.Combine(Links.configDir, "leia.config");
1617

1718
private static readonly object _locker = new object();
19+
public static int lastElement = 0;
1820

1921
static SettingsConfig()
2022
{
@@ -129,5 +131,36 @@ private static void CreateDefaultConfig()
129131

130132
doc.Save(_configFile);
131133
}
134+
135+
public static void UpdatedLastElement(ElementId elementId)
136+
{
137+
try
138+
{
139+
if (elementId == null)
140+
{
141+
lastElement = -1;
142+
return;
143+
}
144+
145+
if (elementId == ElementId.InvalidElementId)
146+
{
147+
lastElement = -1;
148+
return;
149+
}
150+
151+
#if REVIT2024 || REVIT2025 || REVIT2026
152+
153+
long longValue = (long)elementId.Value;
154+
lastElement = Convert.ToInt32(elementId.Value);
155+
156+
#else
157+
lastElement = elementId.IntegerValue;
158+
#endif
159+
}
160+
catch (OverflowException ex)
161+
{
162+
lastElement = -1;
163+
}
164+
}
132165
}
133166
}

0 commit comments

Comments
 (0)