public void CircleMultiLineTrimTest() { var wireCircle = OccShapeCreatorCode.CreateWireCircle(new gpAx1(new gpPnt(0, 0, 0), new gpDir(0, 0, 1)), 2); var circleEdges = GeomUtils.ExtractEdges(wireCircle); var edge1 = new BRepBuilderAPIMakeEdge(new gpPnt(-3, 0, 0), new gpPnt(3, 0, 0)).Edge; var edge2 = new BRepBuilderAPIMakeEdge(new gpPnt(0, -3, 0), new gpPnt(0, 3, 0)).Edge; Assert.IsTrue(circleEdges.Count > 0, "invalid circle edges"); var clickPoint = new Point3D(2, 0, 0); var trimmingEdges = new List <TopoDSEdge> { edge1, edge2 }; var trimmedEdges = GeomUtils.TrimGenericShape(trimmingEdges, circleEdges[0], clickPoint); Assert.IsTrue(trimmedEdges.Count == 1, "Incorrect number of trim solutions"); var trimmedCurve = new BRepAdaptorCurve(trimmedEdges[0]); var firstPoint = new Point3D(trimmedCurve.Value(trimmedCurve.FirstParameter)); var lastPoint = new Point3D(trimmedCurve.Value(trimmedCurve.LastParameter)); Assert.IsTrue(firstPoint.IsEqual(new Point3D(0, 2, 0)), "invalid trimming point"); Assert.IsTrue(lastPoint.IsEqual(new Point3D(2, 0, 0)), "invalid trimming point"); }
public override bool Execute() { // Get the values of dimension and position attributes var firstPoint = Dependency[0].TransformedPoint3D; var secondPoint = Dependency[1].TransformedPoint3D; var thirdPoint = Dependency[2].TransformedPoint3D; var wire = OccShapeCreatorCode.BuildRectangle(firstPoint, secondPoint, thirdPoint); if ((wire == null) || (wire.IsNull)) { return(false); } // Make also the shape axis before the shape regeneration var axis = new gpAx1 { Location = firstPoint.GpPnt }; Axis = axis; Shape = wire; return(true); }
public override bool Execute() { var axis = NodeBuilderUtils.GetTransformedAxis(Dependency[0].ReferenceBuilder); var zoomLevel = CoreGlobalPreferencesSingleton.Instance.ZoomLevel; Shape = OccShapeCreatorCode.CreateCircle(axis, zoomLevel); return(true); }
private static TopoDSFace BuildPlane(gpAx2 orientation, double rectangleLength) { var diagonalVector = new gpVec(orientation.XDirection); diagonalVector.Multiply(rectangleLength * Math.Sqrt(2)); var secondPoint = GeomUtils.BuildTranslation(new Point3D(orientation.Location), diagonalVector); return(OccShapeCreatorCode.BuildRectangle(orientation.Location, secondPoint.GpPnt, orientation.Direction)); }
public override bool Execute() { var mainAxis = Dependency[0].Axis3D.GpAxis; var radius = Dependency[2].Real; Shape = OccShapeCreatorCode.CreateCircle(mainAxis, radius); return(true); }
/// <summary> /// Builds a box receiving three points that describe the base rectangle and one being the height /// </summary> /// <param name = "axis"></param> /// <param name = "secondPoint"></param> /// <param name = "height"></param> /// <returns></returns> private static TopoDSShape MakeBox(gpAx1 axis, Point3D secondPoint, double height) { var face = OccShapeCreatorCode.BuildRectangle(axis.Location, secondPoint.GpPnt, axis.Direction); // Get the direction var dir = GeomUtils.ExtractDirection(face); var vector = new gpVec(dir); vector.Multiply(height); return(new BRepPrimAPIMakePrism(face, vector, false, true).Shape); }
public override bool Execute() { var position = Dependency[0].TransformedPoint3D; var direction = new gpDir(Dependency[1].TransformedPoint3D.GpPnt.XYZ); var line = new GeomLine(new gpLin(position.GpPnt, direction)); var helperLine = OccShapeCreatorCode.BuildDottedLine(line); Interactive = helperLine; return(true); }
public override bool Execute() { if (Dependency[1].TransformedPoint3D.IsEqual(new Point3D(0, 0, 0))) { return(false); } var Line = new AISLine(new GeomCartesianPoint(Dependency[0].TransformedPoint3D.GpPnt), new GeomCartesianPoint(Dependency[1].TransformedPoint3D.GpPnt)); var helperLine = OccShapeCreatorCode.BuildDottedLine(Line); Interactive = helperLine; return(true); }
public override bool Execute() { var point1 = Dependency[0].ReferenceBuilder[1].TransformedPoint3D; var point2 = Dependency[1].ReferenceBuilder[1].TransformedPoint3D; var point3 = Dependency[2].ReferenceBuilder[1].TransformedPoint3D; var result = OccShapeCreatorCode.CreateArcShape(point1, point2, point3); if (result == null) { return(false); } Shape = result; return(true); }
public override bool Execute() { // Get the two line points var firstPoint = Dependency[0].TransformedPoint3D; var secondPoint = Dependency[1].TransformedPoint3D; if (firstPoint.IsEqual(secondPoint)) { return(false); } var wire = OccShapeCreatorCode.CreateLineWire(firstPoint, secondPoint); Shape = wire; return(true); }
public override bool Execute() { var baseAxis = Dependency[0].Axis3D; var firstPoint = baseAxis.GpAxis.Location; var secondPoint = Dependency[1].TransformedPoint3D.GpPnt; var direction = baseAxis.GpAxis.Direction; var wire = OccShapeCreatorCode.BuildRectangle(firstPoint, secondPoint, direction); if ((wire == null) || (wire.IsNull)) { return(false); } // Generate also the visual shape axis before the shape regeneration Axis = baseAxis.GpAxis; Shape = wire; return(true); }
public override bool Execute() { var radius = Dependency[1].Real; if (radius < Precision.Confusion) { return(false); } var pointBuilder = Dependency[0].ReferenceBuilder; var sketchNode = pointBuilder.Dependency[0].ReferenceBuilder; var transformedAxis = NodeBuilderUtils.GetTransformedAxis(sketchNode); var centerAxis = new Axis { Location = pointBuilder[1].TransformedPoint3D, Direction = new Point3D(transformedAxis.Direction.X, transformedAxis.Direction.Y, transformedAxis.Direction.Z) }; var topoShape = OccShapeCreatorCode.CreateWireCircle(centerAxis.GpAxis, radius); Shape = topoShape; return(true); }
public override bool Execute() { Interactive = OccShapeCreatorCode.TextureShape(Builder[0].ReferenceBuilder.Shape, Dependency[1].Text, Parent); return(true); }