예제 #1
0
파일: URDFWriter.cs 프로젝트: yatli/sw2urdf
 public joint()
 {
     Origin      = new origin();
     Parent      = new parent_link();
     Child       = new child_link();
     Axis        = new axis();
     Limit       = new limit();
     Calibration = new calibration();
     Dynamics    = new dynamics();
     Safety      = new safety_controller();
 }
예제 #2
0
파일: URDFWriter.cs 프로젝트: yatli/sw2urdf
 public visual()
 {
     Origin   = new origin();
     Geometry = new geometry();
     Material = new material();
 }
예제 #3
0
파일: URDFWriter.cs 프로젝트: yatli/sw2urdf
 public collision()
 {
     Origin   = new origin();
     Geometry = new geometry();
 }
예제 #4
0
파일: URDF.cs 프로젝트: chlai/sw2urdf
 public visual()
 {
     Origin = new origin();
     Geometry = new geometry();
     Material = new material();
 }
예제 #5
0
파일: URDFWriter.cs 프로젝트: yatli/sw2urdf
 public inertial()
 {
     Origin  = new origin();
     Mass    = new mass();
     Inertia = new inertia();
 }
예제 #6
0
파일: URDF.cs 프로젝트: chlai/sw2urdf
 public joint()
 {
     Origin = new origin();
     Parent = new parent_link();
     Child = new child_link();
     Axis = new axis();
     Name = new Attribute();
     Name.isRequired = true;
     Name.type = "name";
     name = "";
     Type = new Attribute();
     Type.isRequired = true;
     Type.type = "type";
     
 }
예제 #7
0
파일: URDF.cs 프로젝트: chlai/sw2urdf
 public inertial()
 {
     Origin = new origin();
     Mass = new mass();
     Inertia = new inertia();
 }
예제 #8
0
파일: URDF.cs 프로젝트: chlai/sw2urdf
 public collision()
 {
     Origin = new origin();
     Geometry = new geometry();
 }
예제 #9
0
        //Inserts a sketch segment for use when creating a Reference Axis
        public SketchSegment addSketchGeometry(axis Axis, origin Origin)
        {
            if (ActiveSWModel.SketchManager.ActiveSketch == null)
            {
                bool sketchExists = ActiveSWModel.Extension.SelectByID2(referenceSketchName, "SKETCH", 0, 0, 0, false, 0, null, 0);
                ActiveSWModel.SketchManager.Insert3DSketch(true);
            }

            //Insert sketch segment 0.1m long centered on the origin.
            SketchSegment RotAxis = ActiveSWModel.SketchManager.CreateLine(Origin.X - 0.05 * Axis.X,
                                                               Origin.Y - 0.05 * Axis.Y,
                                                               Origin.Z - 0.05 * Axis.Z,
                                                               Origin.X + 0.05 * Axis.X,
                                                               Origin.Y + 0.05 * Axis.Y,
                                                               Origin.Z + 0.05 * Axis.Z);
            if (RotAxis == null)
            {
                return null;
            }
            RotAxis.ConstructionGeometry = true;
            RotAxis.Width = 2;

            //Close sketch
            if (ActiveSWModel.SketchManager.ActiveSketch != null)
            {
                ActiveSWModel.SketchManager.Insert3DSketch(true);

            }
            return RotAxis;
        }
