Sunteți pe pagina 1din 18

Apply Table-driven Load to Multiple Beam (C#) This example shows how to apply a table-driven elliptical load to multiple

beams on a part. //------------------------------------------------------------// Preconditions: // 1. Add the SolidWorks Simulation as an add-in // (in SolidWorks, click Tools > Add-ins > SolidWorks Simulation). // 2. Add a reference to the SolidWorks Simulation interop // (in the IDE, click Project > Add Reference > Browse button, // navigate to // C:\Program Files\SolidWorks Corp\SolidWorks\SolidWorks\api\redist, // and select SolidWorks.Interop.cosworks.dll). // 3. Open the Immediate window. // // Postconditions: // 1. A table-driven, elliptical load is applied to the part, // and its type is shown in the Immediate window. // 2. To verify, examine the External Loads folder // in Study 3 in the Simulation tree. // // NOTE: Because this part document is used elsewhere, // do not save any changes when closing it. //------------------------------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using SolidWorks.Interop.cosworks; using System.Windows.Forms; using System.Diagnostics; namespace TableDrivenLoadsSWSimulationCSharp.csproj { partial class SolidWorksMacro { public void Main() { ModelDoc2 swModel = default(ModelDoc2); ModelDocExtension swModelDocExt = default(ModelDocExtension); SelectionMgr swSelMgr = default(SelectionMgr); CosmosWorks COSMOSWORKS = null; CwAddincallback COSMOSObject = default(CwAddincallback); CWModelDoc swsActDoc = default(CWModelDoc); CWStudyManager swsStudyMngr = default(CWStudyManager); CWStudy swsStudy = default(CWStudy); CWLoadsAndRestraintsManager swsLBCMgr = default(CWLoadsAndRestraints Manager); CWForce swsCWForce = default(CWForce); object selBeam1 = null; object selBeam2 = null; object selBeam3 = null; object selBeam4 = null; object selTrimExtend1 = null; object selTrimExtend2 = null; object selTrimExtend3 = null; object selFace = null; double[] data = new double[6];

int rowNum = 0; double[] distValue = new double[3]; double[] forceValue = new double[3]; int errors = 0; int warnings = 0; int errCode = 0; string forceType = null; const string fileName = "C:\\Program Files\\SolidWorks Corp\\SolidWo rks (2)\\samples\\tutorial\\api\\Loop.sldprt"; // Open document swModel = (ModelDoc2)swApp.OpenDoc6(fileName, (int)swDocumentTypes_e .swDocPART, (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings); swModelDocExt = (ModelDocExtension)swModel.Extension; // Get the SolidWorks Simulation object COSMOSObject = (CwAddincallback)swApp.GetAddInObject("SldWorks.Simul ation"); if (COSMOSObject == null) ErrorMsg(swApp, "COSMOSObject object not found.", true); COSMOSWORKS = (CosmosWorks)COSMOSObject.CosmosWorks; if (COSMOSWORKS == null) ErrorMsg(swApp, "COSMOSWORKS object not found.", true); // Open and get active document swsActDoc = (CWModelDoc)COSMOSWORKS.ActiveDoc; if (swsActDoc == null) ErrorMsg(swApp, "No active document.", true); // Create new static study swsStudyMngr = (CWStudyManager)swsActDoc.StudyManager; if (swsStudyMngr == null) ErrorMsg(swApp, "StudyMngr object not there.", true); swsStudy = (CWStudy)swsStudyMngr.GetStudy(2); if (swsStudy == null) ErrorMsg(swApp, "Study not created.", true); swsLBCMgr = (CWLoadsAndRestraintsManager)swsStudy.LoadsAndRestraints Manager; swSelMgr = (SelectionMgr)swModel.SelectionManager; // Select entities swModel.Extension.SelectByID2("Structural Member1[3]", "SOLIDBODY", 0.2669983091512, -0.4441139265177, -0.05999999999995, true, 0, null, 0); selBeam1 = (object)swSelMgr.GetSelectedObject6(1, -1); swModel.Extension.SelectByID2("Structural Member1[1]", "SOLIDBODY", 0.5462661602309, 0.4984264234139, -0.02447052600974, true, 0, null, 0); selBeam2 = (object)swSelMgr.GetSelectedObject6(2, -1); swModel.Extension.SelectByID2("Structural Member1[4]", "SOLIDBODY", -0.364288009376, 0.3216654991368, -0.0596008827161, true, 0, null, 0); selBeam3 = (object)swSelMgr.GetSelectedObject6(3, -1); swModel.Extension.SelectByID2("Structural Member1[2]", "SOLIDBODY", 1.410399123355, -0.191782066378, -0.05999999999989, true, 0, null, 0); selBeam4 = (object)swSelMgr.GetSelectedObject6(4, -1);

swModel.Extension.SelectByID2("Trim/Extend3[1]", "SOLIDBODY", 0.3090 890041738, -0.1687816014703, -0.01999999999992, true, 0, null, 0); selTrimExtend1 = (object)swSelMgr.GetSelectedObject6(5, -1); swModel.Extension.SelectByID2("Trim/Extend3[2]", "SOLIDBODY", 0.7058 778550122, -0.1651708212717, -0.01943888995868, true, 0, null, 0); selTrimExtend2 = (object)swSelMgr.GetSelectedObject6(6, -1); swModel.Extension.SelectByID2("Trim/Extend2[2]", "SOLIDBODY", 0.6681 230178383, 0.1527188626094, -0.01999999999998, true, 0, null, 0); selTrimExtend3 = (object)swSelMgr.GetSelectedObject6(7, -1); swModel.Extension.SelectByID2("", "FACE", -0.4332349164914, -0.14310 37474702, -0.05999999999989, true, 0, null, 0); selFace = (object)swSelMgr.GetSelectedObject6(8, -1); object[] beamArray = { selBeam1, selBeam2, selBeam3, selBeam4, selTrimExtend1, selTrimExtend2, selTrimExtend3 }; // Create data[0] = data[1] = data[2] = data[3] = data[4] = data[5] = the force 100.0; 100.0; 100.0; 100.0; 100.0; 100.0;

object[] forceArray = { data[0], data[1], data[2], data[3], data[4], data[5] }; rowNum = 3; distValue[0] = 10.0; distValue[1] = 50.0; distValue[2] = 100.0; forceValue[0] = 100.0; forceValue[1] = 0.0; forceValue[2] = 50.0; // Table-driven Load: Elliptical swsCWForce = (CWForce)swsLBCMgr.AddForce3((int)swsForceType_e.swsFor ceTypeForceOrMoment, (int)swsSelectionType_e.swsSelectionBeams, 2, (int)swsTable DrivenInterpolationType_e.swsLinear, (int)swsTableDrivenDistOption_e.swsPercenta ge, rowNum, distValue, forceValue, true, true, (int)swsBeamNonUniformLoadDef_e.swsTableDrivenLoad, (int)swsBeamNonU

niformLoadType_e.swsEllipticalLoad, 4, 100, (forceArray), false, false, (beamArr ay), selFace, true, out errCode); forceType = "Table-drive Load: Multiple Beams"; LoadError(swApp, forceType, errCode); } public void LoadError(object swApp, string force, long errorCode) { switch (errorCode) { case 18: ErrorMsg(swApp, "You cannot apply triangular and centered lo ad distribution on multiple beams.", true); break; case 19: ErrorMsg(swApp, "You cannot apply a zero intensity load.", t rue); break; case 20: ErrorMsg(swApp, "Invalid selection.", true); break; case 21: ErrorMsg(swApp, "The table-driven data is invalid.", true); break; case 22: ErrorMsg(swApp, "In the table-driven distance data, the dist ance value from the previous row cannot be greater than the distance value in th e next row.", true); break; case 0: Debug.Print(force); break; default: ErrorMsg(swApp, "No forces applied.", true); break; } } public void ErrorMsg(object swApp, string Message, bool EndTest) { MessageBox.Show(Message); MessageBox.Show("'*** WARNING - General"); MessageBox.Show("'*** " + Message); MessageBox.Show(""); if (EndTest) { } } /// <summary> /// The SldWorks swApp variable is pre-assigned for you. /// </summary> public SldWorks swApp; }

} ---------------------------------Apply and Remove Texture To and From Model By Display State Example (C#) This example shows how to apply and remove texture to and from a model by a disp lay state. //-------------------------------------------------------------------------// Preconditions: // 1. Model opened by macro exists. // 2. Open the Immediate window. // // Postconditions: // 1. Model opened and texture applied to // and removed from the selected component.

// 2. Examine the model to verify. // 3. Results printed to Immediate window. // // NOTE: Because the part document is used in // a SolidWorks online tutorial, do not save any // changes when closing the document. //---------------------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System; using System.Diagnostics; namespace ApplyRemoveTextureByDisplayStateCSharp.csproj { partial class SolidWorksMacro { public void Main() { ModelDoc2 swModel = default(ModelDoc2);

ModelDocExtension swModelDocExt = default(ModelDocExtension); Texture texture = default(Texture); string displayState = null; int errors = 0; int warnings = 0; string namStr = null;

// Open document swModel = (ModelDoc2)swApp.OpenDoc6("c:\\Program Files\\SolidWorks C orp\\SolidWorks\\samples\\tutorial\\motionstudies\\valve.sldprt", (int)swDocumen tTypes_e.swDocPART, (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref err ors, ref warnings); swModelDocExt = (ModelDocExtension) swModel.Extension;

// Set texture on model in the // specified display state displayState = "<Default>_Display State 1"; namStr = "<SystemTexture>\\images\\textures\\pattern\\checker2.jpg"; texture = (Texture) swModelDocExt.CreateTexture(namStr, 5, 45, false ); Debug.Print("Texture set: " + swModelDocExt.SetTextureByDisplayState (displayState, texture));

// Remove texture from model by display state Debug.Print("Texture removed: " + swModelDocExt.RemoveTextureByDispl ayState(displayState));

// Rebuild model swModel.ForceRebuild3(false); } /// <summary> /// The SldWorks swApp variable is pre-assigned for you. /// </summary>

public SldWorks swApp; } } ................................................................................ .............................................. Create and Modify Move Face Feature Example (C#) This example shows how to create a Move Face feature by translating a face on a part and then how to modify that Move Face feature. //--------------------------------------------------------------------------// Preconditions: // 1. The specified SolidWorks document exists // on your system.

// 2. Set a break point at the OpenDoc6 statement. // 3. Step through (press F8) the macro. // // Postconditions: A Move Face feature is created and then // modified. // // NOTE: Because the specified SolidWorks document is used by // // a SolidWorks online tutorial, do not save any changes when closing the document.

//--------------------------------------------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System;

namespace InsertMoveFace2FeatureManagerCSharp.csproj { public partial class SolidWorksMacro { public void Main() {

ModelDoc2 swModel = default(ModelDoc2); ModelDocExtension swModelDocExt = default(ModelDocExtension); FeatureManager swFeatMgr = default(FeatureManager); Feature swFeat = default(Feature); MoveFaceFeatureData swMoveFaceFeat = default(MoveFaceFeatureData); double[] transParams = null; bool boolstatus = false; double[] triadParams = new double[3]; int fileerror = 0; int filewarning = 0;

// Open the SolidWorks document swApp.OpenDoc6("C:\\Program Files\\SolidWorks Corp\\SolidWorks\\samp les\\tutorial\\assemblymates\\knee.sldprt", (int)swDocumentTypes_e.swDocPART, (i nt)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref fileerror, ref filewarnin g);

swModel = (ModelDoc2)swApp.ActiveDoc; swModelDocExt = swModel.Extension; swFeatMgr = swModel.FeatureManager;

// Translation parameters triadParams[0] = 0; triadParams[1] = 0.05; triadParams[2] = 0; transParams = triadParams;

// Select face to move boolstatus = swModel.Extension.SelectByID2("", "FACE", 0.04239074672 171, 0.01587499999999, 0.3283508339712, false, 1, null, 0);

// Create the Move Face feature by

// moving the selected face swFeat = (Feature)swFeatMgr.InsertMoveFace2(1, false, 0, 0, (transPa rams), null);

// Modify the Move Face feature swMoveFaceFeat = (MoveFaceFeatureData)swFeat.GetDefinition();

// Roll back the Move Face feature swMoveFaceFeat.AccessSelections(swModel, null); triadParams[0] = 0; triadParams[1] = 0.1; triadParams[2] = 0; transParams = triadParams; swMoveFaceFeat.TriadTranslationParameters = (transParams);

// Roll back the part with the modified Move Face feature swFeat.ModifyDefinition(swMoveFaceFeat, swModel, null);

/// <summary> /// The SldWorks swApp variable is pre-assigned for you. /// </summary> public SldWorks swApp;

} } ...................................................................... Get P-Spline Parameterization Data Example (C#) This example shows how to get P-spline parameter data for a selected spline or c urve.

//--------------------------------------------------------------------------// Preconditions: // 1. Open <SolidWorks_install_dir>\samples\tutorial\molds\telephone.sldprt. // 2. Select a curved edge of Shell1 in the graphics area. // 3. Rename the namespace to match the name of your C# project. // 4. Open an Immediate Window. // // Postconditions: // View the following information about the selected spline // in the Immediate Window: // * dimension // 1-D: X // 2-D: X, Y // 3-D: X, Y, Z // 4-D: X, Y, Z, W (where W is the weight of the control point) // * order (degree + 1) // * periodicity // * number of knots // * number of segments // * coefficients in each segment polynomial // # coefficients = (segment count) X (dimension) X (count) // * spline style: color, layer, layer override, line style, line weight //--------------------------------------------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System; using System.Diagnostics; namespace GetPSplineParamData_CSharp.csproj { partial class SolidWorksMacro { public void Main() { ModelDoc2 Part = null; Part = (ModelDoc2)swApp.ActiveDoc; SelectionMgr swSelectMgr = null; swSelectMgr = (SelectionMgr)Part.SelectionManager; Edge swSketchSeg = null; swSketchSeg = (Edge)swSelectMgr.GetSelectedObject6(1, -1); Curve swCurveIn = null; SplineParamData swSplineParaData = default(SplineParamData); object varCtrlPoints = null; object varKnotPoints = null; bool boolStatus = false; int i = 0; double[] knotPoints; double[] ctrlPoints; swCurveIn = (Curve)swSketchSeg.GetCurve(); swSplineParaData = (SplineParamData)swCurveIn.GetPCurveParams2(); Debug.Print("P-spline"); Debug.Print(""); Debug.Print("The dimension is: " + swSplineParaData.Dimension);

Debug.Print("The order is: " + swSplineParaData.Order); Debug.Print("The periodicity is: " + swSplineParaData.Periodic); Debug.Print("The knot count is: " + swSplineParaData.KnotPointsCount ); Debug.Print("Knots: "); boolStatus = swSplineParaData.GetKnotPoints(out varKnotPoints); knotPoints = (double[])varKnotPoints; for (i = 0; i <= knotPoints.GetUpperBound(0); i++) { Debug.Print(knotPoints[i].ToString()); } Debug.Print("The segment count is: " + swSplineParaData.SegmentCount ); boolStatus = swSplineParaData.GetSegments(out varCtrlPoints); ctrlPoints = (double[])varCtrlPoints; Debug.Print((swSplineParaData.SegmentCount * swSplineParaData.Dimens ion * swSplineParaData.Order) + " Coefficients: "); for (i = 0; i <= ctrlPoints.GetUpperBound(0); i++) { Debug.Print(ctrlPoints[i].ToString()); } Debug.Print(""); Debug.Print("COLORREF of spline: " + swSplineParaData.Color); Debug.Print("Layer of spline: " + swSplineParaData.Layer); Debug.Print("Style overrides as defined in swLayerOverride_e: " + sw SplineParaData.LayerOverride); Debug.Print("Line style as defined in swLineStyles_e:: " + swSplineP araData.LineStyle); Debug.Print("Line weight at defined in swLineWeights_e: " + swSpline ParaData.LineWidth); } public SldWorks swApp; } } ........................................................ SolidWorks Get BCurve Spline Points Example (C#) This example shows how to get B-spline parameter data (knots, control points, et c.) for a selected spline or curve. //--------------------------------------------------------------------------// Preconditions: // 1. Open <SolidWorks_install_dir>\samples\tutorial\molds\telephone.sldprt. // 2. Select a curve in the graphics area. // 3. Rename the namespace of this macro to match the name of your C# project. // 4. Open an Immediate Window. // // Postconditions: // View the following information about the selected spline

// in the Immediate Window: // * dimension // 1-D: X // 2-D: X, Y // 3-D: X, Y, Z // 4-D: X, Y, Z, W (where W is the weight of the control point) // * order (degree + 1) // * number of control points // * periodicity // * number of knots: // if periodicity = 1, // number of control points + 1 // else // number of control points + order // * spline style: color, layer, layer override, line style, line weight //-------------------------------------------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System; using System.Diagnostics; namespace GetBSplineParamData_CSharp.csproj { partial class SolidWorksMacro { public void Main() { ModelDoc2 Part = null; Part = (ModelDoc2)swApp.ActiveDoc; SelectionMgr swSelectMgr = null; swSelectMgr = (SelectionMgr)Part.SelectionManager; IEdge swSketchSeg = null; swSketchSeg = (ISketchSegment)swSelectMgr.GetSelectedObject6(1,-1); Curve swCurveIn = null; SplineParamData swSplineParaData = default(SplineParamData); object varCtrlPoints = null; object varKnotPoints = null; bool boolStatus = false; int i = 0; swCurveIn = (Curve)swSketchSeg.GetCurve(); Debug.Print(""); Debug.Print("B-spline"); Debug.Print(""); swSplineParaData = (SplineParamData)swCurveIn.GetBCurveParams5(false , false, true, true); Debug.Print("The dimension is: " + swSplineParaData.Dimension); Debug.Print("The order is: " + swSplineParaData.Order); Debug.Print("The periodicity is: " + swSplineParaData.Periodic); Debug.Print("The control point count is: " + swSplineParaData.Contro lPointsCount); Debug.Print("The knot point count is: " + swSplineParaData.KnotPoint sCount);

Debug.Print("COLORREF of spline: " + swSplineParaData.Color); Debug.Print("Layer of spline: " + swSplineParaData.Layer); Debug.Print("Style overrides as defined in swLayerOverride_e: " + sw SplineParaData.LayerOverride); Debug.Print("Line style as defined in swLineStyles_e:: " + swSplineP araData.LineStyle); Debug.Print("Line weight at defined in swLineWeights_e: " + swSpline ParaData.LineWidth); } public SldWorks swApp; } } ......................................................................... Get the Number of Lines in Flat-pattern Drawing View's Boundary-box Sketch (C#) This example shows how to get the number of lines in a flat-pattern drawing view 's boundary-box sketch. //--------------------------------------------// // Preconditions: // 1. In SolidWorks: // a. Open <SolidWorks_install_dir>\samples\design portfolio\sheet_metal_brac ket.sldprt. // b. Open a new drawing document. // c. Select sheet_metal_bracket.sldprt in the View Palette's dropdown list b ox. // 2. In the IDE: // a. Open the Immediate window. // b. Run macro. // // Postconditions: The View Palette view's name, drawing view name, and // number of lines in the boundary-box sketch of the // drawing view of the flat pattern of the sheet // metal part are printed to the Immediate window. // //--------------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System; using System.Diagnostics; namespace GetSMBoundaryBoxDisplayDataViewCSharp.csproj { partial class SolidWorksMacro { public void Main() { ModelDoc2 swModel; DrawingDoc swDrawing; View swView; Sheet swSheet;

