예제 #1
0
        /// <summary>
        /// Returns a composite curve of the surface curve.
        /// </summary>
        /// <returns>A new composite curve.</returns>
        public PSCompCurve CreateCompositeCurve()
        {
            // Select the surface curve
            AddToSelection(true);

            // Create the compcurve
            _powerSHAPE.DoCommand("CONVERT WIREFRAME");

            // Get the create curve
            PSCompCurve createdCurve = (PSCompCurve)_powerSHAPE.ActiveModel.CreatedItems[0];

            _powerSHAPE.ActiveModel.Add(createdCurve);
            return(createdCurve);
        }
예제 #2
0
        /// <summary>
        /// Creates a new Curve from a CompCurve
        /// </summary>
        internal PSCurve(PSAutomation powerSHAPE, PSCompCurve compCurveToConvert) : base(powerSHAPE)
        {
            // Selects the CompCurve
            compCurveToConvert.AddToSelection(true);

            // Converts CompCurve into a curve
            _powerSHAPE.DoCommand("CONVERT WIREFRAME");
            compCurveToConvert.Delete();

            // Get the id of the Curve
            PSCurve curve = (PSCurve)_powerSHAPE.ActiveModel.UpdatedItems[0];

            _name = curve.Name;
            _id   = curve.Id;
        }
        /// <summary>
        /// Creates a Curve from a CompCurve
        /// </summary>
        /// <param name="compCurve">CompCurve to create a curev from</param>
        /// <returns>Curve created by the operation</returns>
        public PSCurve CreateCurveFromCompCurve(PSCompCurve compCurve)
        {
            PSCompCurve newCompCurve = (PSCompCurve)compCurve.Duplicate();

            newCompCurve.AddToSelection(true);
            _powerSHAPE.DoCommand("CONVERT WIREFRAME");

            //Add the new Curve to the collection of Curves
            PSCurve newCurve = null;

            newCurve = (PSCurve)_powerSHAPE.ActiveModel.UpdatedItems[0];
            _powerSHAPE.ActiveModel.Curves.Add(newCurve);

            //Remove duplicate CompCurve from the collection of compcurves
            newCompCurve.Delete();

            return(newCurve);
        }
예제 #4
0
        /// <summary>
        /// Allows the user to select a hole on the mesh and fill it
        /// </summary>
        public void FillHole()
        {
            // Pick a point that will define where the hole is
            Point pickedPoint = _powerSHAPE.PickPoint();

            // Create a CompCurve around the hole
            _powerSHAPE.DoCommand("CREATE CURVE COMPCURVE");
            _powerSHAPE.DoCommand(pickedPoint.X.ToString() + " " + pickedPoint.Y.ToString() + " " + pickedPoint.Z.ToString());
            _powerSHAPE.DoCommand("FASTFORWARDS");
            _powerSHAPE.DoCommand("SAVE");

            PSCompCurve createdCompCurve = (PSCompCurve)_powerSHAPE.ActiveModel.CreatedItems[0];

            createdCompCurve.AddToSelection(true);

            // The curve must be closed for this to work
            if (createdCompCurve.IsClosed)
            {
                _powerSHAPE.DialogsOff();

                // Create a fillin surface from the curve
                PSSurface fillinSurface = _powerSHAPE.ActiveModel.Surfaces.CreateFillInSurface(createdCompCurve);
                PSMesh    fillinMesh    = _powerSHAPE.ActiveModel.Meshes.CreateMeshFromSurface(fillinSurface);
                fillinSurface.Delete();
                fillinMesh.AddToSelection(true);

                // Append the fillin mesh to this mesh
                Append(fillinMesh);

                // Delete the curve that was created
                createdCompCurve.Delete();

                _powerSHAPE.DialogsOn();
            }
            else
            {
                // Delete the curve that was created and throw an exception
                createdCompCurve.Delete();
                _powerSHAPE.DialogsOn();
                throw new Exception("Unable to create closed curve");
            }
        }