예제 #10
0
        // Adds lines and a point to create the entities for a reference coordinates
        public object[] addSketchGeometry(origin Origin)
        {
            //Find if the sketch exists first
            if (ActiveSWModel.SketchManager.ActiveSketch == null)
            {
                bool sketchExists = ActiveSWModel.Extension.SelectByID2(referenceSketchName, "SKETCH", 0, 0, 0, false, 0, null, 0);
                ActiveSWModel.SketchManager.Insert3DSketch(true);
            }
            IFeature sketch = (IFeature)ActiveSWModel.SketchManager.ActiveSketch;

            //Calculate the lines that need to be drawn
            Matrix<double> transform = ops.getRotation(Origin.rpy);
            Matrix<double> Axes = 0.01 * DenseMatrix.Identity(4);
            Matrix<double> tA = transform * Axes;

            // origin at X, Y, Z
            SketchPoint OriginPoint = ActiveSWModel.SketchManager.CreatePoint(Origin.X,
                                                                      Origin.Y,
                                                                      Origin.Z);

            // xAxis is a 1cm line from the origin in the direction of the xaxis of the coordinate system
            SketchSegment XAxis = ActiveSWModel.SketchManager.CreateLine(Origin.X,
                                                                         Origin.Y,
                                                                         Origin.Z,
                                                                         Origin.X + tA[0, 0],
                                                                         Origin.Y + tA[1, 0],
                                                                         Origin.Z + tA[2, 0]);
            XAxis.ConstructionGeometry = true;

            //yAxis is a 1cm line from the origin in the direction of the yaxis of the coordinate system
            SketchSegment YAxis = ActiveSWModel.SketchManager.CreateLine(Origin.X,
                                                                         Origin.Y,
                                                                         Origin.Z,
                                                                         Origin.X + tA[0, 1],
                                                                         Origin.Y + tA[1, 1],
                                                                         Origin.Z + tA[2, 1]);
            YAxis.ConstructionGeometry = true;

            //Close the sketch
            if (ActiveSWModel.SketchManager.ActiveSketch != null)
            {
                ActiveSWModel.SketchManager.Insert3DSketch(true);

            }
            // Return an array of objects representing the sketch items that were just inserted, as well as the actual locations of those objecs (aids selection).
            return new object[] { OriginPoint, XAxis, YAxis, Origin.X, Origin.Y, Origin.Z, Origin.X + tA[0, 0], Origin.Y + tA[1, 0], Origin.Z + tA[2, 0], Origin.X + tA[0, 1], Origin.Y + tA[1, 1], Origin.Z + tA[2, 1] };
        }
예제 #11
0
        // Creates a Reference Coordinate System in the SolidWorks Model to symbolize the joint location
        public void createRefOrigin(origin Origin, string CoordinateSystemName)
        {
            // Adds the sketch segments and point to the 3D sketch. The sketchEnties are the actual items created (and their locations)
            object[] sketchEntities = addSketchGeometry(Origin);

            SketchPoint OriginPoint = (SketchPoint)sketchEntities[0];
            SketchSegment xaxis = (SketchSegment)sketchEntities[1];
            SketchSegment yaxis = (SketchSegment)sketchEntities[2];

            double origin_X = (double)sketchEntities[3]; //OriginPoint X
            double origin_Y = (double)sketchEntities[4];
            double origin_Z = (double)sketchEntities[5];

            double xAxis_X = (double)sketchEntities[6];
            double xAxis_Y = (double)sketchEntities[7];
            double xAxis_Z = (double)sketchEntities[8];

            double yAxis_X = (double)sketchEntities[9];
            double yAxis_Y = (double)sketchEntities[10];
            double yAxis_Z = (double)sketchEntities[11];

            IFeature coordinates = default(IFeature);
            ActiveSWModel.ClearSelection2(true);
            SelectionMgr selectionManager = ActiveSWModel.SelectionManager;
            SelectData data = selectionManager.CreateSelectData();

            // First select the origin
            bool SelectedOrigin = false; bool SelectedXAxis = false; bool SelectedYAxis = false;
            if (OriginPoint != null)
            {
                data.Mark = 1;
                SelectedOrigin = OriginPoint.Select4(true, data);
            }
            if (!SelectedOrigin)
            {
                SelectedOrigin = ActiveSWModel.Extension.SelectByID2("", "EXTSKETCHPOINT", origin_X, origin_Y, origin_Z, true, 1, null, 0);
            }

            // Second, select the xaxis
            if (xaxis != null)
            {
                data.Mark = 2;
                SelectedXAxis = xaxis.Select4(true, data);
            }
            if (!SelectedXAxis)
            {
                SelectedXAxis = ActiveSWModel.Extension.SelectByID2("", "EXTSKETCHPOINT", xAxis_X, xAxis_Y, xAxis_Z, true, 2, null, 0);
            }

            // Third, select the yaxis
            if (yaxis != null)
            {
                data.Mark = 4;
                SelectedYAxis = yaxis.Select4(true, data);
            }
            if (!SelectedYAxis)
            {
                SelectedYAxis = ActiveSWModel.Extension.SelectByID2("", "EXTSKETCHPOINT", yAxis_X, yAxis_Y, yAxis_Z, true, 4, null, 0);
            }

            //From the selected items, insert a coordinate system.
            coordinates = ActiveSWModel.FeatureManager.InsertCoordinateSystem(false, false, false);
            if (coordinates != null)
            {
                coordinates.Name = CoordinateSystemName;
            }
        }
예제 #12
0
파일: URDFWriter.cs 프로젝트: chlai/sw2urdf
 public joint()
 {
     Origin = new origin();
     Parent = new parent_link();
     Child = new child_link();
     Axis = new axis();
     Limit = new limit();
     Calibration = new calibration();
     Dynamics = new dynamics();
     Safety = new safety_controller();
 }