DisplayData swDisplayData; double[] sheetProperties = null; double sheetScale = 0; swDwgPaperSizes_e paperSize; double width = 0; double height = 0; long numViews = 0; object[] viewNames = null; string viewPaletteName = ""; string drawingViewName = ""; int i = 0; bool status = false; swModel = (ModelDoc2)swApp.ActiveDoc; swDrawing = (DrawingDoc)swModel; // Get current sheet swSheet = (Sheet)swDrawing.GetCurrentSheet(); sheetProperties = (double[])swSheet.GetProperties(); sheetScale = (double)sheetProperties[2] / sheetProperties[3]; paperSize = (swDwgPaperSizes_e)swSheet.GetSize(ref width, ref height ); // Get number of views on View Palette numViews = 0; viewNames = (object[])swDrawing.GetDrawingPaletteViewNames(); // // // if { 0); for (i = 0; i <= numViews; i++) { viewPaletteName = (string)viewNames[i]; if ((viewPaletteName == "Flat pattern")) { Debug.Print("Dropping View Palette view named: " + viewP aletteName); swView = (View)swDrawing.DropDrawingViewFromPalette2(vie wPaletteName, 0.0, 0.0, 0.0); drawingViewName = swView.GetName2(); Debug.Print("Dropped View Palette view into drawing view named: " + drawingViewName); } } } // Activate view and get number of lines in // its boundary box sketch status = swDrawing.ActivateView(drawingViewName); swView = (View)swDrawing.ActiveDrawingView; swDisplayData = (DisplayData)swView.GetSMBoundaryBoxDisplayData(); Debug.Print("Number of lines in boundary box of flat-pattern drawing view: " + swDisplayData.GetLineCount()); } Iterate through views on View Palette When view name equals "Flat pattern", drop that view in drawing (!((viewNames == null))) numViews = viewNames.GetUpperBound(0) - viewNames.GetLowerBound(

