<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extraer parametro Comentario con WPF(Extract Comment parameter with WPF) in Revit, BIM 360 &amp; Autodesk Construction Cloud (ACC) - Español</title>
    <link>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10342253#M19076</link>
    <description>&lt;P&gt;I don't know the nature of your error in terms of exception messages or what part of code isn't working specifically?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can't interact with Revit when showing modal dialogue. For modal you need to close, interact with Revit and re-show. For modeless you need to use ExternalEvent and implement IExternalEventHandler.&lt;/P&gt;</description>
    <pubDate>Wed, 26 May 2021 20:19:49 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2021-05-26T20:19:49Z</dc:date>
    <item>
      <title>Extraer parametro Comentario con WPF(Extract Comment parameter with WPF)</title>
      <link>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10341691#M19073</link>
      <description>&lt;P&gt;Hice un pequeño script con WPF para extraer el parametro comentario(Ejemplo puertas).&lt;BR /&gt;No puedo hacerlo,aqui estas mi codigos,que falta?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;I made a small script with WPF to extract the comment parameter (Example doors).
I can't do it, here are my codes, what's missing?&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;class Utils
    {
        //variable
       public string Nombre { get; set; }
        public string Comentario { get; set; }
        public string Marca { get; set; }
        public string datos { get; set; }

        //public Document _doc;


        #region Seleccionar Elemento
        /// &amp;lt;summary&amp;gt;
        /// Seleccionar un elemento
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="uidoc"&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="doc"&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
        public Element SeleccElement(UIDocument uidoc)
        {
            //Documentos
            Document doc = uidoc.Document;

            //Seleccionar Elemento en la pantalla
            TaskDialog.Show("Info_Revit", "Seleccione un elemento");

            // Access current selection
            Selection sel = uidoc.Selection;

            //Obtener la referencia seleccionada
            Reference reference = sel.PickObject(ObjectType.Element, "Seleccione un Elemento");

            //Obtener el elemento elegido
            Element element = doc.GetElement(reference);

            return element;
        }
        #endregion

        public string Getdata(Document doc, Element elem)
        {
            BuiltInParameter built_name = BuiltInParameter.ELEM_FAMILY_PARAM;
            BuiltInParameter built_Comments = BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS;
            BuiltInParameter built_Marca = BuiltInParameter.ALL_MODEL_MARK;

            Nombre = string.Format("Nombre {0} =&amp;gt; ID {1} ", elem.get_Parameter(built_name).AsValueString(), "&amp;lt;" + elem.Id.IntegerValue.ToString() + "&amp;gt;");
            Parameter param_Commen = elem.get_Parameter(built_Comments);
            Parameter param_Marca = elem.get_Parameter(built_Marca);

            if (param_Commen != null)
            {
                Comentario = param_Commen.AsValueString();
            }
            
            if (param_Marca != null)
            {
                Marca = param_Marca.AsValueString();
            }
            datos = Nombre + Comentario + Marca;

            return datos;
        }

        public void SetData(UIDocument uidoc, Element elem)
        {
            Document doc = uidoc.Document;
            
            BuiltInParameter built_Comments = BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS;
            //BuiltInParameter built_Marca = BuiltInParameter.ALL_MODEL_MARK;
            
            Parameter param_Commen = elem.get_Parameter(built_Comments);
           // Parameter param_Marca = elem.get_Parameter(built_Marca);

           // Comentario = param_Commen.AsValueString();

            //Iniciar una transaccion
            using (Transaction trans = new Transaction(doc, "Modificar Parametro"))
            {
                trans.Start();
                //Modificar los parametros
                if (param_Commen != null)
                {
                    //Comentario = param_Commen.AsValueString();
                    //param_Commen.Set(Comentario);
                    MessageBox.Show(Comentario);
                }
                //if (param_Marca != null)
                //{
                //    param_Marca.Set(Marca);
                //}
                trans.Commit();

                TaskDialog.Show("Info_Revit", "Parametro Modificado correctmente");
            }
        }
    }

/// &amp;lt;summary&amp;gt;
    /// Lógica de interacción para MainWindow_Seleccion.xaml
    /// &amp;lt;/summary&amp;gt;
    public partial class MainWindow_Seleccion : Window
    {
        //Accesos
        UIDocument _uidoc;
        Document _doc;
        Element _elem;

        public MainWindow_Seleccion(UIDocument uidoc,Element elem)
        {
            Document doc = uidoc.Document;
            InitializeComponent();
            this._doc = doc;
            this._elem = elem;
            this._uidoc = uidoc;
            Utils u = new Utils();
            u.datos = u.Getdata(_doc, _elem);

            this.DataContext =u;
        }

        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            Utils u = new Utils();
            u.SetData(_uidoc, _elem);
            this.Close();
            
        }
    }

....
try
            {
                Utils utils = new Utils();
                Element elem = utils.SeleccElement(uidoc);
                MainWindow_Seleccion _Seleccion = new MainWindow_Seleccion(uidoc,elem);
                _Seleccion.ShowDialog();

                // Assuming that everything went right return Result.Succeeded
                return Result.Succeeded;
            }
            // This is where we "catch" potential errors and define how to deal with them
            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                // If user decided to cancel the operation return Result.Canceled
                return Result.Cancelled;
            }
