Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/production_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ jobs:
run: |
(Get-Content GltfInstaller/Program.cs) -replace '0.0.0', $env:FULL_VERSION | Out-File -encoding ASCII GltfInstaller/Program.cs

- name: Configuring ClickupEndpoint
run: |
$apiUrl = "${{ secrets.EVERSE_LEIA_Clickup }}"
(Get-Content Common_glTF_Exporter/Utils/ClickUpFormSender.cs) -replace 'ClickupEndPoint', $apiUrl | Out-File -encoding ASCII Common_glTF_Exporter/Utils/ClickUpFormSender.cs
shell: pwsh

- name: Build and Publish App
run: msbuild Revit_glTF_Exporter.sln /t:Clean,Build /p:platform="Any CPU" /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile

Expand Down
15 changes: 15 additions & 0 deletions Common_glTF_Exporter/Common_glTF_Exporter.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Transform\ModelRotation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Transform\ModelScale.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\Analytics.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\ClickUpFormSender.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\DirectoryUtils.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\ExportLog.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\Hyperlink.cs" />
Expand All @@ -82,6 +83,12 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows\AboutUsWindow.xaml.cs">
<DependentUpon>AboutUsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows\ErrorReportWindow.xaml.cs">
<DependentUpon>ErrorReportWindow.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows\ErrorWindow.xaml.cs">
<DependentUpon>ErrorWindow.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows\FeedbackWindow.xaml.cs">
<DependentUpon>FeedbackWindow.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -145,6 +152,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows\ErrorReportWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows\ErrorWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows\FeedbackWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
3 changes: 2 additions & 1 deletion Common_glTF_Exporter/Core/GLTFVersion.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Common_glTF_Exporter.Core
{
using Common_glTF_Exporter.Utils;
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -11,7 +12,7 @@
public class GLTFVersion
{
public string version = "2.0";
public string generator = "e-verse custom generator";
public string generator = string.Concat("e-verse custom generator ", SettingsConfig.currentVersion);
public string copyright = "free tool created by e-verse";
}
}
7 changes: 4 additions & 3 deletions Common_glTF_Exporter/Core/GlTFExportContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public RenderNodeAction OnElementBegin(ElementId elementId)
currentGeometry.Reset();
currentVertices.Reset();

SettingsConfig.UpdatedLastElement(elementId);
return RenderNodeAction.Proceed;
}

Expand Down Expand Up @@ -221,11 +222,11 @@ public void OnElementEnd(ElementId elementId)
bufferViews,
kvp.Value,
kvp.Key,
#if REVIT2024 || REVIT2025 || REVIT2026
#if REVIT2024 || REVIT2025 || REVIT2026
elementId.Value,
#else
#else
elementId.IntegerValue,
#endif
#endif
preferences,
mat,
images,
Expand Down
3 changes: 2 additions & 1 deletion Common_glTF_Exporter/ExternalCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
catch (Exception ex)
{
Analytics.Send("Error", ex.Message).GetAwaiter();
ExportLog.Write($"Last Element Processed {SettingsConfig.lastElement}");
ExportLog.WriteException(ex);
MessageWindow.Show("Error", ex.Message);
ErrorWindow.Show(ex.Message);
return Result.Failed;
}
}
Expand Down
9 changes: 7 additions & 2 deletions Common_glTF_Exporter/Materials/AssetProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public static class AssetPropertiesUtils
{ "PrismMetalSchema", Autodesk.Revit.DB.Visual.AdvancedMetal.SurfaceAlbedo },
{ "PrismWoodSchema", Autodesk.Revit.DB.Visual.AdvancedWood.WoodCurlyDistortionMap },
{ "HardwoodSchema", Autodesk.Revit.DB.Visual.Hardwood.HardwoodColor },
{ "PrismMasonryCMUSchema", Autodesk.Revit.DB.Visual.MasonryCMU.MasonryCMUPatternMap },
{ "PrismMasonryCMUSchema", Autodesk.Revit.DB.Visual.MasonryCMU.MasonryCMUColor },
{ "MasonryCMUSchema", Autodesk.Revit.DB.Visual.MasonryCMU.MasonryCMUColor },
{ "PrismOpaqueSchema", Autodesk.Revit.DB.Visual.AdvancedOpaque.OpaqueAlbedo }
};

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

var prop = theAsset.FindByName(diffusePropertyName);
if (prop?.NumberOfConnectedProperties > 0)

if (prop == null)
return null;

if (prop.NumberOfConnectedProperties == 1)
{
return prop.GetSingleConnectedAsset();
}
Expand Down
55 changes: 55 additions & 0 deletions Common_glTF_Exporter/Utils/ClickUpFormSender.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Common_glTF_Exporter.Utils;
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

