Skip to content

Commit

Permalink
Update OverallCommand.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed Nov 20, 2024
1 parent 575fd57 commit d417c5e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Test/Sample/BenchmarkCommand/OverallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ public class OverallCommand : IExternalCommand
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
var doc = commandData.Application.ActiveUIDocument.Document;
var allElements = new FilteredElementCollector(doc).WhereElementIsNotElementType().ToElements();
BenchmarkReport benchmarkReport = new BenchmarkReport();
benchmarkReport.FolderId = GetFolderId(doc);
benchmarkReport.ItemId = GetItemId(doc);
benchmarkReport.ProjectId = GetProjectId(doc);
benchmarkReport.ProjectGuid = GetProjectGuid(doc);
benchmarkReport.ModelGuid = GetModelGuid(doc);
benchmarkReport.ModelName = doc.Title + ".rvt";
benchmarkReport.Version = doc.Application.VersionName;
benchmarkReport.Version = doc.Application.VersionNumber;
benchmarkReport.Path = GetPath(doc);
benchmarkReport.Unit = GetUnit(doc);
benchmarkReport.Categories = GetCountCategories(doc).ToString();
Expand All @@ -44,7 +43,7 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
// save json
string fileName = "OverallBenchmark.csv";
string filePath =
System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments),
System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile),
fileName);
CsvUtils.WriteOverallBenmark(new List<BenchmarkReport>(){benchmarkReport}, filePath);
Process.Start(filePath);
Expand All @@ -63,12 +62,20 @@ public string GetItemId(Document doc)

public string GetModelGuid(Document doc)
{
if (!doc.IsModelInCloud)
{
return "";
}
ModelPath modelPath = doc.GetCloudModelPath();
return modelPath.GetModelGUID().ToString();
}

public string GetProjectGuid(Document doc)
{
if (!doc.IsModelInCloud)
{
return "";
}
ModelPath modelPath = doc.GetCloudModelPath();
return modelPath.GetProjectGUID().ToString();
}
Expand Down

0 comments on commit d417c5e

Please sign in to comment.