Offset Multiple

Offset Multiple

revitaddins
Contributor Contributor
1,775件の閲覧回数
7件の返信
メッセージ1/8

Offset Multiple

revitaddins
Contributor
Contributor

Hi guys,

 

what's the best way to offset a line multiple times? I'm struggling to do it ;/

 

for(int i = 0; i < (numberOfOffset); i++ )
                    {
                       
                        XYZ normal = XYZ.BasisZ;
                        Curve newLine = LongLine.CreateOffset(2000, normal);
                        doc.Create.NewDetailCurve(doc.ActiveView, newLine);

                    }

 

basically i need an array of lines

 

Thanks in advance.

0 件のいいね
解決済み
1,776件の閲覧回数
7件の返信
返信 (7)
メッセージ2/8

jeremy_tammik
Alumni
Alumni

That looks perfectly fine to me.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
メッセージ3/8

RPTHOMAS108
Mentor
Mentor

You are offsetting by 610m since internal units are ft.

メッセージ4/8

jeremy_tammik
Alumni
Alumni

Wow, very perceptive reading and guesswork!

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 件のいいね
メッセージ5/8

revitaddins
Contributor
Contributor

Thank you @RPTHOMAS108 , 

  double offset = UnitUtils.ConvertToInternalUnits(2000, DisplayUnitType.DUT_MILLIMETERS);

I converted it, but the problem is the lines stays in the same position

 

revitaddins_0-1616516380716.png

 

0 件のいいね
メッセージ6/8

RPTHOMAS108
Mentor
Mentor

I can't see from that what is wrong where is LongLine? Was you offsetting 2m from the adjacent wall (this looks about 2m judging from door)?

 

If you want cumulative offset for each iteration of your loop then you need to multiply distance by iteration or add it to running total each time (not just keep offsetting same distance from same line).

 

Thanks @jeremy_tammik as internal units are not metric I don't expect them to be rounded so nicely.

0 件のいいね
メッセージ7/8

revitaddins
Contributor
Contributor

Yes the offset will start from long line, and yes I guess that's what I need, cumulative distance, sorry for ignorance but that's where I'm failing, would you mind giving an example? Thanks 

0 件のいいね
メッセージ8/8

RPTHOMAS108
Mentor
Mentor
解決済み

It is also worth mentioning that your offset direction is going to be based on the direction of the line being offset. So for some instances you may have to either use (0,0,-1) rather than BasisZ or multiply offset value by -1 to get the direction of offset you want. 

 

Dim Offset as Double = 304.8
For I = 1 to NumberOfOffsets
  Dim Total = I * Offset
  Dim NxtLine = LongLine.CreateOffset(Total, XYZ.BasisZ)
...
Next

 

or

 

Dim Offset as Double = 304.8
Dim Total as double = 0
For I = 0 to NumberOfOffsets - 1
  Total += Offset
  Dim NxtLine = LongLine.CreateOffset(Total, XYZ.BasisZ)
...
Next

 

 

0 件のいいね