Help for move to c#

Hello to all
help for move to c#?
Hi Move or Copy in C # How are you? None of these methods below
move

A-


dynamic L = c.Transform.Translation((new Vector3d.XAxis) * gap);

B-

{ var L = Rhino.Geometry.Transform.Translation((new Vector3d.XAxis) * gap);}
    var L2 = Rhino.DocObjects.RhinoTransformObjectsEventArgs(L);

C-

{ var L = Rhino.Geometry.Transform.Translation((new Vector3d.XAxis) * gap);}
    var L2 = c.Transform(L);

move.gh (7.6 KB)

Replace “dymanic L” with “A”. A is named by default , means your output.

Hi,

C is uppercase.
The return value of the Translate method is a Bool.
XAxis is a static property, so there is no need for new.

thanks
In fact, my question is RefrenceType that after the Trancform (Move, Rotate…),What to do the primary clean object of ValueType
(Copy in C #) (in Python this problem is resolved with DeepCopy, but in the # c how?
move &(copy)gh.gh (14.6 KB)
?
must A!=B BUT A=B :point_down:

   var y = new List<Curve>();
    y = c;
    B = new List<Curve>(y);;
    var x = Rhino.Geometry.Transform.Translation(gap);
    c[0].Transform(x);
    A = c;

@Mahdiyar

Every GeometryBase has a generic Duplicate() method and a type based duplicated method, for curve type:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_DuplicateCurve.htm

var first = c[0].DuplicateCurve();
var xf = Rhino.Geometry.Transform.Translation(gap);
first.Transform(xf);
A = c;
B = first;
1 Like

THNKS :pray: excellent

Another question that( what? API Extrude (Surfce) command in C #?)

private void RunScript(Surface surface, Vector3d direction, ref object A)
{
  var brep = surface.ToBrep();
  var line = new Line(Point3d.Origin, direction);
  A = brep.Faces[0].CreateExtrusion(line.ToNurbsCurve(), true);
}
private void RunScript(Brep brep, Vector3d direction, ref object A)
{
  A = ExtrudeBrep(brep, direction);
}
// <Custom additional code> 
public static Brep ExtrudeBrep(Brep brep, Vector3d direction)
{
  if(direction.IsZero) return brep;
  var breps = new List<Brep>{brep};
  foreach(BrepEdge edge in brep.Edges)
  {
    if(edge.TrimCount == 0) continue;
    var crv = edge.DuplicateCurve();
    var extrusion = Surface.CreateExtrusion(crv, direction);
    if(extrusion == null) continue;
    var b = extrusion.ToBrep();
    b.Faces.SplitKinkyFaces();
    breps.Add(b);
  }
  if(breps.Count == 1) return brep;
  var cap = brep.DuplicateBrep();
  cap.Translate(direction);
  breps.Add(cap);
  var result = Brep.JoinBreps(breps, 0.001);
  return result == null ? brep : result[0];
}
// <Custom additional code> 

Extrude.gh (13.6 KB)

1 Like