Edit Wall Length

I recently posted Augusto Gonçalves DevTV add-in templates, which by the way have been updated based on some recent feedback. Here are the updated versions and the directories to plug them in to:

Augusto has already done quite a bit of other work on the Revit API as well, such as preparing the DevTV presentation for the Revit 2010 API. He will be giving his first Revit API training in Brazil later this week.

The best of luck to you with that, Augusto!

He also recently stepped into the next phase of supporting the Revit API by answering several DevTech support cases in this area. Here is one of his recent cases:

Question: I am working on an add-in that creates window families through the Revit API. These families sometimes consist of a single window unit, but also may be combinations of windows, in which case the add-in creates nested window families and inserts instances of the nested families into the combination family.

I want to be able to increase the length and/or height of the wall in the family document, because the window combinations can be quite large in dimensions. I am able to increase the height of the wall using the "Unconnected Height" parameter. However, the "Length" parameter of the wall is read-only, and my code gets an InvalidOperationException if Set is called on the "Length" parameter.

Is there some other way to increase the length of this wall?

Answer: You are right, the Length is read-only. You can use the LocationCurve.Curve instead, which is write enabled. The following code snippet shows how to move the point and update the location:

  // get the current wall location
  LocationCurve wallLocation = myWall.Location 
    as LocationCurve;
  // get the points
  XYZ pt1 = wallLocation.Curve.get_EndPoint( 0 );
  XYZ pt2 = wallLocation.Curve.get_EndPoint( 1 );
  // change one point, e.g. move 1000 mm on X axis
  pt2 = pt2.Add( new XYZ( mmToFeet( 1000 ), 0, 0 ) );
  // create a new LineBound
  Line newWallLine = app.Create.NewLineBound( 
    pt1, pt2 );
  // update the wall curve
  wallLocation.Curve = newWallLine;

More From Ko Tao

I am still on Ko Tao. You may be surprised to hear that one of the reasons for me to come here was to practice Italian. My friend Daniela invited me to join her here for a diving holiday. I took a CMAS diving exam in swimming pools with a final test in the Zurich Lake several years ago, and never ever made any use of it by going diving in natural waters, and I also wanted to continue practicing Italian, so it sounded like a perfect idea. Once here, we even met her friend Maurizio, another diver, more or less by coincidence, so now the three of us often hang out. Here are Daniela and Maurizio in Hin Wong Bay, where we went for a very nice snorkelling tour:

Maurizio and Daniela in Hin Wong Bay

In that bay I had my first very impressive experience of swimming in the middle of a huge school of tiny fish, maybe a couple of hundred thousand of them, several cubic metres, swirling around me in all directions, like a single living mass.

And here is Daniela watching some chickens in front of the Alvaro Diving office in Alok Baan Kao Bay with the Buddha Rock in the background:

Daniela with chickens and the Buddha Rock

Finally, here is a sweet little hut on a boat right next to the hut we were staying in until yesterday:

Hut on a boat

Now we moved to a more tranquil spot at Jul Julea Beach, away from noise and music and bars and people.