Guest User

Untitled

a guest
Nov 30th, 2011
295
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  [Transaction(TransactionMode.Manual)]
  2.     [Regeneration(RegenerationOption.Manual)]
  3.     public class AdskCommandTest : IExternalCommand
  4.     {
  5.         public Result Execute(ExternalCommandData commandData,
  6.             ref string message,
  7.             ElementSet elements)
  8.         {
  9.  
  10.             var document = commandData.Application.ActiveUIDocument.Document;
  11.  
  12.             var reference = commandData.Application
  13.                 .ActiveUIDocument
  14.                 .Selection.PickObject(ObjectType.Element);
  15.  
  16.             var element = document.get_Element(reference.ElementId);            
  17.  
  18.             foreach (Parameter param in element.Parameters )
  19.             {
  20.                 if (param.StorageType == StorageType.Double)
  21.                 {
  22.                     try
  23.                     {
  24.                         Debug.Print("Parameter name: {0}\tParameter value (imperial): {1}\t" +
  25.                                 "Parameter unit value: {2}\tParameter AsValueString: {3}",
  26.                                 param.Definition.Name,
  27.                                 param.AsDouble(),
  28.                                 param.AsProjectUnitTypeDouble(),
  29.                                 param.AsValueString());
  30.                     }
  31.                     catch (Exception ex)
  32.                     {
  33.                        
  34.                         Debug.Print("Parameter name: {0}\tException: {1}", param.Definition.Name, ex.Message);
  35.                     }
  36.                    
  37.                 }
  38.             }
  39.  
  40.         return Result.Succeeded;
  41. }
  42. }
  43.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×