Grasshopper

algorithmic modeling for Rhino

Hi all ~

I wanna create that shape which is pointed at by the red arrow.

To do that, I need to use "OffsetOnSurface Method'. Cuz, as you can see, there is twisted surface also.

Here is the RhinoCommon SDk.

public Curve[] OffsetOnSurface(

BrepFace face,

double distance;

double fittingTolerance )

SO... I write down the script like this.

protected override void SolveInstance(IGH_DataAccess DA)
{
Brep brep = null;
double distance = double.MaxValue;

if (!DA.GetData(0, ref brep))
return;
if (!DA.GetData(1, ref distance))
return;

List<Curve> crvList = new List<Curve>();

for(int i = 0 ; i < brep.Faces.Count ; i++ )
{
crvList.AddRange(Curve.JoinCurves(brep.Faces[i].DuplicateFace(true).DuplicateEdgeCurves()));
}

List<Curve> crvS = new List<Curve>();

for (int i = 0; i < brep.Faces.Count; i ++ )
{
crvS.AddRange( crvList[i].OffsetOnSurface(brep.Faces[i]));
}

DA.SetDataList(0, crvList);

}

Except for that red area, everything seems to be nice.

What's the problem ??

Views: 586

Replies to This Discussion

Hi there

you need to also give "double distance, double fittingTolerance" as inputs to the crvList[i].OffsetOnSurface method: you highlighed it yourself in the text above here.

Please let me know if this helped

Thanks

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Hi Giulio :D 

I did that again like this

List<Curve> crvS = null;

for (int i = 0; i < brep.Faces.Count; i ++ )
{
crvS.AddRange( crvList[i].OffsetOnSurface(brep.Faces[i], distance, 0.001));
}

DA.SetDataList(0, crvS);

distance is "double (input)".

But... still have error.

Even all there below have error.

crvList[0].OffsetOnSurface(brep.Faces[0], distance, 0.001));

crvList[0].OffsetOnSurface(brep.Faces[1], distance, 0.001));

crvList[0].OffsetOnSurface(brep.Faces[2], distance, 0.001));

crvList[0].OffsetOnSurface(brep.Faces[3], distance, 0.001));

crvList[0].OffsetOnSurface(brep.Faces[4], distance, 0.001));

I don't know why it's still doesn't work.

Where are you writing this?

VS usually shows the error message!

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

I'm using Microsoft Visual Studio Express 2013 for Windows Desktop :D

This could become problem ?

and Here is the whole script.

protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddCurveParameter("Curves", "C", "Curves", GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
Brep brep = null;
double distance = double.MaxValue;

if (!DA.GetData(0, ref brep))
return;
if (!DA.GetData(1, ref distance))
return;

List<Curve> crvList = new List<Curve>();

for(int i = 0 ; i < brep.Faces.Count ; i++ )
{
crvList.AddRange(Curve.JoinCurves(brep.Faces[i].DuplicateFace(true).DuplicateEdgeCurves()));
}

List<Curve> crvS = null;

for (int i = 0; i < brep.Faces.Count; i ++ )
{
crvS.AddRange( crvList[i].OffsetOnSurface(brep.Faces[i], distance, 0.001));
}

DA.SetDataList(0, crvS);

}

Look in the lower area, where it shows compile Warnings & Errors...

There's a precise description of the problem. If that does not help, please zip the whole solution and post it here, or please post the error message.

Thanks,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Here it the .zip file !

Thanks Giulio :D !!

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service