greatverve
直接用NewLine();显示不了,需要一个草图平面。
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
//[Journaling(JournalingMode.NoCommandData)]
public class NewLine : IExternalCommand
{
    
public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
    {

        Document doc 
= revit.Application.ActiveUIDocument.Document;
        
//需要启动一个事务
        Transaction tr = new Transaction(doc, "test");
        tr.Start();

        XYZ pt1 
= new XYZ(550);
        XYZ pt2 
= new XYZ(5100);

        Line line 
= doc.Application.Create.NewLine(pt1, pt2,true);
        XYZ origin 
= new XYZ(000);
        XYZ normal 
= new XYZ(001);

        Plane plane 
= doc.Application.Create.NewPlane(pt2.CrossProduct(pt1), pt1);//平面
        SketchPlane skplane = doc.Create.NewSketchPlane(plane);//草图平面
        ModelCurve modelcurve1 = doc.Create.NewModelCurve(line, skplane);//模型曲线

        tr.Commit();

        
return Autodesk.Revit.UI.Result.Succeeded;
    }
}
from:http://revit.5d6d.com/thread-913-1-4.html

分类:

技术点:

相关文章:

  • 2021-06-09
  • 2021-12-25
  • 2021-07-21
  • 2021-09-07
  • 2021-11-27
  • 2021-04-24
  • 2021-12-26
  • 2022-01-08
猜你喜欢
  • 2021-03-31
  • 2021-12-01
  • 2021-10-07
  • 2021-12-26
  • 2021-11-18
  • 2021-12-26
  • 2021-10-03
相关资源
相似解决方案