Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5804

Offset curves consistently

$
0
0

@Dongyeop_Lee wrote:

Hello all,

I’m trying to make a C# component that will offset planar curves consistently regardless of curve directions.
The process would be:

  1. Close all curves, if not closed.
  2. Get center points of curves.
  3. Get normal vectors of surfaces from curves
  4. Offset curves

I asked a similar question before here, but the curve offset method seems changed in Rhino 6.


I’m embarrassed that I didn’t make much progress on coding since then, but can you help me write this component in C#?

//Create surfaces to get normal vectors from surfaces using ClosestPoint method.
Brep[] crvBreps = Brep.CreatePlanarBreps(crvs, 0.1);

//Get centroid of curves 
AreaMassProperties AMP = AreaMassProperties.Compute(crvs);
Point3d cen = AMP.Centroid;

//Get Vector3d normal using Brep.ClosestPoint method 
Vector3d[] normalCrvs;
Point3d[] cPoints;
int ci;
double s;
double t;
crvBreps.ClosestPoint(cen, out cPoints, out ci, out s, out t, 100.00, out normalCrvs);

I skipped the step 1 for now and am trying to get normal vectors from surfaces using Brep.CloestPoint method. Can someone let me know I can make this work?
Once I get normal vectors, I’m thinking to use Curve.Offset Method (Point3d, Vector3d, Double, Double, CurveOffsetCornerStyle).
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_Offset_1.htm
Thank you.

Dongyeop

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5804

Trending Articles