Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Automated Design Validation The Solid Works Api

8,416 views

Published on

This SolidWorks World 2010 presentation by Paul Gimbel from Razorleaf Corporation explores using the SolidWorks API and the tools available within SolidWorks and SolidWorks Simulation to validate automatically generated, and manually configured designs.

Published in: Technology, Business
  • Be the first to comment

Automated Design Validation The Solid Works Api

  1. 1. Automated Design Validation with the SolidWorks API<br />Paul Gimbel, Business Process Sherpa<br />Razorleaf Corporation<br />
  2. 2. What You Will Hear In This Session<br />Automating SolidWorks Simulation programmatically<br />BUT THAT’S NOT IT<br />Tools within SolidWorks to do design validations<br />This an ADVANCED session<br />Assumes that you know SolidWorks user interface<br />Assumes that you know the basics of SolidWorks API programming<br />ALL CODE EXAMPLES IN VB.NET<br />Presentation will be available at www.razorleaf.com<br />
  3. 3. Who Is This Guy and Where Did He Come From?<br />Razorleaf Corporation<br />SolidWorks Service Partner<br />Services ONLY (we’re not trying to sell you anything, we’re neutral)<br />Data Management (EPDM, SmarTeam, Aras)<br />Design Automation (DriveWorks, Tacton)<br />Workflow Automation (Microsoft SharePoint and Tools)<br />Paul Gimbel (aka “The Sherpa”)<br />10+ years as Demo Jock, Applications Engineer, Trainer, Support Tech<br />5 years as Design Automation Implementer<br />Specializing in SolidWorks, DriveWorks, Tacton, Custom Programming<br />(THERE! Now I can report this trip as reimbursable.)<br />The <br />Sherpa<br />
  4. 4. What is Design Validation?<br />Ensuring that the suggested design meets requirements<br />Form/Fit/Function<br />Durability<br />Weight<br />Performance<br />Manufacturability<br />Maintenanceability<br />Packaging/Shipping Limitations<br />And so on…<br />It’s more than just fea!!<br />
  5. 5. What Forms Can Validation Take?<br />Equations<br />The most accurate method to determine values<br />Can be difficult to apply to complex geometries<br />Code Calculations<br />Many have to meet and publish them…it’s the law<br />Simulation<br />Iterative<br />Prototype<br />Digital<br />Somewhat time consuming<br />Physical <br />Expensive and time consuming<br />Lesson from Programming: <br />Rule out the easy stuff before you start sucking up CPU.<br />
  6. 6. How Does This Work With Design Automation?<br />Frequent Goal of Design Automation <br />Allow NON-SolidWorks USERS to design/configure valid products<br />Therefore:<br />Cannot use any interactive tools<br />Methods must not require SolidWorks on their machine<br />May use a 3rd party solution<br />
  7. 7. What Validation Tools and/or Techniques are there?Why Does Every Slide Have a Question in the Title?<br />Within SolidWorks<br /><ul><li>Sensors
  8. 8. Design Checker
  9. 9. Measure
  10. 10. Mass/Section Properties
  11. 11. Interference Detection
  12. 12. SimulationXPress
  13. 13. Any other XPress
  14. 14. Reference Dimensions!!</li></ul>With SolidWorks Simulation<br /><ul><li>Stress Analysis
  15. 15. Flow Analysis
  16. 16. Motion Simulation
  17. 17. Optimization</li></ul>Outside tools (commercially available and homegrown)<br />
  18. 18. Functionality Within SolidWorks<br />Gimme Free Stuff (well, what I already pay for)<br />
  19. 19. What Do I Get With My SolidWorks?<br /><ul><li>Reference Dimensions
  20. 20. Measure
  21. 21. Mass/Section Properties
  22. 22. Interference Detection
  23. 23. Sensors
  24. 24. Design Checker
  25. 25. SimulationXPress
  26. 26. Any other XPress</li></li></ul><li>What Do I Get With My SolidWorks?<br /><ul><li>Reference Dimensions
  27. 27. Measure
  28. 28. Mass/Section Properties
  29. 29. Interference Detection
  30. 30. Sensors
  31. 31. Design Checker
  32. 32. SimulationXPress
  33. 33. Any other XPress</li></li></ul><li>What Do I Get With My SolidWorks?<br /><ul><li>Reference Dimensions
  34. 34. Measure
  35. 35. Mass/Section Properties
  36. 36. Interference Detection
  37. 37. Sensors
  38. 38. Design Checker
  39. 39. SimulationXPress
  40. 40. Any other XPress</li></li></ul><li>Reference Dimensions (2D and 3D)<br />Watch the name of the reference dimension<br />Find it in the Property Mangler<br />Retrieve the DIMENSION object.GetValue2(“ConfigName”)<br />Imports SolidWorks.Interop.sldworks<br />Imports SolidWorks.Interop.swconst<br />PartialClassSolidWorksMacro<br />PublicswAppAsSldWorks<br />PublicSub main()<br />DimswDocAs ModelDoc2 = Nothing<br />swDoc = CType(swApp.ActiveDoc, ModelDoc2)<br />MsgBox(swDoc.Parameter(&quot;TXD1@Scheme2&quot;).GetValue2(&quot;Default&quot;))<br />MsgBox(swDoc.Parameter(“Gap@skSlot&quot;).GetValue2(&quot;Default&quot;))<br />EndSub<br />EndClass<br />No longer a property<br />Note: Code in yellow omitted from future slides.<br />
  41. 41. Measure Tool<br />Separate Measure object - swDoc.Extension.CreateMeasure<br />Must use Measure.CALCULATE(object)<br />If Object Is Nothing, SolidWorks will use the current selection set<br />Alternatively, you can use the Selection Manager object<br />Set options before you call the calculate method<br />Returns are fairly specific<br />DimswMeasAs Measure = Ctype(swDoc.Extension.CreateMeasure, Measure)<br />swMeas.ArcOption = _<br />swMeasureArcCircleOption_e.swMeasureArcCircle_MinimumDistance<br />swMeas.Calculate(Nothing)<br />MsgBox(swMeas.Distance)<br />Don’t forget to test all objects and results!<br />Check out the options here<br />
  42. 42. Mass Properties<br />Obtain MassProperty object<br />ModelDoc2.Extension.CreateMassProperty()<br />DimswMassPropAsMassProperty = _<br />CType(swDoc.Extension.CreateMassProperty(), MassProperty)<br />MsgBox(swMassProp.Mass)<br />boolstatus = swMassProp.SetAssignedMassProp(1.5, 0, 0, 0, 1, Nothing)<br />
  43. 43. Section Properties<br />Requires an Array of FACE or SKETCH object as input<br />ModelDoc2.Extension.GetSectionProperties2(objSections) <br />Returns a 24 item array<br />Need to look up which index corresponds to what you’re interested in<br />Use API Help topic IGetSectionProperties2<br />Clumsy throwback to VBA<br />DimswSelMgrAsSelectionMgr = swDoc.SelectionManager<br />DimswFaceAs Face = swSelMgr.GetSelectedObject6(0, 0)<br />DimswSectionProps(23) AsDouble<br />swSectionProps = swDoc.Extension.GetSectionProperties2(swFace)<br />MsgBox(&quot;Area (index 1) = &quot; & swSectionProps(1))<br />Don’t forget to test all objects and results!<br />
  44. 44. How’s THIS For Helpful?<br />
  45. 45. Dealing with Result Arrays Using Enumerations<br />PublicEnumSectionResults<br /> Area = 1<br />CentroidX = 2<br />CentroidY = 3<br />CentroidZ = 4<br />momentXX = 5<br />momentYY = 6<br />momentZZ = 7<br />momentXY = 8<br />momentZX = 9<br />momentYZ = 10<br />polarMoment = 11<br />principalAngle = 12<br />principalIx = 13<br />principalIy = 14<br />EndEnum&apos;SectionResults<br />Paste me!<br />PublicEnumSectionResults<br /> Area = 1<br />CentroidX = 2<br />CentroidY = 3<br />CentroidZ = 4<br />momentXX = 5<br />momentYY = 6<br />momentZZ = 7<br />momentXY = 8<br />momentZX = 9<br />momentYZ = 10<br />polarMoment = 11<br />principalAngle = 12<br />principalIx = 13<br />principalIy = 14<br />DirectionXx = 15<br />DirectionXy = 16<br />DirectionXz = 17<br />DirectionYx = 18<br />DirectionYy = 19<br />DirectionYz = 20<br />DirectionZx = 21<br />DirectionZy = 22<br />DirectionZz = 23<br />EndEnum&apos;SectionResults<br />
  46. 46. Interference/Collision Detection<br />swAssembly.ToolsCheckInterference() just opens the UI<br />Use the InterferenceDetectionMgr object to create an Interference Object<br />Establish object<br />swIntMgr = Ctype(AssemblyDoc.InterferenceDetectionManager, _ InterferenceDetectionMgr)<br />Set properties<br />swIntMgr.TreatCoincidenceAsInterference = True<br />Run Interference Check (any method except Done)<br />DimswInts() As Object = swIntMgr.GetInterferences<br />DimswIntAs Interference = Ctype(swInts(0), Interference)<br />Grab results<br />DimdVolumesAs Double = swInt.Volume<br />
  47. 47. Interference/Collision Detection<br />swAssembly.ToolsCheckInterference() just opens the UI<br />Use the InterferenceDetectionMgr object to create an Interference Object<br />Establish object<br />Ctype(AssemblyDoc.InterferenceDetectionManager, _ InterferenceDetectionMgr)<br />Set properties<br />swIntMgr.TreatCoincidenceAsInterference = True<br />Run Interference Check (any method except Done)<br />DimswInts() As Object = swIntMgr.GetInterferences<br />DimswIntAs Interference = Ctype(swInts(0), Interference)<br />Grab results<br />DimdVolumesAs Double = swInt.Volume<br />
  48. 48. Interference/Collision Detection<br />swAssembly.ToolsCheckInterference() just opens the UI<br />Use the InterferenceDetectionMgr object to create an Interference Object<br />Establish object<br />Ctype(AssemblyDoc.InterferenceDetectionManager, _ InterferenceDetectionMgr)<br />Set properties<br />swIntMgr.TreatCoincidenceAsInterference = True<br />Run Interference Check (any method except Done)<br />DimswInts() As Object = swIntMgr.GetInterferences<br />DimswIntAs Interference = Ctype(swInts(0), Interference)<br />Grab results<br />DimdVolumesAs Double = swInt.Volume<br />
  49. 49. Interference/Collision Detection – More Complete Code<br />DimswAssemblyAsAssemblyDoc = CType(swDoc, AssemblyDoc)<br />swDoc.Parameter(&quot;CrankAngle@RotationMate@Crank-Slider.SLDASM&quot;).Value = 150<br />DimboolstatusAsBoolean = swDoc.EditRebuild3()<br />DimswIMAsInterferenceDetectionMgr = swAssembly.InterferenceDetectionManager<br />DimiIntQtyAsInteger = swIM.GetInterferenceCount<br />IfiIntQty &gt;= 0 Then<br />DimswInts(iIntQty - 1) AsObject<br />swInts = swIM.GetInterferences<br />DimswIntAs Interference = CType(swInts(0), Interference)<br />MsgBox(swInt.Volume)<br />EndIf<br />Don’t forget to test all objects and results!<br />
  50. 50. Sensors<br />(PART)<br /><ul><li>Sensor types
  51. 51. Notice for interactive users
  52. 52. Potential performance issues
  53. 53. Suppress extraneous sensors
  54. 54. Set notification frequency</li></ul>(ASSY)<br />
  55. 55. Working with Sensors in Code<br />Get the sensor object from the Sensor Feature (use MD2.GetFirstFeature)<br />DimswSensorAsSensor = swFeature.GetSpecificFeature2<br />Critical sensor properties and methods<br />SelectCaseswSensor.SensorType<br />CaseswSensorType_e.swSensorSimulation<br />CaseswSensorType_e.swSensorMassProperty<br />CaseswSensorType_e.swSensorDimension<br />CaseswSensorType_e.swSensorInterfaceDetection<br />EndSelect<br />Be sure to Update the sensor with the UpdateSensor method<br />Check the AlertState to see if the sensor has picked up on a problem<br />Use the AlertType to see what kind of a problem<br />SW2009 SP2 and before only supported Dimension Sensors<br />
  56. 56. Using SolidWorks Events<br />Create a class <br />Declare a variable WITHEVENTS for the object that holds your events<br />PublicWithEventsswPartAsSolidWorks.interop.sldworks.PartDoc<br />Create a Function for whatever event you want to monitor<br />FunctionswPart_SensorAlertPreNotify(ByValswSensorAsObject, ByVal _<br />SensorAlertTypeAsInteger)AsInteger<br />Shell(&quot;http://www.twitter.com/?&apos;#SW Sensor!&apos;&quot;, AppWinStyle.Hide, False)<br />EndFunction &apos;swPart_SensorAlertPreNotify<br />In your main code – Activate the handler (RemoveHandler to discontinue)<br />AddHandlerswPart.SensorAlertPreNotify, AddressOf _<br />Me.swPart_SensorAlertPreNotify<br />Note who your event belongs to<br />Check out all available events in API Help<br />
  57. 57. Using SolidWorks Events<br />Create a class <br />Declare a variable WITHEVENTS for the object that holds your events<br />PublicWithEventsswPartAsSolidWorks.interop.sldworks.PartDoc<br />Create a Function for whatever event you want to monitor<br />FunctionswPart_SensorAlertPreNotify(ByValswSensorAsObject, ByVal _<br />SensorAlertTypeAsInteger) AsInteger<br /> Shell(&quot;http://www.twitter.com/?&apos;#SW Sensor!&apos;&quot;, AppWinStyle.Hide, False)<br />EndFunction &apos;swPart_SensorAlertPreNotify<br />In your main code – Activate the handler (RemoveHandler to discontinue)<br />AddHandlerswPart.SensorAlertPreNotify, AddressOf _<br />Me.swPart_SensorAlertPreNotify<br />(Don’t think you can ignore me)<br />Note who your event belongs to<br />Check out all available events in API Help<br />
  58. 58. Using SolidWorks Events<br />Create a class <br />Declare a variable WITHEVENTS for the object that holds your events<br />PublicWithEventsswPartAsSolidWorks.interop.sldworks.PartDoc<br />Create a Function for whatever event you want to monitor<br />FunctionswPart_SensorAlertPreNotify(ByValswSensorAsObject, ByVal _<br />SensorAlertTypeAsInteger) AsInteger<br /> Shell(&quot;http://www.twitter.com/?&apos;#SW Sensor!&apos;&quot;, AppWinStyle.Hide, False)<br />EndFunction &apos;swPart_SensorAlertPreNotify<br />In your main code – Activate the handler (RemoveHandler to discontinue)<br />AddHandlerswPart.SensorAlertPreNotify, AddressOf _<br />Me.swPart_SensorAlertPreNotify<br />(I’m not going away)<br />Note who your event belongs to<br />Check out all available events in API Help<br />
  59. 59. Using SolidWorks Events<br />Create a class <br />Declare a variable WITHEVENTS for the object that holds your events<br />PublicWithEventsswPartAsSolidWorks.interop.sldworks.PartDoc<br />Create a Function for whatever event you want to monitor<br />FunctionswPart_SensorAlertPreNotify(ByValswSensorAsObject, ByVal _<br />SensorAlertTypeAsInteger) AsInteger<br /> Shell(&quot;http://www.twitter.com/?&apos;#SW Sensor!&apos;&quot;, AppWinStyle.Hide, False)<br />EndFunction &apos;swPart_SensorAlertPreNotify<br />In your main code – Activate the handler (RemoveHandler to discontinue)<br />AddHandlerswPart.SensorAlertPreNotify, AddressOf _<br />Me.swPart_SensorAlertPreNotify<br />(I’m not going away)<br />Note who your event belongs to<br />Check out all available events in API Help<br />
  60. 60. Using SolidWorks Events<br />Create a class <br />Declare a variable WITHEVENTS for the object that holds your events<br />PublicWithEventsswPartAsSolidWorks.interop.sldworks.PartDoc<br />Create a Function for whatever event you want to monitor<br />FunctionswPart_SensorAlertPreNotify(ByValswSensorAsObject, ByVal _<br />SensorAlertTypeAsInteger) AsInteger<br /> Shell(&quot;http://www.twitter.com/?&apos;#SW Sensor!&apos;&quot;, AppWinStyle.Hide, False)<br />EndFunction &apos;swPart_SensorAlertPreNotify<br />In your main code – Activate the handler (RemoveHandler to discontinue)<br />AddHandlerswPart.SensorAlertPreNotify, AddressOf _<br />Me.swPart_SensorAlertPreNotify<br />(Keep it up. Your iPhone is next.)<br />Note who your event belongs to<br />Check out all available events in API Help<br />
  61. 61. Using SolidWorks Events<br />Create a class <br />Declare a variable WITHEVENTS for the object that holds your events<br />PublicWithEventsswPartAsSolidWorks.interop.sldworks.PartDoc<br />Create a Function for whatever event you want to monitor<br />FunctionswPart_SensorAlertPreNotify(ByValswSensorAsObject, ByVal _<br />SensorAlertTypeAsInteger) AsInteger<br /> Shell(&quot;http://www.twitter.com/?&apos;#SW Sensor!&apos;&quot;, AppWinStyle.Hide, False)<br />EndFunction &apos;swPart_SensorAlertPreNotify<br />In your main code – Activate the handler (RemoveHandler to discontinue)<br />AddHandlerswPart.SensorAlertPreNotify, AddressOf _<br />Me.swPart_SensorAlertPreNotify<br /> Fine! I’ll do it myself.<br />Rebooting in:<br />Note who your event belongs to<br />Check out all available events in API Help<br />
  62. 62. Applying Update 1 of 9,278,029….0% Complete<br />Do Not Turn Off Computer<br />
  63. 63. Applying Update 1 of 9,278,029….0.001% Complete<br />Don’t Even Think About It.<br />I’ll restart when I’m good and ready.<br />
  64. 64. Autonomous Edition<br />
  65. 65.
  66. 66. SolidWorks Simulation<br />At long last…<br />
  67. 67. Automating SolidWorks Simulation<br />Evaluate what you are trying to automate<br />Can it be done with sensors?<br />Can it be done with Optimization?<br />Not all of SolidWorks Simulation is documented in API Help<br />Extra SDKs or Installation options may be required (ex. Flow)<br />
  68. 68. Gimme an S, Gimme an R, Gimme an A, Gimme a C!<br />Must add SolidWorks 2010 Simulation Type Library as a reference to each project<br />You can also add SolidWorks.Interop.cosworks.dll<br />You will need to BROWSE for it …SolidWorksAPI edist<br />(cosworks? There’s your proof that all the product renames are marketing)<br />
  69. 69. Possible Applications<br />Record iterative results<br />Run iterations and send results out to Excel or other system<br />Allow code or outside tool control when to iterate and how<br />
  70. 70. Possible Applications<br />Attach / create / modify study components (loads, connections, etc.)<br />Create 400 pin locations in a regular (or slightly irregular) array<br />Create an unknown number of loads based on driven geometry<br />Allow 3rd party solutions to kick off simulation as part of automation<br />More complex iterative optimizations using your own optimization algorithm<br />Change what YOU want to change, how YOU want to change it<br />
  71. 71. Cosmos? Yes, Cosmos.<br />© COSMOS/and COSMOS/WORKS and their respective logos property of Structural Research Analysis Corporation 1997<br />Run Analysis<br />
  72. 72. RMB in the Project Explorer to add a Reference<br />You will not find it in the .NET tab<br />You MAY find it under COM<br />You will most likely need to browse for it<br />Adding The Reference<br />
  73. 73. The Process<br />Fetch the SolidWorks Simulation (CosmosWorks) Add-In object<br />DimcwAddInAsSolidWorks.interop.cosworks.CWAddInCallBack = _<br />swApp.GetAddInObject(&quot;CosmosWorks.CosmosWorks&quot;)<br />Fetch the cwModelDoc<br />DimCWorksAsObject = cwAddIn.CosmosWorks<br />DimcwDocAsCWModelDoc = Ctype(CWorks.ActiveDoc(), CWModelDoc)<br />Fetch the CWStudyManager object<br />DimcwStudyMgrAsCWStudyManager = cwDoc.StudyManager()<br />Imports SolidWorks.interop.cosworksis implied<br />
  74. 74. More of The Process<br />Fetch the CWStudy object<br />Test for study existence with StudyCount<br />DimcwStudyCountAsInteger = cwStudyMgr.StudyCount<br />DimcwCurStudyAsCWStudy<br />Dim iErrors As Integer<br />IFcwStudyCount &gt; 0 Then<br />cwCurStudy = CWStudyManager.GetStudy(0)<br />Else<br />cwCurStudy = CWStudyManager.CreateNewStudy2 _<br /> (“StudyName”, type, iErrors)<br />EndIf<br />TIP: Don’t create studies when you can preset and drive them<br />Imports SolidWorks.interop.cosworksis implied<br />
  75. 75. Add Material<br />Need to apply the material to the Solid Body Object<br />Study gets the SolidManager<br />SolidManager gets the SolidComponent<br />SolidComponent gets the SolidBody<br />Circle gets the square<br />DimcwSolidMgrAsCosmosWorksLib.CWSolidManager<br />cwSolidMgr = cwCurStudy.SolidManager<br />DimCompCountAsInteger = cwSolidMgr.ComponentCount<br />DimcwCompAsCWSolidComponent = cwSolidMgr.GetComponentAt(0, cwStudyErrors)<br />DimcwBodyAsCWSolidBody = cwComp.GetSolidBodyAt(0, cwStudyErrors)<br />cwStudyErrors = cwBody.SetLibraryMaterial(&quot;M:MyMatlLibRLMatl.sldmatlib&quot;, &quot;Unobtainium&quot;)<br />
  76. 76. Even More of The Process<br />All ReadOnly!!<br />Get the next Manager or Options object<br />All properties and options reside one level down<br />DimcwStaticOptionsAsCWStaticStudyOptions<br />cwStaticOptions = cwCurStudy.StaticStudyOptions<br />cwStaticOptions.SolverType = _<br />CosmosWorksLib.swsSolverType_e.swsSolverTypeFFEPlus<br />DimcwCurMeshAsCWMesh = cwCurStudy.Mesh<br />cwCurMesh.Quality = _<br />CosmosWorksLib.swsMeshQuality_e.swsMeshQualityHigh<br />Imports SolidWorks.interop.cosworksis implied<br />
  77. 77. Even Still More of The Process<br />Update components, mesh and run the analysis<br />Update is for any geometry changes since last run<br /> &apos;We&apos;ll typically calculate or get these as inputs<br />DimdElementSizeAsDouble = 0.0012<br />DimdToleranceAsDouble = 0.005<br />cwCurStudy.UpdateAllComponents()<br />cwCurStudy.CreateMesh(CosmosWorksLib.swsUnit_e.swsUnitEnglish, _<br />dElementSize, dTolerance)<br />cwCurStudy.RunAnalysis()<br />Imports SolidWorks.interop.cosworksis implied<br />
  78. 78. Mandatory Charts (Gratuitous Chart of Fictitious Data)(per Microsoft PowerPoint code 2009 Section XXIV Subsection 441.K.9.ii.v)<br />Activities Past Midnight<br />Reaction to Subtle Jokes In Slides by Demographic<br />
  79. 79. Even Yet Still More of The Process<br />Retrieve the Results object<br />Most Results methods return arrays<br />These are typically brought in with generic options<br />DimcwCurResultsAsCWResults<br />cwCurResults = cwCurStudy.Results<br />Dim cwResultsErrors As Integer<br />Dim cwStress As Object<br />cwStress = cwCurResults.GetMinMaxStress _<br /> (0, 0, 1, Nothing, 0, cwResultsErrors)<br />Imports SolidWorks.interop.cosworksis implied<br />
  80. 80. Dealing with Arrays<br />Return types are VERY vague<br />Always the possibility of a null return<br />Most samples stay generic<br />VBA dim as VARIANT<br />VB.NET/C#.NET dim as OBJECT<br />Run once or twice or check sample to find out return type<br />Fetch as generic object then recast the variable to get the array<br />ERROR TRAP THE SNOT OUT OF IT!!!<br />Make separate functions wherever possible to use Try…Catch blocks<br />Allows you to handle the errors differently<br />
  81. 81. Array Sample<br />TRY<br />‘Define as generic object<br />DimcwStressAsObject<br />‘Retrieve the object<br />cwStress = cwCurResults.GetMinMaxStress(0, 0, 1, Nothing, 0, cwResultErrors)<br />IfcwStressIsNotNothing<br />‘Declare your array<br />DimcwStressArray() AsDouble<br />‘Recast your generic object as an array<br />cwStressArray = CType(cwStress, Double())<br />IfcwStressArray.Length &gt; 0 Then<br />ForEachdStressAsDoubleIncwStressArray<br />NextdStress<br />EndIf‘Array.Length &gt; 0<br />EndIf‘we have a stress results object<br />
  82. 82. Array Sample<br />Catch<br />‘Handle the fact that we did not get usable stress results<br />End Catch<br />Try<br />‘Define as generic object<br />DimcwDisplacementAsObject<br />‘Retrieve the object<br />cwDisplacement = cwCurResults.GetMinMaxDisplacement(0, 0, Nothing, _<br />CosmosWorksLib.swsUnit_e.swsUnitEnglish, cwStudyErrors)<br />IfcwDisplacementIsNotNothing<br />‘Declare your array<br />DimcwDispArray() AsDouble<br />‘Recast your generic object as an array<br />cwStressArray = CType(cwStress, Double())<br />And so on…<br />
  83. 83. Getting Back Visual Results<br />“A picture is worth a thousand lines of code” <br />– Michaelangelo (…I think)<br />The absolute most beneficial feature of automating simulations!!!<br />API has the ability to activate plots, delete plots, and tell you how many there are and their names<br />There appears to be no way to Save plots or animations out to files.<br />End of slide<br />
  84. 84. Other Places to Explore<br />And finally…<br />
  85. 85. Other Validation Tools<br />Available via API <br />SolidWorks Utilities<br />Compare Document<br />Compare Feature<br />Compare Geometry<br />Geometry Analysis<br />Thickness Analysis<br />Design Checker<br />Check (Face, Edge, Body)<br />Parting Line Draft Analysis<br />NOT Available via API <br /><ul><li>SimulationXpress
  86. 86. FloXpress
  87. 87. DFMXpress
  88. 88. SustainabilityXpress
  89. 89. Deviation Analysis
  90. 90. TolAnalyst</li></li></ul><li>Outside Validation Tools<br />Calculations are too involved or not understood to recreate<br />External DLL code<br />May be VB, FORTAN, PASCAL, GW-BASIC, Assembly Code, Pig Latin<br />public declare function InitializeLibrary lib &quot;extn.dll&quot; alias &quot;_InitializeLibrary@12&quot; (byvalhWnd as long, byvalstrasstring, byvaldwordas long) as longShell<br />External EXE code<br />Shell(“PVCalc.EXE “ & dPressure & “,” & dWallThk, AppWinStyle.MinimizedNoFocus)<br />Web-based ASP tools<br />Less overhead to load/install<br />Most applications allow parameters to be passed in the header<br />
  91. 91. Questions? Comments? Suggestions? Soup Recipes?<br />If you have questions you would like to discuss, please find me<br />Now…At any time during the conference…or After the conference<br />Presentation available on www.razorleaf.com<br />Free newsletter with tech tips, industry insiders and more…<br />Catch me in my upcoming tour dates!!<br />Wednesday @ 1:30 – Automating Your Designs with Excel and the SW API<br />Friday @ Miffy’s Muffin Palace – Drury Lane<br />The <br />Sherpa<br />Paul Gimbel<br />Business Process Sherpa<br />Paul.Gimbel@razorleaf.com<br /> www.razorleaf.com<br />TheProcesSherpa on Twitter<br />
  92. 92. Paul Gimbel, Razorleaf Corporation<br />paul.gimbel@razorleaf.com<br />@TheProcesSherpa on Twitter<br /><ul><li>PLEASE PLEASEPLEASE fill out your survey
  93. 93. It takes practically no time at all
  94. 94. I HONESTLY want your feedback and I do apply it
  95. 95. Let’s see if the SolidWorks folks read these:</li></ul>PLEASE PLEASEPLEASE fill out your survey<br />It takes practically no time at all<br />I HONESTLY want your feedback and I do apply it<br />Let’s see if the SolidWorks folks read these:<br />In the comments section, add:<br />“OK, I’m stumped. <br />How did he pull my card out of THERE?”<br />SURVEY TIME!!!<br />

×