/// <summary> /// The SldWorks swApp variable is pre-assigned for you. /// </summary> public SldWorks swApp; } } ......................................................................... Get Active PropertyManager Page Name (C#) This example shows how to get the name of the active PropertyManager page. //-------------------------------------------------------------------------// Preconditions: // 1. Open: // C:\Program Files\SolidWorks Corp\SolidWorks\samples\tutorial\fillets\knob. sldprt // 2. In SolidWorks, click Insert > Features > Fillet/Round. // 3. Open the Immediate window. // 4. Run the macro. // // Postconditions: // 1. The name of the active PropertyManager page is // written to the Immediate window. // 2. In the SolidWorks user-interface: // a. Close the PropertyManager page. // b. Close the part document. //---------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System; using System.Diagnostics; namespace GetActivePropertyManagerPageName.csproj { partial class SolidWorksMacro { public void Main() { ModelDoc2 swModel = default(ModelDoc2); ModelDocExtension swModelDocExt = default(ModelDocExtension); string pageName = null; swModel = (ModelDoc2)swApp.ActiveDoc; swModelDocExt = (ModelDocExtension)swModel.Extension; // Print the name of the active PropertyManager page in the Immediat e window pageName = swModelDocExt.GetActivePropertyManagerPage();

Debug.Print("Name of active PropertyManager page: " + pageName); } /// <summary> /// The SldWorks swApp variable is pre-assigned for you. /// </summary> public SldWorks swApp; } }

