Digital Construction and Drawing a Model Line

I am attending the BAM Digital Construction Live event in the UK and presenting on Forge for that domain. You can see what's going on here looking for the #bamdigital hashtag.

On the way here, I visited my brother and passed by the interesting climbing areas at Cheddar Gorge and Symonds Yat:

Cheddar Gorge

In the latter, we climbed the Long Rock Pinnacle via Whitt:

Long Rock Pinnacle

Today, I'll share my slide deck from this event and welcome my colleague Xiaodong answering his first Revit API cases:

Forge for Digital Construction

As said, I am attending this event with my Autodesk colleagues Az Jasat and Manu Venugopal, presenting on Insight and Connection.

Insight is covered by Manu, discussing Project IQ and machine learning enhanced analytics for automated risk assessment.

I am presenting on Forge for the digital construction process and connecting to the BIM360 products.

I already explained the main concepts from my point of view in the overview of Forge for AEC and BIM360 and the BIM360 and Forge for AEC message and samples.

Here is the final slide deck summarising those points in the BAM Forge for Digital Construction slides.

Manu and Az at BAM Digital Construction Live

Welcome Xiaodong and Invoking the Draw Model Line Command

Many congratulations to my colleague Xiaodong Liang for diving into the Revit API and starting to answer cases!

Here is one of his first:

Question: How can I programmatically invoke the Draw Model Line command?

Answer: If your workflow is to simply to invoke the built-in Draw Model Line command as is, you could find the command id and execute it using PostCommand:

  Autodesk.Revit.UI.RevitCommandId cmd_id
    = RevitCommandId.LookupPostableCommandId(
      PostableCommand.ModelLine );

  uiapp.PostCommand( cmd_id );

If your workflow is to create a model line yourself with the parameters the user inputs, you can use the following:

  UIApplication uiApp = commandData.Application;
  Application rvtApp = uiApp.Application;
  UIDocument uiDoc = uiApp.ActiveUIDocument;
  Document doc = uiDoc.Document;

  usingTransaction transaction = new Transaction( doc ) )
    transaction.Start( "Create Model Line By Me" );

    XYZ startPoint = XYZ.Zero;
    XYZ endPoint = new XYZ( 10, 10, 0 );

    Line geomLine = Line.CreateBound( startPoint, endPoint );

    // Create a geometry plane in Revit application memory

    XYZ origin = XYZ.Zero;
    XYZ normal = XYZ.BasisZ;
    Plane geomPlane = Plane.CreateByNormalAndOrigin(
      normal, origin );

    // Create a sketch plane in current document

    SketchPlane sketch = SketchPlane.Create(
      doc, geomPlane );

    ModelLine modelLine = doc.Create.NewModelCurve(
      geomLine, sketch ) as ModelLine;


Xiaodong adds:

Though it is a simple question, it took me some time to test out the working codes, and I learned some valuable knowledge of Revit API.

Stumblingly at the starting point of the journey into the Revit API   :-)

Many thanks to Xiaodong for the nice and comprehensive answer!

It looks like a great start!

I wish you much success and lots of fun going further.