Hi,
I had a look and couldn’t find a topic that answers this. I haven’t really Csharp-ed since Rhino 6 and I’m using Rhino 8.
My brep input, which I’m inputting as GeometryBase keeps outputting miles away from where it currently is, even when I don’t use it in any code. Below is my code but the output you can see is just the input. However, as you can see in the screenshot it’s in a totally different location.
Has there been any major update that changes which co-ordinate system geometry uses once in C#?
public class Script_Instance : GH_ScriptInstance
{
region Notes
/*
Members:
RhinoDoc RhinoDocument
GH_Document GrasshopperDocument
IGH_Component Component
int Iteration
Methods (Virtual & overridable):
Print(string text)
Print(string format, params object[] args)
Reflect(object obj)
Reflect(object obj, string method_name)
*/
#endregion
private void RunScript(
List<Curve> Curves,
double Spacing,
double MortarSpacing,
GeometryBase Brick,
ref object a)
{
double brickSpacing = new double();
double brickCount = 0;
double crvLength = 0;
Plane brickPlane;
List<Plane> brickSpos = new List<Plane>();
List<GeometryBase> brickS = new List<GeometryBase>();
foreach (Curve crv in Curves)
{
crvLength = crv.GetLength();
brickCount = Math.Round(crvLength / Spacing);
brickSpacing = crvLength / brickCount;
for (int i = 0; i <= brickCount; i++)
{
var brickDup = Brick;
Point3d brickPos = crv.PointAtLength(brickSpacing * i);
brickPlane = new Plane(brickPos, Vector3d.XAxis, Vector3d.YAxis);
Transform moveTOpos = Transform.PlaneToPlane(brickPlane, Plane.WorldXY);
brickDup.Transform(moveTOpos);
brickS.Add(brickDup);
brickSpos.Add(brickPlane);
}
}
a = Brick;
}
}