&amp;lt;Window x:Class="Seleccionar.MainWindow_Seleccion"
             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:Seleccionar"
             mc:Ignorable="d" 
             Height="280" Width="420" 
             Title="Ventana de Seleccion"
             Background="Lavender" WindowStartupLocation="CenterScreen"
             ResizeMode="CanResize"&amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;!-- Crear filas--&amp;gt;
        &amp;lt;Grid.RowDefinitions&amp;gt;
            &amp;lt;RowDefinition Height="30"/&amp;gt;
            &amp;lt;RowDefinition Height="25"/&amp;gt;
            &amp;lt;RowDefinition Height="250*"/&amp;gt;
            &amp;lt;RowDefinition Height="25"/&amp;gt;
        &amp;lt;/Grid.RowDefinitions&amp;gt;
        &amp;lt;Label Content="Editar Parametros" FontSize="18" FontWeight="Black" HorizontalContentAlignment="Center" /&amp;gt;
        &amp;lt;Label Grid.Row="1" Content="Informacion del Elemento" 
               FontSize="14" Foreground="Black" 
               ScrollViewer.VerticalScrollBarVisibility="Disabled" 
               Background="#FF2AB25B" /&amp;gt;
        &amp;lt;DockPanel  Grid.Row="2" Margin="5"&amp;gt;
            &amp;lt;Border CornerRadius="6" BorderBrush="Gray" BorderThickness="2" &amp;gt;
                &amp;lt;StackPanel Grid.Column="0" Grid.Row="2"&amp;gt;
                    &amp;lt;!-- Nombre--&amp;gt;
                    &amp;lt;StackPanel Orientation="Horizontal" Margin="10" Width="372" &amp;gt;
                        &amp;lt;Label Content="Nombre:" FontSize="16" Foreground="Black" /&amp;gt;
                        &amp;lt;TextBox  Width="250" Margin="50,0,0,0" IsReadOnly="true" Background="Beige"
                                  Text="{Binding Path = Nombre}" FontWeight="Bold" /&amp;gt;
                    &amp;lt;/StackPanel&amp;gt;
                    &amp;lt;!-- Fin Nombre--&amp;gt;
                    &amp;lt;!-- Commentario--&amp;gt;
                    &amp;lt;StackPanel Orientation="Horizontal" Margin="10" Width="372"&amp;gt;
                        &amp;lt;Label Content="Comentario:" FontSize="16" Foreground="Black" Width="98"/&amp;gt;
                        &amp;lt;TextBox Width="244" Margin="30,0,20,0" 
                                 Text="{Binding Path = Comentario}" Background="Beige"/&amp;gt;
                    &amp;lt;/StackPanel&amp;gt;
                    &amp;lt;!-- Fin Commentario--&amp;gt;
                    &amp;lt;!-- Marca--&amp;gt;
                    &amp;lt;StackPanel Orientation="Horizontal" Margin="10" Width="369"&amp;gt;
                        &amp;lt;Label Content="Marca:" FontSize="16" Foreground="Black" Width="88"/&amp;gt;
                        &amp;lt;TextBox  Width="251" Margin="30,0,20,0" 
                                 Text="{Binding Path = Marca}" Background="Beige"/&amp;gt;
                    &amp;lt;/StackPanel&amp;gt;
                    &amp;lt;!-- Fin Marca--&amp;gt;
                &amp;lt;/StackPanel&amp;gt;
            &amp;lt;/Border&amp;gt;
        &amp;lt;/DockPanel&amp;gt;
        &amp;lt;Button x:Name="btnGuardar" 
                Content="GUARDAR" Grid.Row="3" 
                FontWeight="Black" Click="btnGuardar_Click" /&amp;gt;
            
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;
....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 16:41:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10341691#M19073</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2021-05-26T16:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extraer parametro Comentario con WPF(Extract Comment parameter with WPF)</title>
      <link>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10341715#M19074</link>
      <description>&lt;P&gt;For&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; if (param_Commen != null)
            {
                Comentario = param_Commen.AsValueString();
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use instead param_Commen.AsString.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AsValueString only applicable to value types normally.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 16:48:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10341715#M19074</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-05-26T16:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extraer parametro Comentario con WPF(Extract Comment parameter with WPF)</title>
      <link>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10341809#M19075</link>
      <description>&lt;P&gt;No sobrescribes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Do not overwrite,not working&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 17:23:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10341809#M19075</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2021-05-26T17:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extraer parametro Comentario con WPF(Extract Comment parameter with WPF)</title>
      <link>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10342253#M19076</link>
      <description>&lt;P&gt;I don't know the nature of your error in terms of exception messages or what part of code isn't working specifically?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can't interact with Revit when showing modal dialogue. For modal you need to close, interact with Revit and re-show. For modeless you need to use ExternalEvent and implement IExternalEventHandler.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 20:19:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10342253#M19076</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-05-26T20:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Extraer parametro Comentario con WPF(Extract Comment parameter with WPF)</title>
      <link>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10350040#M19152</link>
      <description>&lt;P&gt;Siguiendo el ejemplo,estoy usando MVVM.&lt;BR /&gt;Como podria cambiar el parametro Comentario?&lt;BR /&gt;Aqui estas en WinRar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Following the example, I am using MVVM.
How could I change the Comment parameter?
Here you are at WinRar.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 May 2021 16:11:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-bim-360-autodesk/extraer-parametro-comentario-con-wpf-extract-comment-parameter/m-p/10350040#M19152</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2021-05-29T16:11:29Z</dc:date>
    </item>
  </channel>
</rss>

