CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 22, 2020, 14:22:16 pm


Login with username, password and session length


Pages: 1 [2]
  Print  
Author Topic: STOP writing plugins!!!  (Read 11610 times)
dh42
Administrator
CNC Jedi
*****
Offline Offline

Posts: 5727



View Profile WWW
« Reply #15 on: November 29, 2016, 17:38:20 pm »

Hello

Quote
you can ave Arc2F in a polyline, but apparently you can't create them (or at least i couldn't find a manner to to so).

To create an arc in a polyline, if you works with point, just add a "bulge" value for the first point of the arc ;

in the polylineitem, there is a bulge variable.

  public double Bulge;

if you works with segments then you can directly add an arc2F, a line2F or a line3F to a polyline

  public void Add(Arc2F arc, double tolerance);
    public void Add(Line2F line, double tolerance);
    public void Add(Line3F line, double tolerance);



I don't know how to convert an arc to a bulge value with math, but in the arc2F, there is a readonly bulge value.

public double Bulge { get; }

so I think we have all what is needed to draw what we want.

http://www.atelier-des-fougeres.fr/Cambam/Aide/API%20Doc/Cambam_cad_dll/Cambam_cad/Polyline/Polyline_point_property.png

++
David
Logged
jk
Wookie
****
Offline Offline

Posts: 262


View Profile
« Reply #16 on: November 29, 2016, 21:04:28 pm »

A bit offtopic, but the bulge is just tan (arc sweep / 4),
Arc segment may be inserted in polyline via Add(Point3F, bulge)

I think geometry structures (PointxF, LinexF, ArcxF etc) and Polyline API are stable enough and unlikely to be changed. Higher-level APIs is the other matter of course.

I do all CAD work in other software, so in CB my CAD-work is a small adjustments to account for the machining strategy, then comes the CAM :-) I think CAD-mode of CB (+ a number of plugins) is perfectly adequate for such workflow.
Logged
onekk
Wookie
****
Offline Offline

Posts: 498


View Profile
« Reply #17 on: November 30, 2016, 10:18:00 am »

Hello

Quote
you can ave Arc2F in a polyline, but apparently you can't create them (or at least i couldn't find a manner to to so).

To create an arc in a polyline, if you works with point, just add a "bulge" value for the first point of the arc ;

in the polylineitem, there is a bulge variable.

  public double Bulge;

if you works with segments then you can directly add an arc2F, a line2F or a line3F to a polyline

  public void Add(Arc2F arc, double tolerance);
    public void Add(Line2F line, double tolerance);
    public void Add(Line3F line, double tolerance);



I don't know how to convert an arc to a bulge value with math, but in the arc2F, there is a readonly bulge value.

public double Bulge { get; }

so I think we have all what is needed to draw what we want.

http://www.atelier-des-fougeres.fr/Cambam/Aide/API%20Doc/Cambam_cad_dll/Cambam_cad/Polyline/Polyline_point_property.png

++
David


But in Linux there is no Arc2F Object,

Code:
ap1 = new Point3F (start.X, start.Y, 0);
ap2 = new Point3F (end.X, end.Y, 0);
poly1.Add (ap1, s_bulge);
poly1.Add (ap2, s_bulge);

This code works, to add an arc, or better a "bulged" segment, otherwise the only Arc is the Arc entity.

From now I'm quite happy with CamBam API, but  some it has soem quirks, probably due to Mono, but if .NET is a "standard" not all the MS .NET parts are implemented in Mono due to Licensing problems, so we have to struggle with these problems.
« Last Edit: December 01, 2016, 07:20:47 am by onekk » Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
dh42
Administrator
CNC Jedi
*****
Offline Offline

Posts: 5727



View Profile WWW
« Reply #18 on: November 30, 2016, 18:46:22 pm »

Hello,

Quote
But in Linux there is no Arc2F Object,

You are sure ? .. strange  Huh

Arc is in CamBam.CAD.dll, but Arc2F is in CamBam.Geom.dll (and also Circle2F, line2F .. etc )

++
David
Logged
onekk
Wookie
****
Offline Offline

Posts: 498


View Profile
« Reply #19 on: December 01, 2016, 07:24:45 am »

I've to be blind, now I could find it.

Generally I search the object by name or by clicking on the istance of the IDE and it goes to te definition (although is only a mere list of properties name and composition) like this

Code:
namespace CamBam.Geom
{
[Serializable]
public struct Arc2F : IBSPItem
{
//
// Fields
//
public Point2F Center;

public Point2F P1;

public Point2F P2;

public RotationDirection Direction;

//
// Static Properties
//
public static Arc2F Undefined {
get;
}

//
// Properties
//
public double Bulge {
get;
}

public Point2F Midpoint {
get;
}

public double Radius {
get;
}

public double Start {
get;
}

public double Sweep {
get;
}

//
// Constructors
//
public Arc2F (Point2F center, double radius, double start, double sweep);

public Arc2F (Point2F center, Point2F p1, Point2F p2, RotationDirection dir);

public Arc2F (Point2F p1, Point2F p2, double sweep);

//
// Static Methods
//
public static double _CalcPolyArcSweep (Point2F p1, Point2F p2, Point2F pmid);

public static Arc2F GetArcFromMidpoint (Point2F p1, Point2F p2, Point2F pmid);

//
// Methods
//
public bool AngleWithinArc (double angle, double tolerance);

public Line2F ArcIntersect (Arc2F arc);

public Line2F ArcIntersect (Arc2F arc, double tolerance);

public Line2F CircleIntersect (Circle2F circle);

public Line2F CircleIntersect (Circle2F circle, double tolerance);

public double DistanceToPoint (Point2F p);

public ArcBulgeDirection GetBulgeDirectionLeftRight ();

public ArcBulgeDirection GetBulgeDirectionUpDown ();

public void GetExtrema (ref Point2F min, ref Point2F max);

public double GetPerimeter ();

public void Invert ();

public bool IsInside (Rect2F rect);

public Line2F LineIntersect (Line2F line, double tolerance);

public Point2F NearestPoint (Line2F line, ref double distance, double tolerance);

public Point2F NearestPoint (Arc2F arc, ref double distance, double tolerance);

public Point2F NearestPoint (Point2F p, ref double distance);

public Vector2F P1Tangent ();

public Vector2F P2Tangent ();

public bool RadiusOffset (double delta);

public Line2F RayIntersect (Line2F line, double tolerance);

public bool RegionInside (Rect2F rect);

public Point3FArray RenderToPoints (double tolerance);

public Arc2F[] SplitAtPoint (Point2F p);

public double SweepDiff (Point2F p);

public bool VectorInsideArc (Vector2F v);
}
}

Sorry for the inconveninence.
Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.097 seconds with 19 queries.

Copyright © 2018 HexRay Ltd. | Sitemap