public static class ClickUpFormSender
{
public static async Task CreateClickUpTask(string email, string errorDescription, string exError)
{
string url = "ClickupEndPoint";
string description = $"{email}\n{errorDescription}\n{exError}";

using (var client = new HttpClient())
{
// Leer el archivo de forma síncrona (compatible con .NET Framework)
byte[] fileBytes = File.ReadAllBytes(ExportLog.logFilePath);

var content = new ByteArrayContent(fileBytes);
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

// Crear el JSON dinámicamente, incluyendo la descripción
string taskJson = $"{{\"name\":\"Bug Report\",\"description\":\"{EscapeJson(description)}\"}}";

// Agregar headers
content.Headers.Add("x-file-name", ExportLog.FileLogName);
content.Headers.Add("x-task-json", taskJson);

try
{
Console.WriteLine("Uploading file...");
HttpResponseMessage response = await client.PostAsync(url, content);

string responseText = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response status: " + response.StatusCode);
Console.WriteLine("Response body: " + responseText);
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
}

// Escapa caracteres especiales para que no rompan el JSON
private static string EscapeJson(string value)
{
return value
.Replace("\\", "\\\\")
.Replace("\"", "\\\"")
.Replace("\n", "\\n")
.Replace("\r", "\\r");
}
}
3 changes: 2 additions & 1 deletion Common_glTF_Exporter/Utils/ExportLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace Common_glTF_Exporter.Utils
{
public class ExportLog
{
private static readonly string logFilePath = Path.Combine(Links.configDir, "leia_log.txt");
public static readonly string FileLogName = "leia_log.txt";
public static readonly string logFilePath = Path.Combine(Links.configDir, FileLogName);

public static void StartLog()
{
Expand Down
1 change: 1 addition & 0 deletions Common_glTF_Exporter/Utils/LogConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static void SaveConfig()
ExportLog.Write($"compression: {compression}");
ExportLog.Write($"release: {release}");
ExportLog.Write($"runs: {runs}");
ExportLog.Write($"LeiaVersion: {SettingsConfig.currentVersion}");
}

}
Expand Down
35 changes: 34 additions & 1 deletion Common_glTF_Exporter/Utils/SettingsConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Autodesk.Revit.DB;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
Expand All @@ -15,6 +16,7 @@
Path.Combine(Links.configDir, "leia.config");

private static readonly object _locker = new object();
public static int lastElement = 0;

static SettingsConfig()
{
Expand Down Expand Up @@ -129,5 +131,36 @@

doc.Save(_configFile);
}

public static void UpdatedLastElement(ElementId elementId)
{
try
{
if (elementId == null)
{
lastElement = -1;
return;
}

if (elementId == ElementId.InvalidElementId)
{
lastElement = -1;
return;
}

#if REVIT2024 || REVIT2025 || REVIT2026

long longValue = (long)elementId.Value;
lastElement = Convert.ToInt32(elementId.Value);

#else
lastElement = elementId.IntegerValue;
#endif
}
catch (OverflowException ex)

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used

Check warning on line 160 in Common_glTF_Exporter/Utils/SettingsConfig.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
{
lastElement = -1;
}
}
}
}
112 changes: 112 additions & 0 deletions Common_glTF_Exporter/Windows/ErrorReportWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<Window x:Class="Revit_glTF_Exporter.ErrorReportWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Revit_glTF_Exporter"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="Exporting process in progress..."
Height="335"
Width="357"
ResizeMode="NoResize"
Topmost="True"
ShowInTaskbar="True"
Style="{DynamicResource CustomWindowStyle}">


<Border Background="{DynamicResource BackgroundColor}"
BorderBrush="Transparent"
BorderThickness="1,1,1,1"
CornerRadius="8,8,8,8"
MouseDown="Border_MouseDown" Margin="15,5,13,15">
<Border.Effect>
<DropShadowEffect BlurRadius="20" Color="Gray" Opacity="0.3" ShadowDepth="0" Direction="0"></DropShadowEffect>
</Border.Effect>

<Grid
Background="Transparent" Margin="20">

<Button Style="{DynamicResource MainTitleButtonStyle}"
Background="Transparent"
BorderBrush="Transparent"
Click="Leia_Link"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="0,0,0,0" Height="44" Width="149" >
</Button>

<Button
Style="{DynamicResource TabCloseButtonStyle}"
Name="CloseButton"
Click="CancelProcess_Click"
HorizontalAlignment="Right"
VerticalAlignment="Top"/>

<StackPanel Orientation="Vertical" Margin="0,49,0,0">
<Line Stroke="{DynamicResource MainGray}"
X2="1000"
Opacity="0.5"
StrokeThickness="4"
VerticalAlignment="Top"
Margin="-9,0,-9,10" RenderTransformOrigin="0.5,0.5" Height="2">
<Line.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Line.RenderTransform>
</Line>

<TextBlock TextWrapping="Wrap"
Text="Email"
TextAlignment="Left"
Foreground="{DynamicResource MainGray}"
HorizontalAlignment="Left"
Height="18"
VerticalAlignment="Top"
RenderTransformOrigin="0.16,0.487"/>

<TextBox x:Name="email_textBox"
Style="{DynamicResource MainTextBox}"
TextWrapping="Wrap"
Width="287"
HorizontalAlignment="Center"
Margin="0,5,0,20"/>

<TextBlock TextWrapping="Wrap"
Text="Error Description"
TextAlignment="Left"
Foreground="{DynamicResource MainGray}"
Height="18" />

<TextBox x:Name="description_textBox"
Style="{DynamicResource MainTextBox}"
TextWrapping="Wrap"
VerticalAlignment="Top"
Width="287"
Height="50"
Margin="0,5,0,20"/>

</StackPanel>

<Button Content="Report"
Style="{DynamicResource MainButtonStyle}"
Width="129"
Click="Report_Click"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"/>
</Grid>
</Border>

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

</Window>
Loading
Loading