SpeckleGrasshopper/UserDataUtils/SetUserDataComponent.cs
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object can be used to retrieve data from input parameters and 
/// to store data in output parameters.</param>
This is the method that actually does the work.
This is the method that actually does the work .
protected override void SolveInstance( IGH_DataAccess DA )
    {
      object objectRef = null;
      DA.GetData( 0, ref objectRef );
      if ( objectRef == null )
        return;
      object valueExtract = objectRef.GetType().GetProperty( "Value" ).GetValue( objectRef, null );
      GeometryBase recipient = getGeometryBase( valueExtract );
      if ( recipient == null )
      {
        DA.SetData( 0, null );
        this.AddRuntimeMessage( GH_RuntimeMessageLevel.Error, "Input object not supported." );
        return;
      }
      object dictObject = null;
      DA.GetData( 1, ref dictObject );
      GH_ObjectWrapper temp = dictObject as GH_ObjectWrapper;
      if ( temp == null )
      {
        DA.SetData( 0, recipient );
        this.AddRuntimeMessage( GH_RuntimeMessageLevel.Warning, "Dictionary not provided. Object not modified." );
        return;
      }
      ArchivableDictionary dict = ( ( GH_ObjectWrapper ) dictObject ).Value as ArchivableDictionary;
      if ( dict == null )
      {
        DA.SetData( 0, recipient );
        this.AddRuntimeMessage( GH_RuntimeMessageLevel.Warning, "Dictionary not valid. Object not modified." );
        return;
      }
      recipient.UserDictionary.ReplaceContentsWith( dict );
      DA.SetData( 0, new GH_ObjectWrapper( recipient ) );
    }
protected override void SolveInstance ( IGH_DataAccess DA ) { object objectRef = null ; DA . GetData ( 0 , ref objectRef ) ; if ( objectRef == null ) return ; object valueExtract = objectRef . GetType ( ) . GetProperty ( " " ) . GetValue ( objectRef , null ) ; GeometryBase recipient = getGeometryBase ( valueExtract ) ; if ( recipient == null ) { DA . SetData ( 0 , null ) ; this . AddRuntimeMessage ( GH_RuntimeMessageLevel . Error , " " ) ; return ; } object dictObject = null ; DA . GetData ( 1 , ref dictObject ) ; GH_ObjectWrapper temp = dictObject as GH_ObjectWrapper ; if ( temp == null ) { DA . SetData ( 0 , recipient ) ; this . AddRuntimeMessage ( GH_RuntimeMessageLevel . Warning , " " ) ; return ; } ArchivableDictionary dict = ( ( GH_ObjectWrapper ) dictObject ) . Value as ArchivableDictionary ; if ( dict == null ) { DA . SetData ( 0 , recipient ) ; this . AddRuntimeMessage ( GH_RuntimeMessageLevel . Warning , " " ) ; return ; } recipient . UserDictionary . ReplaceContentsWith ( dict ) ; DA . SetData ( 0 , new GH_ObjectWrapper ( recipient ) ) ; }
This is the method that actually does the work.
This is the method that actually does the work .
DA
IGH_DataAccess
The DA object can be used to retrieve data from input parameters and
to store data in output parameters.
The DA object can be used to retrieve data from input parameters and to store data in output parameters .