From e924af5564557686b2ab487c006a706b00187ee0 Mon Sep 17 00:00:00 2001 From: kike-garbo Date: Thu, 2 Jan 2025 12:15:21 +0100 Subject: [PATCH] Fix on 'Add Symbol' component. --- docs/pages/_en/1.0/reference/release-notes.md | 2 ++ .../DB/Extensions/ElementLocation.cs | 2 +- .../Components/Annotations/AddSymbol.cs | 12 ++---------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/pages/_en/1.0/reference/release-notes.md b/docs/pages/_en/1.0/reference/release-notes.md index 5b5848d1f..f33698397 100644 --- a/docs/pages/_en/1.0/reference/release-notes.md +++ b/docs/pages/_en/1.0/reference/release-notes.md @@ -22,6 +22,8 @@ group: Deployment & Configs ### RC +- Fix on 'Add Symbol' component when updating element location. + {% endcapture %} {% include ltr/release_header_next.html title="Upcoming Changes" note=rc_release_notes %} diff --git a/src/RhinoInside.Revit.External/DB/Extensions/ElementLocation.cs b/src/RhinoInside.Revit.External/DB/Extensions/ElementLocation.cs index 1e7946c2b..063f95d2b 100644 --- a/src/RhinoInside.Revit.External/DB/Extensions/ElementLocation.cs +++ b/src/RhinoInside.Revit.External/DB/Extensions/ElementLocation.cs @@ -124,7 +124,7 @@ internal static void SetLocation(this T element, XYZ newOrigin, double newAng // Set Origin { var translation = newOrigin - origin; - if (translation.IsZeroLength()) + if (!translation.IsZeroLength()) { if (element.Pinned) element.Pinned = false; modified = true; diff --git a/src/RhinoInside.Revit.GH/Components/Annotations/AddSymbol.cs b/src/RhinoInside.Revit.GH/Components/Annotations/AddSymbol.cs index ed6f0887c..6ee716f07 100644 --- a/src/RhinoInside.Revit.GH/Components/Annotations/AddSymbol.cs +++ b/src/RhinoInside.Revit.GH/Components/Annotations/AddSymbol.cs @@ -142,17 +142,9 @@ ARDB.AnnotationSymbolType type if (detail is null) return false; if (detail.OwnerViewId != view.Id) return false; - if (detail.GetTypeId() != type.Id) - { - if (ARDB.Element.IsValidType(detail.Document, new ARDB.ElementId[] { detail.Id }, type.Id)) - { - if (detail.ChangeTypeId(type.Id) is ARDB.ElementId id && id != ARDB.ElementId.InvalidElementId) - detail = detail.Document.GetElement(id) as ARDB.AnnotationSymbol; - } - else return false; - } + if (detail.GetTypeId() != type.Id) detail.ChangeTypeId(type.Id); - return false; + return true; } ARDB.AnnotationSymbol Create(ARDB.View view, ARDB.XYZ point, ARDB.AnnotationSymbolType type)