.................................................... Insert Thin Cut Extrude Example (C#) This example shows how to insert a thin cut extrude feature. //--------------------------------------// Preconditions: Specified part exists. // // Postconditions: A thin cut extrude feature in inserted in // the part. // // NOTE: Because this part document is used by an online // SolidWorks tutorial, do not save any changes when // closing the document. //---------------------------------------using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System;

namespace FeatureCutThin2FeatureManagerCSharp.csproj

{ partial class SolidWorksMacro {

public void Main() { ModelDoc2 swModel = default(ModelDoc2); ModelDocExtension swModelDocExt = default(ModelDocExtension); SketchManager swSketchManager = default(SketchManager); SketchSegment swSketchSegment = default(SketchSegment); FeatureManager swFeatureManager = default(FeatureManager); Feature swFeature = default(Feature); bool boolstatus = false; int errorstatus = 0; int warnings = 0;

// Open part swApp.OpenDoc6("C:\\Program Files\\SolidWorks Corp\\SolidWorks\\samp les\\tutorial\\api\\water.sldprt", 1, 0, "", ref errorstatus, ref warnings); swModel = (ModelDoc2)swApp.ActiveDoc;

// Select face on which to sketch a circle swModelDocExt = (ModelDocExtension)swModel.Extension; boolstatus = swModelDocExt.SelectByID2("", "FACE", 0.000165536222084 5, -0.0477671348753, 0.072, false, 0, null, 0); swModel.ShowNamedView2("*Normal To", (int)swStandardViews_e.swBackVi ew); swModel.ClearSelection2(true);

// Sketch a circle swSketchManager = (SketchManager)swModel.SketchManager; swSketchSegment = (SketchSegment)swSketchManager.CreateCircle(0.0, 0 .0, 0.0, 0.030255, -0.042492, 0.0); swModel.ClearSelection2(true);

// Create the thin cut extrude

boolstatus = swModelDocExt.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0 , 0, false, 0, null, 0); swFeatureManager = (FeatureManager)swModel.FeatureManager; swFeature = (Feature)swFeatureManager.FeatureCutThin2(true, false, f alse, (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind, 0.01, 0.01, false, false, false, false, 0.01745329251994, 0.01745329251994, false, false, false, false, 0.01, 0.01, 0.01, 0, 0, false, 0.005, true, true, (int)swStartConditions_e.swStart SketchPlane, 0, false); swModel.ShowNamedView2("*Isometric", (int)swStandardViews_e.swIsomet ricView);

/// <summary> /// The SldWorks swApp variable is pre-assigned for you. /// </summary> public SldWorks swApp;

} } ...............................................

S-ar putea să vă placă și