@@ -36,7 +36,7 @@ public Creator( Document doc )
3636
3737 /// <summary>
3838 /// Determine the plane that a given curve resides in and return its normal vector.
39- /// Ask the curve for its start and end points and some curve in the middle.
39+ /// Ask the curve for its start and end points and some point in the middle.
4040 /// The latter can be obtained by asking the curve for its parameter range and
4141 /// evaluating it in the middle, or by tessellation. In case of tessellation,
4242 /// you could iterate through the tessellation points and use each one together
@@ -70,7 +70,7 @@ XYZ GetCurveNormal( Curve curve )
7070 "expected non-line element to have "
7171 + "more than two tessellation points" ) ;
7272
73- // for non-vertical lines, use Z axis to
73+ // For non-vertical lines, use Z axis to
7474 // span the plane, otherwise Y axis:
7575
7676 double dxy = Math . Abs ( v . X ) + Math . Abs ( v . Y ) ;
@@ -95,7 +95,7 @@ XYZ GetCurveNormal( Curve curve )
9595 }
9696 }
9797
98- #if DEBUG
98+ #if DEBUG
9999 {
100100 XYZ normal2 ;
101101 while ( ++ i < n - 1 )
@@ -108,69 +108,69 @@ XYZ GetCurveNormal( Curve curve )
108108 + "lie in same plane" ) ;
109109 }
110110 }
111- #endif // DEBUG
111+ #endif // DEBUG
112112
113113 }
114114 return normal ;
115115 }
116116
117- /// <summary>
118- /// Create a model line between the two given points.
119- /// Internally, it creates an arbitrary sketch
120- /// plane given the model line end points.
121- /// </summary>
122- public static ModelLine CreateModelLine (
123- Document doc ,
124- XYZ p ,
125- XYZ q )
126- {
127- if ( p . DistanceTo ( q ) < Util . MinLineLength ) return null ;
117+ /// <summary>
118+ /// Create a model line between the two given points.
119+ /// Internally, it creates an arbitrary sketch
120+ /// plane given the model line end points.
121+ /// </summary>
122+ public static ModelLine CreateModelLine (
123+ Document doc ,
124+ XYZ p ,
125+ XYZ q )
126+ {
127+ if ( p . DistanceTo ( q ) < Util . MinLineLength ) return null ;
128128
129- // Create sketch plane; for non-vertical lines,
130- // use Z-axis to span the plane, otherwise Y-axis:
129+ // Create sketch plane; for non-vertical lines,
130+ // use Z-axis to span the plane, otherwise Y-axis:
131131
132- XYZ v = q - p ;
132+ XYZ v = q - p ;
133133
134- double dxy = Math . Abs ( v . X ) + Math . Abs ( v . Y ) ;
134+ double dxy = Math . Abs ( v . X ) + Math . Abs ( v . Y ) ;
135135
136- XYZ w = ( dxy > Util . TolPointOnPlane )
137- ? XYZ . BasisZ
138- : XYZ . BasisY ;
136+ XYZ w = ( dxy > Util . TolPointOnPlane )
137+ ? XYZ . BasisZ
138+ : XYZ . BasisY ;
139139
140- XYZ norm = v . CrossProduct ( w ) . Normalize ( ) ;
140+ XYZ norm = v . CrossProduct ( w ) . Normalize ( ) ;
141141
142- //Autodesk.Revit.Creation.Application creApp
143- // = doc.Application.Create;
142+ //Autodesk.Revit.Creation.Application creApp
143+ // = doc.Application.Create;
144144
145- //Plane plane = creApp.NewPlane( norm, p ); // 2014
146- Plane plane = new Plane ( norm , p ) ; // 2015
145+ //Plane plane = creApp.NewPlane( norm, p ); // 2014
146+ Plane plane = new Plane ( norm , p ) ; // 2015
147147
148- //SketchPlane sketchPlane = creDoc.NewSketchPlane( plane ); // 2013
149- SketchPlane sketchPlane = SketchPlane . Create ( doc , plane ) ; // 2014
148+ //SketchPlane sketchPlane = creDoc.NewSketchPlane( plane ); // 2013
149+ SketchPlane sketchPlane = SketchPlane . Create ( doc , plane ) ; // 2014
150150
151- //Line line = creApp.NewLine( p, q, true ); // 2013
152- Line line = Line . CreateBound ( p , q ) ; // 2014
151+ //Line line = creApp.NewLine( p, q, true ); // 2013
152+ Line line = Line . CreateBound ( p , q ) ; // 2014
153153
154- // The following line is only valid in a project
155- // document. In a family, it will throw an exception
156- // saying "Document.Create can only be used with
157- // project documents. Use Document.FamilyCreate
158- // in the Family Editor."
154+ // The following line is only valid in a project
155+ // document. In a family, it will throw an exception
156+ // saying "Document.Create can only be used with
157+ // project documents. Use Document.FamilyCreate
158+ // in the Family Editor."
159159
160- //Autodesk.Revit.Creation.Document creDoc
161- // = doc.Create;
160+ //Autodesk.Revit.Creation.Document creDoc
161+ // = doc.Create;
162162
163- //return creDoc.NewModelCurve(
164- // //creApp.NewLine( p, q, true ), // 2013
165- // Line.CreateBound( p, q ), // 2014
166- // sketchPlane ) as ModelLine;
163+ //return creDoc.NewModelCurve(
164+ // //creApp.NewLine( p, q, true ), // 2013
165+ // Line.CreateBound( p, q ), // 2014
166+ // sketchPlane ) as ModelLine;
167167
168- ModelCurve curve = doc . IsFamilyDocument
169- ? doc . FamilyCreate . NewModelCurve ( line , sketchPlane )
170- : doc . Create . NewModelCurve ( line , sketchPlane ) ;
168+ ModelCurve curve = doc . IsFamilyDocument
169+ ? doc . FamilyCreate . NewModelCurve ( line , sketchPlane )
170+ : doc . Create . NewModelCurve ( line , sketchPlane ) ;
171171
172- return curve as ModelLine ;
173- }
172+ return curve as ModelLine ;
173+ }
174174
175175 SketchPlane NewSketchPlanePassLine (
176176 Line line )
@@ -227,8 +227,8 @@ SketchPlane NewSketchPlaneContainCurve(
227227 XYZ normal = GetCurveNormal ( curve ) ;
228228 Plane plane = _creapp . NewPlane ( normal , p ) ;
229229
230- #if DEBUG
231- if ( ! ( curve is Line ) )
230+ #if DEBUG
231+ if ( ! ( curve is Line ) )
232232 {
233233 CurveArray a = _creapp . NewCurveArray ( ) ;
234234 a . Append ( curve ) ;
@@ -240,7 +240,7 @@ SketchPlane NewSketchPlaneContainCurve(
240240 Debug . Assert ( Util . IsZero ( plane2 . SignedDistanceTo (
241241 plane . Origin ) ) , "expected equal planes" ) ;
242242 }
243- #endif // DEBUG
243+ #endif // DEBUG
244244
245245 //return _credoc.NewSketchPlane( plane ); // 2013
246246
0 commit comments