├── .gitignore ├── BREP ├── BREP.csproj ├── BRep │ ├── BRepCurve.cs │ ├── BRepEdge.cs │ ├── BRepFace.cs │ ├── BRepSurface.cs │ ├── BRepWire.cs │ ├── Contour.cs │ ├── Curves │ │ ├── BRepBSplineWithKnotsCurve.cs │ │ ├── BRepCircleCurve.cs │ │ ├── BRepEllipseCurve.cs │ │ ├── BRepLineCurve.cs │ │ ├── BRepSeamCurve.cs │ │ └── BRepSpline.cs │ ├── CylinderMeshNode.cs │ ├── Faces │ │ ├── BRepBSplineWithKnotsSurfaceFace.cs │ │ ├── BRepConicalSurfaceFace.cs │ │ ├── BRepCylinderSurfaceFace.cs │ │ ├── BRepLinearExtrusionFace.cs │ │ ├── BRepPlaneFace.cs │ │ └── BRepToroidalSurfaceFace.cs │ ├── MeshNode.cs │ ├── Outlines │ │ ├── LineItem.cs │ │ └── OutlineItem.cs │ ├── ProjectPolygon.cs │ ├── Segment.cs │ ├── Surfaces │ │ ├── BRepBSplineWithKnotsSurface.cs │ │ ├── BRepConicalSurface.cs │ │ ├── BRepCylinder.cs │ │ ├── BRepLinearExtrusionSurface.cs │ │ ├── BRepPlane.cs │ │ └── BRepToroidalSurface.cs │ ├── TriangleInfo.cs │ └── UnsupportedCurveException.cs ├── Common │ ├── BrepException.cs │ ├── DebugHelpers.cs │ ├── Extensions.cs │ ├── FactoryHelper.cs │ ├── GeometryUtils.cs │ ├── Helpers.cs │ ├── IMesh.cs │ ├── IMeshNodesContainer.cs │ ├── IPartContainer.cs │ ├── IXmlStorable.cs │ ├── Line3D.cs │ ├── NFP.cs │ ├── Part.cs │ ├── Plane.cs │ └── Segment3d.cs ├── NURBS │ ├── NURBS.cs │ └── RationalBSplinePoint.cs ├── OpenTK.dll.config ├── Parsers │ ├── Iges │ │ └── IgesParser.cs │ └── Step │ │ ├── AdvancedFace.cs │ │ ├── AdvancedFaceParseItem.cs │ │ ├── Axis2Placement3d.cs │ │ ├── Axis2Placement3dParseItem.cs │ │ ├── BSplineCurve.cs │ │ ├── BSplineCurveWithKnots.cs │ │ ├── BSplineCurveWithKnotsParseItem.cs │ │ ├── BSplineSurface.cs │ │ ├── BSplineSurfaceWithKnots.cs │ │ ├── BSplineSurfaceWithKnotsParseItem.cs │ │ ├── BoundeSurfaceParseItem.cs │ │ ├── BoundedCurve.cs │ │ ├── BoundedCurveParseItem.cs │ │ ├── CartesianPointParseItem.cs │ │ ├── CircleParseItem.cs │ │ ├── ClosedShell.cs │ │ ├── ColourRGBParseItem.cs │ │ ├── ConicalSurfaceParseItem.cs │ │ ├── CylindricalSurfaceParseItem.cs │ │ ├── DefinitionalRepresentation.cs │ │ ├── DefinitionalRepresentationParseItem.cs │ │ ├── DirectionParseItem.cs │ │ ├── EdgeCurve.cs │ │ ├── EdgeCurveParseItem.cs │ │ ├── EdgeLoopParseItem.cs │ │ ├── EllipseParseItem.cs │ │ ├── FaceBoundParseItem.cs │ │ ├── FaceOuterBoundParseItem.cs │ │ ├── ITokenItem.cs │ │ ├── LineParseItem.cs │ │ ├── LinearExtrusionSurfaceParseItem.cs │ │ ├── ListTokenItem.cs │ │ ├── OpenShellParseItem.cs │ │ ├── OrientedEdge.cs │ │ ├── OrientedEdgeParseItem.cs │ │ ├── PCurve.cs │ │ ├── PCurveParseItem.cs │ │ ├── ParserItem.cs │ │ ├── PlaneSurfaceParseItem.cs │ │ ├── RationalBSplineSurface.cs │ │ ├── SeamCurve.cs │ │ ├── SeamCurveParseItem.cs │ │ ├── ShellParseItem.cs │ │ ├── StepLineItem.cs │ │ ├── StepParseContext.cs │ │ ├── StepParser.cs │ │ ├── StepParserException.cs │ │ ├── StringTokenItem.cs │ │ ├── SurfaceCurve.cs │ │ ├── SurfaceCurveParseItem.cs │ │ ├── TokenList.cs │ │ ├── VectorParseItem.cs │ │ ├── VertexPointParseItem.cs │ │ └── WrongArgumentsException.cs ├── PolyBool.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── IxMilia.Iges ├── Collections │ └── ListWithPredicates`1.cs ├── Entities │ ├── IIgesBooleanTreeItem.cs │ ├── IgesAngularDimension.cs │ ├── IgesAssociativity.cs │ ├── IgesAxisymmetricCubicLine.cs │ ├── IgesAxisymmetricLinarLine.cs │ ├── IgesAxisymmetricLinearQuadrilateral.cs │ ├── IgesAxisymmetricLinearTriangle.cs │ ├── IgesAxisymmetricParabolicLine.cs │ ├── IgesAxisymmetricParabolicQuadrilateral.cs │ ├── IgesAxisymmetricParabolicTriangle.cs │ ├── IgesBeam.cs │ ├── IgesBlankStatus.cs │ ├── IgesBlock.cs │ ├── IgesBooleanTree.cs │ ├── IgesBooleanTreeEntity.cs │ ├── IgesBooleanTreeOperation.cs │ ├── IgesBooleanTreeOperationKind.cs │ ├── IgesBoundary.cs │ ├── IgesBoundedSurface.cs │ ├── IgesCircularArc.cs │ ├── IgesColorDefinition.cs │ ├── IgesCompositeCurve.cs │ ├── IgesConicArc.cs │ ├── IgesConnectPoint.cs │ ├── IgesCopiousData.cs │ ├── IgesCubicParabolicSolidWedge.cs │ ├── IgesCubicQuadrilateral.cs │ ├── IgesCubicSolid.cs │ ├── IgesCubicSolidWedge.cs │ ├── IgesCubicThickShell.cs │ ├── IgesCubicThickShellWedge.cs │ ├── IgesCubicTriangle.cs │ ├── IgesCurveDimension.cs │ ├── IgesCurveOnAParametricSurface.cs │ ├── IgesCurvedBeam.cs │ ├── IgesCustomFiniteElement.cs │ ├── IgesDamper.cs │ ├── IgesDefinitionLevelsProperty.cs │ ├── IgesDiameterDimension.cs │ ├── IgesDimensionBase.cs │ ├── IgesDirection.cs │ ├── IgesElementResults.cs │ ├── IgesEllipsoid.cs │ ├── IgesEntity.AssociatedEntityCollection.cs │ ├── IgesEntity.WriterState.cs │ ├── IgesEntity.cs │ ├── IgesEntityType.cs │ ├── IgesEntityUseFlag.cs │ ├── IgesEntity_FromData.cs │ ├── IgesFiniteElement.cs │ ├── IgesFiniteElementDummy.cs │ ├── IgesFlagNote.cs │ ├── IgesFlash.cs │ ├── IgesGeneralLabel.cs │ ├── IgesGeneralNote.cs │ ├── IgesGeneralSymbol.cs │ ├── IgesGroundedDamper.cs │ ├── IgesGroundedSpring.cs │ ├── IgesHierarchy.cs │ ├── IgesLabelDisplayAssociativity.cs │ ├── IgesLeader.cs │ ├── IgesLine.cs │ ├── IgesLineFontDefinitionBase.cs │ ├── IgesLinearDimension.cs │ ├── IgesLinearQuadrilateral.cs │ ├── IgesLinearSolid.cs │ ├── IgesLinearSolidTetrahedron.cs │ ├── IgesLinearSolidWedge.cs │ ├── IgesLinearTriangle.cs │ ├── IgesLocation.cs │ ├── IgesManifestSolidBRepObject.cs │ ├── IgesMass.cs │ ├── IgesNameProperty.cs │ ├── IgesNewGeneralNote.cs │ ├── IgesNodalDisplacementAndRotation.cs │ ├── IgesNodalResults.cs │ ├── IgesNode.cs │ ├── IgesNull.cs │ ├── IgesOffsetBeam.cs │ ├── IgesOffsetCurve.cs │ ├── IgesOffsetMass.cs │ ├── IgesOffsetSurface.cs │ ├── IgesOrdinateDimension.cs │ ├── IgesParabolicQuadrilateral.cs │ ├── IgesParabolicSolid.cs │ ├── IgesParabolicSolidTetrahedron.cs │ ├── IgesParabolicSolidWedge.cs │ ├── IgesParabolicThickShell.cs │ ├── IgesParabolicThickShellWedge.cs │ ├── IgesParabolicTriangle.cs │ ├── IgesParametricSplineCurve.cs │ ├── IgesParametricSplineSurface.cs │ ├── IgesPatternLineFontDefinition.cs │ ├── IgesPerspectiveView.cs │ ├── IgesPlane.cs │ ├── IgesPlaneSurface.cs │ ├── IgesPointDimension.cs │ ├── IgesProperty.cs │ ├── IgesRadiusDimension.cs │ ├── IgesRationalBSplineCurve.cs │ ├── IgesRationalBSplineSurface.cs │ ├── IgesResultType.cs │ ├── IgesRightAngularWedge.cs │ ├── IgesRightCircularConeFrustrum.cs │ ├── IgesRightCircularConicalSurface.cs │ ├── IgesRightCircularCylinder.cs │ ├── IgesRightCircularCylindricalSurface.cs │ ├── IgesRigidBody.cs │ ├── IgesRuledSurface.cs │ ├── IgesSectionedArea.cs │ ├── IgesSelectedComponent.cs │ ├── IgesSingularSubfigureInstance.cs │ ├── IgesSolidAssembly.cs │ ├── IgesSolidOfLinearExtrusion.cs │ ├── IgesSolidOfRevolution.cs │ ├── IgesSphere.cs │ ├── IgesSphericalSurface.cs │ ├── IgesSpring.cs │ ├── IgesSubfigureDefinition.cs │ ├── IgesSubordinateEntitySwitchType.cs │ ├── IgesSurfaceOfRevolution.cs │ ├── IgesTabulatedCylinder.cs │ ├── IgesTemplateLineFontDefinition.cs │ ├── IgesTextDisplayTemplate.cs │ ├── IgesTextFontDefinition.cs │ ├── IgesThreeNodeBeam.cs │ ├── IgesThreeNodedBeam.cs │ ├── IgesToroidalSurface.cs │ ├── IgesTorus.cs │ ├── IgesTransformationMatrix.cs │ ├── IgesTrimmedParametricSurface.cs │ ├── IgesView.cs │ └── IgesViewBase.cs ├── IgesColorNumber.cs ├── IgesDirectoryData.cs ├── IgesDraftingStandard.cs ├── IgesException.cs ├── IgesFile.cs ├── IgesFileReader.cs ├── IgesFileWriter.cs ├── IgesLineFontPattern.cs ├── IgesParameterReader.cs ├── IgesParser.cs ├── IgesPoint.cs ├── IgesReaderBinder.cs ├── IgesSectionType.cs ├── IgesUnits.cs ├── IgesVector.cs ├── IgesVersion.cs ├── IgesWriterBinder.cs └── IxMilia.Iges.csproj ├── LICENSE ├── LiteCAD.sln ├── LiteCAD ├── AboutBox1.Designer.cs ├── AboutBox1.cs ├── AboutBox1.resx ├── AbstractDraftTool.cs ├── AbstractTool.cs ├── App.config ├── Camera.cs ├── CameraViewManager.cs ├── ComboBoxItem.cs ├── DefaultCameraViewManager.cs ├── DefaultSelectManager.cs ├── Dialogs │ ├── ArrayDialog.Designer.cs │ ├── ArrayDialog.cs │ ├── ArrayDialog.resx │ ├── OffsetDialog.Designer.cs │ ├── OffsetDialog.cs │ └── OffsetDialog.resx ├── DraftEditor │ ├── ClipperHelper.cs │ ├── DraftEditor.Designer.cs │ ├── DraftEditor.cs │ ├── DraftEditor.resx │ ├── EqualsConstraintHelper.cs │ ├── EventWrapperPictureBox.cs │ ├── HorizontalConstraintHelper.cs │ ├── IDraftEditor.cs │ ├── ImageDraftHelper.cs │ ├── LinearConstraintHelper.cs │ ├── LinearConstraintLengthDialog.Designer.cs │ ├── LinearConstraintLengthDialog.cs │ ├── LinearConstraintLengthDialog.resx │ ├── ParallelConstraintHelper.cs │ ├── PerpendicularConstraintHelper.cs │ └── VerticalConstraintHelper.cs ├── EventWrapperGlControl.cs ├── ExportDxfDialog.Designer.cs ├── ExportDxfDialog.cs ├── ExportDxfDialog.resx ├── ExtrudeModifier.cs ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Group.cs ├── GroupInstance.cs ├── Helpers.cs ├── IEconomicsDetail.cs ├── IEditor.cs ├── ITool.cs ├── Icons │ ├── anchor.png │ ├── application-tile.png │ ├── arrow-curve-180-left.ico │ ├── arrow-resize.ico │ ├── arrow-skip-090.ico │ ├── blue-document-export.png │ ├── blue-document.png │ ├── cross-button.ico │ ├── cursor.ico │ ├── cutter.png │ ├── disk.ico │ ├── eraser.ico │ ├── fill-090.png │ ├── folder-horizontal-open.png │ ├── gear.png │ ├── grid.png │ ├── layer-flip-vertical.png │ ├── layer-flip.png │ ├── layer-resize.png │ ├── layer-shape-ellipse.ico │ ├── layer-shape-line.ico │ ├── layer-shape-polygon.png │ ├── layer-shape.ico │ ├── light-bulb-off.png │ ├── light-bulb.ico │ ├── magnet.ico │ ├── magnifier-zoom-actual-equal.png │ ├── magnifier.ico │ ├── molecule.png │ ├── picture.png │ ├── plug-connect.png │ ├── puzzle.png │ └── question.png ├── Info.Designer.cs ├── Info.cs ├── Info.resx ├── InfoPanel.Designer.cs ├── InfoPanel.cs ├── InfoPanel.resx ├── IntersectInfo.cs ├── Intersection.cs ├── LiteCAD.csproj ├── LiteCADScene.cs ├── MeshModel.cs ├── MouseRay.cs ├── PartAssembly.cs ├── PartInstance.cs ├── ProductionStuff.cs ├── Program.cs ├── PropEditors │ ├── ColorPickerDialog.Designer.cs │ ├── ColorPickerDialog.cs │ ├── ColorPickerDialog.resx │ ├── DoublePropEditor.Designer.cs │ ├── DoublePropEditor.cs │ ├── DoublePropEditor.resx │ ├── Matrix4dPropEditor.Designer.cs │ ├── Matrix4dPropEditor.cs │ ├── Matrix4dPropEditor.resx │ ├── RPNCalc.cs │ ├── Vector2dPropEditor.Designer.cs │ ├── Vector2dPropEditor.cs │ ├── Vector2dPropEditor.resx │ ├── Vector3dPropEditor.Designer.cs │ ├── Vector3dPropEditor.cs │ └── Vector3dPropEditor.resx ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ └── cursor.ico ├── RibbonMenu.Designer.cs ├── RibbonMenu.cs ├── RibbonMenu.resx ├── RibbonMenuWpf.xaml ├── RibbonMenuWpf.xaml.cs ├── STLLoader.cs ├── Tools │ ├── AdjoinTool.cs │ ├── CutEdgeTool.cs │ ├── DraftEllipseTool.cs │ ├── DraftLineTool.cs │ ├── EqualsConstraintTool.cs │ ├── HorizontalConstraintTool.cs │ ├── LinearConstraintTool.cs │ ├── ParallelConstraintTool.cs │ ├── PerpendicularConstraintTool.cs │ ├── RectDraftTool.cs │ ├── SelectionTool.cs │ └── VerticalConstraintTool.cs └── ruler-triangle.ico ├── LiteCADLib ├── BRep │ ├── DrawItem.cs │ ├── Editor │ │ ├── AbstractDrawingContext.cs │ │ ├── EventWrapperPictureBox.cs │ │ ├── GdiDrawingContext.cs │ │ ├── IDrawingContext.cs │ │ ├── IUndoItem.cs │ │ ├── PointUndoItem.cs │ │ ├── ProjectMapEditor.Designer.cs │ │ ├── ProjectMapEditor.cs │ │ ├── ProjectMapEditor.resx │ │ └── SkiaGLDrawingContext.cs │ ├── LineItem.cs │ ├── PlaneItem.cs │ └── PointItem.cs ├── CSP │ ├── CSPConstr.cs │ ├── CSPConstrEqualExpression.cs │ ├── CSPConstrEqualTwoVars.cs │ ├── CSPConstrEqualVarValue.cs │ ├── CSPTask.cs │ ├── CSPVar.cs │ ├── CSPVarContext.cs │ ├── CSPVarInfo.cs │ └── Token.cs ├── Common │ ├── AbstractDrawable.cs │ ├── ChangeCand.cs │ ├── Draft.cs │ ├── DraftConstraint.cs │ ├── DraftElement.cs │ ├── DraftEllipse.cs │ ├── DraftLine.cs │ ├── DraftPoint.cs │ ├── EditFieldAttribute.cs │ ├── EqualsConstraint.cs │ ├── Extensions.cs │ ├── GeometryUtils.cs │ ├── HorizontalConstraint.cs │ ├── IDraftConstraintHelper.cs │ ├── IDraftHelper.cs │ ├── IDrawable.cs │ ├── IEditFieldsContainer.cs │ ├── IMessageReporter.cs │ ├── IName.cs │ ├── IPlaneSplittable.cs │ ├── ISelectManager.cs │ ├── IVisualPartContainer.cs │ ├── IXmlStorable.cs │ ├── IntFieldEditor.cs │ ├── LineHelper.cs │ ├── LinearConstaint.cs │ ├── LiteCadException.cs │ ├── NFP.cs │ ├── ParallelConstraint.cs │ ├── PerpendicularConstraint.cs │ ├── PlaneDataTransferObject.cs │ ├── PlaneHelper.cs │ ├── PlyStuff.cs │ ├── PointPositionConstraint.cs │ ├── PolylineHelper.cs │ ├── RotationTransformChainItem.cs │ ├── ScaleTransformChainItem.cs │ ├── Segment3d.cs │ ├── StringFieldEditor.cs │ ├── TopologyConstraint.cs │ ├── TopologyDraftLineInfo.cs │ ├── TransformationChain.cs │ ├── TransformationChainItem.cs │ ├── TranslateTransformChainItem.cs │ ├── VectorEditor.cs │ ├── VerticalConstraint.cs │ ├── VisualPart.cs │ └── XmlNameAttribute.cs ├── LiteCAD.Lib.csproj ├── MessageFilter.cs ├── Properties │ └── AssemblyInfo.cs └── Tools │ ├── CylinderProjectionPointEditorToolPanel.Designer.cs │ ├── CylinderProjectionPointEditorToolPanel.cs │ ├── CylinderProjectionPointEditorToolPanel.resx │ ├── ToolHeader.cs │ ├── ToolPanel.Designer.cs │ ├── ToolPanel.cs │ └── ToolPanel.resx ├── README.md ├── Triangle ├── Behavior.cs ├── Configuration.cs ├── Enums.cs ├── Geometry │ ├── Contour.cs │ ├── Edge.cs │ ├── ExtensionMethods.cs │ ├── IEdge.cs │ ├── IPolygon.cs │ ├── ISegment.cs │ ├── ITriangle.cs │ ├── Point.cs │ ├── Polygon.cs │ ├── Rectangle.cs │ ├── RegionPointer.cs │ ├── Segment.cs │ └── Vertex.cs ├── IO │ ├── DebugWriter.cs │ ├── FileProcessor.cs │ ├── IFileFormat.cs │ ├── IMeshFormat.cs │ ├── IPolygonFormat.cs │ ├── InputTriangle.cs │ ├── TriangleFormat.cs │ ├── TriangleReader.cs │ └── TriangleWriter.cs ├── IPredicates.cs ├── Log.cs ├── Logging │ ├── ILog.cs │ ├── ILogItem.cs │ └── LogItem.cs ├── Mesh.cs ├── MeshValidator.cs ├── Meshing │ ├── Algorithm │ │ ├── Dwyer.cs │ │ ├── Incremental.cs │ │ └── SweepLine.cs │ ├── ConstraintMesher.cs │ ├── ConstraintOptions.cs │ ├── Converter.cs │ ├── Data │ │ ├── BadSubseg.cs │ │ ├── BadTriQueue.cs │ │ └── BadTriangle.cs │ ├── GenericMesher.cs │ ├── IConstraintMesher.cs │ ├── IMesh.cs │ ├── IQualityMesher.cs │ ├── ITriangulator.cs │ ├── Iterators │ │ ├── EdgeIterator.cs │ │ ├── RegionIterator.cs │ │ └── VertexCirculator.cs │ ├── QualityMesher.cs │ └── QualityOptions.cs ├── NewLocation.cs ├── Properties │ └── AssemblyInfo.cs ├── RobustPredicates.cs ├── Smoothing │ ├── ISmoother.cs │ ├── SimpleSmoother.cs │ └── VoronoiFactory.cs ├── Tools │ ├── AdjacencyMatrix.cs │ ├── CuthillMcKee.cs │ ├── Interpolation.cs │ ├── IntersectionHelper.cs │ ├── PolygonValidator.cs │ ├── QualityMeasure.cs │ ├── Statistic.cs │ ├── TriangleQuadTree.cs │ └── VertexSorter.cs ├── Topology │ ├── DCEL │ │ ├── DcelMesh.cs │ │ ├── Face.cs │ │ ├── HalfEdge.cs │ │ └── Vertex.cs │ ├── Osub.cs │ ├── Otri.cs │ ├── SubSegment.cs │ └── Triangle.cs ├── Triangle.csproj ├── TriangleLocator.cs ├── TrianglePool.cs ├── TriangleSampler.cs └── Voronoi │ ├── BoundedVoronoi.cs │ ├── DefaultVoronoiFactory.cs │ ├── IVoronoiFactory.cs │ ├── Legacy │ ├── BoundedVoronoiLegacy.cs │ ├── IVoronoi.cs │ ├── SimpleVoronoi.cs │ └── VoronoiRegion.cs │ ├── StandardVoronoi.cs │ └── VoronoiBase.cs ├── clipper ├── Properties │ └── AssemblyInfo.cs ├── clipper.cs └── clipperLib.csproj └── imgs ├── 1.jpg ├── 2.jpg ├── 3.jpg └── 4.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | .vs/ 3 | packages/ 4 | bin/ 5 | obj/ -------------------------------------------------------------------------------- /BREP/BRep/BRepCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | 4 | namespace BREP.BRep 5 | { 6 | public class BRepCurve 7 | { 8 | public virtual BRepCurve Clone() 9 | { 10 | throw new NotImplementedException(); 11 | } 12 | 13 | public virtual void Transform(Matrix4d mtr4) 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /BREP/BRep/BRepSurface.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | 4 | namespace BREP.BRep 5 | { 6 | public abstract class BRepSurface 7 | { 8 | public abstract bool IsOnSurface(Vector3d v, double eps = 1e-8); 9 | 10 | public virtual BRepSurface Clone() 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | 15 | public virtual void Transform(Matrix4d mtr4) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /BREP/BRep/BRepWire.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace BREP.BRep 7 | { 8 | public class BRepWire 9 | { 10 | public List Edges = new List(); 11 | public bool IsOutter = false; 12 | 13 | 14 | public bool IsClosed(double eps = 1e-8) 15 | { 16 | if (Edges.Count == 0) return true; 17 | BRepEdge p = Edges[0]; 18 | 19 | for (int i = 1; i < Edges.Count; i++) 20 | { 21 | BRepEdge item = Edges[i]; 22 | if (!((item.Start - p.Start).Length < eps || (item.Start - p.End).Length < eps || (item.End - p.Start).Length < eps || (item.End - p.End).Length < eps)) return false; 23 | p = item; 24 | } 25 | return true; 26 | } 27 | 28 | public BRepWire Clone() 29 | { 30 | BRepWire ret = new BRepWire(); 31 | foreach (var item in Edges) 32 | { 33 | ret.Edges.Add(item.Clone()); 34 | } 35 | return ret; 36 | } 37 | 38 | public void Transform(Matrix4d mtr4) 39 | { 40 | foreach (var item in Edges) 41 | { 42 | item.Transform(mtr4); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /BREP/BRep/Curves/BRepBSplineWithKnotsCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Curves 4 | { 5 | public class BRepBSplineWithKnotsCurve : BRepCurve 6 | { 7 | public Vector3d Location; 8 | public Vector3d RefDir; 9 | public int Degree; 10 | public bool Closed; 11 | public int[] KnotMultiplicities; 12 | public Vector3d[] ControlPoints; 13 | 14 | public double[] Knots; 15 | 16 | } 17 | 18 | 19 | } -------------------------------------------------------------------------------- /BREP/BRep/Curves/BRepCircleCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Curves 4 | { 5 | public class BRepCircleCurve : BRepCurve 6 | { 7 | public double Radius; 8 | public Vector3d Axis; 9 | public Vector3d Dir; 10 | public Vector3d Location; 11 | 12 | public double SweepAngle; 13 | 14 | public override BRepCurve Clone() 15 | { 16 | BRepCircleCurve cc = new BRepCircleCurve(); 17 | 18 | cc.Radius = Radius; 19 | cc.Axis = Axis; 20 | cc.Dir = Dir; 21 | cc.Location = Location; 22 | cc.SweepAngle = SweepAngle; 23 | 24 | return cc; 25 | } 26 | 27 | public override void Transform(Matrix4d mtr4) 28 | { 29 | var rot = mtr4.ExtractRotation(); 30 | Axis = Vector3d.Transform(Axis, rot); ; 31 | Dir = Vector3d.Transform(Dir, rot); 32 | Location = Vector3d.Transform(Location, mtr4); 33 | 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /BREP/BRep/Curves/BRepEllipseCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Curves 4 | { 5 | public class BRepEllipseCurve : BRepCurve 6 | { 7 | public Vector3d Location; 8 | public Vector3d RefDir; 9 | 10 | public double SemiAxis1; 11 | public double SemiAxis2; 12 | 13 | public Vector3d Axis; 14 | public Vector3d Dir; 15 | 16 | public double SweepAngle; 17 | } 18 | } -------------------------------------------------------------------------------- /BREP/BRep/Curves/BRepLineCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Curves 4 | { 5 | public class BRepLineCurve : BRepCurve 6 | { 7 | public Vector3d Point; 8 | public Vector3d Vector; 9 | 10 | public override BRepCurve Clone() 11 | { 12 | BRepLineCurve ret = new BRepLineCurve(); 13 | ret.Point = Point; 14 | ret.Vector = Vector; 15 | return ret; 16 | } 17 | 18 | public override void Transform(Matrix4d mtr4) 19 | { 20 | Point = Vector3d.Transform(Point, mtr4); 21 | var p2 = Point + Vector; 22 | p2 = Vector3d.Transform(p2, mtr4); 23 | 24 | Vector = p2 - Point; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /BREP/BRep/Curves/BRepSeamCurve.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.BRep.Curves 2 | { 3 | public class BRepSeamCurve : BRepCurve 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /BREP/BRep/CylinderMeshNode.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep.Surfaces; 2 | using OpenTK; 3 | 4 | namespace BREP.BRep 5 | { 6 | public class CylinderMeshNode : MeshNode 7 | { 8 | public override void SwitchNormal() 9 | { 10 | var cl = Parent.Surface as BRepCylinder; 11 | foreach (var item in Triangles) 12 | { 13 | foreach (var vv in item.Vertices) 14 | { 15 | vv.Normal *= -1; 16 | } 17 | } 18 | } 19 | public void SetNormal(TriangleInfo triangleInfo, Vector3d nrm) 20 | { 21 | if(Vector3d.Dot(triangleInfo.Vertices[0].Normal, nrm) < 0) 22 | { 23 | SwitchNormal(); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /BREP/BRep/Faces/BRepToroidalSurfaceFace.cs: -------------------------------------------------------------------------------- 1 | using BREP.Parsers.Step; 2 | using LiteCAD.Common; 3 | using OpenTK; 4 | using System; 5 | using System.Linq; 6 | 7 | namespace BREP.BRep.Faces 8 | { 9 | public class BRepToroidalSurfaceFace : BRepFace 10 | { 11 | public BRepToroidalSurfaceFace(Part parent) : base(parent) { } 12 | 13 | public override BRepFace Clone() 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | 18 | public override MeshNode ExtractMesh() 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | 23 | 24 | public override void Load(AdvancedFace face) 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /BREP/BRep/Outlines/LineItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Outlines 4 | { 5 | public class LineItem : OutlineItem 6 | { 7 | public Vector3d Start; 8 | public Vector3d End; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BREP/BRep/Outlines/OutlineItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.BRep.Outlines 2 | { 3 | public class OutlineItem 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /BREP/BRep/ProjectPolygon.cs: -------------------------------------------------------------------------------- 1 | using BREP.Common; 2 | using LiteCAD.Common; 3 | using OpenTK; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Linq; 7 | 8 | namespace BREP.BRep 9 | { 10 | public class ProjectPolygon 11 | { 12 | public List Points = new List(); 13 | 14 | public ProjectPolygon Clone() 15 | { 16 | ProjectPolygon ret = new ProjectPolygon(); 17 | ret.Points = Points.ToList(); 18 | return ret; 19 | } 20 | public void Scale(double x, double y) 21 | { 22 | for (int i = 0; i < Points.Count; i++) 23 | { 24 | Points[i] = new Vector2d(Points[i].X * x, Points[i].Y * y); 25 | } 26 | } 27 | public RectangleF? BoundingBox() 28 | { 29 | var pnt = Points.Select(z => new PointF((float)z.X, (float)z.Y)).ToArray(); 30 | 31 | var maxx = pnt.Max(z => z.X); 32 | var maxy = pnt.Max(z => z.Y); 33 | var minx = pnt.Min(z => z.X); 34 | var miny = pnt.Min(z => z.Y); 35 | 36 | return new RectangleF((float)(minx), (float)(miny), maxx - minx, maxy - miny); 37 | } 38 | 39 | internal double Area() 40 | { 41 | return GeometryUtils.CalculateArea(Points.ToArray()); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /BREP/BRep/Segment.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep 4 | { 5 | public class Segment 6 | { 7 | public override string ToString() 8 | { 9 | return "Start: " + Start + "; End: " + End; 10 | } 11 | public Vector2d Start; 12 | public Vector2d End; 13 | public double Length() 14 | { 15 | return (End - Start).Length; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /BREP/BRep/Surfaces/BRepBSplineWithKnotsSurface.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Surfaces 4 | { 5 | public class BRepBSplineWithKnotsSurface : BRepSurface 6 | { 7 | public Vector3d Location; 8 | public Vector3d Normal; 9 | public int uDegree; 10 | public int vDegree; 11 | public Vector3d[][] ControlPoints; 12 | 13 | public override bool IsOnSurface(Vector3d v, double eps = 1E-08) 14 | { 15 | throw new System.NotImplementedException(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /BREP/BRep/Surfaces/BRepConicalSurface.cs: -------------------------------------------------------------------------------- 1 | using BREP.Common; 2 | using LiteCAD.Common; 3 | using OpenTK; 4 | using System; 5 | 6 | namespace BREP.BRep.Surfaces 7 | { 8 | public class BRepConicalSurface : BRepSurface 9 | { 10 | public Vector3d Location; 11 | public Vector3d Normal; 12 | public double SemiAngle; 13 | public double Radius; 14 | 15 | public Vector2d GetProj(Vector3d v) 16 | { 17 | if (!IsOnSurface(v)) 18 | throw new BrepException("point is not on surface"); 19 | /* 20 | BRepPlane plane = new BRepPlane() { Location = Location, Normal = Axis }; 21 | var proj0 = plane.GetProjPoint(v) - Location; 22 | var p = Vector3d.Dot(v - Location, Axis); 23 | var t1 = Location + Axis * p; 24 | var ang = Vector3d.CalculateAngle(proj0, RefDir); 25 | var crs = Vector3d.Cross(proj0, RefDir); 26 | if (Vector3d.Dot(Axis, crs) < 0) 27 | { 28 | ang = -ang; 29 | } 30 | if (ang < 0) ang += Math.PI * 2; 31 | return new Vector2d(ang, p);*/ 32 | throw new NotImplementedException(); 33 | } 34 | 35 | public override bool IsOnSurface(Vector3d v, double eps = 1E-08) 36 | { 37 | throw new System.NotImplementedException(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /BREP/BRep/Surfaces/BRepLinearExtrusionSurface.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Surfaces 4 | { 5 | public class BRepLinearExtrusionSurface : BRepSurface 6 | { 7 | public Vector3d Location; 8 | public Vector3d Normal; 9 | public double Length; 10 | public Vector3d Vector; 11 | 12 | public override bool IsOnSurface(Vector3d v, double eps = 1E-08) 13 | { 14 | throw new System.NotImplementedException(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /BREP/BRep/Surfaces/BRepPlane.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | 4 | namespace BREP.BRep.Surfaces 5 | { 6 | public class BRepPlane : BRepSurface 7 | { 8 | public Vector3d Location; 9 | public Vector3d Normal; 10 | public Vector2d GetUVProjPoint(Vector3d point, Vector3d axis1, Vector3d axis2) 11 | { 12 | var p = GetProjPoint(point) - Location; 13 | var p1 = Vector3d.Dot(p, axis1); 14 | var p2 = Vector3d.Dot(p, axis2); 15 | return new Vector2d(p1, p2); 16 | } 17 | public Vector3d GetProjPoint(Vector3d point) 18 | { 19 | var v = point - Location; 20 | var nrm = Normal; 21 | var dist = Vector3d.Dot(v, nrm); 22 | var proj = point - dist * nrm; 23 | return proj; 24 | } 25 | 26 | public override bool IsOnSurface(Vector3d v, double eps = 1E-08) 27 | { 28 | return (Math.Abs(Vector3d.Dot(Location - v, Normal)) < eps); 29 | } 30 | 31 | public override BRepSurface Clone() 32 | { 33 | BRepPlane ret = new BRepPlane(); 34 | ret.Location = Location; 35 | ret.Normal = Normal; 36 | return ret; 37 | } 38 | 39 | public override void Transform(Matrix4d mtr4) 40 | { 41 | Location = Vector3d.Transform(Location, mtr4); 42 | var rot = mtr4.ExtractRotation(); 43 | Normal = Vector3d.Transform(Normal, rot); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /BREP/BRep/Surfaces/BRepToroidalSurface.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.BRep.Surfaces 4 | { 5 | public class BRepToroidalSurface : BRepSurface 6 | { 7 | public Vector3d Location; 8 | public Vector3d Normal; 9 | public double MajorRadius { get; set; } 10 | public double MinorRadius { get; set; } 11 | 12 | public override bool IsOnSurface(Vector3d v, double eps = 1E-08) 13 | { 14 | throw new System.NotImplementedException(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /BREP/BRep/UnsupportedCurveException.cs: -------------------------------------------------------------------------------- 1 | using BREP.Parsers.Step; 2 | 3 | namespace BREP.BRep 4 | { 5 | public class UnsupportedCurveException : StepParserException 6 | { 7 | public UnsupportedCurveException() { } 8 | public UnsupportedCurveException(string msg) : base(msg) { } 9 | } 10 | } -------------------------------------------------------------------------------- /BREP/Common/BrepException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BREP.Common 4 | { 5 | public class BrepException : Exception 6 | { 7 | public BrepException(string str) : base(str) { } 8 | } 9 | } -------------------------------------------------------------------------------- /BREP/Common/Extensions.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Drawing; 3 | using System.Text; 4 | using System.Windows.Forms; 5 | 6 | namespace LiteCAD.Common 7 | { 8 | public static class Extensions 9 | { 10 | public static Vector3 ToVector3(this Vector3d v) 11 | { 12 | return new Vector3((float)v.X, (float)v.Y, (float)v.Z); 13 | } 14 | public static Vector3d ToVector3d(this Vector3 v) 15 | { 16 | return new Vector3d(v.X, v.Y, v.Z); 17 | } 18 | 19 | public static Vector2d ToVector2d(this Vector2 v) 20 | { 21 | return new Vector2d(v.X, v.Y); 22 | } 23 | public static StringBuilder ToXml(this PolyBoolCS.Polygon p) 24 | { 25 | StringBuilder s = new StringBuilder(); 26 | s.AppendLine(""); 27 | s.AppendLine(""); 28 | foreach (var item in p.regions) 29 | { 30 | s.AppendLine(""); 31 | 32 | foreach (var pn in item) 33 | { 34 | s.AppendLine($""); 35 | } 36 | s.AppendLine(""); 37 | } 38 | s.AppendLine(""); 39 | return s; 40 | 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /BREP/Common/FactoryHelper.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.Common 2 | { 3 | public static class FactoryHelper 4 | { 5 | 6 | public static int NewId; 7 | } 8 | } -------------------------------------------------------------------------------- /BREP/Common/IMesh.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Collections.Generic; 3 | 4 | namespace LiteCAD.Common 5 | { 6 | public interface IMesh 7 | { 8 | IEnumerable GetPoints(); 9 | } 10 | } -------------------------------------------------------------------------------- /BREP/Common/IMeshNodesContainer.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public interface IMeshNodesContainer 6 | { 7 | MeshNode[] Nodes { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /BREP/Common/IPartContainer.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.Common 2 | { 3 | public interface IPartContainer 4 | { 5 | int Id { get; } 6 | Part Part { get; } 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /BREP/Common/IXmlStorable.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Xml.Linq; 3 | 4 | namespace LiteCAD.Common 5 | { 6 | public interface IXmlStorable 7 | { 8 | void StoreXml(TextWriter writer); 9 | void RestoreXml(XElement elem); 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /BREP/Common/Line3D.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | 4 | namespace BREP.Common 5 | { 6 | public class Line3D 7 | { 8 | public Vector3d Start; 9 | public Vector3d End; 10 | public Vector3d Dir 11 | { 12 | get 13 | { 14 | return (End - Start).Normalized(); 15 | } 16 | } 17 | 18 | public bool IsPointOnLine(Vector3d pnt, float epsilon = 10e-6f) 19 | { 20 | float tolerance = 10e-6f; 21 | var d1 = pnt - Start; 22 | if (d1.Length < tolerance) return true; 23 | if ((End - Start).Length < tolerance) throw new Exception("degenerated 3d line"); 24 | var crs = Vector3d.Cross(d1.Normalized(), (End - Start).Normalized()); 25 | return Math.Abs(crs.Length) < epsilon; 26 | } 27 | public bool IsPointInsideSegment(Vector3d pnt, float epsilon = 10e-6f) 28 | { 29 | if (!IsPointOnLine(pnt, epsilon)) return false; 30 | var v0 = (End - Start).Normalized(); 31 | var v1 = pnt - Start; 32 | var crs = Vector3d.Dot(v0, v1) / (End - Start).Length; 33 | return !(crs < 0 || crs > 1); 34 | } 35 | public bool IsSameLine(Line3D l) 36 | { 37 | return IsPointOnLine(l.Start) && IsPointOnLine(l.End); 38 | } 39 | 40 | public void Shift(Vector3d vector3) 41 | { 42 | Start += vector3; 43 | End += vector3; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /BREP/Common/NFP.cs: -------------------------------------------------------------------------------- 1 | using BREP.Common; 2 | using OpenTK; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace BREP.Common 7 | { 8 | public class NFP 9 | { 10 | public Vector2d[] Points = new Vector2d[] { }; 11 | public List Childrens = new List(); 12 | public NFP Parent; 13 | public Vector2d this[int ind] 14 | { 15 | get 16 | { 17 | return Points[ind]; 18 | } 19 | } 20 | public void Shift(Vector2d vector) 21 | { 22 | for (int i = 0; i < Points.Length; i++) 23 | { 24 | Points[i].X += vector.X; 25 | Points[i].Y += vector.Y; 26 | } 27 | } 28 | public double SignedArea() 29 | { 30 | return GeometryUtils.signed_area(Points); 31 | } 32 | 33 | public int Length 34 | { 35 | get 36 | { 37 | return Points.Length; 38 | } 39 | } 40 | 41 | public void Reverse() 42 | { 43 | Points = Points.Reverse().ToArray(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /BREP/Common/Segment3d.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.Common 4 | { 5 | public class Segment3d 6 | { 7 | public Vector3d Start; 8 | public Vector3d End; 9 | } 10 | } -------------------------------------------------------------------------------- /BREP/NURBS/RationalBSplinePoint.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCADLib.NURBS 4 | { 5 | public class RationalBSplinePoint 6 | { 7 | 8 | public RationalBSplinePoint(Vector3d myPoint, double weight) 9 | { 10 | MyPoint = myPoint; 11 | Weight = weight; 12 | } 13 | 14 | private Vector3d pMyPoint = Vector3d.Zero; 15 | 16 | public Vector3d MyPoint 17 | { 18 | get { return pMyPoint; } 19 | set { pMyPoint = value; } 20 | } 21 | 22 | private double pWeight = 1d; 23 | 24 | public double Weight 25 | { 26 | get { return pWeight; } 27 | set { pWeight = value; } 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/AdvancedFace.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class AdvancedFace 6 | { 7 | public List Bounds = new List(); 8 | public Surface Surface; 9 | public bool Flag; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/AdvancedFaceParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class AdvancedFaceParseItem : ParserItem 7 | { 8 | public override string Key => "ADVANCED_FACE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | AdvancedFace ret = new AdvancedFace(); 18 | 19 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 22 | 23 | ret.Bounds = objs.Except(new[] { objs.Last() }).OfType().ToList(); 24 | 25 | ret.Surface = (Surface)objs.Last(); 26 | if(ret.Surface == null) 27 | { 28 | throw new StepParserException("empty surface"); 29 | } 30 | return ret; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/Axis2Placement3d.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class Axis2Placement3d 6 | { 7 | public Vector3d Location; 8 | public Vector3d Dir1; 9 | public Vector3d Dir2; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/Axis2Placement3dParseItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class Axis2Placement3dParseItem : ParserItem 8 | { 9 | public override string Key => "AXIS2_PLACEMENT_3D"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | Axis2Placement3d ret = new Axis2Placement3d(); 19 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | var aa = spl.Skip(1).Select(z => z.Trim()).ToArray(); 21 | 22 | var refs = aa.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 23 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 24 | ret.Location = (Vector3d)objs[0]; 25 | ret.Dir1 = (Vector3d)objs[1]; 26 | ret.Dir2 = (Vector3d)objs[2]; 27 | 28 | 29 | return ret; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/BSplineCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class BSplineCurve : Curve 8 | { 9 | public Vector3d[] Poles; 10 | public int Degree; 11 | 12 | internal void Parse(StepParseContext ctx, TokenList list1) 13 | { 14 | Degree = int.Parse((list1.Tokens.First(z => z is StringTokenItem ss && ss.Token.All(char.IsDigit)) as StringTokenItem).Token); 15 | var l1 = (list1.Tokens.First(z => z is ListTokenItem) as ListTokenItem).List.Tokens.ToArray(); 16 | var a1 = l1.Where(z => z is StringTokenItem).Select(z => z as StringTokenItem).Where(z => z.Token.StartsWith("#")).ToArray(); 17 | 18 | var zz = a1.Select(z => ctx.GetRefObj(int.Parse(z.Token.TrimStart('#')))).ToArray(); 19 | Poles = zz.Select(z => (Vector3d)z).ToArray(); 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/BSplineCurveWithKnots.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | 6 | namespace BREP.Parsers.Step 7 | { 8 | public class BSplineCurveWithKnots : Curve 9 | { 10 | public Vector3d[] ControlPoints; 11 | public double Param1; 12 | public double Param2; 13 | public int[] Degree; 14 | public List Knots = new List(); 15 | public List Weights = new List(); 16 | public List Multiplicities = new List(); 17 | internal void Parse(TokenList list1) 18 | { 19 | var l1 = (list1.Tokens.First(z => z is ListTokenItem) as ListTokenItem).List.Tokens.ToArray(); 20 | var l2 = (list1.Tokens.Where(z => z is ListTokenItem).Skip(1).First() as ListTokenItem).List.Tokens.ToArray(); 21 | var z1 = l1.Where(z => z is StringTokenItem).ToArray(); 22 | Degree = z1.Select(z => z as StringTokenItem).Where(z => z.Token.All(char.IsDigit)).Select(z => int.Parse(z.Token)).ToArray(); 23 | //degree==multiplicities 24 | var aa = l2.Select(z => z as StringTokenItem).Where(z => z.Token.Any(char.IsDigit)).Select(u => double.Parse(u.Token.Replace(",", "."), CultureInfo.InvariantCulture)).ToArray(); 25 | Param1 = aa[0]; 26 | Param2 = aa[1]; 27 | //knots=[param1, param2] 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/BSplineSurface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class BSplineSurface : Surface 6 | { 7 | public int Degree; 8 | 9 | internal void Parse(StepParseContext ctx, TokenList list) 10 | { 11 | //throw new NotImplementedException(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/BSplineSurfaceWithKnots.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class BSplineSurfaceWithKnots : BSplineSurface 8 | { 9 | public int uDegree; 10 | public int vDegree; 11 | public Vector3d[][] ControlPoints; 12 | 13 | 14 | internal void Parse(TokenList list1) 15 | { 16 | var l1 = (list1.Tokens.First(z => z is ListTokenItem) as ListTokenItem).List.Tokens.ToArray(); 17 | var l2 = (list1.Tokens.Where(z => z is ListTokenItem).Skip(1).First() as ListTokenItem).List.Tokens.ToArray(); 18 | var z1 = l1.Where(z => z is StringTokenItem).ToArray(); 19 | //Degree = z1.Select(z => z as StringTokenItem).Where(z => z.Token.All(char.IsDigit)).Select(z => int.Parse(z.Token)).ToArray(); 20 | //degree==multiplicities 21 | var aa = l2.Select(z => z as StringTokenItem).Where(z => z.Token.Any(char.IsDigit)).Select(u => double.Parse(u.Token.Replace(",", "."), CultureInfo.InvariantCulture)).ToArray(); 22 | // Param1 = aa[0]; 23 | // Param2 = aa[1]; 24 | //knots=[param1, param2] 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/BoundedCurve.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Collections.Generic; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class BoundedCurve : Curve 7 | { 8 | public List Poles = new List(); 9 | public List Weights = new List(); 10 | public List Knots = new List(); 11 | public List Multiplicities = new List(); 12 | public int Degree; 13 | public List Curves = new List(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/CartesianPointParseItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Globalization; 4 | using System.Linq; 5 | 6 | namespace BREP.Parsers.Step 7 | { 8 | public class CartesianPointParseItem : ParserItem 9 | { 10 | public override string Key => "CARTESIAN_POINT"; 11 | 12 | public override bool IsApplicable(StepLineItem item) 13 | { 14 | return item.Value.Contains(Key); 15 | } 16 | 17 | public override object Parse(StepParseContext ctx, StepLineItem item) 18 | { 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | var zz = spl.Skip(1).Where(z => !z.Contains('\'')).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 21 | if (zz.Length < 1 || zz.Length > 3) 22 | { 23 | throw new WrongArgumentsException(); 24 | } 25 | Vector3d ret = new Vector3d(); 26 | if (zz.Length >= 1) 27 | ret.X = zz[0]; 28 | if (zz.Length >= 2) 29 | ret.Y = zz[1]; 30 | if (zz.Length >= 3) 31 | ret.Z = zz[2]; 32 | 33 | return ret; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/CircleParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class CircleParseItem : ParserItem 8 | { 9 | public override string Key => "CIRCLE"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | Circle ret = new Circle(); 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | spl = spl.Where(z => !z.Contains('\'')).ToArray(); 21 | var zz = spl.Skip(2).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 22 | var refs = spl.Skip(1).Take(1).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 23 | 24 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 25 | 26 | ret.Axis = (Axis2Placement3d)objs[0]; 27 | ret.Radius = zz[0]; 28 | 29 | return ret; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ClosedShell.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class Shell 6 | { 7 | public bool Closed; 8 | public List Faces = new List(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ColourRGBParseItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Globalization; 4 | using System.Linq; 5 | 6 | namespace BREP.Parsers.Step 7 | { 8 | public class ColourRGBParseItem : ParserItem 9 | { 10 | public override string Key => "COLOUR_RGB"; 11 | 12 | public override bool IsApplicable(StepLineItem item) 13 | { 14 | return item.Value.Contains(Key); 15 | } 16 | 17 | public override object Parse(StepParseContext ctx, StepLineItem item) 18 | { 19 | Vector3d ret = new Vector3d(); 20 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 21 | var zz = spl.Skip(1).Where(z => !z.Contains('\'')).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 22 | ret.X = zz[0]; 23 | ret.Y = zz[1]; 24 | ret.Z = zz[2]; 25 | return ret; 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ConicalSurfaceParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class ConicalSurfaceParseItem : ParserItem 8 | { 9 | public override string Key => "CONICAL_SURFACE"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | ConicalSurface ret = new ConicalSurface(); 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | 21 | var zz = spl.Skip(2).Where(z => !z.Contains('\'') && !z.Trim().StartsWith("#")).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 22 | var refs = spl.Skip(1).Where(z => !z.Contains('\'')).Take(1).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 23 | 24 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 25 | 26 | 27 | ret.Axis = (Axis2Placement3d)objs[0]; 28 | ret.Radius = zz[0]; 29 | ret.SemiAngle = zz[1]; 30 | 31 | return ret; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/CylindricalSurfaceParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class CylindricalSurfaceParseItem : ParserItem 8 | { 9 | public override string Key => "CYLINDRICAL_SURFACE"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | CylindricalSurface ret = new CylindricalSurface(); 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | 21 | var zz = spl.Skip(2).Where(z => !z.Contains('\'') && !z.Trim().StartsWith("#")).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 22 | var refs = spl.Skip(1).Where(z => !z.Contains('\'')).Take(1).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 23 | 24 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 25 | 26 | 27 | ret.Axis = (Axis2Placement3d)objs[0]; 28 | ret.Radius = zz[0]; 29 | 30 | return ret; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/DefinitionalRepresentation.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class DefinitionalRepresentation 6 | { 7 | public List Curves = new List(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/DefinitionalRepresentationParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class DefinitionalRepresentationParseItem : ParserItem 7 | { 8 | public override string Key => "DEFINITIONAL_REPRESENTATION"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | DefinitionalRepresentation ret = new DefinitionalRepresentation(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 20 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 21 | ret.Curves = objs.OfType().ToList(); 22 | 23 | return ret; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/DirectionParseItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class DirectionParseItem : CartesianPointParseItem 4 | { 5 | public override string Key => "DIRECTION"; 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/EdgeCurve.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class EdgeCurve 4 | { 5 | public VertexPoint Start; 6 | public VertexPoint End; 7 | public Curve EdgeGeometry; 8 | public bool SameSense; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/EdgeCurveParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class EdgeCurveParseItem : ParserItem 7 | { 8 | public override string Key => "EDGE_CURVE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | EdgeCurve ret = new EdgeCurve(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 20 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 21 | ret.Start = objs[0] as VertexPoint; 22 | ret.End = objs[1] as VertexPoint; 23 | ret.EdgeGeometry = objs[2] as Curve; 24 | ret.SameSense = spl.Last().Contains("T."); 25 | if (ret.EdgeGeometry == null) 26 | { 27 | throw new StepParserException("empty geomtery"); 28 | } 29 | return ret; 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/EdgeLoopParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class EdgeLoopParseItem : ParserItem 7 | { 8 | public override string Key => "EDGE_LOOP"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | EdgeLoop ret = new EdgeLoop(); 18 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | 20 | var refs = spl.Skip(1).Where(z => !z.Contains('\'')).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 22 | ret.Edges = objs.Select(z => z as OrientedEdge).ToList(); 23 | 24 | return ret; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /BREP/Parsers/Step/EllipseParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class EllipseParseItem : ParserItem 8 | { 9 | public override string Key => "ELLIPSE"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | Ellipse ret = new Ellipse(); 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | spl = spl.Where(z => !z.Contains('\'')).ToArray(); 21 | var zz = spl.Skip(2).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 22 | var refs = spl.Skip(1).Take(1).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 23 | 24 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 25 | 26 | ret.Axis = (Axis2Placement3d)objs[0]; 27 | ret.MinorRadius = zz[0]; 28 | ret.MajorRadius = zz[1]; 29 | 30 | return ret; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/FaceBoundParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class FaceBoundParseItem : ParserItem 7 | { 8 | public override string Key => "FACE_BOUND"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | FaceBound ret = new FaceBound(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | 20 | var refs = spl.Skip(1).Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | 22 | //spl.Last()=="T" 23 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 24 | ret.Loop = objs[0] as EdgeLoop; 25 | ret.Orientation = spl.Last().Contains("T."); 26 | 27 | return ret; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/FaceOuterBoundParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class FaceOuterBoundParseItem : ParserItem 7 | { 8 | public override string Key => "FACE_OUTER_BOUND"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | FaceOuterBound ret = new FaceOuterBound(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | 20 | var refs = spl.Skip(1).Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | 22 | //spl.Last()=="T" 23 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 24 | ret.Loop = objs[0] as EdgeLoop; 25 | 26 | return ret; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ITokenItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public interface ITokenItem 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/LineParseItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Globalization; 4 | using System.Linq; 5 | 6 | namespace BREP.Parsers.Step 7 | { 8 | public class LineParseItem : ParserItem 9 | { 10 | public override string Key => "LINE"; 11 | 12 | public override bool IsApplicable(StepLineItem item) 13 | { 14 | return item.Value.Trim().StartsWith(Key); 15 | } 16 | 17 | public override object Parse(StepParseContext ctx, StepLineItem item) 18 | { 19 | Line ret = new Line(); 20 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 21 | 22 | var refs = spl.Skip(1).Where(z => !z.Contains('\'')).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 23 | 24 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 25 | 26 | ret.Point = (Vector3d)objs[0]; 27 | ret.Vector = objs[1] as Vector; 28 | 29 | return ret; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/LinearExtrusionSurfaceParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class LinearExtrusionSurfaceParseItem : ParserItem 8 | { 9 | public override string Key => "SURFACE_OF_LINEAR_EXTRUSION"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | LinearExtrusionSurface ret = new LinearExtrusionSurface(); 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | 21 | var refs = spl.Skip(1).Where(z => !z.Contains('\'')).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 22 | 23 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 24 | 25 | ret.Curve = (Curve)objs[0]; 26 | ret.Vector = (Vector)objs[1]; 27 | return ret; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ListTokenItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class ListTokenItem : ITokenItem 4 | { 5 | public TokenList List; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/OpenShellParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class OpenShellParseItem : ParserItem 7 | { 8 | public override string Key => "OPEN_SHELL"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | Shell ret = new Shell(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | 20 | var refs = spl.Skip(1).Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | 22 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 23 | ret.Faces = objs.OfType().ToList(); 24 | 25 | return ret; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/OrientedEdge.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class OrientedEdge 4 | { 5 | public EdgeCurve Curve; 6 | public bool Orientation; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/OrientedEdgeParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class OrientedEdgeParseItem : ParserItem 7 | { 8 | public override string Key => "ORIENTED_EDGE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | OrientedEdge ret = new OrientedEdge(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 20 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 21 | ret.Curve = objs[0] as EdgeCurve; 22 | ret.Orientation = spl.Last().Contains("T."); 23 | 24 | return ret; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/PCurve.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class PCurve : Curve 4 | { 5 | public Surface Surface; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/PCurveParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class PCurveParseItem : ParserItem 7 | { 8 | public override string Key => "PCURVE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Trim().StartsWith(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | PCurve ret = new PCurve(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 20 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 21 | ret.Surface = objs[0] as Surface; 22 | 23 | 24 | if (ret.Surface == null) 25 | { 26 | throw new StepParserException($"empty surface"); 27 | } 28 | return ret; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ParserItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public abstract class ParserItem 4 | { 5 | public abstract bool IsApplicable(StepLineItem item); 6 | public abstract string Key { get; } 7 | public abstract object Parse(StepParseContext ctx, StepLineItem item); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/PlaneSurfaceParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class PlaneSurfaceParseItem : ParserItem 7 | { 8 | public override string Key => "PLANE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | PlaneSurface ret = new PlaneSurface(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var aa = spl.Skip(1).Select(z => z.Trim()).ToArray(); 20 | var refs = aa.Where(z=>z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | 22 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 23 | ret.Axis = (Axis2Placement3d)objs[0]; 24 | 25 | return ret; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/RationalBSplineSurface.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class RationalBSplineSurface : BSplineSurface 7 | { 8 | public double[] Weights; 9 | public void Parse(TokenList list) 10 | { 11 | var l1 = (list.Tokens.First(z => z is ListTokenItem) as ListTokenItem).List.Tokens.ToArray(); 12 | var z1 = l1.Where(z => z is StringTokenItem).ToArray(); 13 | 14 | Weights = z1.Select(z => z as StringTokenItem).Where(z => z.Token.Any(char.IsDigit)).Select(u => double.Parse(u.Token.Replace(",", "."), CultureInfo.InvariantCulture)).ToArray(); 15 | } 16 | } 17 | public class RationalBSplineCurve : Curve 18 | { 19 | public double[] Weights; 20 | public void Parse(TokenList list) 21 | { 22 | var l1 = (list.Tokens.First(z => z is ListTokenItem) as ListTokenItem).List.Tokens.ToArray(); 23 | var z1 = l1.Where(z => z is StringTokenItem).ToArray(); 24 | 25 | Weights = z1.Select(z => z as StringTokenItem).Where(z => z.Token.Any(char.IsDigit)).Select(u => double.Parse(u.Token.Replace(",", "."), CultureInfo.InvariantCulture)).ToArray(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/SeamCurve.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class SeamCurve : Curve 6 | { 7 | public List Curves = new List(); 8 | public Curve Curve; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/SeamCurveParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class SeamCurveParseItem : ParserItem 7 | { 8 | public override string Key => "SEAM_CURVE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | SeamCurve ret = new SeamCurve(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 20 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 21 | if (objs.Any(z => z == null)) 22 | { 23 | throw new StepParserException("empty curve"); 24 | } 25 | ret.Curve = objs[0] as Curve; 26 | for (int i = 1; i < objs.Length; i++) 27 | { 28 | ret.Curves.Add(objs[i] as Curve); 29 | } 30 | 31 | return ret; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/ShellParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class ClosedShellParseItem : ParserItem 7 | { 8 | public override string Key => "CLOSED_SHELL"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | Shell ret = new Shell() { Closed = true }; 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | 20 | var refs = spl.Skip(1).Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 21 | 22 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 23 | ret.Faces = objs.OfType().ToList(); 24 | 25 | return ret; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/StepLineItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class StepLineItem 4 | { 5 | public override string ToString() 6 | { 7 | return $"#{Index} = {Value}"; 8 | } 9 | public int Index; 10 | public string Value; 11 | 12 | public object Tag; 13 | public string[] Tokens() 14 | { 15 | return StepParser.Tokenize(Value); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/StepParserException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class StepParserException : Exception 6 | { 7 | public StepParserException(string text) : base(text) { } 8 | public StepParserException() : base() { } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/StringTokenItem.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class StringTokenItem : ITokenItem 4 | { 5 | public string Token; 6 | public override string ToString() 7 | { 8 | return $"{GetType().Name}: {Token}"; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/SurfaceCurve.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class SurfaceCurve : Curve 6 | { 7 | public Curve Geometry; 8 | public List Curves = new List(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/SurfaceCurveParseItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace BREP.Parsers.Step 5 | { 6 | public class SurfaceCurveParseItem : ParserItem 7 | { 8 | public override string Key => "SURFACE_CURVE"; 9 | 10 | public override bool IsApplicable(StepLineItem item) 11 | { 12 | return item.Value.Contains(Key); 13 | } 14 | 15 | public override object Parse(StepParseContext ctx, StepLineItem item) 16 | { 17 | SurfaceCurve ret = new SurfaceCurve(); 18 | var spl = item.Value.Split(new char[] { '\'', ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 19 | var refs = spl.Where(z => z.StartsWith("#")).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 20 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 21 | ret.Geometry = objs[0] as Curve; 22 | if (ret.Geometry == null) 23 | { 24 | throw new StepParserException($"empty geometry: {item.Value}"); 25 | } 26 | ret.Curves = objs.Skip(1).OfType().ToList(); 27 | 28 | return ret; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/TokenList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BREP.Parsers.Step 4 | { 5 | public class TokenList 6 | { 7 | public List Tokens = new List(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/VectorParseItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Globalization; 4 | using System.Linq; 5 | 6 | namespace BREP.Parsers.Step 7 | { 8 | public class VectorParseItem : ParserItem 9 | { 10 | public override string Key => "VECTOR"; 11 | 12 | public override bool IsApplicable(StepLineItem item) 13 | { 14 | return item.Value.Contains(Key); 15 | } 16 | 17 | public override object Parse(StepParseContext ctx, StepLineItem item) 18 | { 19 | Vector ret = new Vector(); 20 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 21 | spl = spl.Where(z => !z.Contains('\'')).ToArray(); 22 | var zz = spl.Skip(2).Select(z => double.Parse(z, CultureInfo.InvariantCulture)).ToArray(); 23 | var refs = spl.Skip(1).Take(1).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 24 | 25 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 26 | 27 | ret.Location = (Vector3d)objs[0]; 28 | ret.Length = zz[0]; 29 | 30 | return ret; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/VertexPointParseItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System; 3 | using System.Linq; 4 | 5 | namespace BREP.Parsers.Step 6 | { 7 | public class VertexPointParseItem : ParserItem 8 | { 9 | public override string Key => "VERTEX_POINT"; 10 | 11 | public override bool IsApplicable(StepLineItem item) 12 | { 13 | return item.Value.Contains(Key); 14 | } 15 | 16 | public override object Parse(StepParseContext ctx, StepLineItem item) 17 | { 18 | VertexPoint ret = new VertexPoint(); 19 | var spl = item.Value.Split(new char[] { ',', '(', ')', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray(); 20 | 21 | var refs = spl.Skip(1).Where(z => !z.Contains('\'')).Take(1).Select(z => int.Parse(z.TrimStart('#'))).ToArray(); 22 | var objs = refs.Select(z => ctx.GetRefObj(z)).ToArray(); 23 | ret.Point = (Vector3d)objs[0]; 24 | 25 | return ret; 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BREP/Parsers/Step/WrongArgumentsException.cs: -------------------------------------------------------------------------------- 1 | namespace BREP.Parsers.Step 2 | { 3 | public class WrongArgumentsException : StepParserException 4 | { 5 | public WrongArgumentsException(string text) : base(text) { } 6 | public WrongArgumentsException() : base() { } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BREP/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("LiteCADLib")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LiteCADLib")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("05537b4a-4a48-403c-a61b-9eca33ef559b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /BREP/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IIgesBooleanTreeItem.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public interface IIgesBooleanTreeItem 4 | { 5 | bool IsEntity { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesAssociativity.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public abstract class IgesAssociativity : IgesEntity 4 | { 5 | public override IgesEntityType EntityType { get { return IgesEntityType.AssociativityInstance; } } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesAxisymmetricCubicLine.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesAxisymmetricCubicLine : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Cubic; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | public IgesPoint P4 { get; set; } 11 | 12 | public IgesAxisymmetricCubicLine( 13 | IgesPoint p1, 14 | IgesPoint p2, 15 | IgesPoint p3, 16 | IgesPoint p4) 17 | : base(IgesTopologyType.AxisymmetricCubicLine) 18 | { 19 | P1 = p1; 20 | P2 = p2; 21 | P3 = p3; 22 | P4 = p4; 23 | } 24 | 25 | protected override void AddNodes() 26 | { 27 | InternalNodes.Add(new IgesNode(P1)); 28 | InternalNodes.Add(new IgesNode(P2)); 29 | InternalNodes.Add(new IgesNode(P3)); 30 | InternalNodes.Add(new IgesNode(P4)); 31 | } 32 | 33 | internal static IgesAxisymmetricCubicLine FromDummy(IgesFiniteElementDummy dummy) 34 | { 35 | return new IgesAxisymmetricCubicLine( 36 | GetNodeOffset(dummy, 0), 37 | GetNodeOffset(dummy, 1), 38 | GetNodeOffset(dummy, 2), 39 | GetNodeOffset(dummy, 3)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesAxisymmetricLinarLine.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesAxisymmetricLinarLine : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | 10 | public IgesAxisymmetricLinarLine( 11 | IgesPoint p1, 12 | IgesPoint p2) 13 | : base(IgesTopologyType.AxisymmetricLinarLine) 14 | { 15 | P1 = p1; 16 | P2 = p2; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(P1)); 22 | InternalNodes.Add(new IgesNode(P2)); 23 | } 24 | 25 | internal static IgesAxisymmetricLinarLine FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesAxisymmetricLinarLine( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesAxisymmetricLinearQuadrilateral.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesAxisymmetricLinearQuadrilateral : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | public IgesPoint P4 { get; set; } 11 | 12 | public IgesAxisymmetricLinearQuadrilateral( 13 | IgesPoint p1, 14 | IgesPoint p2, 15 | IgesPoint p3, 16 | IgesPoint p4) 17 | : base(IgesTopologyType.AxisymmetricLinearQuadrilateral) 18 | { 19 | P1 = p1; 20 | P2 = p2; 21 | P3 = p3; 22 | P4 = p4; 23 | } 24 | 25 | protected override void AddNodes() 26 | { 27 | InternalNodes.Add(new IgesNode(P1)); 28 | InternalNodes.Add(new IgesNode(P2)); 29 | InternalNodes.Add(new IgesNode(P3)); 30 | InternalNodes.Add(new IgesNode(P4)); 31 | } 32 | 33 | internal static IgesAxisymmetricLinearQuadrilateral FromDummy(IgesFiniteElementDummy dummy) 34 | { 35 | return new IgesAxisymmetricLinearQuadrilateral( 36 | GetNodeOffset(dummy, 0), 37 | GetNodeOffset(dummy, 1), 38 | GetNodeOffset(dummy, 2), 39 | GetNodeOffset(dummy, 3)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesAxisymmetricLinearTriangle.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesAxisymmetricLinearTriangle : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | 11 | public IgesAxisymmetricLinearTriangle( 12 | IgesPoint p1, 13 | IgesPoint p2, 14 | IgesPoint p3) 15 | : base(IgesTopologyType.AxisymmetricLinearTriangle) 16 | { 17 | P1 = p1; 18 | P2 = p2; 19 | P3 = p3; 20 | } 21 | 22 | protected override void AddNodes() 23 | { 24 | InternalNodes.Add(new IgesNode(P1)); 25 | InternalNodes.Add(new IgesNode(P2)); 26 | InternalNodes.Add(new IgesNode(P3)); 27 | } 28 | 29 | internal static IgesAxisymmetricLinearTriangle FromDummy(IgesFiniteElementDummy dummy) 30 | { 31 | return new IgesAxisymmetricLinearTriangle( 32 | GetNodeOffset(dummy, 0), 33 | GetNodeOffset(dummy, 1), 34 | GetNodeOffset(dummy, 2)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesAxisymmetricParabolicLine.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesAxisymmetricParabolicLine : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Parabolic; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | 11 | public IgesAxisymmetricParabolicLine( 12 | IgesPoint p1, 13 | IgesPoint p2, 14 | IgesPoint p3) 15 | : base(IgesTopologyType.AxisymmetricParabolicLine) 16 | { 17 | P1 = p1; 18 | P2 = p2; 19 | P3 = p3; 20 | } 21 | 22 | protected override void AddNodes() 23 | { 24 | InternalNodes.Add(new IgesNode(P1)); 25 | InternalNodes.Add(new IgesNode(P2)); 26 | InternalNodes.Add(new IgesNode(P3)); 27 | } 28 | 29 | internal static IgesAxisymmetricParabolicLine FromDummy(IgesFiniteElementDummy dummy) 30 | { 31 | return new IgesAxisymmetricParabolicLine( 32 | GetNodeOffset(dummy, 0), 33 | GetNodeOffset(dummy, 1), 34 | GetNodeOffset(dummy, 2)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesBeam.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesBeam : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | 10 | public IgesBeam( 11 | IgesPoint p1, 12 | IgesPoint p2) 13 | : base(IgesTopologyType.Beam) 14 | { 15 | P1 = p1; 16 | P2 = p2; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(P1)); 22 | InternalNodes.Add(new IgesNode(P2)); 23 | } 24 | 25 | internal static IgesBeam FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesBeam( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesBlankStatus.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public enum IgesBlankStatus 4 | { 5 | Visible = 0, 6 | Blanked = 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesBooleanTreeEntity.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesBooleanTreeEntity : IIgesBooleanTreeItem 4 | { 5 | public bool IsEntity { get { return true; } } 6 | 7 | public IgesEntity Entity { get; set; } 8 | 9 | public IgesBooleanTreeEntity(IgesEntity entity) 10 | { 11 | Entity = entity; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesBooleanTreeOperation.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesBooleanTreeOperation : IIgesBooleanTreeItem 4 | { 5 | public bool IsEntity { get { return false; } } 6 | 7 | public IgesBooleanTreeOperationKind OperationKind { get; set; } 8 | 9 | public IIgesBooleanTreeItem LeftChild { get; set; } 10 | 11 | public IIgesBooleanTreeItem RightChild { get; set; } 12 | 13 | public IgesBooleanTreeOperation(IgesBooleanTreeOperationKind operationKind) 14 | : this(operationKind, null, null) 15 | { 16 | } 17 | 18 | public IgesBooleanTreeOperation(IgesBooleanTreeOperationKind operationKind, IIgesBooleanTreeItem leftChild, IIgesBooleanTreeItem rightChild) 19 | { 20 | OperationKind = operationKind; 21 | LeftChild = leftChild; 22 | RightChild = rightChild; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesBooleanTreeOperationKind.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public enum IgesBooleanTreeOperationKind 4 | { 5 | Union = 1, 6 | Intersection = 2, 7 | Difference = 3 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesCompositeCurve.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace IxMilia.Iges.Entities 5 | { 6 | public partial class IgesCompositeCurve : IgesEntity 7 | { 8 | public override IgesEntityType EntityType { get { return IgesEntityType.CompositeCurve; } } 9 | 10 | // custom properties 11 | public List Entities { get; private set; } 12 | 13 | public IgesCompositeCurve() 14 | : base() 15 | { 16 | Entities = new List(); 17 | } 18 | 19 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 20 | { 21 | var entityCount = Integer(parameters, 0); 22 | for (int i = 0; i < entityCount; i++) 23 | { 24 | binder.BindEntity(Integer(parameters, i + 1), e => Entities.Add(e)); 25 | } 26 | 27 | return entityCount + 1; 28 | } 29 | 30 | internal override IEnumerable GetReferencedEntities() 31 | { 32 | return Entities; 33 | } 34 | 35 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 36 | { 37 | parameters.Add(this.Entities.Count); 38 | parameters.AddRange(Entities.Select(binder.GetEntityId).Cast()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesCurvedBeam.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesCurvedBeam : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Parabolic; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | 10 | public IgesCurvedBeam( 11 | IgesPoint p1, 12 | IgesPoint p2) 13 | : base(IgesTopologyType.CurvedBeam) 14 | { 15 | P1 = p1; 16 | P2 = p2; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(P1)); 22 | InternalNodes.Add(new IgesNode(P2)); 23 | } 24 | 25 | internal static IgesCurvedBeam FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesCurvedBeam( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesCustomFiniteElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesCustomFiniteElement : IgesFiniteElement 6 | { 7 | public int CustomTopologyNumber { get; set; } 8 | public List Nodes { get; set; } 9 | protected override int TopologyNumber { get { return CustomTopologyNumber; } } 10 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 11 | 12 | public IgesCustomFiniteElement(int customTopologyNumber) 13 | : base(IgesTopologyType.Custom) 14 | { 15 | CustomTopologyNumber = customTopologyNumber; 16 | Nodes = new List(); 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.AddRange(Nodes); 22 | } 23 | 24 | internal static IgesCustomFiniteElement FromDummy(IgesFiniteElementDummy dummy) 25 | { 26 | var custom = new IgesCustomFiniteElement((int)dummy.TopologyType); 27 | custom.Nodes.AddRange(dummy.InternalNodes); 28 | return custom; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesDamper.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesDamper : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | 10 | public IgesDamper( 11 | IgesPoint p1, 12 | IgesPoint p2) 13 | : base(IgesTopologyType.Damper) 14 | { 15 | P1 = p1; 16 | P2 = p2; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(P1)); 22 | InternalNodes.Add(new IgesNode(P2)); 23 | } 24 | 25 | internal static IgesDamper FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesDamper( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesDefinitionLevelsProperty.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesDefinitionLevelsProperty : IgesProperty 6 | { 7 | public HashSet DefinedLevels { get; private set; } 8 | 9 | public IgesDefinitionLevelsProperty() 10 | : base() 11 | { 12 | FormNumber = 1; 13 | DefinedLevels = new HashSet(); 14 | } 15 | 16 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 17 | { 18 | var nextIndex = base.ReadParameters(parameters, binder); 19 | for (int i = 0; i < PropertyCount; i++) 20 | { 21 | DefinedLevels.Add(Integer(parameters, nextIndex + i)); 22 | } 23 | 24 | return nextIndex + PropertyCount; 25 | } 26 | 27 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 28 | { 29 | PropertyCount = DefinedLevels.Count; 30 | base.WriteParameters(parameters, binder); 31 | foreach (var level in DefinedLevels) 32 | { 33 | parameters.Add(level); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesDiameterDimension.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesDiameterDimension : IgesDimensionBase 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.DiameterDimension; } } 8 | 9 | public IgesPoint ArcCenter { get; set; } = IgesPoint.Origin; 10 | 11 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 12 | { 13 | var index = 0; 14 | binder.BindEntity(Integer(parameters, index++), generalNote => GeneralNote = generalNote as IgesGeneralNote); 15 | binder.BindEntity(Integer(parameters, index++), leader => FirstLeader = leader as IgesLeader); 16 | binder.BindEntity(Integer(parameters, index++), leader => SecondLeader = leader as IgesLeader); 17 | ArcCenter = new IgesPoint( 18 | Double(parameters, index++), 19 | Double(parameters, index++), 20 | 0.0); 21 | return index; 22 | } 23 | 24 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 25 | { 26 | parameters.Add(binder.GetEntityId(GeneralNote)); 27 | parameters.Add(binder.GetEntityId(FirstLeader)); 28 | parameters.Add(binder.GetEntityId(SecondLeader)); 29 | parameters.Add(ArcCenter.X); 30 | parameters.Add(ArcCenter.Y); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesDimensionBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public abstract class IgesDimensionBase : IgesEntity 6 | { 7 | public IgesGeneralNote GeneralNote { get; set; } 8 | public IgesLeader FirstLeader { get; set; } 9 | public IgesLeader SecondLeader { get; set; } 10 | 11 | protected IgesDimensionBase() 12 | { 13 | EntityUseFlag = IgesEntityUseFlag.Annotation; 14 | } 15 | 16 | internal override IEnumerable GetReferencedEntities() 17 | { 18 | yield return GeneralNote; 19 | yield return FirstLeader; 20 | yield return SecondLeader; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesEntityUseFlag.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public enum IgesEntityUseFlag 4 | { 5 | Geometry = 0, 6 | Annotation = 1, 7 | Definition = 2, 8 | Other = 3, 9 | LogicalOrPositional = 4, 10 | Parametric2D = 5, 11 | ConstructionGeometry = 6 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesGroundedDamper.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesGroundedDamper : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint Location { get; set; } 8 | 9 | public IgesGroundedDamper( 10 | IgesPoint location) 11 | : base(IgesTopologyType.GroundedDamper) 12 | { 13 | Location = location; 14 | } 15 | 16 | protected override void AddNodes() 17 | { 18 | InternalNodes.Add(new IgesNode(Location)); 19 | } 20 | 21 | internal static IgesGroundedDamper FromDummy(IgesFiniteElementDummy dummy) 22 | { 23 | return new IgesGroundedDamper( 24 | GetNodeOffset(dummy, 0)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesGroundedSpring.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesGroundedSpring : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint Location { get; set; } 8 | 9 | public IgesGroundedSpring( 10 | IgesPoint location) 11 | : base(IgesTopologyType.GroundedSpring) 12 | { 13 | Location = location; 14 | } 15 | 16 | protected override void AddNodes() 17 | { 18 | InternalNodes.Add(new IgesNode(Location)); 19 | } 20 | 21 | internal static IgesGroundedSpring FromDummy(IgesFiniteElementDummy dummy) 22 | { 23 | return new IgesGroundedSpring( 24 | GetNodeOffset(dummy, 0)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesHierarchy.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public enum IgesHierarchy 4 | { 5 | GlobalTopDown = 0, 6 | GlobalDefer = 1, 7 | UseHierarchyProperty = 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesLineFontDefinitionBase.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public abstract class IgesLineFontDefinitionBase : IgesEntity 4 | { 5 | public override IgesEntityType EntityType { get { return IgesEntityType.LineFontDefinition; } } 6 | 7 | public IgesLineFontDefinitionBase() 8 | : base() 9 | { 10 | this.SubordinateEntitySwitchType = IgesSubordinateEntitySwitchType.Independent; 11 | this.EntityUseFlag = IgesEntityUseFlag.Definition; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesLinearQuadrilateral.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesLinearQuadrilateral : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | public IgesPoint P4 { get; set; } 11 | 12 | public IgesLinearQuadrilateral( 13 | IgesPoint p1, 14 | IgesPoint p2, 15 | IgesPoint p3, 16 | IgesPoint p4) 17 | : base(IgesTopologyType.LinearQuadrilateral) 18 | { 19 | P1 = p1; 20 | P2 = p2; 21 | P3 = p3; 22 | P4 = p4; 23 | } 24 | 25 | protected override void AddNodes() 26 | { 27 | InternalNodes.Add(new IgesNode(P1)); 28 | InternalNodes.Add(new IgesNode(P2)); 29 | InternalNodes.Add(new IgesNode(P3)); 30 | InternalNodes.Add(new IgesNode(P4)); 31 | } 32 | 33 | internal static IgesLinearQuadrilateral FromDummy(IgesFiniteElementDummy dummy) 34 | { 35 | return new IgesLinearQuadrilateral( 36 | GetNodeOffset(dummy, 0), 37 | GetNodeOffset(dummy, 1), 38 | GetNodeOffset(dummy, 2), 39 | GetNodeOffset(dummy, 3)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesLinearSolidTetrahedron.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesLinearSolidTetrahedron : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | public IgesPoint P4 { get; set; } 11 | 12 | public IgesLinearSolidTetrahedron( 13 | IgesPoint p1, 14 | IgesPoint p2, 15 | IgesPoint p3, 16 | IgesPoint p4) 17 | : base(IgesTopologyType.LinearSolidTetrahedron) 18 | { 19 | P1 = p1; 20 | P2 = p2; 21 | P3 = p3; 22 | P4 = p4; 23 | } 24 | 25 | protected override void AddNodes() 26 | { 27 | InternalNodes.Add(new IgesNode(P1)); 28 | InternalNodes.Add(new IgesNode(P2)); 29 | InternalNodes.Add(new IgesNode(P3)); 30 | InternalNodes.Add(new IgesNode(P4)); 31 | } 32 | 33 | internal static IgesLinearSolidTetrahedron FromDummy(IgesFiniteElementDummy dummy) 34 | { 35 | return new IgesLinearSolidTetrahedron( 36 | GetNodeOffset(dummy, 0), 37 | GetNodeOffset(dummy, 1), 38 | GetNodeOffset(dummy, 2), 39 | GetNodeOffset(dummy, 3)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesLinearTriangle.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesLinearTriangle : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | 11 | public IgesLinearTriangle( 12 | IgesPoint p1, 13 | IgesPoint p2, 14 | IgesPoint p3) 15 | : base(IgesTopologyType.LinearTriangle) 16 | { 17 | P1 = p1; 18 | P2 = p2; 19 | P3 = p3; 20 | } 21 | 22 | protected override void AddNodes() 23 | { 24 | InternalNodes.Add(new IgesNode(P1)); 25 | InternalNodes.Add(new IgesNode(P2)); 26 | InternalNodes.Add(new IgesNode(P3)); 27 | } 28 | 29 | internal static IgesLinearTriangle FromDummy(IgesFiniteElementDummy dummy) 30 | { 31 | return new IgesLinearTriangle( 32 | GetNodeOffset(dummy, 0), 33 | GetNodeOffset(dummy, 1), 34 | GetNodeOffset(dummy, 2)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesLocation.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public partial class IgesLocation : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.Point; } } 8 | 9 | // properties 10 | public double X { get; set; } 11 | public double Y { get; set; } 12 | public double Z { get; set; } 13 | 14 | public IgesLocation() 15 | : this(0.0, 0.0, 0.0) 16 | { 17 | } 18 | 19 | public IgesLocation(double x, double y, double z) 20 | : base() 21 | { 22 | this.X = x; 23 | this.Y = y; 24 | this.Z = z; 25 | } 26 | 27 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 28 | { 29 | this.X = Double(parameters, 0); 30 | this.Y = Double(parameters, 1); 31 | this.Z = Double(parameters, 2); 32 | return 3; 33 | } 34 | 35 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 36 | { 37 | parameters.Add(this.X); 38 | parameters.Add(this.Y); 39 | parameters.Add(this.Z); 40 | } 41 | 42 | public IgesPoint ToPoint() 43 | { 44 | return new IgesPoint(X, Y, Z); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesMass.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesMass : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint Location { get; set; } 8 | 9 | public IgesMass( 10 | IgesPoint location) 11 | : base(IgesTopologyType.Mass) 12 | { 13 | Location = location; 14 | } 15 | 16 | protected override void AddNodes() 17 | { 18 | InternalNodes.Add(new IgesNode(Location)); 19 | } 20 | 21 | internal static IgesMass FromDummy(IgesFiniteElementDummy dummy) 22 | { 23 | return new IgesMass( 24 | GetNodeOffset(dummy, 0)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesNameProperty.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesNameProperty : IgesProperty 6 | { 7 | public string Name { get; set; } 8 | 9 | internal IgesNameProperty() 10 | : base() 11 | { 12 | FormNumber = 15; 13 | } 14 | 15 | public IgesNameProperty(string name) 16 | : this() 17 | { 18 | Name = name; 19 | } 20 | 21 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 22 | { 23 | var nextIndex = base.ReadParameters(parameters, binder); 24 | Name = String(parameters, nextIndex); 25 | return nextIndex + PropertyCount; 26 | } 27 | 28 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 29 | { 30 | PropertyCount = 1; 31 | base.WriteParameters(parameters, binder); 32 | parameters.Add(Name); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesNull.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public partial class IgesNull : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.Null; } } 8 | 9 | public IgesNull() 10 | : base() 11 | { 12 | } 13 | 14 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 15 | { 16 | return 0; 17 | } 18 | 19 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesOffsetBeam.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesOffsetBeam : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint Offset1 { get; set; } 8 | public IgesPoint Offset2 { get; set; } 9 | public IgesPoint P1 { get; set; } 10 | public IgesPoint P2 { get; set; } 11 | 12 | public IgesOffsetBeam( 13 | IgesPoint offset1, 14 | IgesPoint offset2, 15 | IgesPoint p1, 16 | IgesPoint p2) 17 | : base(IgesTopologyType.OffsetBeam) 18 | { 19 | Offset1 = offset1; 20 | Offset2 = offset2; 21 | P1 = p1; 22 | P2 = p2; 23 | } 24 | 25 | protected override void AddNodes() 26 | { 27 | InternalNodes.Add(new IgesNode(Offset1)); 28 | InternalNodes.Add(new IgesNode(Offset2)); 29 | InternalNodes.Add(new IgesNode(P1)); 30 | InternalNodes.Add(new IgesNode(P2)); 31 | } 32 | 33 | internal static IgesOffsetBeam FromDummy(IgesFiniteElementDummy dummy) 34 | { 35 | return new IgesOffsetBeam( 36 | GetNodeOffset(dummy, 0), 37 | GetNodeOffset(dummy, 1), 38 | GetNodeOffset(dummy, 2), 39 | GetNodeOffset(dummy, 3)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesOffsetMass.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesOffsetMass : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint Location { get; set; } 8 | public IgesPoint CenterOfMass { get; set; } 9 | 10 | public IgesOffsetMass( 11 | IgesPoint location, 12 | IgesPoint centerOfMass) 13 | : base(IgesTopologyType.OffsetMass) 14 | { 15 | Location = location; 16 | CenterOfMass = centerOfMass; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(Location)); 22 | InternalNodes.Add(new IgesNode(CenterOfMass)); 23 | } 24 | 25 | internal static IgesOffsetMass FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesOffsetMass( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesPatternLineFontDefinition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using System.Linq; 4 | 5 | namespace IxMilia.Iges.Entities 6 | { 7 | public class IgesPatternLineFontDefinition : IgesLineFontDefinitionBase 8 | { 9 | public List SegmentLengths { get; private set; } 10 | public int DisplayMask { get; set; } 11 | 12 | public IgesPatternLineFontDefinition() 13 | : base() 14 | { 15 | this.FormNumber = 2; 16 | SegmentLengths = new List(); 17 | } 18 | 19 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 20 | { 21 | var segmentCount = Integer(parameters, 0); 22 | for (int i = 0; i < segmentCount; i++) 23 | { 24 | SegmentLengths.Add(Double(parameters, i + 1)); 25 | } 26 | 27 | DisplayMask = IgesParser.ParseIntStrict(StringOrDefault(parameters, segmentCount + 1, "0"), NumberStyles.HexNumber); 28 | return segmentCount + 2; 29 | } 30 | 31 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 32 | { 33 | parameters.Add(SegmentLengths.Count); 34 | parameters.AddRange(SegmentLengths.Cast()); 35 | parameters.Add(DisplayMask.ToString("X")); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesPointDimension.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesPointDimension : IgesDimensionBase 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.PointDimension; } } 8 | 9 | public IgesEntity Geometry { get; set; } 10 | 11 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 12 | { 13 | var index = 0; 14 | binder.BindEntity(Integer(parameters, index++), generalNote => GeneralNote = generalNote as IgesGeneralNote); 15 | binder.BindEntity(Integer(parameters, index++), leader => FirstLeader = leader as IgesLeader); 16 | binder.BindEntity(Integer(parameters, index++), geometry => Geometry = geometry); 17 | return index; 18 | } 19 | 20 | internal override IEnumerable GetReferencedEntities() 21 | { 22 | foreach (var referenced in base.GetReferencedEntities()) 23 | { 24 | yield return referenced; 25 | } 26 | 27 | yield return Geometry; 28 | } 29 | 30 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 31 | { 32 | parameters.Add(binder.GetEntityId(GeneralNote)); 33 | parameters.Add(binder.GetEntityId(FirstLeader)); 34 | parameters.Add(binder.GetEntityId(Geometry)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesProperty.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public abstract class IgesProperty : IgesEntity 6 | { 7 | protected int PropertyCount { get; set; } 8 | 9 | public override IgesEntityType EntityType { get { return IgesEntityType.Property; } } 10 | 11 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 12 | { 13 | PropertyCount = Integer(parameters, 0); 14 | return 1; 15 | } 16 | 17 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 18 | { 19 | parameters.Add(PropertyCount); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesRightCircularCylinder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesRightCircularCylinder : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.RightCircularCylinder; } } 8 | 9 | public double Height { get; set; } 10 | public double Radius { get; set; } 11 | public IgesPoint FirstFaceCenter { get; set; } = IgesPoint.Origin; 12 | public IgesVector AxisDirection { get; set; } = IgesVector.ZAxis; 13 | 14 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 15 | { 16 | int index = 0; 17 | Height = Double(parameters, index++); 18 | Radius = Double(parameters, index++); 19 | FirstFaceCenter = Point3(parameters, ref index); 20 | AxisDirection = Vector(parameters, ref index); 21 | return index; 22 | } 23 | 24 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 25 | { 26 | parameters.Add(Height); 27 | parameters.Add(Radius); 28 | parameters.Add(FirstFaceCenter.X); 29 | parameters.Add(FirstFaceCenter.Y); 30 | parameters.Add(FirstFaceCenter.Z); 31 | parameters.Add(AxisDirection.X); 32 | parameters.Add(AxisDirection.Y); 33 | parameters.Add(AxisDirection.Z); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesRigidBody.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesRigidBody : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | 10 | public IgesRigidBody( 11 | IgesPoint p1, 12 | IgesPoint p2) 13 | : base(IgesTopologyType.RigidBody) 14 | { 15 | P1 = p1; 16 | P2 = p2; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(P1)); 22 | InternalNodes.Add(new IgesNode(P2)); 23 | } 24 | 25 | internal static IgesRigidBody FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesRigidBody( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesSolidOfLinearExtrusion.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesSolidOfLinearExtrusion : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.SolidOfLinearExtrusion; } } 8 | 9 | public IgesEntity Curve { get; set; } 10 | public double ExtrusionLength { get; set; } 11 | public IgesVector ExtrusionDirection { get; set; } = IgesVector.ZAxis; 12 | 13 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 14 | { 15 | int index = 0; 16 | binder.BindEntity(Integer(parameters, index++), e => Curve = e); 17 | ExtrusionLength = Double(parameters, index++); 18 | ExtrusionDirection = Vector(parameters, ref index); 19 | return index; 20 | } 21 | 22 | internal override IEnumerable GetReferencedEntities() 23 | { 24 | yield return Curve; 25 | } 26 | 27 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 28 | { 29 | parameters.Add(binder.GetEntityId(Curve)); 30 | parameters.Add(ExtrusionLength); 31 | parameters.Add(ExtrusionDirection.X); 32 | parameters.Add(ExtrusionDirection.Y); 33 | parameters.Add(ExtrusionDirection.Z); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesSphere.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public partial class IgesSphere : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.Sphere; } } 8 | 9 | // properties 10 | public double Radius { get; set; } 11 | public IgesPoint Center { get; set; } 12 | 13 | public IgesSphere() 14 | : this(0.0, IgesPoint.Origin) 15 | { 16 | } 17 | 18 | public IgesSphere(double radius, IgesPoint center) 19 | : base() 20 | { 21 | this.EntityUseFlag = IgesEntityUseFlag.Geometry; 22 | this.Radius = radius; 23 | this.Center = center; 24 | } 25 | 26 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 27 | { 28 | int index = 0; 29 | this.Radius = Double(parameters, index++); 30 | this.Center = Point3(parameters, ref index); 31 | return index; 32 | } 33 | 34 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 35 | { 36 | parameters.Add(this.Radius); 37 | if (Center != IgesPoint.Origin) 38 | { 39 | parameters.Add(this.Center.X); 40 | parameters.Add(this.Center.Y); 41 | parameters.Add(this.Center.Z); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesSpring.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesSpring : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.NotApplicable; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | 10 | public IgesSpring( 11 | IgesPoint p1, 12 | IgesPoint p2) 13 | : base(IgesTopologyType.Spring) 14 | { 15 | P1 = p1; 16 | P2 = p2; 17 | } 18 | 19 | protected override void AddNodes() 20 | { 21 | InternalNodes.Add(new IgesNode(P1)); 22 | InternalNodes.Add(new IgesNode(P2)); 23 | } 24 | 25 | internal static IgesSpring FromDummy(IgesFiniteElementDummy dummy) 26 | { 27 | return new IgesSpring( 28 | GetNodeOffset(dummy, 0), 29 | GetNodeOffset(dummy, 1)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesSubordinateEntitySwitchType.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public enum IgesSubordinateEntitySwitchType 4 | { 5 | Independent = 0, 6 | PhysicallyDependent = 1, 7 | LogicallyDependent = 2, 8 | PhysicallyAndLogicallyDependent = PhysicallyDependent | LogicallyDependent 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesSurfaceOfRevolution.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesSurfaceOfRevolution : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.SurfaceOfRevolution; } } 8 | 9 | public IgesLine AxisOfRevolution { get; set; } 10 | public IgesEntity Generatrix { get; set; } 11 | public double StartAngle { get; set; } 12 | public double EndAngle { get; set; } 13 | 14 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 15 | { 16 | binder.BindEntity(Integer(parameters, 0), e => AxisOfRevolution = e as IgesLine); 17 | binder.BindEntity(Integer(parameters, 1), e => Generatrix = e); 18 | StartAngle = Double(parameters, 2); 19 | EndAngle = Double(parameters, 3); 20 | return 4; 21 | } 22 | 23 | internal override IEnumerable GetReferencedEntities() 24 | { 25 | yield return AxisOfRevolution; 26 | yield return Generatrix; 27 | } 28 | 29 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 30 | { 31 | parameters.Add(binder.GetEntityId(AxisOfRevolution)); 32 | parameters.Add(binder.GetEntityId(Generatrix)); 33 | parameters.Add(StartAngle); 34 | parameters.Add(EndAngle); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesTabulatedCylinder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public class IgesTabulatedCylinder : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.TabulatedCylinder; } } 8 | 9 | public IgesEntity Directrix { get; set; } 10 | public IgesPoint GeneratrixTerminatePoint { get; set; } 11 | 12 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 13 | { 14 | binder.BindEntity(Integer(parameters, 0), e => Directrix = e); 15 | var x = Double(parameters, 1); 16 | var y = Double(parameters, 2); 17 | var z = Double(parameters, 3); 18 | GeneratrixTerminatePoint = new IgesPoint(x, y, z); 19 | return 4; 20 | } 21 | 22 | internal override IEnumerable GetReferencedEntities() 23 | { 24 | yield return Directrix; 25 | } 26 | 27 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 28 | { 29 | parameters.Add(binder.GetEntityId(Directrix)); 30 | parameters.Add(GeneratrixTerminatePoint.X); 31 | parameters.Add(GeneratrixTerminatePoint.Y); 32 | parameters.Add(GeneratrixTerminatePoint.Z); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesThreeNodeBeam.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesThreeNodeBeam : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Parabolic; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | 11 | public IgesThreeNodeBeam( 12 | IgesPoint p1, 13 | IgesPoint p2, 14 | IgesPoint p3) 15 | : base(IgesTopologyType.ThreeNodeBeam) 16 | { 17 | P1 = p1; 18 | P2 = p2; 19 | P3 = p3; 20 | } 21 | 22 | protected override void AddNodes() 23 | { 24 | InternalNodes.Add(new IgesNode(P1)); 25 | InternalNodes.Add(new IgesNode(P2)); 26 | InternalNodes.Add(new IgesNode(P3)); 27 | } 28 | 29 | internal static IgesThreeNodeBeam FromDummy(IgesFiniteElementDummy dummy) 30 | { 31 | return new IgesThreeNodeBeam( 32 | GetNodeOffset(dummy, 0), 33 | GetNodeOffset(dummy, 1), 34 | GetNodeOffset(dummy, 2)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesThreeNodedBeam.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges.Entities 2 | { 3 | public class IgesThreeNodedBeam : IgesFiniteElement 4 | { 5 | public override IgesElementEdgeOrder EdgeOrder { get { return IgesElementEdgeOrder.Linear; } } 6 | 7 | public IgesPoint P1 { get; set; } 8 | public IgesPoint P2 { get; set; } 9 | public IgesPoint P3 { get; set; } 10 | 11 | public IgesThreeNodedBeam( 12 | IgesPoint p1, 13 | IgesPoint p2, 14 | IgesPoint p3) 15 | : base(IgesTopologyType.ThreeNodedBeam) 16 | { 17 | P1 = p1; 18 | P2 = p2; 19 | P3 = p3; 20 | } 21 | 22 | protected override void AddNodes() 23 | { 24 | InternalNodes.Add(new IgesNode(P1)); 25 | InternalNodes.Add(new IgesNode(P2)); 26 | InternalNodes.Add(new IgesNode(P3)); 27 | } 28 | 29 | internal static IgesThreeNodedBeam FromDummy(IgesFiniteElementDummy dummy) 30 | { 31 | return new IgesThreeNodedBeam( 32 | GetNodeOffset(dummy, 0), 33 | GetNodeOffset(dummy, 1), 34 | GetNodeOffset(dummy, 2)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /IxMilia.Iges/Entities/IgesViewBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace IxMilia.Iges.Entities 4 | { 5 | public abstract class IgesViewBase : IgesEntity 6 | { 7 | public override IgesEntityType EntityType { get { return IgesEntityType.View; } } 8 | 9 | // properties 10 | public int ViewNumber { get; set; } 11 | public double ScaleFactor { get; set; } 12 | 13 | protected IgesViewBase(int viewNumber, double scaleFactor) 14 | : base() 15 | { 16 | this.EntityUseFlag = IgesEntityUseFlag.Annotation; 17 | this.ViewNumber = viewNumber; 18 | this.ScaleFactor = scaleFactor; 19 | } 20 | 21 | internal override int ReadParameters(List parameters, IgesReaderBinder binder) 22 | { 23 | this.ViewNumber = Integer(parameters, 0); 24 | this.ScaleFactor = Double(parameters, 1); 25 | return 2; 26 | } 27 | 28 | internal override void WriteParameters(List parameters, IgesWriterBinder binder) 29 | { 30 | parameters.Add(ViewNumber); 31 | parameters.Add(ScaleFactor); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesColorNumber.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges 2 | { 3 | public enum IgesColorNumber 4 | { 5 | Custom = -1, 6 | Default = 0, 7 | Black = 1, 8 | Red = 2, 9 | Green = 3, 10 | Blue = 4, 11 | Yellow = 5, 12 | Magenta = 6, 13 | Cyan = 7, 14 | White = 8 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesDraftingStandard.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges 2 | { 3 | public enum IgesDraftingStandard 4 | { 5 | None = 0, 6 | ISO = 1, 7 | AFNOR = 2, 8 | ANSI = 3, 9 | BSI = 4, 10 | CSA = 5, 11 | DIN = 6, 12 | JIS = 7 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace IxMilia.Iges 4 | { 5 | public class IgesException : Exception 6 | { 7 | public IgesException() 8 | : base() 9 | { 10 | } 11 | 12 | public IgesException(string message) 13 | : base(message) 14 | { 15 | } 16 | 17 | public IgesException(string message, Exception innerException) 18 | : base(message, innerException) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesLineFontPattern.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges 2 | { 3 | public enum IgesLineFontPattern 4 | { 5 | Custom = -1, 6 | Default = 0, 7 | Solid = 1, 8 | Dashed = 2, 9 | Phantom = 3, 10 | Centerline = 4, 11 | Dotted = 5, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesReaderBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using IxMilia.Iges.Entities; 4 | 5 | namespace IxMilia.Iges 6 | { 7 | internal class IgesReaderBinder 8 | { 9 | private List>> _unboundEntities; 10 | 11 | public Dictionary EntityMap { get; } 12 | 13 | public IgesReaderBinder() 14 | { 15 | EntityMap = new Dictionary(); 16 | _unboundEntities = new List>>(); 17 | } 18 | 19 | public void BindEntity(int entityIndex, Action bindAction) 20 | { 21 | if (EntityMap.ContainsKey(entityIndex)) 22 | { 23 | bindAction(EntityMap[entityIndex]); 24 | } 25 | else 26 | { 27 | _unboundEntities.Add(Tuple.Create(entityIndex, bindAction)); 28 | } 29 | } 30 | 31 | public void BindRemainingEntities() 32 | { 33 | foreach (var pair in _unboundEntities) 34 | { 35 | var index = pair.Item1; 36 | var bindAction = pair.Item2; 37 | var entity = EntityMap.ContainsKey(index) 38 | ? EntityMap[index] 39 | : null; 40 | bindAction(entity); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesSectionType.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges 2 | { 3 | internal enum IgesSectionType 4 | { 5 | None = 0, 6 | Start = 1, 7 | Global = 2, 8 | Directory = 3, 9 | Parameter = 4, 10 | Terminate = 5 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesUnits.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges 2 | { 3 | public enum IgesUnits 4 | { 5 | Inches = 1, 6 | Millimeters = 2, 7 | Custom = 3, 8 | Feet = 4, 9 | Miles = 5, 10 | Meters = 6, 11 | Kilometers = 7, 12 | Mils = 8, 13 | Microns = 9, 14 | Centimeters = 10, 15 | MicroInches = 11 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesVersion.cs: -------------------------------------------------------------------------------- 1 | namespace IxMilia.Iges 2 | { 3 | public enum IgesVersion 4 | { 5 | v1_0 = 1, 6 | ANSI_1981 = 2, 7 | v2_0 = 3, 8 | v3_0 = 4, 9 | ANSI_1987 = 5, 10 | v4_0 = 6, 11 | ASME_1989 = 7, 12 | v5_0 = 8, 13 | v5_1 = 9, 14 | USPRO_v5_2 = 10, 15 | v5_3 = 11 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /IxMilia.Iges/IgesWriterBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using IxMilia.Iges.Entities; 4 | 5 | namespace IxMilia.Iges 6 | { 7 | internal class IgesWriterBinder 8 | { 9 | private Dictionary _entityMap; 10 | 11 | public IgesWriterBinder(Dictionary entityMap) 12 | { 13 | _entityMap = entityMap; 14 | } 15 | 16 | public int GetEntityId(IgesEntity entity) 17 | { 18 | if (entity == null) 19 | { 20 | return 0; 21 | } 22 | else if (!_entityMap.ContainsKey(entity)) 23 | { 24 | throw new InvalidOperationException($"Entity not found. Did you forget to override {nameof(IgesEntity)}.{nameof(IgesEntity.GetReferencedEntities)}()?"); 25 | } 26 | 27 | return _entityMap[entity]; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /IxMilia.Iges/IxMilia.Iges.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A portable .NET library for reading and writing IGES files. 5 | Copyright 2018 6 | IxMilia.Iges 7 | IxMilia 8 | netstandard1.0;netstandard1.3 9 | IxMilia.Iges 10 | IxMilia.Iges 11 | CAD;IGES;IGS 12 | https://github.com/ixmilia/iges 13 | MIT 14 | 15 | 16 | true 17 | true 18 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb 19 | 20 | 21 | 22 | $(DefineConstants);HAS_FILESYSTEM_ACCESS 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 fel88 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LiteCAD/AbstractDraftTool.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.DraftEditor; 2 | using System.Windows.Forms; 3 | 4 | namespace LiteCAD 5 | { 6 | public abstract class AbstractDraftTool : ITool 7 | { 8 | 9 | public AbstractDraftTool(IDraftEditor editor) 10 | { 11 | Editor = editor; 12 | } 13 | 14 | public abstract void Deselect(); 15 | 16 | 17 | public abstract void Draw(); 18 | 19 | public IDraftEditor Editor; 20 | public abstract void MouseDown(MouseEventArgs e); 21 | 22 | public abstract void MouseUp(MouseEventArgs e); 23 | 24 | public abstract void Select(); 25 | 26 | public abstract void Update(); 27 | } 28 | } -------------------------------------------------------------------------------- /LiteCAD/AbstractTool.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace LiteCAD 4 | { 5 | public abstract class AbstractTool : ITool 6 | { 7 | protected IEditor Editor; 8 | public AbstractTool(IEditor editor) 9 | { 10 | Editor = editor; 11 | } 12 | 13 | public abstract void Deselect(); 14 | 15 | public abstract void Draw(); 16 | 17 | public abstract void MouseDown(MouseEventArgs e); 18 | 19 | public abstract void MouseUp(MouseEventArgs e); 20 | 21 | public abstract void Select(); 22 | 23 | public abstract void Update(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /LiteCAD/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LiteCAD/CameraViewManager.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCAD 4 | { 5 | public abstract class CameraViewManager 6 | { 7 | public GLControl Control; 8 | public EventWrapperGlControl EventWrapper; 9 | 10 | public virtual void Detach() 11 | { 12 | EventWrapper.MouseUpAction = null; 13 | EventWrapper.MouseDownAction = null; 14 | EventWrapper.MouseWheelAction = null; 15 | EventWrapper.KeyDownAction = null; 16 | EventWrapper.KeyUpUpAction = null; 17 | 18 | } 19 | 20 | public abstract void Update(); 21 | 22 | public virtual void Attach(EventWrapperGlControl control, Camera camera) 23 | { 24 | Control = control.Control; 25 | EventWrapper = control; 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /LiteCAD/ComboBoxItem.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD 2 | { 3 | public class ComboBoxItem 4 | { 5 | public string Name; 6 | public object Tag; 7 | public override string ToString() 8 | { 9 | return Name; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LiteCAD/DefaultSelectManager.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep; 2 | using LiteCAD.Common; 3 | using System.Collections.Generic; 4 | 5 | namespace LiteCAD 6 | { 7 | public class DefaultSelectManager : ISelectManager 8 | { 9 | HashSet selected = new HashSet(); 10 | public bool IsSelected(BRepFace face) 11 | { 12 | return selected.Contains(face); 13 | } 14 | 15 | public void Select(BRepFace f) 16 | { 17 | selected.Add(f); 18 | } 19 | 20 | public void Unselect(BRepFace f) 21 | { 22 | selected.Remove(f); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /LiteCAD/DraftEditor/HorizontalConstraintHelper.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using LiteCAD.Common; 3 | using LiteCAD.BRep.Editor; 4 | using System.Drawing; 5 | 6 | namespace LiteCAD.DraftEditor 7 | { 8 | public class HorizontalConstraintHelper : AbstractDrawable, IDraftConstraintHelper 9 | { 10 | public readonly HorizontalConstraint constraint; 11 | public HorizontalConstraintHelper(HorizontalConstraint c) 12 | { 13 | constraint = c; 14 | } 15 | 16 | public Vector2d SnapPoint { get; set; } 17 | public DraftConstraint Constraint => constraint; 18 | 19 | public bool Enabled { get => constraint.Enabled; set => constraint.Enabled = value; } 20 | 21 | public Draft DraftParent { get; private set; } 22 | 23 | public void Draw(IDrawingContext ctx) 24 | { 25 | var dp0 = constraint.Line.Center; 26 | var perp = new Vector2d(-constraint.Line.Dir.Y, constraint.Line.Dir.X); 27 | 28 | SnapPoint = (dp0); 29 | var tr0 = ctx.Transform(dp0 + perp * 15 / ctx.zoom); 30 | 31 | var gap = 10; 32 | //create bezier here 33 | ctx.FillCircle(Brushes.Green, tr0.X, tr0.Y, gap); 34 | ctx.SetPen(new Pen(Brushes.Orange, 3)); 35 | ctx.DrawLine(tr0.X - 5, tr0.Y, tr0.X + 5, tr0.Y); 36 | } 37 | 38 | public override void Draw() 39 | { 40 | 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LiteCAD/DraftEditor/IDraftEditor.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | using LiteCAD.BRep.Editor; 3 | 4 | namespace LiteCAD.DraftEditor 5 | { 6 | public interface IDraftEditor 7 | { 8 | object nearest { get; } 9 | Draft Draft { get; } 10 | IDrawingContext DrawingContext { get; } 11 | void Backup(); 12 | void ResetTool(); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LiteCAD/DraftEditor/LinearConstraintLengthDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Globalization; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace LiteCAD.DraftEditor 13 | { 14 | public partial class LinearConstraintLengthDialog : Form 15 | { 16 | public LinearConstraintLengthDialog() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | public decimal Length; 22 | 23 | private void button1_Click(object sender, EventArgs e) 24 | { 25 | try 26 | { 27 | Length = decimal.Parse(textBox1.Text.Replace(",", "."), CultureInfo.InvariantCulture); 28 | Close(); 29 | } 30 | catch (Exception ex) 31 | { 32 | 33 | } 34 | } 35 | 36 | internal void Init(double length) 37 | { 38 | Length = (decimal)length; 39 | textBox1.Text = length.ToString(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LiteCAD/DraftEditor/VerticalConstraintHelper.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using LiteCAD.Common; 3 | using LiteCAD.BRep.Editor; 4 | using System.Drawing; 5 | 6 | namespace LiteCAD.DraftEditor 7 | { 8 | public class VerticalConstraintHelper : AbstractDrawable, IDraftConstraintHelper 9 | { 10 | public readonly VerticalConstraint constraint; 11 | public VerticalConstraintHelper(VerticalConstraint c) 12 | { 13 | constraint = c; 14 | } 15 | 16 | public Vector2d SnapPoint { get; set; } 17 | public DraftConstraint Constraint => constraint; 18 | 19 | public bool Enabled { get => constraint.Enabled; set => constraint.Enabled = value; } 20 | 21 | public Draft DraftParent { get; private set; } 22 | 23 | public void Draw(IDrawingContext ctx) 24 | { 25 | var dp0 = constraint.Line.Center; 26 | var perp = new Vector2d(-constraint.Line.Dir.Y, constraint.Line.Dir.X); 27 | 28 | SnapPoint = (dp0); 29 | var tr0 = ctx.Transform(dp0 + perp * 15 / ctx.zoom); 30 | 31 | var gap = 10; 32 | //create bezier here 33 | ctx.FillCircle(Brushes.Green, tr0.X , tr0.Y , gap); 34 | ctx.SetPen(new Pen(Brushes.Orange, 3)); 35 | ctx.DrawLine( tr0.X, tr0.Y + 5, tr0.X, tr0.Y - 5); 36 | } 37 | 38 | public override void Draw() 39 | { 40 | 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LiteCAD/ExportDxfDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace LiteCAD 12 | { 13 | public partial class ExportDxfDialog : Form 14 | { 15 | public ExportDxfDialog() 16 | { 17 | InitializeComponent(); 18 | } 19 | public bool MmUnitEnabled; 20 | private void checkBox1_CheckedChanged(object sender, EventArgs e) 21 | { 22 | MmUnitEnabled = checkBox1.Checked; 23 | } 24 | 25 | private void button1_Click(object sender, EventArgs e) 26 | { 27 | Close(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LiteCAD/IEconomicsDetail.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD 2 | { 3 | public interface IEconomicsDetail 4 | { 5 | decimal TotalCutLength { get; } 6 | decimal Volume { get; } 7 | ProduceOperation Operation { get; set; } 8 | } 9 | 10 | public enum ProduceOperation 11 | { 12 | NotProducable, //already existed detail 13 | LaserCutting, 14 | FDMPrinting 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LiteCAD/IEditor.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | using System; 3 | 4 | namespace LiteCAD 5 | { 6 | public interface IEditor 7 | { 8 | IDrawable[] Parts { get; } 9 | ITool CurrentTool { get; } 10 | event Action ToolChanged; 11 | IntersectInfo Pick { get; } 12 | void ObjectSelect(object nearest); 13 | void ResetTool(); 14 | void Backup(); 15 | void Undo(); 16 | } 17 | } -------------------------------------------------------------------------------- /LiteCAD/ITool.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace LiteCAD 4 | { 5 | public interface ITool 6 | { 7 | 8 | void Update(); 9 | void MouseDown(MouseEventArgs e); 10 | void MouseUp(MouseEventArgs e); 11 | void Draw(); 12 | void Select(); 13 | void Deselect(); 14 | } 15 | } -------------------------------------------------------------------------------- /LiteCAD/Icons/anchor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/anchor.png -------------------------------------------------------------------------------- /LiteCAD/Icons/application-tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/application-tile.png -------------------------------------------------------------------------------- /LiteCAD/Icons/arrow-curve-180-left.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/arrow-curve-180-left.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/arrow-resize.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/arrow-resize.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/arrow-skip-090.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/arrow-skip-090.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/blue-document-export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/blue-document-export.png -------------------------------------------------------------------------------- /LiteCAD/Icons/blue-document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/blue-document.png -------------------------------------------------------------------------------- /LiteCAD/Icons/cross-button.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/cross-button.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/cursor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/cursor.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/cutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/cutter.png -------------------------------------------------------------------------------- /LiteCAD/Icons/disk.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/disk.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/eraser.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/eraser.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/fill-090.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/fill-090.png -------------------------------------------------------------------------------- /LiteCAD/Icons/folder-horizontal-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/folder-horizontal-open.png -------------------------------------------------------------------------------- /LiteCAD/Icons/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/gear.png -------------------------------------------------------------------------------- /LiteCAD/Icons/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/grid.png -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-flip-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-flip-vertical.png -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-flip.png -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-resize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-resize.png -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-shape-ellipse.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-shape-ellipse.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-shape-line.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-shape-line.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-shape-polygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-shape-polygon.png -------------------------------------------------------------------------------- /LiteCAD/Icons/layer-shape.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/layer-shape.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/light-bulb-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/light-bulb-off.png -------------------------------------------------------------------------------- /LiteCAD/Icons/light-bulb.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/light-bulb.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/magnet.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/magnet.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/magnifier-zoom-actual-equal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/magnifier-zoom-actual-equal.png -------------------------------------------------------------------------------- /LiteCAD/Icons/magnifier.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/magnifier.ico -------------------------------------------------------------------------------- /LiteCAD/Icons/molecule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/molecule.png -------------------------------------------------------------------------------- /LiteCAD/Icons/picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/picture.png -------------------------------------------------------------------------------- /LiteCAD/Icons/plug-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/plug-connect.png -------------------------------------------------------------------------------- /LiteCAD/Icons/puzzle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/puzzle.png -------------------------------------------------------------------------------- /LiteCAD/Icons/question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Icons/question.png -------------------------------------------------------------------------------- /LiteCAD/IntersectInfo.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep; 2 | using LiteCAD.BRep; 3 | using LiteCAD.Common; 4 | using OpenTK; 5 | 6 | namespace LiteCAD 7 | { 8 | public class IntersectInfo 9 | { 10 | public double Distance; 11 | public TriangleInfo Target; 12 | public IMeshNodesContainer Model; 13 | public Vector3d Point { get; set; } 14 | public object Parent; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /LiteCAD/ProductionStuff.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD 2 | { 3 | public static class ProductionStuff 4 | { 5 | public static decimal RunningMeterCutPrice = 40;//price for 1 meter 6 | public static decimal FDMPrintingPrice = 40;//price fro 1cm3 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LiteCAD/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace LiteCAD 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new Form1()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /LiteCAD/PropEditors/ColorPickerDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | 5 | namespace LiteCAD.PropEditors 6 | { 7 | public partial class ColorPickerDialog : UserControl, IPropEditor 8 | { 9 | public ColorPickerDialog() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | public object ReturnValue { get; set; } 15 | 16 | public void Init(object o) 17 | { 18 | colorDialog1.Color = (Color)o; 19 | pictureBox1.BackColor = (Color)o; 20 | ReturnValue = o; 21 | } 22 | 23 | private void button1_Click(object sender, EventArgs e) 24 | { 25 | colorDialog1.ShowDialog(); 26 | pictureBox1.BackColor = colorDialog1.Color; 27 | ReturnValue = colorDialog1.Color; 28 | } 29 | 30 | private void button2_Click(object sender, EventArgs e) 31 | { 32 | ParentForm.Close(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LiteCAD/PropEditors/DoublePropEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace LiteCAD.PropEditors 5 | { 6 | public partial class DoublePropEditor : UserControl, IPropEditor 7 | { 8 | public DoublePropEditor() 9 | { 10 | InitializeComponent(); 11 | } 12 | 13 | private void button1_Click(object sender, EventArgs e) 14 | { 15 | ParentForm.Close(); 16 | } 17 | 18 | public double Result; 19 | 20 | public object ReturnValue { get; set; } 21 | 22 | private void textBox1_TextChanged(object sender, EventArgs e) 23 | { 24 | try 25 | { 26 | var res = RPNCalc.Solve(textBox1.Text); 27 | textBox2.Text = res.ToString(); 28 | //solver formula here 29 | Result = res; 30 | ReturnValue = Result; 31 | } 32 | catch (Exception ex) 33 | { 34 | 35 | } 36 | } 37 | 38 | public void Init(object o) 39 | { 40 | textBox1.Text = ((double)o).ToString(); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /LiteCAD/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace LiteCAD.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LiteCAD/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LiteCAD/Resources/cursor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/Resources/cursor.ico -------------------------------------------------------------------------------- /LiteCAD/RibbonMenu.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD 2 | { 3 | partial class RibbonMenu 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // RibbonMenu 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "RibbonMenu"; 38 | this.Size = new System.Drawing.Size(540, 169); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /LiteCAD/RibbonMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using System.Windows.Forms.Integration; 3 | using System.Windows.Controls.Ribbon; 4 | 5 | namespace LiteCAD 6 | { 7 | public partial class RibbonMenu : UserControl 8 | { 9 | 10 | public RibbonTab DraftTab => Ribbon.draftTab; 11 | public RibbonTab ProjectTab => Ribbon.projectTab; 12 | public RibbonMenu() 13 | { 14 | InitializeComponent(); 15 | ElementHost elementHost1 = new ElementHost(); 16 | Ribbon = new RibbonMenuWpf(); 17 | Ribbon.DataContext = Form1.Form; 18 | elementHost1.Child = Ribbon; 19 | Controls.Add(elementHost1); 20 | elementHost1.Dock = DockStyle.Fill; 21 | elementHost1.AutoSize = true; 22 | } 23 | 24 | public RibbonMenuWpf Ribbon; 25 | 26 | internal void SetTab(RibbonTab tab) 27 | { 28 | tab.IsSelected = true; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LiteCAD/Tools/ParallelConstraintTool.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace LiteCAD.Tools 4 | { 5 | public class ParallelConstraintTool : AbstractTool 6 | { 7 | public ParallelConstraintTool(IEditor editor) : base(editor) { } 8 | 9 | public override void Deselect() 10 | { 11 | 12 | } 13 | 14 | public override void Draw() 15 | { 16 | 17 | } 18 | 19 | public override void MouseDown(MouseEventArgs e) 20 | { 21 | 22 | } 23 | 24 | public override void MouseUp(MouseEventArgs e) 25 | { 26 | 27 | } 28 | 29 | public override void Select() 30 | { 31 | 32 | 33 | } 34 | 35 | public override void Update() 36 | { 37 | 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /LiteCAD/Tools/PerpendicularConstraintTool.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.DraftEditor; 2 | using System.Windows.Forms; 3 | 4 | namespace LiteCAD.Tools 5 | { 6 | public class PerpendicularConstraintTool : AbstractDraftTool 7 | { 8 | public PerpendicularConstraintTool(IDraftEditor ee) : base(ee) 9 | { 10 | } 11 | 12 | 13 | public override void Deselect() 14 | { 15 | 16 | } 17 | 18 | public override void Draw() 19 | { 20 | 21 | } 22 | 23 | public override void MouseDown(MouseEventArgs e) 24 | { 25 | 26 | } 27 | 28 | public override void MouseUp(MouseEventArgs e) 29 | { 30 | 31 | } 32 | 33 | public override void Select() 34 | { 35 | 36 | 37 | } 38 | 39 | public override void Update() 40 | { 41 | 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /LiteCAD/Tools/SelectionTool.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace LiteCAD.Tools 4 | { 5 | public class SelectionTool : AbstractTool 6 | { 7 | public SelectionTool(IEditor editor) : base(editor) 8 | { 9 | 10 | } 11 | 12 | public override void Deselect() 13 | { 14 | //Form1.Form.ViewManager.Detach(); 15 | } 16 | 17 | public override void Draw() 18 | { 19 | 20 | } 21 | 22 | public override void MouseDown(MouseEventArgs e) 23 | { 24 | 25 | } 26 | 27 | public override void MouseUp(MouseEventArgs e) 28 | { 29 | 30 | } 31 | 32 | public override void Select() 33 | { 34 | //Form1.Form.ViewManager.Attach(Form1.Form.evwrapper, Form1.Form.camera1); 35 | 36 | } 37 | 38 | public override void Update() 39 | { 40 | 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /LiteCAD/ruler-triangle.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/LiteCAD/ruler-triangle.ico -------------------------------------------------------------------------------- /LiteCADLib/BRep/DrawItem.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | 3 | namespace LiteCAD.BRep 4 | { 5 | public class DrawItem : AbstractDrawable 6 | { 7 | public override void Draw() { } 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/BRep/Editor/IUndoItem.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.BRep.Editor 2 | { 3 | public interface IUndoItem 4 | { 5 | void Undo(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /LiteCADLib/BRep/Editor/PointUndoItem.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep; 2 | using OpenTK; 3 | 4 | namespace LiteCAD.BRep.Editor 5 | { 6 | public class PointUndoItem : IUndoItem 7 | { 8 | public ProjectPolygon Polygon; 9 | public int PointIndex; 10 | public Vector2d Position; 11 | public void Undo() 12 | { 13 | Polygon.Points[PointIndex] = Position; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LiteCADLib/BRep/LineItem.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep.Outlines; 2 | using OpenTK; 3 | using OpenTK.Graphics.OpenGL; 4 | using System.Drawing; 5 | 6 | namespace LiteCAD.BRep 7 | { 8 | public class OutlineItemHelper : DrawItem 9 | { 10 | 11 | readonly LineItem _lineItem; 12 | public OutlineItemHelper(LineItem l) 13 | { 14 | _lineItem = l; 15 | } 16 | public override void Draw() 17 | { 18 | GL.Color3(Color.Blue); 19 | if (Selected) 20 | { 21 | GL.Color3(Color.Violet); 22 | } 23 | GL.Begin(PrimitiveType.Lines); 24 | GL.Vertex3(Start); 25 | GL.Vertex3(End); 26 | GL.End(); 27 | } 28 | public Vector3d Start => _lineItem.Start; 29 | public Vector3d End => _lineItem.End; 30 | } 31 | } -------------------------------------------------------------------------------- /LiteCADLib/BRep/PlaneItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using OpenTK.Graphics.OpenGL; 3 | using System.Drawing; 4 | 5 | namespace LiteCAD.BRep 6 | { 7 | public class PlaneItem : DrawItem 8 | { 9 | public Vector3d Dir; 10 | public Vector3d Position; 11 | public override void Draw() 12 | { 13 | GL.Color3(Color.Red); 14 | GL.Begin(PrimitiveType.Lines); 15 | GL.Vertex3(Position); 16 | GL.Vertex3(Position + Dir * 100); 17 | GL.End(); 18 | GL.Color3(Color.Blue); 19 | } 20 | } 21 | 22 | 23 | } -------------------------------------------------------------------------------- /LiteCADLib/BRep/PointItem.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using OpenTK.Graphics.OpenGL; 3 | using System.Drawing; 4 | 5 | namespace LiteCAD.BRep 6 | { 7 | public class PointItem : DrawItem 8 | { 9 | 10 | public Vector3d Position; 11 | public override void Draw() 12 | { 13 | GL.Color3(Color.Yellow); 14 | GL.PointSize(4); 15 | GL.Begin(PrimitiveType.Points); 16 | GL.Vertex3(Position); 17 | GL.End(); 18 | GL.Color3(Color.Blue); 19 | } 20 | } 21 | 22 | 23 | } -------------------------------------------------------------------------------- /LiteCADLib/CSP/CSPConstr.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.CSP 2 | { 3 | public abstract class CSPConstr 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /LiteCADLib/CSP/CSPConstrEqualTwoVars.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.CSP 2 | { 3 | public class CSPConstrEqualTwoVars : CSPConstrEqualExpression 4 | { 5 | public CSPConstrEqualTwoVars(CSPVar var1,CSPVar var2) 6 | { 7 | Var1 = var1; 8 | Var2 = var2; 9 | Expression = $"{var1.Name}={var2.Name}"; 10 | Vars = new[] { var1, var2 }; 11 | } 12 | public CSPVar Var1; 13 | public CSPVar Var2; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LiteCADLib/CSP/CSPConstrEqualVarValue.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.CSP 2 | { 3 | public class CSPConstrEqualVarValue : CSPConstrEqualExpression 4 | { 5 | public CSPConstrEqualVarValue(CSPVar var, double val) 6 | { 7 | Var1 = var; 8 | Value = val; 9 | Expression = $"{Var1.Name}={val}"; 10 | Vars = new[] { Var1 }; 11 | } 12 | public CSPVar Var1; 13 | public double Value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LiteCADLib/CSP/CSPTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace LiteCAD.CSP 6 | { 7 | public class CSPTask 8 | { 9 | public List Vars = new List(); 10 | public List Constrs = new List(); 11 | 12 | internal string Dump() 13 | { 14 | StringBuilder sb = new StringBuilder(); 15 | foreach (var item in Vars) 16 | { 17 | sb.AppendLine("var " + item.Name); 18 | } 19 | 20 | foreach (var item in Constrs) 21 | { 22 | if (item is CSPConstrEqualExpression expr) 23 | { 24 | sb.AppendLine(expr.Expression); 25 | } 26 | } 27 | return sb.ToString(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LiteCADLib/CSP/CSPVar.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.CSP 2 | { 3 | public class CSPVar 4 | { 5 | public string Name; 6 | public override string ToString() 7 | { 8 | return "CSP var: " + Name; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LiteCADLib/CSP/CSPVarInfo.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.CSP 2 | { 3 | public class CSPVarInfo 4 | { 5 | public CSPVarInfo(CSPVar v) 6 | { 7 | Var = v; 8 | } 9 | public readonly CSPVar Var; 10 | public double Value; 11 | 12 | public override string ToString() 13 | { 14 | return $"CSP var info: {Var.Name} = {Value}"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LiteCADLib/CSP/Token.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.CSP 2 | { 3 | public class Token 4 | { 5 | public string Text; 6 | public object Tag; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LiteCADLib/Common/ChangeCand.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class ChangeCand 6 | { 7 | public DraftPoint Point; 8 | public Vector2d Position; 9 | public void Apply() 10 | { 11 | Point.SetLocation(Position); 12 | } 13 | 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/DraftConstraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace LiteCAD.Common 5 | { 6 | public abstract class DraftConstraint 7 | { 8 | public Draft Parent { get; private set; } 9 | public DraftConstraint(Draft parent) 10 | { 11 | Parent = parent; 12 | Id = FactoryHelper.NewId++; 13 | } 14 | public int Id { get; set; } 15 | public abstract bool IsSatisfied(float eps = 1e-6f); 16 | public abstract void RandomUpdate(ConstraintSolverContext ctx); 17 | public bool Enabled { get; set; } = true; 18 | public Action BeforeChanged; 19 | public abstract bool ContainsElement(DraftElement de); 20 | 21 | internal abstract void Store(TextWriter writer); 22 | } 23 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/DraftElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Xml.Linq; 4 | 5 | namespace LiteCAD.Common 6 | { 7 | public abstract class DraftElement 8 | { 9 | public int Id { get; set; } 10 | public bool Frozen { get; set; }//can't be changed during constraints satisfaction 11 | public Draft Parent; 12 | public bool Dummy { get; set; }//dummy line. don't export 13 | 14 | protected DraftElement(Draft parent) 15 | { 16 | Parent = parent; 17 | Id = FactoryHelper.NewId++; 18 | } 19 | protected DraftElement(XElement e, Draft parent) 20 | { 21 | if (e.Attribute("id") != null) 22 | { 23 | Id = int.Parse(e.Attribute("id").Value); 24 | FactoryHelper.NewId = Math.Max(FactoryHelper.NewId, Id + 1); 25 | } 26 | else 27 | { 28 | Id = FactoryHelper.NewId++; 29 | } 30 | Parent = parent; 31 | } 32 | 33 | public abstract void Store(TextWriter writer); 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/EditFieldAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class EditFieldAttribute : Attribute 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/Extensions.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Drawing; 3 | using System.Text; 4 | using System.Windows.Forms; 5 | 6 | namespace LiteCAD.Common 7 | { 8 | public static class Extensions 9 | { 10 | public static void SetErrorStyle(this TextBox c) 11 | { 12 | c.BackColor = Color.Red; 13 | c.ForeColor = Color.White; 14 | } 15 | public static void SetNormalStyle(this TextBox c) 16 | { 17 | c.BackColor = Color.White; 18 | c.ForeColor = Color.Black; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IDraftConstraintHelper.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public interface IDraftConstraintHelper : IDraftHelper 6 | { 7 | DraftConstraint Constraint { get; } 8 | Vector2d SnapPoint { get; set; } 9 | 10 | 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IDraftHelper.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.BRep.Editor; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public interface IDraftHelper : IDrawable 6 | { 7 | 8 | Draft DraftParent { get; } 9 | bool Enabled { get; set; } 10 | 11 | void Draw(IDrawingContext ctx); 12 | 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IDrawable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace LiteCAD.Common 6 | { 7 | public interface IDrawable 8 | { 9 | int Id { get; set; } 10 | IDrawable Parent { get; set; } 11 | List Childs { get; } 12 | string Name { get; set; } 13 | bool Visible { get; set; } 14 | bool Frozen { get; set; } 15 | void Draw(); 16 | bool Selected { get; set; } 17 | TransformationChain Matrix { get; } 18 | 19 | IDrawable[] GetAll(Predicate p); 20 | void RemoveChild(IDrawable dd); 21 | void Store(TextWriter writer); 22 | int Z { get; set; } 23 | } 24 | 25 | 26 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IEditFieldsContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public interface IEditFieldsContainer 6 | { 7 | IName[] GetObjects(); 8 | } 9 | public class EditFieldAttribute : Attribute 10 | { 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IMessageReporter.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.Common 2 | { 3 | public interface IMessageReporter 4 | { 5 | void Warning(string text); 6 | void Error(string text); 7 | void Info(string text); 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IName.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.Common 2 | { 3 | public interface IName 4 | { 5 | string Name { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IPlaneSplittable.cs: -------------------------------------------------------------------------------- 1 | using BREP.Common; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public interface IPlaneSplittable 6 | { 7 | Line3D[] SplitPyPlane(Plane ph); 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/ISelectManager.cs: -------------------------------------------------------------------------------- 1 | using BREP.BRep; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public interface ISelectManager 6 | { 7 | bool IsSelected(BRepFace face); 8 | void Select(BRepFace f); 9 | void Unselect(BRepFace f); 10 | } 11 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IVisualPartContainer.cs: -------------------------------------------------------------------------------- 1 | namespace LiteCAD.Common 2 | { 3 | public interface IVisualPartContainer 4 | { 5 | int Id { get; } 6 | 7 | VisualPart Part { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IXmlStorable.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Xml.Linq; 3 | 4 | namespace LiteCAD.Common 5 | { 6 | public interface IXmlStorable 7 | { 8 | void StoreXml(TextWriter writer); 9 | void RestoreXml(XElement elem); 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/IntFieldEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class IntFieldEditor : IName 6 | { 7 | public IntFieldEditor(PropertyInfo f) 8 | { 9 | Field = f; 10 | Name = f.Name; 11 | } 12 | public string Name { get; set; } 13 | public object Object; 14 | public PropertyInfo Field; 15 | public int Value 16 | { 17 | get 18 | { 19 | return ((int)Field.GetValue(Object)); 20 | } 21 | set 22 | { 23 | Field.SetValue(Object, value); 24 | } 25 | } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/LineHelper.cs: -------------------------------------------------------------------------------- 1 | using BREP.Common; 2 | using OpenTK; 3 | using OpenTK.Graphics.OpenGL; 4 | 5 | namespace LiteCAD.Common 6 | { 7 | public class LineHelper : AbstractDrawable 8 | { 9 | public LineHelper() 10 | { 11 | 12 | } 13 | public LineHelper(Line3D ll) 14 | { 15 | Start = ll.Start; 16 | End = ll.End; 17 | } 18 | public Vector3d Start { get; set; } 19 | public Vector3d End { get; set; } 20 | public override void Draw() 21 | { 22 | GL.Begin(PrimitiveType.Lines); 23 | GL.Vertex3(Start); 24 | GL.Vertex3(End); 25 | GL.End(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/LiteCadException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class LiteCadException : Exception 6 | { 7 | public LiteCadException(string str) : base(str) { } 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/NFP.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace LiteCAD.Common 6 | { 7 | public class NFP 8 | { 9 | public Vector2d[] Points = new Vector2d[] { }; 10 | public List Childrens = new List(); 11 | public NFP Parent; 12 | public Vector2d this[int ind] 13 | { 14 | get 15 | { 16 | return Points[ind]; 17 | } 18 | } 19 | public void Shift(Vector2d vector) 20 | { 21 | for (int i = 0; i < Points.Length; i++) 22 | { 23 | Points[i].X += vector.X; 24 | Points[i].Y += vector.Y; 25 | } 26 | } 27 | public double SignedArea() 28 | { 29 | return GeometryUtils.signed_area(Points); 30 | } 31 | 32 | public int Length 33 | { 34 | get 35 | { 36 | return Points.Length; 37 | } 38 | } 39 | 40 | public void Reverse() 41 | { 42 | Points = Points.Reverse().ToArray(); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/PlaneDataTransferObject.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class PlaneDataTransferObject 6 | { 7 | public Vector3d Normal; 8 | public double W; 9 | public PlaneDataTransferObject(Vector3d normal, double w) 10 | { 11 | Normal = normal; 12 | W = w; 13 | } 14 | 15 | public static PlaneDataTransferObject FromPoints(Vector3d a, Vector3d b, Vector3d c) 16 | { 17 | var n = Vector3d.Cross((b - a), (c - a)).Normalized(); 18 | return new PlaneDataTransferObject(n, Vector3d.Dot(n, a)); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/PolylineHelper.cs: -------------------------------------------------------------------------------- 1 | using BREP.Common; 2 | using OpenTK.Graphics.OpenGL; 3 | using System.Drawing; 4 | 5 | namespace LiteCAD.Common 6 | { 7 | public class PolylineHelper : AbstractDrawable 8 | { 9 | public PolylineHelper() 10 | { 11 | 12 | } 13 | public bool ShowIndex { get; set; } 14 | public int LinesCount => Lines.Length; 15 | public int Index { get; set; } 16 | public PolylineHelper(Line3D[] ll) 17 | { 18 | Lines = ll; 19 | } 20 | public Line3D[] Lines { get; set; } 21 | 22 | public override void Draw() 23 | { 24 | GL.Disable(EnableCap.Lighting); 25 | GL.Color3(Color.Blue); 26 | 27 | GL.Begin(PrimitiveType.Lines); 28 | foreach (var item in Lines) 29 | { 30 | GL.Vertex3(item.Start); 31 | GL.Vertex3(item.End); 32 | } 33 | 34 | GL.End(); 35 | GL.Disable(EnableCap.DepthTest); 36 | GL.LineWidth(3); 37 | if (ShowIndex && Index < Lines.Length) 38 | { 39 | GL.Color3(Color.Red); 40 | GL.Begin(PrimitiveType.Lines); 41 | for (int i = 0; i <= Index; i++) 42 | { 43 | GL.Vertex3(Lines[i].Start); 44 | GL.Vertex3(Lines[i].End); 45 | } 46 | GL.End(); 47 | } 48 | GL.Enable(EnableCap.DepthTest); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/RotationTransformChainItem.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | using OpenTK; 3 | using System; 4 | using System.IO; 5 | using System.Xml.Linq; 6 | 7 | namespace LiteCAD 8 | { 9 | [XmlName(XmlName = "rotate")] 10 | public class RotationTransformChainItem : TransformationChainItem 11 | { 12 | public Vector3d Axis = Vector3d.UnitZ; 13 | public double Angle { get; set; } 14 | public override Matrix4d Matrix() 15 | { 16 | return Matrix4d.Rotate(Axis, Angle * Math.PI / 180); 17 | } 18 | 19 | internal override TransformationChainItem Clone() 20 | { 21 | return new RotationTransformChainItem() { Axis = Axis, Angle = Angle }; 22 | } 23 | 24 | internal override void RestoreXml(XElement elem) 25 | { 26 | Axis = Helpers.ParseVector(elem.Attribute("axis").Value); 27 | Angle = Helpers.ParseDouble(elem.Attribute("angle").Value); 28 | } 29 | 30 | internal override void StoreXml(TextWriter writer) 31 | { 32 | writer.WriteLine($""); 33 | 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/ScaleTransformChainItem.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | using OpenTK; 3 | using System.IO; 4 | using System.Xml.Linq; 5 | 6 | namespace LiteCAD 7 | { 8 | [XmlName(XmlName = "scale")] 9 | public class ScaleTransformChainItem : TransformationChainItem 10 | { 11 | public Vector3d Vector; 12 | public override Matrix4d Matrix() 13 | { 14 | return Matrix4d.Scale(Vector); 15 | } 16 | 17 | internal override TransformationChainItem Clone() 18 | { 19 | return new ScaleTransformChainItem() { Vector = Vector }; 20 | } 21 | 22 | internal override void RestoreXml(XElement elem) 23 | { 24 | Vector = Helpers.ParseVector(elem.Attribute("vec").Value); 25 | } 26 | 27 | internal override void StoreXml(TextWriter writer) 28 | { 29 | writer.WriteLine($""); 30 | 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/Segment3d.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class Segment3d 6 | { 7 | public Vector3d Start; 8 | public Vector3d End; 9 | } 10 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/StringFieldEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class StringFieldEditor : IName 6 | { 7 | public StringFieldEditor(FieldInfo f) 8 | { 9 | Field = f; 10 | Name = f.Name; 11 | } 12 | public string Name { get; set; } 13 | public object Object; 14 | public FieldInfo Field; 15 | public string Value 16 | { 17 | get 18 | { 19 | return ((string)Field.GetValue(Object)); 20 | } 21 | set 22 | { 23 | Field.SetValue(Object, value); 24 | } 25 | } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/TopologyDraftLineInfo.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class TopologyDraftLineInfo 6 | { 7 | public DraftLine Line; 8 | public Vector2d Dir; 9 | } 10 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/TransformationChainItem.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | using OpenTK; 3 | using System.IO; 4 | using System.Xml.Linq; 5 | 6 | namespace LiteCAD 7 | { 8 | public abstract class TransformationChainItem: IXmlStorable 9 | { 10 | public abstract Matrix4d Matrix(); 11 | 12 | void IXmlStorable.RestoreXml(XElement elem) 13 | { 14 | RestoreXml(elem); 15 | } 16 | 17 | internal abstract void StoreXml(TextWriter writer); 18 | internal abstract void RestoreXml(XElement elem); 19 | 20 | void IXmlStorable.StoreXml(TextWriter writer) 21 | { 22 | StoreXml(writer); 23 | } 24 | 25 | internal abstract TransformationChainItem Clone(); 26 | } 27 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/TranslateTransformChainItem.cs: -------------------------------------------------------------------------------- 1 | using LiteCAD.Common; 2 | using OpenTK; 3 | using System.IO; 4 | using System.Xml.Linq; 5 | 6 | namespace LiteCAD 7 | { 8 | [XmlName(XmlName = "translate")] 9 | public class TranslateTransformChainItem : TransformationChainItem 10 | { 11 | public Vector3d Vector; 12 | public override Matrix4d Matrix() 13 | { 14 | return Matrix4d.CreateTranslation(Vector); 15 | } 16 | 17 | internal override TransformationChainItem Clone() 18 | { 19 | return new TranslateTransformChainItem() { Vector = Vector }; 20 | } 21 | 22 | internal override void RestoreXml(XElement elem) 23 | { 24 | Vector = Helpers.ParseVector(elem.Attribute("vec").Value); 25 | } 26 | 27 | internal override void StoreXml(TextWriter writer) 28 | { 29 | writer.WriteLine($""); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/VectorEditor.cs: -------------------------------------------------------------------------------- 1 | using OpenTK; 2 | using System.Reflection; 3 | 4 | namespace LiteCAD.Common 5 | { 6 | public class VectorEditor : IName 7 | { 8 | public VectorEditor(PropertyInfo f) 9 | { 10 | Field = f; 11 | Name = f.Name; 12 | } 13 | public string Name { get; set; } 14 | public object Object; 15 | public PropertyInfo Field; 16 | public double X 17 | { 18 | get 19 | { 20 | return ((Vector3d)Field.GetValue(Object)).X; 21 | } 22 | set 23 | { 24 | var v = ((Vector3d)Field.GetValue(Object)); 25 | v.X = value; 26 | Field.SetValue(Object, v); 27 | } 28 | } 29 | 30 | public double Y 31 | { 32 | get 33 | { 34 | return ((Vector3d)Field.GetValue(Object)).Y; 35 | } 36 | set 37 | { 38 | var v = ((Vector3d)Field.GetValue(Object)); 39 | v.Y = value; 40 | Field.SetValue(Object, v); 41 | } 42 | } 43 | 44 | public double Z 45 | { 46 | get 47 | { 48 | return ((Vector3d)Field.GetValue(Object)).Z; 49 | } 50 | set 51 | { 52 | var v = ((Vector3d)Field.GetValue(Object)); 53 | v.Z = value; 54 | Field.SetValue(Object, v); 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /LiteCADLib/Common/XmlNameAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LiteCAD.Common 4 | { 5 | public class XmlNameAttribute : Attribute 6 | { 7 | public string XmlName { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /LiteCADLib/MessageFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace LiteCAD 10 | { 11 | public class MessageFilter : IMessageFilter 12 | { 13 | private const int WM_MOUSEWHEEL = 0x020A; 14 | private const int WM_MOUSEHWHEEL = 0x020E; 15 | 16 | [DllImport("user32.dll")] 17 | static extern IntPtr WindowFromPoint(System.Drawing.Point p); 18 | [DllImport("user32.dll", CharSet = CharSet.Auto)] 19 | static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); 20 | 21 | public bool PreFilterMessage(ref Message m) 22 | { 23 | switch (m.Msg) 24 | { 25 | case WM_MOUSEWHEEL: 26 | case WM_MOUSEHWHEEL: 27 | IntPtr hControlUnderMouse = WindowFromPoint(new System.Drawing.Point((int)m.LParam)); 28 | if (hControlUnderMouse == m.HWnd) 29 | { 30 | return false; 31 | } 32 | else 33 | { 34 | uint u = Convert.ToUInt32(m.Msg); 35 | SendMessage(hControlUnderMouse, u, m.WParam, m.LParam); 36 | return true; 37 | } 38 | default: 39 | return false; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LiteCADLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("LiteCADLib")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LiteCADLib")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("05537b4a-4a48-403c-a61b-9eca33ef559b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /LiteCADLib/Tools/ToolHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Drawing.Drawing2D; 3 | using System.Windows.Forms; 4 | 5 | namespace LiteCAD.Tools 6 | { 7 | public class ToolHeader : Control 8 | { 9 | public ToolHeader() 10 | { 11 | DoubleBuffered = true; 12 | Height = 40; 13 | } 14 | private ContentAlignment textAlign = ContentAlignment.MiddleCenter; 15 | 16 | private Color topColor = Color.White; 17 | 18 | public ContentAlignment TextAlign 19 | { 20 | get 21 | { 22 | return textAlign; 23 | } 24 | set 25 | { 26 | if (textAlign == value) 27 | { 28 | return; 29 | } 30 | textAlign = value; 31 | Invalidate(); 32 | } 33 | } 34 | 35 | public Color TopColor 36 | { 37 | get 38 | { 39 | return topColor; 40 | } 41 | set 42 | { 43 | if (topColor == value) 44 | { 45 | return; 46 | } 47 | topColor = value; 48 | Invalidate(); 49 | } 50 | } 51 | protected override void OnPaint(PaintEventArgs pe) 52 | { 53 | Graphics g = pe.Graphics; 54 | Brush brushBack = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), TopColor, BackColor); 55 | Brush brushText = new SolidBrush(ForeColor); 56 | StringFormat sf = new StringFormat(); 57 | ContentAlignment textAlign = TextAlign; 58 | 59 | g.FillRectangle(brushBack, new Rectangle(0, 0, Width, Height)); 60 | g.DrawString(Text, Font, brushText, new RectangleF(0f, 0f, Width, Height), sf); 61 | 62 | } 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # :triangular_ruler: LiteCAD 2 | 3 |

4 | Simple CAD for designing 2D/3D parts and assemblies :straight_ruler: 5 |

6 | 7 | **Supported formats:** BREP (Step, IGES), STL, Dxf 8 | 9 |

10 | 11 | :pencil2: **2D drawer:** Skia (https://github.com/mono/SkiaSharp) or GDI
12 | :pencil2: **3D drawer:** OpenGL (OpenTK) 13 | 14 | :warning:**Project status:** WIP :construction::construction_worker: (not all functions are fully supported:warning:) 15 | 16 | 17 |

18 | 19 | 20 | 21 | 22 |

23 | Draft editor: 24 | 25 | 26 | 27 | 28 | 29 | ## References: 30 | * Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 31 | * Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 32 | * polybooljs (https://github.com/velipso/polybooljs) 33 | * polyBoolCS (https://github.com/StagPoint/PolyBoolCS) 34 | * clipper (http://www.angusj.com/delphi/clipper.php) 35 | * NURBS (https://www.codeproject.com/Articles/1095142/Generate-and-understand-NURBS-curves) 36 | * https://github.com/ixmilia/dxf 37 | * https://github.com/ixmilia/iges 38 | 39 | Some icons by [Yusuke Kamiyamane](http://p.yusukekamiyamane.com/). Licensed under a [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/) 40 | -------------------------------------------------------------------------------- /Triangle/Configuration.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet 8 | { 9 | using System; 10 | using TriangleNet.Meshing; 11 | using TriangleNet.Meshing.Algorithm; 12 | 13 | /// 14 | /// Configure advanced aspects of the library. 15 | /// 16 | public class Configuration 17 | { 18 | public Configuration() 19 | : this(() => RobustPredicates.Default, () => new TrianglePool()) 20 | { 21 | } 22 | 23 | public Configuration(Func predicates) 24 | : this(predicates, () => new TrianglePool()) 25 | { 26 | } 27 | 28 | public Configuration(Func predicates, Func trianglePool) 29 | { 30 | Predicates = predicates; 31 | TrianglePool = trianglePool; 32 | } 33 | 34 | /// 35 | /// Gets or sets the factory method for the implementation. 36 | /// 37 | public Func Predicates { get; set; } 38 | 39 | /// 40 | /// Gets or sets the factory method for the . 41 | /// 42 | public Func TrianglePool { get; set; } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Triangle/Geometry/IEdge.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | public interface IEdge 10 | { 11 | /// 12 | /// Gets the first endpoints index. 13 | /// 14 | int P0 { get; } 15 | 16 | /// 17 | /// Gets the second endpoints index. 18 | /// 19 | int P1 { get; } 20 | 21 | /// 22 | /// Gets or sets a general-purpose label. 23 | /// 24 | /// 25 | /// This is used for the segments boundary mark. 26 | /// 27 | int Label { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Triangle/Geometry/ISegment.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | /// 10 | /// Interface for segment geometry. 11 | /// 12 | public interface ISegment : IEdge 13 | { 14 | /// 15 | /// Gets the vertex at given index. 16 | /// 17 | /// The local index (0 or 1). 18 | Vertex GetVertex(int index); 19 | 20 | /// 21 | /// Gets an adjoining triangle. 22 | /// 23 | /// The triangle index (0 or 1). 24 | ITriangle GetTriangle(int index); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Triangle/IO/IFileFormat.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | public interface IFileFormat 10 | { 11 | bool IsSupported(string file); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Triangle/IO/IMeshFormat.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | using System.IO; 10 | using TriangleNet.Meshing; 11 | 12 | /// 13 | /// Interface for mesh I/O. 14 | /// 15 | public interface IMeshFormat : IFileFormat 16 | { 17 | /// 18 | /// Read a file containing a mesh. 19 | /// 20 | /// The path of the file to read. 21 | /// An instance of the interface. 22 | IMesh Import(string filename); 23 | 24 | /// 25 | /// Save a mesh to disk. 26 | /// 27 | /// An instance of the interface. 28 | /// The path of the file to save. 29 | void Write(IMesh mesh, string filename); 30 | 31 | /// 32 | /// Save a mesh to a . 33 | /// 34 | /// An instance of the interface. 35 | /// The stream to save to. 36 | void Write(IMesh mesh, Stream stream); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Triangle/IPredicates.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet 8 | { 9 | using TriangleNet.Geometry; 10 | 11 | public interface IPredicates 12 | { 13 | double CounterClockwise(Point a, Point b, Point c); 14 | 15 | double InCircle(Point a, Point b, Point c, Point p); 16 | 17 | Point FindCircumcenter(Point org, Point dest, Point apex, ref double xi, ref double eta); 18 | 19 | Point FindCircumcenter(Point org, Point dest, Point apex, ref double xi, ref double eta, 20 | double offconstant); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Triangle/Logging/ILog.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Logging 8 | { 9 | using System.Collections.Generic; 10 | 11 | public enum LogLevel 12 | { 13 | Info = 0, 14 | Warning = 1, 15 | Error = 2 16 | } 17 | 18 | /// 19 | /// A basic log interface. 20 | /// 21 | public interface ILog where T : ILogItem 22 | { 23 | void Add(T item); 24 | void Clear(); 25 | 26 | void Info(string message); 27 | void Error(string message, string info); 28 | void Warning(string message, string info); 29 | 30 | IList Data { get; } 31 | 32 | LogLevel Level { get; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Triangle/Logging/ILogItem.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Logging 8 | { 9 | using System; 10 | 11 | /// 12 | /// A basic log item interface. 13 | /// 14 | public interface ILogItem 15 | { 16 | DateTime Time { get; } 17 | LogLevel Level { get; } 18 | string Message { get; } 19 | string Info { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Triangle/Logging/LogItem.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Logging 8 | { 9 | using System; 10 | 11 | /// 12 | /// Represents an item stored in the log. 13 | /// 14 | public class LogItem : ILogItem 15 | { 16 | DateTime time; 17 | LogLevel level; 18 | string message; 19 | string info; 20 | 21 | public DateTime Time 22 | { 23 | get { return time; } 24 | } 25 | 26 | public LogLevel Level 27 | { 28 | get { return level; } 29 | } 30 | 31 | public string Message 32 | { 33 | get { return message; } 34 | } 35 | 36 | public string Info 37 | { 38 | get { return info; } 39 | } 40 | 41 | public LogItem(LogLevel level, string message) 42 | : this(level, message, "") 43 | { } 44 | 45 | public LogItem(LogLevel level, string message, string info) 46 | { 47 | this.time = DateTime.Now; 48 | this.level = level; 49 | this.message = message; 50 | this.info = info; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Triangle/Meshing/ConstraintOptions.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TriangleNet.Meshing 3 | { 4 | /// 5 | /// Mesh constraint options for polygon triangulation. 6 | /// 7 | public class ConstraintOptions 8 | { 9 | // TODO: remove ConstraintOptions.UseRegions 10 | 11 | /// 12 | /// Gets or sets a value indicating whether to use regions. 13 | /// 14 | [System.Obsolete("Not used anywhere, will be removed in beta 4.")] 15 | public bool UseRegions { get; set; } 16 | 17 | /// 18 | /// Gets or sets a value indicating whether to create a Conforming 19 | /// Delaunay triangulation. 20 | /// 21 | public bool ConformingDelaunay { get; set; } 22 | 23 | /// 24 | /// Gets or sets a value indicating whether to enclose the convex 25 | /// hull with segments. 26 | /// 27 | public bool Convex { get; set; } 28 | 29 | /// 30 | /// Gets or sets a flag indicating whether to suppress boundary 31 | /// segment splitting. 32 | /// 33 | /// 34 | /// 0 = split segments (default) 35 | /// 1 = no new vertices on the boundary 36 | /// 2 = prevent all segment splitting, including internal boundaries 37 | /// 38 | public int SegmentSplitting { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Triangle/Meshing/Data/BadSubseg.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Meshing.Data 9 | { 10 | using System; 11 | using TriangleNet.Geometry; 12 | using TriangleNet.Topology; 13 | 14 | /// 15 | /// A queue used to store encroached subsegments. 16 | /// 17 | /// 18 | /// Each subsegment's vertices are stored so that we can check whether a 19 | /// subsegment is still the same. 20 | /// 21 | class BadSubseg 22 | { 23 | public Osub subseg; // An encroached subsegment. 24 | public Vertex org, dest; // Its two vertices. 25 | 26 | public override int GetHashCode() 27 | { 28 | return subseg.seg.hash; 29 | } 30 | 31 | public override string ToString() 32 | { 33 | return String.Format("B-SID {0}", subseg.seg.hash); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Triangle/Meshing/Data/BadTriangle.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Meshing.Data 9 | { 10 | using System; 11 | using TriangleNet.Geometry; 12 | using TriangleNet.Topology; 13 | 14 | /// 15 | /// A queue used to store bad triangles. 16 | /// 17 | /// 18 | /// The key is the square of the cosine of the smallest angle of the triangle. 19 | /// Each triangle's vertices are stored so that one can check whether a 20 | /// triangle is still the same. 21 | /// 22 | class BadTriangle 23 | { 24 | public Otri poortri; // A skinny or too-large triangle. 25 | public double key; // cos^2 of smallest (apical) angle. 26 | public Vertex org, dest, apex; // Its three vertices. 27 | public BadTriangle next; // Pointer to next bad triangle. 28 | 29 | public override string ToString() 30 | { 31 | return String.Format("B-TID {0}", poortri.tri.hash); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Triangle/Meshing/IConstraintMesher.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TriangleNet.Meshing 3 | { 4 | using TriangleNet.Geometry; 5 | 6 | /// 7 | /// Interface for polygon triangulation. 8 | /// 9 | public interface IConstraintMesher 10 | { 11 | /// 12 | /// Triangulates a polygon. 13 | /// 14 | /// The polygon. 15 | /// Mesh 16 | IMesh Triangulate(IPolygon polygon); 17 | 18 | /// 19 | /// Triangulates a polygon, applying constraint options. 20 | /// 21 | /// The polygon. 22 | /// Constraint options. 23 | /// Mesh 24 | IMesh Triangulate(IPolygon polygon, ConstraintOptions options); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Triangle/Meshing/IQualityMesher.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TriangleNet.Meshing 3 | { 4 | using TriangleNet.Geometry; 5 | 6 | /// 7 | /// Interface for polygon triangulation with quality constraints. 8 | /// 9 | public interface IQualityMesher 10 | { 11 | /// 12 | /// Triangulates a polygon, applying quality options. 13 | /// 14 | /// The polygon. 15 | /// Quality options. 16 | /// Mesh 17 | IMesh Triangulate(IPolygon polygon, QualityOptions quality); 18 | 19 | /// 20 | /// Triangulates a polygon, applying quality and constraint options. 21 | /// 22 | /// The polygon. 23 | /// Constraint options. 24 | /// Quality options. 25 | /// Mesh 26 | IMesh Triangulate(IPolygon polygon, ConstraintOptions options, QualityOptions quality); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Triangle/Meshing/ITriangulator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Meshing 8 | { 9 | using System.Collections.Generic; 10 | using TriangleNet.Geometry; 11 | 12 | /// 13 | /// Interface for point set triangulation. 14 | /// 15 | public interface ITriangulator 16 | { 17 | /// 18 | /// Triangulates a point set. 19 | /// 20 | /// Collection of points. 21 | /// 22 | /// Mesh 23 | IMesh Triangulate(IList points, Configuration config); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Triangle/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Triangle")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Triangle")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("96a540d0-1772-4bed-8d25-ef5fa23cd1bc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0.0.0")] 36 | [assembly: AssemblyFileVersion("2.0.0.0")] 37 | -------------------------------------------------------------------------------- /Triangle/Smoothing/ISmoother.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Smoothing 8 | { 9 | using TriangleNet.Meshing; 10 | 11 | /// 12 | /// Interface for mesh smoothers. 13 | /// 14 | public interface ISmoother 15 | { 16 | void Smooth(IMesh mesh); 17 | void Smooth(IMesh mesh, int limit); 18 | } 19 | } -------------------------------------------------------------------------------- /Triangle/Voronoi/DefaultVoronoiFactory.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TriangleNet.Voronoi 3 | { 4 | using System; 5 | using TriangleNet.Topology.DCEL; 6 | 7 | /// 8 | /// Default factory for Voronoi / DCEL mesh objects. 9 | /// 10 | public class DefaultVoronoiFactory : IVoronoiFactory 11 | { 12 | public void Initialize(int vertexCount, int edgeCount, int faceCount) 13 | { 14 | } 15 | 16 | public void Reset() 17 | { 18 | } 19 | 20 | public Vertex CreateVertex(double x, double y) 21 | { 22 | return new Vertex(x, y); 23 | } 24 | 25 | public HalfEdge CreateHalfEdge(Vertex origin, Face face) 26 | { 27 | return new HalfEdge(origin, face); 28 | } 29 | 30 | public Face CreateFace(Geometry.Vertex vertex) 31 | { 32 | return new Face(vertex); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Triangle/Voronoi/IVoronoiFactory.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TriangleNet.Voronoi 3 | { 4 | using TriangleNet.Topology.DCEL; 5 | 6 | public interface IVoronoiFactory 7 | { 8 | void Initialize(int vertexCount, int edgeCount, int faceCount); 9 | 10 | void Reset(); 11 | 12 | Vertex CreateVertex(double x, double y); 13 | 14 | HalfEdge CreateHalfEdge(Vertex origin, Face face); 15 | 16 | Face CreateFace(Geometry.Vertex vertex); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Triangle/Voronoi/Legacy/IVoronoi.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Voronoi.Legacy 8 | { 9 | using System.Collections.Generic; 10 | using TriangleNet.Geometry; 11 | 12 | /// 13 | /// Voronoi diagram interface. 14 | /// 15 | public interface IVoronoi 16 | { 17 | /// 18 | /// Gets the list of Voronoi vertices. 19 | /// 20 | Point[] Points { get; } 21 | 22 | /// 23 | /// Gets the list of Voronoi regions. 24 | /// 25 | ICollection Regions { get; } 26 | 27 | /// 28 | /// Gets the list of edges. 29 | /// 30 | IEnumerable Edges { get; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /clipper/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("clipperLib")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Angus Johnson")] 12 | [assembly: AssemblyProduct("clipper_library")] 13 | [assembly: AssemblyCopyright("Copyright © Angus Johnson 2010-14")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("51a6bdca-bc4e-4b2c-ae69-36e2497204f2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /imgs/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/imgs/1.jpg -------------------------------------------------------------------------------- /imgs/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/imgs/2.jpg -------------------------------------------------------------------------------- /imgs/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/imgs/3.jpg -------------------------------------------------------------------------------- /imgs/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fel88/LiteCAD/c89eeec28841836963f2033c0fbee5c21eba68c7/imgs/4.jpg --------------------------------------------------------------------------------