Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Offset command in RevitAPI 2014

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
451 Views, 3 Replies

Offset command in RevitAPI 2014

Hi all,

How can I use the offset command in my C# plugin? I have the list of lines/arcs to include in the offset and the offset value. I can't find the command to use.

I thought that the ElementTransformUnit class contains something to do it but it seems that it doesn't...

 

 

Thank you

Tags (2)
3 REPLIES 3
Message 2 of 4
Revitalizer
in reply to: Anonymous

Dear tobiazambon,

 

some ideas for calculating offsets in 2014.

 

First, you could use AcGe:

http://thebuildingcoder.typepad.com/blog/2013/10/using-the-built-in-revit-acge-functionality.html

In this case, you would create an AcGeOffsetCurve3d from a AcGeCurve3d.

Not in your Revit add-in but in the C++/CLI project mentioned in the blog posting.

 

Second, you could create a Sweep using GeometryCreationUtilities.CreateSweptGeometry().

The swept profile is a rectangle, your offset is its width; the height may have any value.

You could analyze the Sweep's geometry to find the edge which represents the offsetted curve.

 

Third, you could write an offsetting function on your own which could become a major task.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 4
Anonymous
in reply to: Revitalizer

Hello and thank you for your reply,

 

About your solutions:

1) Doesn't works, I don't know if I'm doing something wrong but the program is not working. I've wrote this method:

RvtDB::GeometryObject^ Helper::offsetCurve(RvtDB::Curve^ curve, RvtCrt::Application^ app)
  {
      // Create a temporary AcGeCurve and AcGePlane
    auto geCurvePtr = Converter::createAcGeCurve(curve);

    AcGeVoidPointerArray res;
    geCurvePtr->getTrimmedOffset(10, AcGeVector3d::kZAxis,res);
    throw gcnew NotImplementedException(); 
  }

 but after the execution, the res variable is invalid, the debugger shows "{...}" that I suppose mean null. I've discovered that revit handlers object became null when passed as arguments of a method, I don't know why..The result is that I cannot use this solution/I don't know how to use it.

 

2) Seems to be more viable but I don't get how to create the rectangluar profile with respect to the path lines..In particular if the path starts with an arc

3) I don't think it is a viable solution

Message 4 of 4
Scott_Wilson
in reply to: Anonymous

Revitalizer's second suggestion does look to be the best and it's not really that hard to do. I'd suggest looking into it, but if you really don't want to mess with creating the swept geometry yourself, you could change it up a little and use a custom structural beam family instead. You can place them using pretty much any curve including splines (make sure to deselect 'Always Vertical' when creating the family). Just extract the appropriate edge curves after placement.

 

There's less trigonometry involved, if that's what was bothering you, but the geometry extraction overhead would be pretty much the same. It's a shame you aren't using 2015, are you absolutely stuck on 2014?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community