start
[Transaction(TransactionMode.Automatic)]
[Regeneration(RegenerationOption.Automatic)]
public class CreateView : IExternalCommand
{
    
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
    {
        UIApplication uiApp 
= commandData.Application;
        Document doc 
= uiApp.ActiveUIDocument.Document;
        Selection sel 
= uiApp.ActiveUIDocument.Selection;

        XYZ direction 
= new XYZ(111);
        View3D view3D 
= doc.Create.NewView3D(direction);
        
if (null == view3D)
        {
            
throw new Exception("Failed to create new View3D");
        }
        
string msg = "参数如下:";
        
foreach (Parameter p in view3D.Parameters)
        {
            msg 
+= "\n" + p.Definition.Name + " and value is " + p.AsValueString();
        }
        MessageBox.Show(msg);

        
return Result.Succeeded;
    }
}
end

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2022-12-23
  • 2021-12-12
猜你喜欢
  • 2021-10-03
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
相关资源
相似解决方案